Leaked source code of windows server 2003
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

  1. /*++
  2. Copyright 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 <strsafe.h>
  21. #include <stdio.h>
  22. void ReadCurrentValue(char* szGuid, char * cCurrValue)
  23. {
  24. long lLen = MAX_PATH;
  25. char szKey[MAX_PATH];
  26. StringCchPrintfA( szKey, MAX_PATH, "interface\\%s\\ProxyStubCLSID32", szGuid );
  27. RegQueryValue(HKEY_CLASSES_ROOT, szKey, cCurrValue, &lLen);
  28. }
  29. void RestoreCurrentValue(char* szGuid, char * cCurrValue)
  30. {
  31. char szKey[MAX_PATH];
  32. StringCchPrintfA( szKey, MAX_PATH, "interface\\%s\\ProxyStubCLSID32", szGuid );
  33. if(lstrlen(cCurrValue))
  34. {
  35. RegSetValue(HKEY_CLASSES_ROOT, szKey, REG_SZ, cCurrValue, lstrlen(cCurrValue));
  36. }
  37. }
  38. #define DLLDATA_ROUTINES2(pProxyFileList,pClsID ) \
  39. CLSID_PSFACTORYBUFFER \
  40. CStdPSFactoryBuffer gPFactory = {0,0,0,0}; \
  41. DLLDATA_GETPROXYDLLINFO(pProxyFileList,pClsID) \
  42. DLLGETCLASSOBJECTROUTINE(pProxyFileList,pClsID,&gPFactory) \
  43. DLLCANUNLOADNOW(&gPFactory) \
  44. CSTDSTUBBUFFERRELEASE(&gPFactory) \
  45. CSTDSTUBBUFFER2RELEASE(&gPFactory) \
  46. DLLDUMMYPURECALL \
  47. // REGISTER_PROXY_DLL_ROUTINES2(pProxyFileList, pClsID) \
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. EXTERN_PROXY_FILE( wbemcli )
  52. EXTERN_PROXY_FILE( wbemint )
  53. EXTERN_PROXY_FILE( wbemprov )
  54. EXTERN_PROXY_FILE( wbemtran )
  55. PROXYFILE_LIST_START
  56. /* Start of list */
  57. REFERENCE_PROXY_FILE( wbemcli ),
  58. REFERENCE_PROXY_FILE( wbemint ),
  59. REFERENCE_PROXY_FILE( wbemprov ),
  60. REFERENCE_PROXY_FILE( wbemtran ),
  61. /* End of list */
  62. PROXYFILE_LIST_END
  63. #define IWBEMOBJECTSINK_GUID "{7c857801-7381-11cf-884d-00aa004b2e24}"
  64. #define IENUMWBEMCLASSOBJECT_GUID "{027947E1-D731-11CE-A357-000000000001}"
  65. #define IWBEMUNBOUNDOBJECTSINK_GUID "{E246107B-B06E-11D0-AD61-00C04FD8FDFF}"
  66. #define IWBEMMULTITARGET_GUID "{755F9DA6-7508-11D1-AD94-00C04FD8FDFF}"
  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] = {0};
  85. char cCurrValueEnum[MAX_PATH] = {0};
  86. char cCurrValueUnboundSink[MAX_PATH] = {0};
  87. char cCurrValueMultiTarget[MAX_PATH] = {0};
  88. char cCurrValueServices[MAX_PATH] = {0};
  89. ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  90. ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  91. ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  92. ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  93. ReadCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
  94. hRes = NdrDllRegisterProxy(hProxyDll, aProxyFileList, GET_DLL_CLSID);
  95. RestoreCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  96. RestoreCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  97. RestoreCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  98. RestoreCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  99. RestoreCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
  100. return hRes;
  101. }
  102. /* DllUnregisterServer unregisters the interfaces contained in the proxy DLL. */ \
  103. HRESULT STDAPICALLTYPE DLLUNREGISTERSERVER_ENTRY()
  104. {
  105. HRESULT hRes;
  106. char cCurrValueSink[MAX_PATH] = {0};
  107. char cCurrValueEnum[MAX_PATH] = {0};
  108. char cCurrValueUnboundSink[MAX_PATH] = {0};
  109. char cCurrValueMultiTarget[MAX_PATH] = {0};
  110. char cCurrValueServices[MAX_PATH] = {0};
  111. ReadCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  112. ReadCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  113. ReadCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  114. ReadCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  115. ReadCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
  116. hRes = NdrDllUnregisterProxy(hProxyDll, aProxyFileList, GET_DLL_CLSID );
  117. RestoreCurrentValue( IWBEMOBJECTSINK_GUID, cCurrValueSink );
  118. RestoreCurrentValue( IENUMWBEMCLASSOBJECT_GUID, cCurrValueEnum );
  119. RestoreCurrentValue( IWBEMUNBOUNDOBJECTSINK_GUID, cCurrValueUnboundSink );
  120. RestoreCurrentValue( IWBEMMULTITARGET_GUID, cCurrValueMultiTarget );
  121. RestoreCurrentValue( IWBEMSERVICES_GUID, cCurrValueServices );
  122. return hRes;
  123. }
  124. #ifdef __cplusplus
  125. } /*extern "C" */
  126. #endif
  127. /* end of generated dlldata file */