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.

348 lines
12 KiB

  1. #ifndef __ntrkcomm_h__
  2. #define __ntrkcomm_h__
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif
  6. typedef LPVOID * PPVOID;
  7. class CWbemServices
  8. {
  9. protected:
  10. IWbemServices* m_pWbemServices;
  11. public:
  12. CWbemServices(IWbemServices* );
  13. virtual ~CWbemServices();
  14. HRESULT STDMETHODCALLTYPE GetObject(
  15. /* [in] */ const BSTR ObjectPath,
  16. /* [in] */ long lFlags,
  17. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  18. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  19. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  20. HRESULT STDMETHODCALLTYPE PutClass(
  21. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  22. /* [in] */ long lFlags,
  23. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  24. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  25. HRESULT STDMETHODCALLTYPE DeleteClass(
  26. /* [in] */ const BSTR Class,
  27. /* [in] */ long lFlags,
  28. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  29. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  30. HRESULT STDMETHODCALLTYPE CreateClassEnum(
  31. /* [in] */ const BSTR Superclass,
  32. /* [in] */ long lFlags,
  33. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  34. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  35. HRESULT STDMETHODCALLTYPE PutInstance(
  36. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  37. /* [in] */ long lFlags,
  38. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  39. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  40. HRESULT STDMETHODCALLTYPE DeleteInstance(
  41. /* [in] */ const BSTR ObjectPath,
  42. /* [in] */ long lFlags,
  43. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  44. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult) ;
  45. HRESULT STDMETHODCALLTYPE CreateInstanceEnum(
  46. /* [in] */ const BSTR Class,
  47. /* [in] */ long lFlags,
  48. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  49. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  50. HRESULT STDMETHODCALLTYPE ExecQuery(
  51. /* [in] */ const BSTR QueryLanguage,
  52. /* [in] */ const BSTR Query,
  53. /* [in] */ long lFlags,
  54. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  55. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  56. HRESULT STDMETHODCALLTYPE ExecNotificationQuery(
  57. /* [in] */ const BSTR QueryLanguage,
  58. /* [in] */ const BSTR Query,
  59. /* [in] */ long lFlags,
  60. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  61. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum) ;
  62. HRESULT STDMETHODCALLTYPE ExecMethod(
  63. const BSTR,
  64. const BSTR,
  65. long,
  66. IWbemContext*,
  67. IWbemClassObject*,
  68. IWbemClassObject**,
  69. IWbemCallResult**) ;
  70. };
  71. class CImpersonatedProvider : public IWbemServices, public IWbemProviderInit
  72. {
  73. protected:
  74. ULONG m_cRef; //Object reference count
  75. CWbemServices* m_pNamespace;
  76. public:
  77. CImpersonatedProvider(const BSTR =NULL, const BSTR =NULL , const BSTR =NULL, IWbemContext* =NULL);
  78. virtual ~CImpersonatedProvider();
  79. //Non-delegating object IUnknown
  80. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  81. STDMETHODIMP_(ULONG) AddRef(void);
  82. STDMETHODIMP_(ULONG) Release(void);
  83. //IWbemProviderInit
  84. HRESULT STDMETHODCALLTYPE Initialize(
  85. /* [in] */ LPWSTR pszUser,
  86. /* [in] */ LONG lFlags,
  87. /* [in] */ LPWSTR pszNamespace,
  88. /* [in] */ LPWSTR pszLocale,
  89. /* [in] */ IWbemServices *pNamespace,
  90. /* [in] */ IWbemContext *pCtx,
  91. /* [in] */ IWbemProviderInitSink *pInitSink
  92. );
  93. //IWbemServices
  94. HRESULT STDMETHODCALLTYPE OpenNamespace(
  95. /* [in] */ const BSTR Namespace,
  96. /* [in] */ long lFlags,
  97. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  98. /* [unique][in][out] */ IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace,
  99. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult)
  100. {return WBEM_E_NOT_SUPPORTED;};
  101. HRESULT STDMETHODCALLTYPE CancelAsyncCall(
  102. /* [in] */ IWbemObjectSink __RPC_FAR *pSink)
  103. {return WBEM_E_NOT_SUPPORTED;};
  104. HRESULT STDMETHODCALLTYPE QueryObjectSink(
  105. /* [in] */ long lFlags,
  106. /* [out] */ IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler)
  107. {return WBEM_E_NOT_SUPPORTED;};
  108. HRESULT STDMETHODCALLTYPE GetObject(
  109. /* [in] */ const BSTR ObjectPath,
  110. /* [in] */ long lFlags,
  111. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  112. /* [unique][in][out] */ IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject,
  113. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  114. {return WBEM_E_NOT_SUPPORTED;};
  115. HRESULT STDMETHODCALLTYPE GetObjectAsync(
  116. /* [in] */ const BSTR ObjectPath,
  117. /* [in] */ long lFlags,
  118. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  119. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  120. HRESULT STDMETHODCALLTYPE PutClass(
  121. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  122. /* [in] */ long lFlags,
  123. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  124. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  125. {return WBEM_E_NOT_SUPPORTED;};
  126. HRESULT STDMETHODCALLTYPE PutClassAsync(
  127. /* [in] */ IWbemClassObject __RPC_FAR *pObject,
  128. /* [in] */ long lFlags,
  129. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  130. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  131. {return WBEM_E_NOT_SUPPORTED;};
  132. HRESULT STDMETHODCALLTYPE DeleteClass(
  133. /* [in] */ const BSTR Class,
  134. /* [in] */ long lFlags,
  135. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  136. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  137. {return WBEM_E_NOT_SUPPORTED;};
  138. HRESULT STDMETHODCALLTYPE DeleteClassAsync(
  139. /* [in] */ const BSTR Class,
  140. /* [in] */ long lFlags,
  141. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  142. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  143. {return WBEM_E_NOT_SUPPORTED;};
  144. HRESULT STDMETHODCALLTYPE CreateClassEnum(
  145. /* [in] */ const BSTR Superclass,
  146. /* [in] */ long lFlags,
  147. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  148. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  149. {return WBEM_E_NOT_SUPPORTED;};
  150. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync(
  151. /* [in] */ const BSTR Superclass,
  152. /* [in] */ long lFlags,
  153. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  154. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  155. {return WBEM_E_NOT_SUPPORTED;};
  156. HRESULT STDMETHODCALLTYPE PutInstance(
  157. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  158. /* [in] */ long lFlags,
  159. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  160. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  161. {return WBEM_E_NOT_SUPPORTED;};
  162. HRESULT STDMETHODCALLTYPE PutInstanceAsync(
  163. /* [in] */ IWbemClassObject __RPC_FAR *pInst,
  164. /* [in] */ long lFlags,
  165. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  166. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  167. HRESULT STDMETHODCALLTYPE DeleteInstance(
  168. /* [in] */ const BSTR ObjectPath,
  169. /* [in] */ long lFlags,
  170. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  171. /* [unique][in][out] */ IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
  172. {return WBEM_E_NOT_SUPPORTED;};
  173. HRESULT STDMETHODCALLTYPE DeleteInstanceAsync(
  174. /* [in] */ const BSTR ObjectPath,
  175. /* [in] */ long lFlags,
  176. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  177. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  178. HRESULT STDMETHODCALLTYPE CreateInstanceEnum(
  179. /* [in] */ const BSTR Class,
  180. /* [in] */ long lFlags,
  181. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  182. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  183. {return WBEM_E_NOT_SUPPORTED;};
  184. HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync(
  185. /* [in] */ const BSTR Class,
  186. /* [in] */ long lFlags,
  187. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  188. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler);
  189. HRESULT STDMETHODCALLTYPE ExecQuery(
  190. /* [in] */ const BSTR QueryLanguage,
  191. /* [in] */ const BSTR Query,
  192. /* [in] */ long lFlags,
  193. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  194. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  195. {return WBEM_E_NOT_SUPPORTED;};
  196. HRESULT STDMETHODCALLTYPE ExecQueryAsync(
  197. /* [in] */ const BSTR QueryLanguage,
  198. /* [in] */ const BSTR Query,
  199. /* [in] */ long lFlags,
  200. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  201. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler) ;
  202. HRESULT STDMETHODCALLTYPE ExecNotificationQuery(
  203. /* [in] */ const BSTR QueryLanguage,
  204. /* [in] */ const BSTR Query,
  205. /* [in] */ long lFlags,
  206. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  207. /* [out] */ IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
  208. {return WBEM_E_NOT_SUPPORTED;};
  209. HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync(
  210. /* [in] */ const BSTR QueryLanguage,
  211. /* [in] */ const BSTR Query,
  212. /* [in] */ long lFlags,
  213. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  214. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler)
  215. {return WBEM_E_NOT_SUPPORTED;};
  216. HRESULT STDMETHODCALLTYPE ExecMethod(
  217. const BSTR,
  218. const BSTR,
  219. long,
  220. IWbemContext*,
  221. IWbemClassObject*,
  222. IWbemClassObject**,
  223. IWbemCallResult**)
  224. {return WBEM_E_NOT_SUPPORTED;}
  225. virtual HRESULT STDMETHODCALLTYPE ExecMethodAsync(
  226. const BSTR,
  227. const BSTR,
  228. long,
  229. IWbemContext*,
  230. IWbemClassObject*,
  231. IWbemObjectSink*);
  232. protected:
  233. virtual HRESULT STDMETHODCALLTYPE DoCreateInstanceEnumAsync(
  234. /* [in] */ const BSTR, // Class,
  235. /* [in] */ long, // lFlags,
  236. /* [in] */ IWbemContext __RPC_FAR *, //pCtx,
  237. /* [in] */ IWbemObjectSink __RPC_FAR * //pResponseHandler
  238. )=0;
  239. virtual HRESULT STDMETHODCALLTYPE DoDeleteInstanceAsync(
  240. /* [in] */ const BSTR , //ObjectPath,
  241. /* [in] */ long, // lFlags,
  242. /* [in] */ IWbemContext __RPC_FAR *, //pCtx,
  243. /* [in] */ IWbemObjectSink __RPC_FAR * //pResponseHandler
  244. ) =0;
  245. virtual HRESULT STDMETHODCALLTYPE DoExecMethodAsync(
  246. const BSTR,
  247. const BSTR,
  248. long,
  249. IWbemContext*,
  250. IWbemClassObject*,
  251. IWbemObjectSink*
  252. )=0;
  253. virtual HRESULT STDMETHODCALLTYPE DoExecQueryAsync(
  254. /* [in] */ const BSTR, // QueryLanguage,
  255. /* [in] */ const BSTR, // Query,
  256. /* [in] */ long, // lFlags,
  257. /* [in] */ IWbemContext __RPC_FAR *, // pCtx,
  258. /* [in] */ IWbemObjectSink __RPC_FAR * //pResponseHandler
  259. ) =0;
  260. virtual HRESULT STDMETHODCALLTYPE DoGetObjectAsync(
  261. /* [in] */ const BSTR ObjectPath,
  262. /* [in] */ long lFlags,
  263. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  264. /* [in] */ IWbemObjectSink __RPC_FAR *pResponseHandler
  265. )=0;
  266. virtual HRESULT STDMETHODCALLTYPE DoPutInstanceAsync(
  267. /* [in] */ IWbemClassObject __RPC_FAR *, //pInst,
  268. /* [in] */ long , // lFlags,
  269. /* [in] */ IWbemContext __RPC_FAR *, //pCtx,
  270. /* [in] */ IWbemObjectSink __RPC_FAR * //pResponseHandler
  271. ) =0;
  272. };
  273. class CWbemInstanceMgr
  274. {
  275. protected:
  276. IWbemObjectSink* m_pSink;
  277. IWbemClassObject **m_ppInst;
  278. DWORD m_dwThreshHold;
  279. DWORD m_dwIndex;
  280. public:
  281. CWbemInstanceMgr(
  282. IWbemObjectSink*,
  283. DWORD =50);
  284. virtual ~CWbemInstanceMgr();
  285. void Indicate(IWbemClassObject*);
  286. void SetStatus(
  287. LONG,
  288. HRESULT,
  289. const BSTR,
  290. IWbemClassObject*);
  291. };
  292. #endif // end of provlib