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.

326 lines
8.1 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. frs.h
  5. Abstract:
  6. This header contains the definition of the CProvider and the CFactory
  7. classes. It also includes WMI related declarations relevant to NTFRS.
  8. Author:
  9. Sudarshan Chitre (sudarc) , Mathew George (t-mattg) - 3-Aug-2000
  10. --*/
  11. #ifndef __PROVIDER_H_
  12. #define __PROVIDER_H_
  13. /*
  14. #include <windows.h>
  15. #include <objbase.h>
  16. #include <comdef.h>
  17. #include <initguid.h>
  18. #include <wbemcli.h>
  19. #include <wbemidl.h>
  20. #include <stdio.h>
  21. #include <string.h>
  22. #include <wchar.h>
  23. #include <tchar.h>
  24. */
  25. #include <wbemcli.h>
  26. #include <wbemidl.h>
  27. #include <tchar.h>
  28. extern const CLSID CLSID_Provider;
  29. #define ODS OutputDebugString
  30. //#define ODS
  31. extern "C" {
  32. DWORD FrsWmiInitialize();
  33. DWORD FrsWmiShutdown();
  34. }
  35. //
  36. // Class definitions
  37. //
  38. class CProvider : public IWbemProviderInit,
  39. public IWbemServices,
  40. public IWbemEventProvider
  41. {
  42. public:
  43. CProvider();
  44. ~CProvider();
  45. //
  46. // Interface IUnknown
  47. //
  48. ULONG STDMETHODCALLTYPE AddRef();
  49. ULONG STDMETHODCALLTYPE Release();
  50. STDMETHOD(QueryInterface)(REFIID riid, void** ppv);
  51. //
  52. // Interface IWbemProviderInit
  53. //
  54. STDMETHOD(Initialize)(
  55. IN LPWSTR pszUser,
  56. IN LONG lFlags,
  57. IN LPWSTR pszNamespace,
  58. IN LPWSTR pszLocale,
  59. IN IWbemServices *pNamespace,
  60. IN IWbemContext *pCtx,
  61. IN IWbemProviderInitSink *pInitSink
  62. );
  63. //
  64. // Interface IWbemEventProvider
  65. //
  66. // +++++++ Implemented +++++++++
  67. STDMETHOD(ProvideEvents)(
  68. IWbemObjectSink __RPC_FAR *pSink,
  69. long lFlags
  70. );
  71. //
  72. // Interface IWbemServices
  73. //
  74. // +++++++ Implemented +++++++
  75. STDMETHOD(GetObjectAsync)(
  76. IN const BSTR bstrObjectPath,
  77. IN long lFlags,
  78. IN IWbemContext *pCtx,
  79. IN IWbemObjectSink *pResponseHandler);
  80. STDMETHOD(CreateInstanceEnumAsync)(
  81. IN const BSTR bstrClass,
  82. IN long lFlags,
  83. IN IWbemContext *pCtx,
  84. IN IWbemObjectSink *pResponseHandler);
  85. // --- NOT Implemented ---
  86. STDMETHOD(OpenNamespace)(
  87. IN const BSTR strNamespace,
  88. IN long lFlags,
  89. IN IWbemContext *pCtx,
  90. IN OUT IWbemServices **ppWorkingNamespace,
  91. IN OUT IWbemCallResult **ppResult)
  92. { return WBEM_E_NOT_SUPPORTED; };
  93. STDMETHOD(CancelAsyncCall)(
  94. IN IWbemObjectSink *pSink)
  95. { return WBEM_E_NOT_SUPPORTED; };
  96. STDMETHOD(QueryObjectSink)(
  97. IN long lFlags,
  98. OUT IWbemObjectSink **ppResponseHandler)
  99. { return WBEM_E_NOT_SUPPORTED; };
  100. STDMETHOD(GetObject)(
  101. IN const BSTR strObjectPath,
  102. IN long lFlags,
  103. IN IWbemContext *pCtx,
  104. IN OUT IWbemClassObject **ppObject,
  105. IN OUT IWbemCallResult **ppCallResult)
  106. { return WBEM_E_NOT_SUPPORTED; };
  107. STDMETHOD(PutClass)(
  108. IN IWbemClassObject *pObject,
  109. IN long lFlags,
  110. IN IWbemContext *pCtx,
  111. IN OUT IWbemCallResult **ppCallResult)
  112. { return WBEM_E_NOT_SUPPORTED; };
  113. STDMETHOD(PutClassAsync)(
  114. IN IWbemClassObject *pObject,
  115. IN long lFlags,
  116. IN IWbemContext *pCtx,
  117. IN IWbemObjectSink *pResponseHandler)
  118. { return WBEM_E_NOT_SUPPORTED; };
  119. STDMETHOD(DeleteClass)(
  120. IN const BSTR strClass,
  121. IN long lFlags,
  122. IN IWbemContext *pCtx,
  123. IN OUT IWbemCallResult **ppCallResult)
  124. { return WBEM_E_NOT_SUPPORTED; };
  125. STDMETHOD(DeleteClassAsync)(
  126. IN const BSTR strClass,
  127. IN long lFlags,
  128. IN IWbemContext *pCtx,
  129. IN IWbemObjectSink *pResponseHandler)
  130. { return WBEM_E_NOT_SUPPORTED; };
  131. STDMETHOD(CreateClassEnum)(
  132. IN const BSTR strSuperclass,
  133. IN long lFlags,
  134. IN IWbemContext *pCtx,
  135. OUT IEnumWbemClassObject **ppEnum)
  136. { return WBEM_E_NOT_SUPPORTED; };
  137. STDMETHOD(CreateClassEnumAsync)(
  138. IN const BSTR strSuperclass,
  139. IN long lFlags,
  140. IN IWbemContext *pCtx,
  141. IN IWbemObjectSink *pResponseHandler)
  142. { return WBEM_E_NOT_SUPPORTED; };
  143. STDMETHOD(PutInstance)(
  144. IN IWbemClassObject *pInst,
  145. IN long lFlags,
  146. IN IWbemContext *pCtx,
  147. IN OUT IWbemCallResult **ppCallResult)
  148. { return WBEM_E_NOT_SUPPORTED; };
  149. STDMETHOD(PutInstanceAsync)(
  150. IN IWbemClassObject *pInst,
  151. IN long lFlags,
  152. IN IWbemContext *pCtx,
  153. IN IWbemObjectSink *pResponseHandler)
  154. { return WBEM_E_NOT_SUPPORTED; };
  155. STDMETHOD(DeleteInstance)(
  156. IN const BSTR strObjectPath,
  157. IN long lFlags,
  158. IN IWbemContext *pCtx,
  159. IN OUT IWbemCallResult **ppCallResult)
  160. { return WBEM_E_NOT_SUPPORTED; };
  161. STDMETHOD(DeleteInstanceAsync)(
  162. IN const BSTR strObjectPath,
  163. IN long lFlags,
  164. IN IWbemContext *pCtx,
  165. IN IWbemObjectSink *pResponseHandler)
  166. { return WBEM_E_NOT_SUPPORTED; };
  167. STDMETHOD(CreateInstanceEnum)(
  168. IN const BSTR strClass,
  169. IN long lFlags,
  170. IN IWbemContext *pCtx,
  171. OUT IEnumWbemClassObject **ppEnum)
  172. { return WBEM_E_NOT_SUPPORTED; };
  173. STDMETHOD(ExecQuery)(
  174. IN const BSTR strQueryLanguage,
  175. IN const BSTR strQuery,
  176. IN long lFlags,
  177. IN IWbemContext *pCtx,
  178. OUT IEnumWbemClassObject **ppEnum)
  179. { return WBEM_E_NOT_SUPPORTED; };
  180. STDMETHOD(ExecQueryAsync)(
  181. IN const BSTR strQueryLanguage,
  182. IN const BSTR strQuery,
  183. IN long lFlags,
  184. IN IWbemContext *pCtx,
  185. IN IWbemObjectSink *pResponseHandler)
  186. { return WBEM_E_NOT_SUPPORTED; };
  187. STDMETHOD(ExecNotificationQuery)(
  188. IN const BSTR strQueryLanguage,
  189. IN const BSTR strQuery,
  190. IN long lFlags,
  191. IN IWbemContext *pCtx,
  192. OUT IEnumWbemClassObject **ppEnum)
  193. { return WBEM_E_NOT_SUPPORTED; };
  194. STDMETHOD(ExecNotificationQueryAsync)(
  195. IN const BSTR strQueryLanguage,
  196. IN const BSTR strQuery,
  197. IN long lFlags,
  198. IN IWbemContext *pCtx,
  199. IN IWbemObjectSink *pResponseHandler)
  200. { return WBEM_E_NOT_SUPPORTED; };
  201. STDMETHOD(ExecMethod)(
  202. IN const BSTR strObjectPath,
  203. IN const BSTR strMethodName,
  204. IN long lFlags,
  205. IN IWbemContext *pCtx,
  206. IN IWbemClassObject *pInParams,
  207. IN OUT IWbemClassObject **ppOutParams,
  208. IN OUT IWbemCallResult **ppCallResult)
  209. { return WBEM_E_NOT_SUPPORTED; };
  210. STDMETHOD(ExecMethodAsync)(
  211. IN const BSTR strObjectPath,
  212. IN const BSTR strMethodName,
  213. IN long lFlags,
  214. IN IWbemContext *pCtx,
  215. IN IWbemClassObject *pInParams,
  216. IN IWbemObjectSink *pResponseHandler)
  217. { return WBEM_E_NOT_SUPPORTED; };
  218. protected:
  219. //
  220. // Place my own methods right here !
  221. //
  222. HRESULT CProvider::EnumNtFrsMemberStatus(
  223. IN IWbemContext *pCtx,
  224. IN IWbemObjectSink *pResponseHandler,
  225. IN const BSTR bstrFilterValue = NULL
  226. );
  227. HRESULT CProvider::EnumNtFrsConnectionStatus(
  228. IN IWbemContext *pCtx,
  229. IN IWbemObjectSink *pResponseHandler,
  230. IN const BSTR bstrFilterValue = NULL
  231. );
  232. //
  233. // Member variables.
  234. //
  235. IWbemServices *m_ipNamespace;
  236. IWbemClassObject *m_ipMicrosoftFrs_DfsMemberClassDef;
  237. IWbemClassObject *m_ipMicrosoftFrs_SysVolMemberClassDef;
  238. IWbemClassObject *m_ipMicrosoftFrs_DfsConnectionClassDef;
  239. IWbemClassObject *m_ipMicrosoftFrs_SysVolConnectionClassDef;
  240. // Event class definitions. (sample)
  241. IWbemClassObject *m_ipMicrosoftFrs_DfsMemberEventClassDef;
  242. IWbemObjectSink *m_pEventSink; // Event sink.
  243. int m_NumReplicaSets;
  244. ULONG m_dwRef;
  245. };
  246. class CFactory : public IClassFactory
  247. {
  248. ULONG m_cRef;
  249. CLSID m_ClsId;
  250. public:
  251. CFactory(const CLSID & ClsId);
  252. ~CFactory();
  253. //
  254. // IUnknown members
  255. //
  256. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  257. STDMETHODIMP_(ULONG) AddRef(void);
  258. STDMETHODIMP_(ULONG) Release(void);
  259. //
  260. // IClassFactory members
  261. //
  262. STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID *);
  263. STDMETHODIMP LockServer(BOOL);
  264. };
  265. #endif //__PROVIDER_H_