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.

304 lines
8.9 KiB

  1. // WbemProv.h: Definition of the CProvider class
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_WBEMPROV_H__95A79B93_CFC8_4DB1_8256_5BEFC3FE2A26__INCLUDED_)
  5. #define AFX_WBEMPROV_H__95A79B93_CFC8_4DB1_8256_5BEFC3FE2A26__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "resource.h" // main symbols
  10. typedef enum _ProviderClass
  11. {
  12. CLASS_STATUS,
  13. CLASS_DC
  14. } ProviderClass;
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CProvider
  17. class CProvider :
  18. public IWbemProviderInit,
  19. public IWbemServices,
  20. public CComObjectRoot,
  21. public CComCoClass<CProvider,&CLSID_ADReplProvider>
  22. {
  23. public:
  24. CProvider();
  25. ~CProvider();
  26. BEGIN_COM_MAP(CProvider)
  27. COM_INTERFACE_ENTRY(IWbemProviderInit)
  28. COM_INTERFACE_ENTRY(IWbemServices)
  29. END_COM_MAP()
  30. //DECLARE_NOT_AGGREGATABLE(CProvider)
  31. // Remove the comment from the line above if you don't want your object to
  32. // support aggregation.
  33. DECLARE_REGISTRY_RESOURCEID(IDR_ADReplProvider)
  34. // IWbemProviderInit
  35. STDMETHOD(Initialize)(
  36. IN LPWSTR pszUser,
  37. IN LONG lFlags,
  38. IN LPWSTR pszNamespace,
  39. IN LPWSTR pszLocale,
  40. IN IWbemServices *pNamespace,
  41. IN IWbemContext *pCtx,
  42. IN IWbemProviderInitSink *pInitSink
  43. );
  44. // IWbemServices
  45. //
  46. // +++ Implemented +++
  47. //
  48. STDMETHOD(GetObjectAsync)(
  49. IN const BSTR bstrObjectPath,
  50. IN long lFlags,
  51. IN IWbemContext *pCtx,
  52. IN IWbemObjectSink *pResponseHandler);
  53. STDMETHOD(CreateInstanceEnumAsync)(
  54. IN const BSTR bstrClass,
  55. IN long lFlags,
  56. IN IWbemContext *pCtx,
  57. IN IWbemObjectSink *pResponseHandler);
  58. //
  59. // --- NOT Implemented ---
  60. //
  61. STDMETHOD(OpenNamespace)(
  62. IN const BSTR strNamespace,
  63. IN long lFlags,
  64. IN IWbemContext *pCtx,
  65. IN OUT IWbemServices **ppWorkingNamespace,
  66. IN OUT IWbemCallResult **ppResult)
  67. { return WBEM_E_NOT_SUPPORTED; };
  68. STDMETHOD(CancelAsyncCall)(
  69. IN IWbemObjectSink *pSink)
  70. { return WBEM_E_NOT_SUPPORTED; };
  71. STDMETHOD(QueryObjectSink)(
  72. IN long lFlags,
  73. OUT IWbemObjectSink **ppResponseHandler)
  74. { return WBEM_E_NOT_SUPPORTED; };
  75. STDMETHOD(GetObject)(
  76. IN const BSTR strObjectPath,
  77. IN long lFlags,
  78. IN IWbemContext *pCtx,
  79. IN OUT IWbemClassObject **ppObject,
  80. IN OUT IWbemCallResult **ppCallResult)
  81. { return WBEM_E_NOT_SUPPORTED; };
  82. STDMETHOD(PutClass)(
  83. IN IWbemClassObject *pObject,
  84. IN long lFlags,
  85. IN IWbemContext *pCtx,
  86. IN OUT IWbemCallResult **ppCallResult)
  87. { return WBEM_E_NOT_SUPPORTED; };
  88. STDMETHOD(PutClassAsync)(
  89. IN IWbemClassObject *pObject,
  90. IN long lFlags,
  91. IN IWbemContext *pCtx,
  92. IN IWbemObjectSink *pResponseHandler)
  93. { return WBEM_E_NOT_SUPPORTED; };
  94. STDMETHOD(DeleteClass)(
  95. IN const BSTR strClass,
  96. IN long lFlags,
  97. IN IWbemContext *pCtx,
  98. IN OUT IWbemCallResult **ppCallResult)
  99. { return WBEM_E_NOT_SUPPORTED; };
  100. STDMETHOD(DeleteClassAsync)(
  101. IN const BSTR strClass,
  102. IN long lFlags,
  103. IN IWbemContext *pCtx,
  104. IN IWbemObjectSink *pResponseHandler)
  105. { return WBEM_E_NOT_SUPPORTED; };
  106. STDMETHOD(CreateClassEnum)(
  107. IN const BSTR strSuperclass,
  108. IN long lFlags,
  109. IN IWbemContext *pCtx,
  110. OUT IEnumWbemClassObject **ppEnum)
  111. { return WBEM_E_NOT_SUPPORTED; };
  112. STDMETHOD(CreateClassEnumAsync)(
  113. IN const BSTR strSuperclass,
  114. IN long lFlags,
  115. IN IWbemContext *pCtx,
  116. IN IWbemObjectSink *pResponseHandler)
  117. { return WBEM_E_NOT_SUPPORTED; };
  118. STDMETHOD(PutInstance)(
  119. IN IWbemClassObject *pInst,
  120. IN long lFlags,
  121. IN IWbemContext *pCtx,
  122. IN OUT IWbemCallResult **ppCallResult)
  123. { return WBEM_E_NOT_SUPPORTED; };
  124. STDMETHOD(PutInstanceAsync)(
  125. IN IWbemClassObject *pInst,
  126. IN long lFlags,
  127. IN IWbemContext *pCtx,
  128. IN IWbemObjectSink *pResponseHandler)
  129. { return WBEM_E_NOT_SUPPORTED; };
  130. STDMETHOD(DeleteInstance)(
  131. IN const BSTR strObjectPath,
  132. IN long lFlags,
  133. IN IWbemContext *pCtx,
  134. IN OUT IWbemCallResult **ppCallResult)
  135. { return WBEM_E_NOT_SUPPORTED; };
  136. STDMETHOD(DeleteInstanceAsync)(
  137. IN const BSTR strObjectPath,
  138. IN long lFlags,
  139. IN IWbemContext *pCtx,
  140. IN IWbemObjectSink *pResponseHandler)
  141. { return WBEM_E_NOT_SUPPORTED; };
  142. STDMETHOD(CreateInstanceEnum)(
  143. IN const BSTR strClass,
  144. IN long lFlags,
  145. IN IWbemContext *pCtx,
  146. OUT IEnumWbemClassObject **ppEnum)
  147. { return WBEM_E_NOT_SUPPORTED; };
  148. STDMETHOD(ExecQuery)(
  149. IN const BSTR strQueryLanguage,
  150. IN const BSTR strQuery,
  151. IN long lFlags,
  152. IN IWbemContext *pCtx,
  153. OUT IEnumWbemClassObject **ppEnum)
  154. { return WBEM_E_NOT_SUPPORTED; };
  155. STDMETHOD(ExecQueryAsync)(
  156. IN const BSTR strQueryLanguage,
  157. IN const BSTR strQuery,
  158. IN long lFlags,
  159. IN IWbemContext *pCtx,
  160. IN IWbemObjectSink *pResponseHandler)
  161. { return WBEM_E_NOT_SUPPORTED; };
  162. STDMETHOD(ExecNotificationQuery)(
  163. IN const BSTR strQueryLanguage,
  164. IN const BSTR strQuery,
  165. IN long lFlags,
  166. IN IWbemContext *pCtx,
  167. OUT IEnumWbemClassObject **ppEnum)
  168. { return WBEM_E_NOT_SUPPORTED; };
  169. STDMETHOD(ExecNotificationQueryAsync)(
  170. IN const BSTR strQueryLanguage,
  171. IN const BSTR strQuery,
  172. IN long lFlags,
  173. IN IWbemContext *pCtx,
  174. IN IWbemObjectSink *pResponseHandler)
  175. { return WBEM_E_NOT_SUPPORTED; };
  176. STDMETHOD(ExecMethod)(
  177. IN const BSTR strObjectPath,
  178. IN const BSTR strMethodName,
  179. IN long lFlags,
  180. IN IWbemContext *pCtx,
  181. IN IWbemClassObject *pInParams,
  182. IN OUT IWbemClassObject **ppOutParams,
  183. IN OUT IWbemCallResult **ppCallResult)
  184. { return WBEM_E_NOT_SUPPORTED; };
  185. STDMETHOD(ExecMethodAsync)(
  186. IN const BSTR strObjectPath,
  187. IN const BSTR strMethodName,
  188. IN long lFlags,
  189. IN IWbemContext *pCtx,
  190. IN IWbemClassObject *pInParams,
  191. IN IWbemObjectSink *pResponseHandler)
  192. { return WBEM_E_NOT_SUPPORTED; };
  193. protected:
  194. HRESULT _EnumAndIndicateDC(
  195. IN IWbemContext *pCtx,
  196. IN IWbemObjectSink *pResponseHandler,
  197. IN const BSTR bstrFilterValue = FALSE
  198. );
  199. HRESULT _EnumAndIndicateStatus(
  200. IN ProviderClass provclass,
  201. IN IWbemContext *pCtx,
  202. IN IWbemObjectSink *pResponseHandler,
  203. IN const BSTR bstrFilterValue = NULL );
  204. HRESULT _EnumAndIndicateWorker(
  205. IN ProviderClass provclass,
  206. IN HANDLE hDS,
  207. IN IWbemContext *pCtx,
  208. IN IWbemObjectSink *pResponseHandler,
  209. IN const BSTR bstrFilterValue = NULL,
  210. IN const BSTR bstrDnsDomainName = NULL );
  211. /*
  212. HRESULT _EnumAndIndicateDCWorker(
  213. IN HANDLE hDS,
  214. IN IWbemContext *pCtx,
  215. IN IWbemObjectSink *pResponseHandler,
  216. IN const BSTR bstrFilterValue = NULL );
  217. */
  218. HRESULT _BuildListStatus(
  219. IN HANDLE hDS,
  220. OUT DS_REPL_NEIGHBORS** ppneighborsstruct );
  221. /*
  222. HRESULT _BuildListDC(
  223. IN HANDLE hDS,
  224. IN const BSTR bstrDnsDomainName,
  225. OUT DS_DOMAIN_CONTROLLER_INFO_1** ppDCs,
  226. OUT ULONG* pcDCs );
  227. */
  228. HRESULT _BuildIndicateArrayStatus(
  229. IN DS_REPL_NEIGHBORS* pneighborstruct,
  230. IN const BSTR bstrFilterValue,
  231. OUT IWbemClassObject*** ppaIndicateItems,
  232. OUT DWORD* pcIndicateItems);
  233. /*
  234. HRESULT _BuildIndicateArrayDC(
  235. IN DS_DOMAIN_CONTROLLER_INFO_1* pDCs,
  236. IN ULONG cDCs,
  237. IN const BSTR bstrFilterValue,
  238. OUT IWbemClassObject*** ppaIndicateItems,
  239. OUT DWORD* pcIndicateItems);
  240. */
  241. void _ReleaseIndicateArray(
  242. IWbemClassObject** paIndicateItems,
  243. DWORD cIndicateItems,
  244. bool fReleaseArray = true);
  245. HRESULT _PutAttributesStatus(
  246. IWbemClassObject** pipNewInst,
  247. const BSTR bstrFilterValue,
  248. DS_REPL_NEIGHBOR* pneighbor);
  249. HRESULT _PutAttributesDC(
  250. IN IWbemClassObject* pIndicateItem,
  251. IN IADsPathname* pPathCracker,
  252. IN const BSTR bstrFilterValue,
  253. IN IDirectorySearch* pIADsSearch,
  254. IN ADS_SEARCH_HANDLE hSearch);
  255. CComPtr<IWbemServices> m_sipNamespace;
  256. CComPtr<IWbemClassObject> m_sipClassDefStatus;
  257. CComPtr<IWbemClassObject> m_sipClassDefDC;
  258. };
  259. #endif // !defined(AFX_WBEMPROV_H__95A79B93_CFC8_4DB1_8256_5BEFC3FE2A26__INCLUDED_)