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.

647 lines
14 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. ProvResv.H
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _Server_DecoupledAggregator_IWbemProvider_H
  9. #define _Server_DecoupledAggregator_IWbemProvider_H
  10. #include "ProvRegDeCoupled.h"
  11. #include "ProvWsv.h"
  12. /******************************************************************************
  13. *
  14. * Name:
  15. *
  16. *
  17. * Description:
  18. *
  19. *
  20. *****************************************************************************/
  21. class CDecoupled_ProviderSubsystemRegistrar : public _IWmiProviderSubsystemRegistrar
  22. {
  23. private:
  24. LONG m_ReferenceCount ; //Object reference count
  25. WmiAllocator &m_Allocator ;
  26. CServerObject_ProviderSubSystem *m_SubSystem ;
  27. HRESULT SaveToRegistry (
  28. long a_Flags ,
  29. IWbemContext *a_Context ,
  30. LPCWSTR a_User ,
  31. LPCWSTR a_Locale ,
  32. LPCWSTR a_Scope ,
  33. LPCWSTR a_Registration ,
  34. DWORD a_ProcessIdentifier ,
  35. GUID &a_Identity ,
  36. IUnknown *a_Unknown
  37. ) ;
  38. HRESULT ValidateClientSecurity (
  39. IWbemContext *a_Context ,
  40. LPCWSTR a_Scope ,
  41. LPCWSTR a_Registration ,
  42. IWbemServices *a_Service
  43. ) ;
  44. HRESULT CacheProvider (
  45. CServerObject_ProviderSubSystem *a_SubSystem ,
  46. IWbemContext *a_Context ,
  47. CServerObject_DecoupledClientRegistration_Element &a_Element ,
  48. IUnknown *a_Unknown
  49. ) ;
  50. HRESULT Load (
  51. CServerObject_ProviderSubSystem *a_SubSystem ,
  52. IWbemContext *a_Context ,
  53. CServerObject_DecoupledClientRegistration_Element &a_Element
  54. ) ;
  55. HRESULT MarshalRegistration (
  56. IUnknown *a_Unknown ,
  57. BYTE *&a_MarshaledProxy ,
  58. DWORD &a_MarshaledProxyLength
  59. ) ;
  60. HRESULT SaveToRegistry (
  61. IUnknown *a_Unknown ,
  62. BYTE *a_MarshaledProxy ,
  63. DWORD a_MarshaledProxyLength
  64. ) ;
  65. protected:
  66. public:
  67. CDecoupled_ProviderSubsystemRegistrar ( WmiAllocator &a_Allocator , CServerObject_ProviderSubSystem *a_SubSystem ) ;
  68. ~CDecoupled_ProviderSubsystemRegistrar () ;
  69. HRESULT Load (
  70. CServerObject_ProviderSubSystem *a_SubSystem ,
  71. IWbemContext *a_Context
  72. ) ;
  73. HRESULT Save () ;
  74. HRESULT Delete () ;
  75. public:
  76. //Non-delegating object IUnknown
  77. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  78. STDMETHODIMP_( ULONG ) AddRef () ;
  79. STDMETHODIMP_( ULONG ) Release () ;
  80. HRESULT STDMETHODCALLTYPE Register (
  81. long a_Flags ,
  82. IWbemContext *a_Context ,
  83. LPCWSTR a_User ,
  84. LPCWSTR a_Locale ,
  85. LPCWSTR a_Registration ,
  86. LPCWSTR a_Scope ,
  87. DWORD a_ProcessIdentifier ,
  88. IUnknown *a_Unknown ,
  89. GUID a_Identity
  90. ) ;
  91. HRESULT STDMETHODCALLTYPE UnRegister (
  92. long a_Flags ,
  93. IWbemContext *a_Context ,
  94. LPCWSTR a_User ,
  95. LPCWSTR a_Locale ,
  96. LPCWSTR a_Scope ,
  97. LPCWSTR a_Registration ,
  98. GUID a_Identity
  99. ) ;
  100. } ;
  101. /******************************************************************************
  102. *
  103. * Name:
  104. *
  105. *
  106. * Description:
  107. *
  108. *
  109. *****************************************************************************/
  110. class CDecoupledAggregator_IWbemProvider : public IWbemServices ,
  111. public IWbemEventProvider ,
  112. public IWbemEventProviderQuerySink ,
  113. public IWbemEventProviderSecurity ,
  114. public IWbemProviderIdentity ,
  115. public IWbemEventConsumerProviderEx ,
  116. public _IWmiProviderSubsystemRegistrar ,
  117. public _IWmiProviderInitialize ,
  118. public IWbemShutdown ,
  119. public _IWmiProviderCache ,
  120. public ServiceCacheElement ,
  121. public CWbemGlobal_IWmiObjectSinkController
  122. {
  123. private:
  124. LONG m_ReferenceCount ; //Object reference count
  125. WmiAllocator &m_Allocator ;
  126. CWbemGlobal_IWbemSyncProviderController *m_Controller ;
  127. _IWmiProviderFactory *m_Factory ;
  128. IWbemObjectSink *m_Sink ;
  129. IWbemServices *m_CoreRepositoryStub ;
  130. IWbemServices *m_CoreFullStub ;
  131. IWbemPath *m_NamespacePath ;
  132. BSTR m_User ;
  133. BSTR m_Locale ;
  134. BSTR m_Namespace ;
  135. IWbemClassObject *m_ExtendedStatusObject ;
  136. CServerObject_ProviderRegistrationV1 *m_Registration ;
  137. LONG m_Initialized ;
  138. HRESULT m_InitializeResult ;
  139. HANDLE m_InitializedEvent ;
  140. IWbemContext *m_InitializationContext ;
  141. private:
  142. HRESULT InitializeProvider (
  143. IUnknown *a_Unknown ,
  144. IWbemServices *a_Stub ,
  145. wchar_t *a_NamespacePath ,
  146. LONG a_Flags ,
  147. IWbemContext *a_Context ,
  148. LPCWSTR a_User ,
  149. LPCWSTR a_Locale ,
  150. LPCWSTR a_Scope ,
  151. CServerObject_ProviderRegistrationV1 &a_Registration
  152. ) ;
  153. HRESULT CreateSyncProvider (
  154. IUnknown *a_ServerSideProvider ,
  155. IWbemServices *a_Stub ,
  156. wchar_t *a_NamespacePath ,
  157. LONG a_Flags ,
  158. IWbemContext *a_Context ,
  159. LPCWSTR a_User ,
  160. LPCWSTR a_Locale ,
  161. LPCWSTR a_Scope ,
  162. CServerObject_ProviderRegistrationV1 &a_Registration ,
  163. GUID a_Identity ,
  164. CInterceptor_IWbemDecoupledProvider *&a_Interceptor
  165. ) ;
  166. HRESULT SetStatus (
  167. LPWSTR a_Operation ,
  168. LPWSTR a_Parameters ,
  169. LPWSTR a_Description ,
  170. HRESULT a_Result ,
  171. IWbemObjectSink *a_Sink
  172. ) ;
  173. public:
  174. CDecoupledAggregator_IWbemProvider (
  175. WmiAllocator &m_Allocator ,
  176. CWbemGlobal_IWmiProviderController *a_Controller ,
  177. _IWmiProviderFactory *a_Factory ,
  178. IWbemServices *a_CoreRepositoryStub ,
  179. IWbemServices *a_CoreFullStub ,
  180. const ProviderCacheKey &a_Key ,
  181. const ULONG &a_Period ,
  182. IWbemContext *a_InitializationContext ,
  183. CServerObject_ProviderRegistrationV1 &a_Registration
  184. ) ;
  185. ~CDecoupledAggregator_IWbemProvider () ;
  186. HRESULT SetInitialized ( HRESULT a_InitializeResult ) ;
  187. HRESULT IsIndependant ( IWbemContext *a_Context ) ;
  188. HRESULT AbnormalShutdown ( IUnknown *t_Element ) ;
  189. public:
  190. //Non-delegating object IUnknown
  191. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  192. STDMETHODIMP_( ULONG ) AddRef () ;
  193. STDMETHODIMP_( ULONG ) Release () ;
  194. /* IWbemServices methods */
  195. HRESULT STDMETHODCALLTYPE OpenNamespace (
  196. const BSTR a_Namespace ,
  197. long a_Flags ,
  198. IWbemContext *a_Context ,
  199. IWbemServices **a_Service ,
  200. IWbemCallResult **a_CallResult
  201. ) ;
  202. HRESULT STDMETHODCALLTYPE CancelAsyncCall (
  203. IWbemObjectSink *a_Sink
  204. ) ;
  205. HRESULT STDMETHODCALLTYPE QueryObjectSink (
  206. long a_Flags ,
  207. IWbemObjectSink **a_Sink
  208. ) ;
  209. HRESULT STDMETHODCALLTYPE GetObject (
  210. const BSTR a_ObjectPath ,
  211. long a_Flags ,
  212. IWbemContext *a_Context ,
  213. IWbemClassObject **ppObject ,
  214. IWbemCallResult **a_CallResult
  215. ) ;
  216. HRESULT STDMETHODCALLTYPE GetObjectAsync (
  217. const BSTR a_ObjectPath ,
  218. long a_Flags ,
  219. IWbemContext *a_Context ,
  220. IWbemObjectSink *a_Sink
  221. ) ;
  222. HRESULT STDMETHODCALLTYPE PutClass (
  223. IWbemClassObject *a_Object ,
  224. long a_Flags ,
  225. IWbemContext *a_Context ,
  226. IWbemCallResult **a_CallResult
  227. ) ;
  228. HRESULT STDMETHODCALLTYPE PutClassAsync (
  229. IWbemClassObject *a_Object ,
  230. long a_Flags ,
  231. IWbemContext *a_Context ,
  232. IWbemObjectSink *a_Sink
  233. ) ;
  234. HRESULT STDMETHODCALLTYPE DeleteClass (
  235. const BSTR a_Class ,
  236. long a_Flags ,
  237. IWbemContext *a_Context ,
  238. IWbemCallResult **a_CallResult
  239. ) ;
  240. HRESULT STDMETHODCALLTYPE DeleteClassAsync (
  241. const BSTR a_Class ,
  242. long a_Flags ,
  243. IWbemContext *a_Context ,
  244. IWbemObjectSink *a_Sink
  245. ) ;
  246. HRESULT STDMETHODCALLTYPE CreateClassEnum (
  247. const BSTR a_Superclass ,
  248. long a_Flags ,
  249. IWbemContext *a_Context ,
  250. IEnumWbemClassObject **a_Enum
  251. ) ;
  252. HRESULT STDMETHODCALLTYPE CreateClassEnumAsync (
  253. const BSTR a_Superclass ,
  254. long a_Flags ,
  255. IWbemContext *a_Context ,
  256. IWbemObjectSink *a_Sink
  257. ) ;
  258. HRESULT STDMETHODCALLTYPE PutInstance (
  259. IWbemClassObject *a_Instance ,
  260. long a_Flags ,
  261. IWbemContext *a_Context ,
  262. IWbemCallResult **a_CallResult
  263. ) ;
  264. HRESULT STDMETHODCALLTYPE PutInstanceAsync (
  265. IWbemClassObject *a_Instance ,
  266. long a_Flags ,
  267. IWbemContext *a_Context ,
  268. IWbemObjectSink *a_Sink
  269. ) ;
  270. HRESULT STDMETHODCALLTYPE DeleteInstance (
  271. const BSTR a_ObjectPath ,
  272. long a_Flags ,
  273. IWbemContext *a_Context ,
  274. IWbemCallResult **a_CallResult
  275. ) ;
  276. HRESULT STDMETHODCALLTYPE DeleteInstanceAsync (
  277. const BSTR a_ObjectPath,
  278. long a_Flags,
  279. IWbemContext *a_Context ,
  280. IWbemObjectSink *a_Sink
  281. ) ;
  282. HRESULT STDMETHODCALLTYPE CreateInstanceEnum (
  283. const BSTR a_Class ,
  284. long a_Flags ,
  285. IWbemContext *a_Context ,
  286. IEnumWbemClassObject **a_Enum
  287. ) ;
  288. HRESULT STDMETHODCALLTYPE CreateInstanceEnumAsync (
  289. const BSTR a_Class ,
  290. long a_Flags ,
  291. IWbemContext *a_Context ,
  292. IWbemObjectSink *a_Sink
  293. ) ;
  294. HRESULT STDMETHODCALLTYPE ExecQuery (
  295. const BSTR a_QueryLanguage,
  296. const BSTR a_Query,
  297. long a_Flags ,
  298. IWbemContext *a_Context ,
  299. IEnumWbemClassObject **a_Enum
  300. ) ;
  301. HRESULT STDMETHODCALLTYPE ExecQueryAsync (
  302. const BSTR a_QueryLanguage ,
  303. const BSTR a_Query ,
  304. long a_Flags ,
  305. IWbemContext *a_Context ,
  306. IWbemObjectSink *a_Sink
  307. ) ;
  308. HRESULT STDMETHODCALLTYPE ExecNotificationQuery (
  309. const BSTR a_QueryLanguage ,
  310. const BSTR a_Query ,
  311. long a_Flags ,
  312. IWbemContext *a_Context ,
  313. IEnumWbemClassObject **a_Enum
  314. ) ;
  315. HRESULT STDMETHODCALLTYPE ExecNotificationQueryAsync (
  316. const BSTR a_QueryLanguage ,
  317. const BSTR a_Query ,
  318. long a_Flags ,
  319. IWbemContext *a_Context ,
  320. IWbemObjectSink *a_Sink
  321. ) ;
  322. HRESULT STDMETHODCALLTYPE ExecMethod (
  323. const BSTR a_ObjectPath ,
  324. const BSTR a_MethodName ,
  325. long a_Flags ,
  326. IWbemContext *a_Context ,
  327. IWbemClassObject *a_InParams ,
  328. IWbemClassObject **a_OutParams ,
  329. IWbemCallResult **a_CallResult
  330. ) ;
  331. HRESULT STDMETHODCALLTYPE ExecMethodAsync (
  332. const BSTR a_ObjectPath ,
  333. const BSTR a_MethodName ,
  334. long a_Flags ,
  335. IWbemContext *a_Context ,
  336. IWbemClassObject *a_InParams ,
  337. IWbemObjectSink *a_Sink
  338. ) ;
  339. /* IWbemEventProvider */
  340. HRESULT STDMETHODCALLTYPE ProvideEvents (
  341. IWbemObjectSink *a_Sink ,
  342. long a_Flags
  343. ) ;
  344. /* IWbemEventProviderQuerySink */
  345. HRESULT STDMETHODCALLTYPE NewQuery (
  346. unsigned long a_Id ,
  347. WBEM_WSTR a_QueryLanguage ,
  348. WBEM_WSTR a_Query
  349. );
  350. HRESULT STDMETHODCALLTYPE CancelQuery (
  351. unsigned long a_Id
  352. ) ;
  353. /* IWbemEventProviderSecurity */
  354. HRESULT STDMETHODCALLTYPE AccessCheck (
  355. WBEM_CWSTR a_QueryLanguage ,
  356. WBEM_CWSTR a_Query ,
  357. long a_SidLength ,
  358. const BYTE *a_Sid
  359. ) ;
  360. /* IWbemProviderIdentity */
  361. HRESULT STDMETHODCALLTYPE SetRegistrationObject (
  362. long a_Flags ,
  363. IWbemClassObject *a_ProviderRegistration
  364. ) ;
  365. /* IWbemEventConsumerProvider */
  366. HRESULT STDMETHODCALLTYPE FindConsumer (
  367. IWbemClassObject *a_LogicalConsumer ,
  368. IWbemUnboundObjectSink **a_Consumer
  369. );
  370. /* IWbemEventConsumerProviderEx */
  371. HRESULT STDMETHODCALLTYPE ValidateSubscription (
  372. IWbemClassObject *a_LogicalConsumer
  373. ) ;
  374. HRESULT STDMETHODCALLTYPE Register (
  375. long a_Flags ,
  376. IWbemContext *a_Context ,
  377. LPCWSTR a_Scope ,
  378. LPCWSTR a_User ,
  379. LPCWSTR a_Locale ,
  380. LPCWSTR a_Registration ,
  381. DWORD a_ProcessIdentifier ,
  382. IUnknown *a_Unknown ,
  383. GUID a_Identity
  384. ) ;
  385. HRESULT STDMETHODCALLTYPE UnRegister (
  386. long a_Flags ,
  387. IWbemContext *a_Context ,
  388. LPCWSTR a_User ,
  389. LPCWSTR a_Locale ,
  390. LPCWSTR a_Scope ,
  391. LPCWSTR a_Registration ,
  392. GUID a_Identity
  393. ) ;
  394. HRESULT STDMETHODCALLTYPE Initialize (
  395. long a_Flags ,
  396. IWbemContext *a_Context ,
  397. GUID *a_TransactionIdentifier,
  398. LPCWSTR a_User,
  399. LPCWSTR a_Locale,
  400. LPCWSTR a_Namespace ,
  401. IWbemServices *a_Repository ,
  402. IWbemServices *a_Service ,
  403. IWbemProviderInitSink *a_Sink
  404. ) ;
  405. HRESULT STDMETHODCALLTYPE WaitProvider ( IWbemContext *a_Context , ULONG a_Timeout ) ;
  406. HRESULT STDMETHODCALLTYPE GetInitializeResult ()
  407. {
  408. return m_InitializeResult ;
  409. }
  410. HRESULT STDMETHODCALLTYPE GetHosting ( ULONG *a_Value )
  411. {
  412. if ( a_Value )
  413. {
  414. *a_Value = e_Hosting_WmiCore ;
  415. return S_OK ;
  416. }
  417. else
  418. {
  419. return WBEM_E_INVALID_PARAMETER ;
  420. }
  421. }
  422. HRESULT STDMETHODCALLTYPE GetHostingGroup ( BSTR *a_Value )
  423. {
  424. if ( a_Value )
  425. {
  426. *a_Value = NULL ;
  427. return S_OK ;
  428. }
  429. else
  430. {
  431. return WBEM_E_INVALID_PARAMETER ;
  432. }
  433. }
  434. HRESULT STDMETHODCALLTYPE IsInternal ( BOOL *a_Value )
  435. {
  436. if ( a_Value )
  437. {
  438. *a_Value = TRUE ;
  439. return S_OK ;
  440. }
  441. else
  442. {
  443. return WBEM_E_INVALID_PARAMETER ;
  444. }
  445. }
  446. HRESULT STDMETHODCALLTYPE IsPerUserInitialization ( BOOL *a_Value )
  447. {
  448. if ( a_Value )
  449. {
  450. *a_Value = FALSE ;
  451. return S_OK ;
  452. }
  453. else
  454. {
  455. return WBEM_E_INVALID_PARAMETER ;
  456. }
  457. }
  458. HRESULT STDMETHODCALLTYPE IsPerLocaleInitialization ( BOOL *a_Value )
  459. {
  460. if ( a_Value )
  461. {
  462. *a_Value = FALSE ;
  463. return S_OK ;
  464. }
  465. else
  466. {
  467. return WBEM_E_INVALID_PARAMETER ;
  468. }
  469. }
  470. /* _IWmiProviderCache */
  471. HRESULT STDMETHODCALLTYPE Expel (
  472. long a_Flags ,
  473. IWbemContext *a_Context
  474. ) ;
  475. HRESULT STDMETHODCALLTYPE Unload (
  476. long a_Flags ,
  477. IWbemContext *a_Context
  478. ) ;
  479. HRESULT STDMETHODCALLTYPE Load (
  480. long a_Flags ,
  481. IWbemContext *a_Context
  482. ) ;
  483. HRESULT STDMETHODCALLTYPE ForceReload () ;
  484. HRESULT STDMETHODCALLTYPE Shutdown (
  485. LONG a_Flags ,
  486. ULONG a_MaxMilliSeconds ,
  487. IWbemContext *a_Context
  488. ) ;
  489. } ;
  490. #endif // _Server_DecoupledAggregator_IWbemProvider_H