Search code examples
c++dllproxyatlstub

I have an ATL project with proxy-stub support enabled, where can I find the implementation of all the methods in xdlldata.h file?


my generated xdlldta.h file 

#ifdef _MERGE_PROXYSTUB

extern "C" 
{
BOOL WINAPI PrxDllMain(HINSTANCE hInstance, DWORD dwReason, 
    LPVOID lpReserved);
STDAPI PrxDllCanUnloadNow(void);
STDAPI PrxDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
STDAPI PrxDllRegisterServer(void);
STDAPI PrxDllUnregisterServer(void);
}

#endif

Here, I do not think that the implementation of these methods is a part of my project, and I want to specifically check the implementation of

BOOL WINAPI PrxDllMain(HINSTANCE hInstance, DWORD dwReason, 
    LPVOID lpReserved);

Where can I find the same? Thanks in advance.


Solution

  • Your xlldata.c defines ENTRY_PREFIX:

    #define ENTRY_PREFIX    Prx
    

    and then includes dlldata.c, which is generated by MIDL compiler:

    #include "dlldata.c"
    

    The generated dlldata.c file includes SDK rpcproxy.h:

    #include <rpcproxy.h>
    

    rpcproxy.h in turn looks at the ENTRY_PREFIX, it actually even has some short syntax help in its header.

    This is where PrxDllMain is defined:

    /*DllMain saves the DLL module handle for later use by DllRegisterServer */ \
    BOOL WINAPI DLLMAIN_ENTRY( \
        HINSTANCE  hinstDLL, \
        DWORD  fdwReason, \
        LPVOID  lpvReserved) \
    { \
    

    DLLMAIN_ENTRY there is:

    #define __rpc_macro_expand2(a, b) a##b
    #define __rpc_macro_expand(a, b) __rpc_macro_expand2(a,b)
    // ...
    #define DLLMAIN_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllMain)