Source code of Windows XP (NT5)
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.

165 lines
6.3 KiB

  1. /*++
  2. // Copyright (c) 1998-2001 Microsoft Corporation, All Rights Reserved
  3. Module Name:
  4. DLLDATA2.C
  5. Abstract:
  6. Replacement for MIDL generated file
  7. History:
  8. --*/
  9. /*********************************************************
  10. DllData file -- generated by MIDL compiler
  11. DO NOT ALTER THIS FILE
  12. This file is regenerated by MIDL on every IDL file compile.
  13. To completely reconstruct this file, delete it and rerun MIDL
  14. on all the IDL files in this DLL, specifying this file for the
  15. /dlldata command line option
  16. *********************************************************/
  17. //
  18. #define PROXY_DELEGATION
  19. #include <rpcproxy.h>
  20. #include <stdio.h>
  21. void ReadCurrentValue(char* szGuid, char * cCurrValue)
  22. {
  23. long lLen = MAX_PATH;
  24. char szKey[MAX_PATH];
  25. sprintf( szKey, "interface\\%s\\ProxyStubCLSID32", szGuid );
  26. RegQueryValue(HKEY_CLASSES_ROOT, szKey, cCurrValue, &lLen);
  27. }
  28. void RestoreCurrentValue(char* szGuid, char * cCurrValue)
  29. {
  30. char szKey[MAX_PATH];
  31. sprintf( szKey, "interface\\%s\\ProxyStubCLSID32", szGuid );
  32. if(lstrlen(cCurrValue))
  33. {
  34. RegSetValue(HKEY_CLASSES_ROOT, szKey, REG_SZ, cCurrValue, lstrlen(cCurrValue));
  35. }
  36. }
  37. #define DLLDATA_ROUTINES2(pProxyFileList,pClsID ) \
  38. CLSID_PSFACTORYBUFFER \
  39. CStdPSFactoryBuffer gPFactory = {0,0,0,0}; \
  40. DLLDATA_GETPROXYDLLINFO(pProxyFileList,pClsID) \
  41. DLLGETCLASSOBJECTROUTINE(pProxyFileList,pClsID,&gPFactory) \
  42. DLLCANUNLOADNOW(&gPFactory) \
  43. CSTDSTUBBUFFERRELEASE(&gPFactory) \
  44. CSTDSTUBBUFFER2RELEASE(&gPFactory) \
  45. DLLDUMMYPURECALL \
  46. // REGISTER_PROXY_DLL_ROUTINES2(pProxyFileList, pClsID) \
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50. EXTERN_PROXY_FILE( wbemcli )
  51. EXTERN_PROXY_FILE( wbemint )
  52. EXTERN_PROXY_FILE( wbemprov )
  53. EXTERN_PROXY_FILE( wbemtran )
  54. PROXYFILE_LIST_START
  55. /* Start of list */
  56. REFERENCE_PROXY_FILE( wbemcli ),
  57. REFERENCE_PROXY_FILE( wbemint ),
  58. REFERENCE_PROXY_FILE( wbemprov ),
  59. REFERENCE_PROXY_FILE( wbemtran ),
  60. /* End of list */
  61. PROXYFILE_LIST_END
  62. #define IWBEMOBJECTSINK_GUID "{7c857801-7381-11cf-884d-00aa004b2e24}"
  63. #define IENUMWBEMCLASSOBJECT_GUID "{027947E1-D731-11CE-A357-000000000001}"
  64. #define IWBEMUNBOUNDOBJECTSINK_GUID "{E246107B-B06E-11D0-AD61-00C04FD8FDFF}"
  65. #define IWBEMMULTITARGET_GUID "{755F9DA6-7508-11D1-AD94-00C04FD8FDFF}"
  66. #define IWBEMSERVICESEX_GUID "{144459c4-cabc-11d3-a11b-00105a1f515a}"
  67. #define IWBEMSERVICES_GUID "{9556dc99-828c-11cf-a37e-00aa003240c7}"
  68. DLLDATA_ROUTINES2( aProxyFileList, GET_DLL_CLSID )
  69. HINSTANCE hProxyDll = 0;
  70. /*DllMain saves the DLL module handle for later use by DllRegisterServer */ \
  71. BOOL WINAPI DLLMAIN_ENTRY(
  72. HINSTANCE hinstDLL,
  73. DWORD fdwReason,
  74. LPVOID lpvReserved)
  75. {
  76. if(fdwReason == DLL_PROCESS_ATTACH)
  77. hProxyDll = hinstDLL;
  78. return TRUE;
  79. }
  80. /* DllRegisterServer registers the interfaces contained in the proxy DLL. */ \
  81. HRESULT STDAPICALLTYPE DLLREGISTERSERVER_ENTRY()
  82. {
  83. HRESULT hRes;
  84. char cCurrValueSink[MAX_PATH], cCurrValueEnum[MAX_PATH], cCurrValueUnboundSink[MAX_PATH],
  85. cCurrValueMultiTarget[MAX_PATH], cCurrValueServicesEx[MAX_PATH], cCurrValueServices[MAX_PATH];
  86. cCurrValueSink[0] = 0;
  87. cCurrValueEnum[0] = 0;
  88. cCurrValueUnboundSink[0] = 0;
  89. cCurrValueMultiTarget[0] = 0;
  90. cCurrValueServicesEx[0] = 0;
  91. ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  92. ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  93. ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  94. ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  95. ReadCurrentValue( IWBEMSERVICESEX_GUID, cCurrValueServicesEx );
  96. ReadCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
  97. hRes = NdrDllRegisterProxy(hProxyDll, aProxyFileList, GET_DLL_CLSID);
  98. RestoreCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  99. RestoreCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  100. RestoreCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  101. RestoreCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  102. RestoreCurrentValue( IWBEMSERVICESEX_GUID, cCurrValueServicesEx );
  103. RestoreCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
  104. return hRes;
  105. }
  106. /* DllUnregisterServer unregisters the interfaces contained in the proxy DLL. */ \
  107. HRESULT STDAPICALLTYPE DLLUNREGISTERSERVER_ENTRY()
  108. {
  109. HRESULT hRes;
  110. char cCurrValueSink[MAX_PATH], cCurrValueEnum[MAX_PATH], cCurrValueUnboundSink[MAX_PATH],
  111. cCurrValueMultiTarget[MAX_PATH];
  112. cCurrValueSink[0] = 0;
  113. cCurrValueEnum[0] = 0;
  114. ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  115. ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  116. ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  117. ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  118. hRes = NdrDllUnregisterProxy(hProxyDll, aProxyFileList, GET_DLL_CLSID );
  119. RestoreCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  120. RestoreCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  121. RestoreCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  122. RestoreCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  123. return hRes;
  124. }
  125. #ifdef __cplusplus
  126. } /*extern "C" */
  127. #endif
  128. /* end of generated dlldata file */