NdrDllRegisterProxy function
Applies to: desktop apps | Metro style apps
The NdrDllRegisterProxy function creates a registry entry for the interfaces contained in the proxy DLL.
Syntax
RPCRTAPI HRESULT RPC_ENTRY NdrDllRegisterProxy( __in HMODULE hDll, __in const ProxyFileInfo **pProxyFileList, __in const CLSID *pclsid );
Parameters
- hDll [in]
-
Handle to the proxy DLL.
- pProxyFileList [in]
-
Pointer to a ProxyFileInfo structure generated by MIDL.
- pclsid [in]
-
Pointer to the class identifier of the proxy being registered.
Return value
Returns S_OK on success.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
Send comments about this topic to Microsoft
Build date: 3/6/2012
DllRegisterServer returns 0x80070006 E_HANDLE
If you have just added the MIDL generated COM proxy classes to your module (e.g. you merge the proxy classes with the real com class), and call
PrxDllRegisterServer() in your DllRegisterServer, you might get 0x80070006 (E_HANDLE) returned when you register your dll.
In this case the hProxyDll defined by rpcproxy.h has not been set (it is set to 0 by default) in your module.
This means you are missing hProxyDll = hInstance in DllMain()
If default initialisation of your DLL-s is enough: define
-D REGISTER_PROXY_DLL macro in your compiler switches: see header of rpcproxy.h
Or do it yourself:
#ifdef _MERGE_PROXYSTUB
extern "C" HINSTANCE hProxyDll; //this is missing from your code
#endif
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if(fdwReason == DLL_PROCESS_ATTACH) \
{
#ifdef _MERGE_PROXYSTUB
hProxyDll = hinstDLL; //this is missing from your code
#endif
...
}
...
}
The reason NdrDllRegisterProxy needs the instance handle hProxyDll is, that it can determine your dll-s name using the handle, and can thus register the proxy classes for your interfaces:
E.g:
HKEY_CLASSES_ROOT\CLSID\{your interface ID}
----(Default) REG_SZ PSFactoryBuffer
----InProcServer32
-------(Default) REG_SZ your dll-s name
PrxDllRegisterServer() in your DllRegisterServer, you might get 0x80070006 (E_HANDLE) returned when you register your dll.
In this case the hProxyDll defined by rpcproxy.h has not been set (it is set to 0 by default) in your module.
This means you are missing hProxyDll = hInstance in DllMain()
If default initialisation of your DLL-s is enough: define
-D REGISTER_PROXY_DLL macro in your compiler switches: see header of rpcproxy.h
Or do it yourself:
#ifdef _MERGE_PROXYSTUB
extern "C" HINSTANCE hProxyDll; //this is missing from your code
#endif
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if(fdwReason == DLL_PROCESS_ATTACH) \
{
#ifdef _MERGE_PROXYSTUB
hProxyDll = hinstDLL; //this is missing from your code
#endif
...
}
...
}
The reason NdrDllRegisterProxy needs the instance handle hProxyDll is, that it can determine your dll-s name using the handle, and can thus register the proxy classes for your interfaces:
E.g:
HKEY_CLASSES_ROOT\CLSID\{your interface ID}
----(Default) REG_SZ PSFactoryBuffer
----InProcServer32
-------(Default) REG_SZ your dll-s name