You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
162 lines
6.4 KiB
162 lines
6.4 KiB
/*++
|
|
|
|
Copyright © Microsoft Corporation. All rights reserved.
|
|
|
|
Module Name:
|
|
|
|
DLLDATA2.C
|
|
|
|
Abstract:
|
|
|
|
Replacement for MIDL generated file
|
|
|
|
History:
|
|
|
|
--*/
|
|
|
|
/*********************************************************
|
|
DllData file -- generated by MIDL compiler
|
|
|
|
DO NOT ALTER THIS FILE
|
|
|
|
This file is regenerated by MIDL on every IDL file compile.
|
|
|
|
To completely reconstruct this file, delete it and rerun MIDL
|
|
on all the IDL files in this DLL, specifying this file for the
|
|
/dlldata command line option
|
|
|
|
*********************************************************/
|
|
//
|
|
|
|
#define PROXY_DELEGATION
|
|
#include <rpcproxy.h>
|
|
#include <strsafe.h>
|
|
#include <stdio.h>
|
|
|
|
void ReadCurrentValue(char* szGuid, char * cCurrValue)
|
|
{
|
|
long lLen = MAX_PATH;
|
|
char szKey[MAX_PATH];
|
|
StringCchPrintfA( szKey, MAX_PATH, "interface\\%s\\ProxyStubCLSID32", szGuid );
|
|
RegQueryValue(HKEY_CLASSES_ROOT, szKey, cCurrValue, &lLen);
|
|
}
|
|
|
|
void RestoreCurrentValue(char* szGuid, char * cCurrValue)
|
|
{
|
|
char szKey[MAX_PATH];
|
|
StringCchPrintfA( szKey, MAX_PATH, "interface\\%s\\ProxyStubCLSID32", szGuid );
|
|
if(lstrlen(cCurrValue))
|
|
{
|
|
RegSetValue(HKEY_CLASSES_ROOT, szKey, REG_SZ, cCurrValue, lstrlen(cCurrValue));
|
|
}
|
|
}
|
|
|
|
|
|
#define DLLDATA_ROUTINES2(pProxyFileList,pClsID ) \
|
|
CLSID_PSFACTORYBUFFER \
|
|
CStdPSFactoryBuffer gPFactory = {0,0,0,0}; \
|
|
DLLDATA_GETPROXYDLLINFO(pProxyFileList,pClsID) \
|
|
DLLGETCLASSOBJECTROUTINE(pProxyFileList,pClsID,&gPFactory) \
|
|
DLLCANUNLOADNOW(&gPFactory) \
|
|
CSTDSTUBBUFFERRELEASE(&gPFactory) \
|
|
CSTDSTUBBUFFER2RELEASE(&gPFactory) \
|
|
DLLDUMMYPURECALL \
|
|
// REGISTER_PROXY_DLL_ROUTINES2(pProxyFileList, pClsID) \
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
EXTERN_PROXY_FILE( wbemcli )
|
|
EXTERN_PROXY_FILE( wbemint )
|
|
EXTERN_PROXY_FILE( wbemprov )
|
|
EXTERN_PROXY_FILE( wbemtran )
|
|
|
|
|
|
PROXYFILE_LIST_START
|
|
/* Start of list */
|
|
REFERENCE_PROXY_FILE( wbemcli ),
|
|
REFERENCE_PROXY_FILE( wbemint ),
|
|
REFERENCE_PROXY_FILE( wbemprov ),
|
|
REFERENCE_PROXY_FILE( wbemtran ),
|
|
/* End of list */
|
|
PROXYFILE_LIST_END
|
|
|
|
#define IWBEMOBJECTSINK_GUID "{7c857801-7381-11cf-884d-00aa004b2e24}"
|
|
#define IENUMWBEMCLASSOBJECT_GUID "{027947E1-D731-11CE-A357-000000000001}"
|
|
#define IWBEMUNBOUNDOBJECTSINK_GUID "{E246107B-B06E-11D0-AD61-00C04FD8FDFF}"
|
|
#define IWBEMMULTITARGET_GUID "{755F9DA6-7508-11D1-AD94-00C04FD8FDFF}"
|
|
#define IWBEMSERVICES_GUID "{9556dc99-828c-11cf-a37e-00aa003240c7}"
|
|
|
|
DLLDATA_ROUTINES2( aProxyFileList, GET_DLL_CLSID )
|
|
|
|
|
|
HINSTANCE hProxyDll = 0;
|
|
|
|
/*DllMain saves the DLL module handle for later use by DllRegisterServer */ \
|
|
BOOL WINAPI DLLMAIN_ENTRY(
|
|
HINSTANCE hinstDLL,
|
|
DWORD fdwReason,
|
|
LPVOID lpvReserved)
|
|
{
|
|
if(fdwReason == DLL_PROCESS_ATTACH)
|
|
hProxyDll = hinstDLL;
|
|
return TRUE;
|
|
}
|
|
|
|
/* DllRegisterServer registers the interfaces contained in the proxy DLL. */ \
|
|
|
|
HRESULT STDAPICALLTYPE DLLREGISTERSERVER_ENTRY()
|
|
{
|
|
HRESULT hRes;
|
|
char cCurrValueSink[MAX_PATH] = {0};
|
|
char cCurrValueEnum[MAX_PATH] = {0};
|
|
char cCurrValueUnboundSink[MAX_PATH] = {0};
|
|
char cCurrValueMultiTarget[MAX_PATH] = {0};
|
|
char cCurrValueServices[MAX_PATH] = {0};
|
|
ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
|
|
ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
|
|
ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
|
|
ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
|
|
ReadCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
|
|
hRes = NdrDllRegisterProxy(hProxyDll, aProxyFileList, GET_DLL_CLSID);
|
|
RestoreCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
|
|
RestoreCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
|
|
RestoreCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
|
|
RestoreCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
|
|
RestoreCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
|
|
return hRes;
|
|
}
|
|
|
|
/* DllUnregisterServer unregisters the interfaces contained in the proxy DLL. */ \
|
|
HRESULT STDAPICALLTYPE DLLUNREGISTERSERVER_ENTRY()
|
|
{
|
|
HRESULT hRes;
|
|
char cCurrValueSink[MAX_PATH] = {0};
|
|
char cCurrValueEnum[MAX_PATH] = {0};
|
|
char cCurrValueUnboundSink[MAX_PATH] = {0};
|
|
char cCurrValueMultiTarget[MAX_PATH] = {0};
|
|
char cCurrValueServices[MAX_PATH] = {0};
|
|
ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
|
|
ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
|
|
ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
|
|
ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
|
|
ReadCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
|
|
hRes = NdrDllUnregisterProxy(hProxyDll, aProxyFileList, GET_DLL_CLSID );
|
|
RestoreCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
|
|
RestoreCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
|
|
RestoreCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
|
|
RestoreCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
|
|
RestoreCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
|
|
return hRes;
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} /*extern "C" */
|
|
#endif
|
|
|
|
/* end of generated dlldata file */
|