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.

258 lines
7.6 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // InstanceProv.h
  7. //
  8. // Implementation File:
  9. // InstanceProv.cpp
  10. //
  11. // Description:
  12. // Definition of the CInstanceProv class.
  13. //
  14. // Author:
  15. // Henry Wang (HenryWa) 24-AUG-1999
  16. //
  17. // Notes:
  18. //
  19. //////////////////////////////////////////////////////////////////////////////
  20. #pragma once
  21. //////////////////////////////////////////////////////////////////////////////
  22. // Include Files
  23. //////////////////////////////////////////////////////////////////////////////
  24. //////////////////////////////////////////////////////////////////////////////
  25. // Forward Declarations
  26. //////////////////////////////////////////////////////////////////////////////
  27. class CInstanceProv;
  28. class CClassProv;
  29. //////////////////////////////////////////////////////////////////////////////
  30. // External Declarations
  31. //////////////////////////////////////////////////////////////////////////////
  32. class CWbemClassObject;
  33. class CProvException;
  34. //////////////////////////////////////////////////////////////////////////////
  35. //++
  36. //
  37. // class CInstanceProv
  38. //
  39. // Description:
  40. // Implement the Instance and method provider entry point class. WMI
  41. // holds a pointer to this object, and invoking its member functions
  42. // based client request
  43. //
  44. //--
  45. //////////////////////////////////////////////////////////////////////////////
  46. class CInstanceProv : public CImpersonatedProvider
  47. {
  48. protected:
  49. SCODE SetExtendedStatus(
  50. CProvException & rpeIn,
  51. CWbemClassObject & rwcoInstOut
  52. );
  53. public:
  54. CInstanceProv(
  55. BSTR bstrObjectPathIn = NULL,
  56. BSTR bstrUserIn = NULL,
  57. BSTR bstrPasswordIn = NULL,
  58. IWbemContext * pCtxIn = NULL
  59. );
  60. virtual ~CInstanceProv( void );
  61. HRESULT STDMETHODCALLTYPE DoGetObjectAsync(
  62. BSTR bstrObjectPathIn,
  63. long lFlagsIn,
  64. IWbemContext * pCtxIn,
  65. IWbemObjectSink * pHandlerIn
  66. );
  67. HRESULT STDMETHODCALLTYPE DoPutInstanceAsync(
  68. IWbemClassObject * pInstIn,
  69. long lFlagsIn,
  70. IWbemContext * pCtxIn,
  71. IWbemObjectSink * pHandlerIn
  72. ) ;
  73. HRESULT STDMETHODCALLTYPE DoDeleteInstanceAsync(
  74. BSTR bstrObjectPathIn,
  75. long lFlagsIn,
  76. IWbemContext * pCtxIn,
  77. IWbemObjectSink * pHandlerIn
  78. ) ;
  79. HRESULT STDMETHODCALLTYPE DoCreateInstanceEnumAsync(
  80. BSTR bstrRefStrIn,
  81. long lFlagsIn,
  82. IWbemContext * pCtxIn,
  83. IWbemObjectSink * pHandlerIn
  84. );
  85. HRESULT STDMETHODCALLTYPE DoExecQueryAsync(
  86. BSTR bstrQueryLanguageIn,
  87. BSTR bstrQueryIn,
  88. long lFlagsIn,
  89. IWbemContext * pCtxIn,
  90. IWbemObjectSink * pHandlerIn
  91. ) ;
  92. HRESULT STDMETHODCALLTYPE DoExecMethodAsync(
  93. BSTR bstrObjectPathIn,
  94. BSTR bstrMethodNameIn,
  95. long lFlagsIn,
  96. IWbemContext * pCtxIn,
  97. IWbemClassObject * pInParamsIn,
  98. IWbemObjectSink * pHandlerIn
  99. );
  100. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
  101. const BSTR bstrSuperclassIn,
  102. long lFlagsIn,
  103. IWbemContext * pCtxIn,
  104. IWbemObjectSink * pResponseHandlerIn
  105. ) ;
  106. STDMETHODIMP Initialize(
  107. LPWSTR pszUserIn,
  108. LONG lFlagsIn,
  109. LPWSTR pszNamespaceIn,
  110. LPWSTR pszLocaleIn,
  111. IWbemServices * pNamespaceIn,
  112. IWbemContext * pCtxIn,
  113. IWbemProviderInitSink * pInitSinkIn
  114. );
  115. static HRESULT S_HrCreateThis(
  116. IUnknown * pUnknownOuterIn,
  117. VOID ** ppvOut
  118. );
  119. }; //*** CInstanceProv
  120. //////////////////////////////////////////////////////////////////////////////
  121. //++
  122. //
  123. // class CClassProv
  124. //
  125. // Description:
  126. // Implement the Class provider entry point class. WMI
  127. // holds a pointer to this object, and invoking its member functions
  128. // based client request
  129. //
  130. //--
  131. //////////////////////////////////////////////////////////////////////////////
  132. class CClassProv : public CImpersonatedProvider
  133. {
  134. public:
  135. CClassProv( void );
  136. virtual ~CClassProv( void );
  137. HRESULT STDMETHODCALLTYPE DoGetObjectAsync(
  138. BSTR bstrObjectPathIN,
  139. long lFlagsIn,
  140. IWbemContext * pCtxIn,
  141. IWbemObjectSink * pHandlerIn
  142. )
  143. {
  144. return WBEM_E_NOT_SUPPORTED;
  145. }
  146. HRESULT STDMETHODCALLTYPE DoPutInstanceAsync(
  147. IWbemClassObject * pInstIn,
  148. long lFlagsIn,
  149. IWbemContext * pCtxIn,
  150. IWbemObjectSink * pHandlerIn
  151. )
  152. {
  153. return WBEM_E_NOT_SUPPORTED;
  154. }
  155. HRESULT STDMETHODCALLTYPE DoDeleteInstanceAsync(
  156. BSTR bstrObjectPathIn,
  157. long lFlagsIn,
  158. IWbemContext * pCtxIn,
  159. IWbemObjectSink * pHandlerIn
  160. )
  161. {
  162. return WBEM_E_NOT_SUPPORTED;
  163. }
  164. HRESULT STDMETHODCALLTYPE DoCreateInstanceEnumAsync(
  165. BSTR bstrRefStrIn,
  166. long lFlagsIn,
  167. IWbemContext * pCtxIn,
  168. IWbemObjectSink * pHandlerIn
  169. )
  170. {
  171. return WBEM_E_NOT_SUPPORTED;
  172. }
  173. HRESULT STDMETHODCALLTYPE DoExecQueryAsync(
  174. BSTR bstrQueryLanguageIn,
  175. BSTR bstrQueryIn,
  176. long lFlagsIn,
  177. IWbemContext * pCtxIn,
  178. IWbemObjectSink * pHandlerIn
  179. )
  180. {
  181. return WBEM_E_NOT_SUPPORTED;
  182. }
  183. HRESULT STDMETHODCALLTYPE DoExecMethodAsync(
  184. BSTR bstrObjectPathIn,
  185. BSTR bstrMethodNameIn,
  186. long lFlagsIn,
  187. IWbemContext * pCtxIn,
  188. IWbemClassObject * pInParamsIn,
  189. IWbemObjectSink * pHandlerIn
  190. )
  191. {
  192. return WBEM_E_NOT_SUPPORTED;
  193. }
  194. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
  195. const BSTR bstrSuperclassIn,
  196. long lFlagsIn,
  197. IWbemContext * pCtxIn,
  198. IWbemObjectSink * pResponseHandlerIn
  199. )
  200. {
  201. return WBEM_E_NOT_SUPPORTED;
  202. }
  203. STDMETHODIMP Initialize(
  204. LPWSTR pszUserIn,
  205. LONG lFlagsIn,
  206. LPWSTR pszNamespaceIn,
  207. LPWSTR pszLocaleIn,
  208. IWbemServices * pNamespaceIn,
  209. IWbemContext * pCtxIn,
  210. IWbemProviderInitSink * pInitSinkIn
  211. );
  212. static HRESULT S_HrCreateThis(
  213. IUnknown * pUnknownOuterIn,
  214. VOID ** ppvOut
  215. );
  216. protected:
  217. void CreateMofClassFromResource(
  218. HRESOURCE hResourceIn,
  219. LPCWSTR pwszTypeNameIn,
  220. CWbemClassObject & pClassInout
  221. );
  222. void CreateMofClassFromResType(
  223. HCLUSTER hCluster,
  224. LPCWSTR pwszTypeNameIn,
  225. CWbemClassObject & pClassInout
  226. );
  227. }; //*** class CClassProv