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.

465 lines
9.2 KiB

  1. #ifndef _Server_Interceptor_IWbemObjectSink_H
  2. #define _Server_Interceptor_IWbemObjectSink_H
  3. /*++
  4. Copyright (C) 1996-2001 Microsoft Corporation
  5. Module Name:
  6. ProvObSk.H
  7. Abstract:
  8. History:
  9. --*/
  10. #include "ProvCache.h"
  11. #include "Queue.h"
  12. /******************************************************************************
  13. *
  14. * Name:
  15. *
  16. *
  17. * Description:
  18. *
  19. *
  20. *****************************************************************************/
  21. class CInterceptor_IWbemObjectSink : public IWbemObjectSink ,
  22. public IWbemShutdown ,
  23. #ifdef INTERNAL_IDENTIFY
  24. public Internal_IWbemObjectSink ,
  25. #endif
  26. public ObjectSinkContainerElement
  27. {
  28. private:
  29. LONG m_GateClosed ;
  30. LONG m_InProgress ;
  31. LONG m_StatusCalled ;
  32. IWbemObjectSink *m_InterceptedSink ;
  33. IUnknown *m_Unknown ;
  34. SECURITY_DESCRIPTOR *m_SecurityDescriptor ;
  35. protected:
  36. public:
  37. CInterceptor_IWbemObjectSink (
  38. IWbemObjectSink *a_InterceptedSink ,
  39. IUnknown *a_Unknown ,
  40. CWbemGlobal_IWmiObjectSinkController *a_Controller
  41. ) ;
  42. ~CInterceptor_IWbemObjectSink () ;
  43. HRESULT Initialize ( SECURITY_DESCRIPTOR *a_SecurityDescriptor ) ;
  44. void CallBackRelease () ;
  45. //Non-delegating object IUnknown
  46. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  47. STDMETHODIMP_( ULONG ) AddRef () ;
  48. STDMETHODIMP_( ULONG ) Release () ;
  49. HRESULT STDMETHODCALLTYPE Indicate (
  50. long a_ObjectCount ,
  51. IWbemClassObject **a_ObjectArray
  52. ) ;
  53. HRESULT STDMETHODCALLTYPE SetStatus (
  54. long a_Flags ,
  55. HRESULT a_Result ,
  56. BSTR a_StringParamater ,
  57. IWbemClassObject *a_ObjectParameter
  58. ) ;
  59. HRESULT STDMETHODCALLTYPE Shutdown (
  60. LONG a_Flags ,
  61. ULONG a_MaxMilliSeconds ,
  62. IWbemContext *a_Context
  63. ) ;
  64. } ;
  65. /******************************************************************************
  66. *
  67. * Name:
  68. *
  69. *
  70. * Description:
  71. *
  72. *
  73. *****************************************************************************/
  74. class CInterceptor_DecoupledIWbemObjectSink : public IWbemObjectSink ,
  75. public IWbemShutdown ,
  76. public ObjectSinkContainerElement
  77. {
  78. private:
  79. LONG m_GateClosed ;
  80. LONG m_InProgress ;
  81. LONG m_StatusCalled ;
  82. IWbemObjectSink *m_InterceptedSink ;
  83. IUnknown *m_Unknown ;
  84. protected:
  85. public:
  86. CInterceptor_DecoupledIWbemObjectSink (
  87. IWbemObjectSink *a_InterceptedSink ,
  88. IUnknown *a_Unknown ,
  89. CWbemGlobal_IWmiObjectSinkController *a_Controller
  90. ) ;
  91. ~CInterceptor_DecoupledIWbemObjectSink () ;
  92. void CallBackRelease () ;
  93. //Non-delegating object IUnknown
  94. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  95. STDMETHODIMP_( ULONG ) AddRef () ;
  96. STDMETHODIMP_( ULONG ) Release () ;
  97. HRESULT STDMETHODCALLTYPE Indicate (
  98. long a_ObjectCount ,
  99. IWbemClassObject **a_ObjectArray
  100. ) ;
  101. HRESULT STDMETHODCALLTYPE SetStatus (
  102. long a_Flags ,
  103. HRESULT a_Result ,
  104. BSTR a_StringParamater ,
  105. IWbemClassObject *a_ObjectParameter
  106. ) ;
  107. HRESULT STDMETHODCALLTYPE Shutdown (
  108. LONG a_Flags ,
  109. ULONG a_MaxMilliSeconds ,
  110. IWbemContext *a_Context
  111. ) ;
  112. } ;
  113. /******************************************************************************
  114. *
  115. * Name:
  116. *
  117. *
  118. * Description:
  119. *
  120. *
  121. *****************************************************************************/
  122. class CInterceptor_IWbemFilteringObjectSink : public CInterceptor_IWbemObjectSink
  123. {
  124. private:
  125. LONG m_Filtering ;
  126. BSTR m_QueryLanguage ;
  127. BSTR m_Query ;
  128. IWbemQuery *m_QueryFilter ;
  129. protected:
  130. public:
  131. CInterceptor_IWbemFilteringObjectSink (
  132. IWbemObjectSink *a_InterceptedSink ,
  133. IUnknown *a_Unknown ,
  134. CWbemGlobal_IWmiObjectSinkController *a_Controller ,
  135. const BSTR a_QueryLanguage ,
  136. const BSTR a_Query
  137. ) ;
  138. ~CInterceptor_IWbemFilteringObjectSink () ;
  139. //Non-delegating object IUnknown
  140. HRESULT STDMETHODCALLTYPE Indicate (
  141. long a_ObjectCount ,
  142. IWbemClassObject **a_ObjectArray
  143. ) ;
  144. HRESULT STDMETHODCALLTYPE SetStatus (
  145. long a_Flags ,
  146. HRESULT a_Result ,
  147. BSTR a_StringParamater ,
  148. IWbemClassObject *a_ObjectParameter
  149. ) ;
  150. } ;
  151. /******************************************************************************
  152. *
  153. * Name:
  154. *
  155. *
  156. * Description:
  157. *
  158. *
  159. *****************************************************************************/
  160. class CInterceptor_DecoupledIWbemCombiningObjectSink : public IWbemObjectSink ,
  161. public IWbemShutdown ,
  162. public ObjectSinkContainerElement ,
  163. public CWbemGlobal_IWmiObjectSinkController
  164. {
  165. private:
  166. LONG m_GateClosed ;
  167. LONG m_InProgress ;
  168. LONG m_StatusCalled ;
  169. LONG m_SinkCount ;
  170. HANDLE m_Event ;
  171. IWbemObjectSink *m_InterceptedSink ;
  172. #if 0
  173. class InternalInterface : public IWbemObjectSink , public IWbemShutdown
  174. {
  175. private:
  176. CInterceptor_DecoupledIWbemCombiningObjectSink *m_This ;
  177. public:
  178. InternalInterface ( CInterceptor_DecoupledIWbemCombiningObjectSink *a_This ) : m_This ( a_This )
  179. {
  180. }
  181. STDMETHODIMP QueryInterface (
  182. REFIID iid ,
  183. LPVOID FAR *iplpv
  184. )
  185. {
  186. *iplpv = NULL ;
  187. if ( iid == IID_IUnknown )
  188. {
  189. *iplpv = ( LPVOID ) this ;
  190. }
  191. else if ( iid == IID_IWbemObjectSink )
  192. {
  193. *iplpv = ( LPVOID ) ( IWbemObjectSink * ) this ;
  194. }
  195. else if ( iid == IID_IWbemShutdown )
  196. {
  197. *iplpv = ( LPVOID ) ( IWbemShutdown * ) this ;
  198. }
  199. if ( *iplpv )
  200. {
  201. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  202. return ResultFromScode ( S_OK ) ;
  203. }
  204. else
  205. {
  206. return ResultFromScode ( E_NOINTERFACE ) ;
  207. }
  208. }
  209. STDMETHODIMP_( ULONG ) AddRef ()
  210. {
  211. return m_This->NonCyclicAddRef () ;
  212. }
  213. STDMETHODIMP_( ULONG ) Release ()
  214. {
  215. return m_This->NonCyclicRelease () ;
  216. }
  217. HRESULT STDMETHODCALLTYPE Indicate (
  218. long a_ObjectCount ,
  219. IWbemClassObject **a_ObjectArray
  220. )
  221. {
  222. return m_This->Indicate (
  223. a_ObjectCount ,
  224. a_ObjectArray
  225. ) ;
  226. }
  227. HRESULT STDMETHODCALLTYPE SetStatus (
  228. long a_Flags ,
  229. HRESULT a_Result ,
  230. BSTR a_StringParamater ,
  231. IWbemClassObject *a_ObjectParameter
  232. )
  233. {
  234. return m_This->SetStatus (
  235. a_Flags ,
  236. a_Result ,
  237. a_StringParamater ,
  238. a_ObjectParameter
  239. ) ;
  240. }
  241. HRESULT STDMETHODCALLTYPE Shutdown (
  242. LONG a_Flags ,
  243. ULONG a_MaxMilliSeconds ,
  244. IWbemContext *a_Context
  245. )
  246. {
  247. return m_This->Shutdown (
  248. a_Flags ,
  249. a_MaxMilliSeconds ,
  250. a_Context
  251. ) ;
  252. }
  253. } ;
  254. InternalInterface m_Internal ;
  255. #endif
  256. void CallBackRelease () ;
  257. protected:
  258. public:
  259. CInterceptor_DecoupledIWbemCombiningObjectSink (
  260. WmiAllocator &m_Allocator ,
  261. IWbemObjectSink *a_InterceptedSink ,
  262. CWbemGlobal_IWmiObjectSinkController *a_Controller
  263. ) ;
  264. ~CInterceptor_DecoupledIWbemCombiningObjectSink () ;
  265. //Non-delegating object IUnknown
  266. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  267. STDMETHODIMP_( ULONG ) AddRef () ;
  268. STDMETHODIMP_( ULONG ) Release () ;
  269. HRESULT STDMETHODCALLTYPE Indicate (
  270. long a_ObjectCount ,
  271. IWbemClassObject **a_ObjectArray
  272. ) ;
  273. HRESULT STDMETHODCALLTYPE SetStatus (
  274. long a_Flags ,
  275. HRESULT a_Result ,
  276. BSTR a_StringParamater ,
  277. IWbemClassObject *a_ObjectParameter
  278. ) ;
  279. HRESULT STDMETHODCALLTYPE Shutdown (
  280. LONG a_Flags ,
  281. ULONG a_MaxMilliSeconds ,
  282. IWbemContext *a_Context
  283. ) ;
  284. HRESULT Wait ( ULONG a_Timeout ) ;
  285. HRESULT EnQueue ( CInterceptor_DecoupledIWbemObjectSink *a_Sink ) ;
  286. void Suspend () ;
  287. void Resume () ;
  288. } ;
  289. /******************************************************************************
  290. *
  291. * Name:
  292. *
  293. *
  294. * Description:
  295. *
  296. *
  297. *****************************************************************************/
  298. class CInterceptor_IWbemWaitingObjectSink : public IWbemObjectSink ,
  299. public IWbemShutdown ,
  300. public ObjectSinkContainerElement ,
  301. public CWbemGlobal_IWmiObjectSinkController
  302. {
  303. private:
  304. LONG m_GateClosed ;
  305. LONG m_InProgress ;
  306. LONG m_StatusCalled ;
  307. WmiQueue <IWbemClassObject *,8> m_Queue ;
  308. CriticalSection m_CriticalSection ;
  309. HANDLE m_Event ;
  310. HRESULT m_Result ;
  311. protected:
  312. public:
  313. CInterceptor_IWbemWaitingObjectSink (
  314. WmiAllocator &m_Allocator ,
  315. CWbemGlobal_IWmiObjectSinkController *a_Controller
  316. ) ;
  317. ~CInterceptor_IWbemWaitingObjectSink () ;
  318. //Non-delegating object IUnknown
  319. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  320. STDMETHODIMP_( ULONG ) AddRef () ;
  321. STDMETHODIMP_( ULONG ) Release () ;
  322. HRESULT STDMETHODCALLTYPE Indicate (
  323. long a_ObjectCount ,
  324. IWbemClassObject **a_ObjectArray
  325. ) ;
  326. HRESULT STDMETHODCALLTYPE SetStatus (
  327. long a_Flags ,
  328. HRESULT a_Result ,
  329. BSTR a_StringParamater ,
  330. IWbemClassObject *a_ObjectParameter
  331. ) ;
  332. HRESULT STDMETHODCALLTYPE Shutdown (
  333. LONG a_Flags ,
  334. ULONG a_MaxMilliSeconds ,
  335. IWbemContext *a_Context
  336. ) ;
  337. HRESULT Wait ( ULONG a_Timeout = INFINITE ) ;
  338. WmiQueue <IWbemClassObject *,8> & GetQueue () { return m_Queue ; }
  339. CriticalSection &GetQueueCriticalSection () { return m_CriticalSection ; }
  340. HRESULT GetResult () { return m_Result ; }
  341. } ;
  342. #endif _Server_Interceptor_IWbemObjectSink_H