166 lines
6.3 KiB
C
166 lines
6.3 KiB
C
|
/*++
|
||
|
|
||
|
|
||
|
|
||
|
// Copyright (c) 1998-2001 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 <stdio.h>
|
||
|
|
||
|
void ReadCurrentValue(char* szGuid, char * cCurrValue)
|
||
|
{
|
||
|
long lLen = MAX_PATH;
|
||
|
char szKey[MAX_PATH];
|
||
|
sprintf( szKey, "interface\\%s\\ProxyStubCLSID32", szGuid );
|
||
|
RegQueryValue(HKEY_CLASSES_ROOT, szKey, cCurrValue, &lLen);
|
||
|
}
|
||
|
|
||
|
void RestoreCurrentValue(char* szGuid, char * cCurrValue)
|
||
|
{
|
||
|
char szKey[MAX_PATH];
|
||
|
sprintf( szKey, "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 IWBEMSERVICESEX_GUID "{144459c4-cabc-11d3-a11b-00105a1f515a}"
|
||
|
#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], cCurrValueEnum[MAX_PATH], cCurrValueUnboundSink[MAX_PATH],
|
||
|
cCurrValueMultiTarget[MAX_PATH], cCurrValueServicesEx[MAX_PATH], cCurrValueServices[MAX_PATH];
|
||
|
cCurrValueSink[0] = 0;
|
||
|
cCurrValueEnum[0] = 0;
|
||
|
cCurrValueUnboundSink[0] = 0;
|
||
|
cCurrValueMultiTarget[0] = 0;
|
||
|
cCurrValueServicesEx[0] = 0;
|
||
|
ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
|
||
|
ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
|
||
|
ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
|
||
|
ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
|
||
|
ReadCurrentValue( IWBEMSERVICESEX_GUID, cCurrValueServicesEx );
|
||
|
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( IWBEMSERVICESEX_GUID, cCurrValueServicesEx );
|
||
|
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], cCurrValueEnum[MAX_PATH], cCurrValueUnboundSink[MAX_PATH],
|
||
|
cCurrValueMultiTarget[MAX_PATH];
|
||
|
cCurrValueSink[0] = 0;
|
||
|
cCurrValueEnum[0] = 0;
|
||
|
ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
|
||
|
ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
|
||
|
ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
|
||
|
ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
|
||
|
hRes = NdrDllUnregisterProxy(hProxyDll, aProxyFileList, GET_DLL_CLSID );
|
||
|
RestoreCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
|
||
|
RestoreCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
|
||
|
RestoreCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
|
||
|
RestoreCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
|
||
|
return hRes;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
} /*extern "C" */
|
||
|
#endif
|
||
|
|
||
|
/* end of generated dlldata file */
|