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.

533 lines
11 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. ProvFact.h
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _Server_ProviderFactory_H
  9. #define _Server_ProviderFactory_H
  10. #include "ProvRegInfo.h"
  11. #include "ProvCache.h"
  12. #include "ProvAggr.h"
  13. #include "Guids.h"
  14. /******************************************************************************
  15. *
  16. * Name:
  17. *
  18. *
  19. * Description:
  20. *
  21. *
  22. *****************************************************************************/
  23. #define ProxyIndex__IWmiProviderFactory 0
  24. #define ProxyIndex_Factory_Size 1
  25. /******************************************************************************
  26. *
  27. * Name:
  28. *
  29. *
  30. * Description:
  31. *
  32. *
  33. *****************************************************************************/
  34. class CServerObject_StrobeInterface : public IUnknown
  35. {
  36. private:
  37. protected:
  38. public:
  39. virtual WmiStatusCode Strobe ( ULONG &a_NextStrobeDelta ) = 0 ;
  40. virtual WmiStatusCode StrobeBegin ( const ULONG &a_Period ) = 0 ;
  41. } ;
  42. /******************************************************************************
  43. *
  44. * Name:
  45. *
  46. *
  47. * Description:
  48. *
  49. *
  50. *****************************************************************************/
  51. class CServerObject_BindingFactory : public _IWmiProviderFactory ,
  52. public _IWmiProviderFactoryInitialize ,
  53. public IWbemShutdown ,
  54. public _IWmiProviderConfiguration ,
  55. public BindingFactoryCacheElement ,
  56. public CWbemGlobal_IWmiProviderController
  57. {
  58. private:
  59. WmiAllocator &m_Allocator ;
  60. LONG m_Flags ;
  61. _IWmiProvSS *m_SubSystem ;
  62. IWbemContext *m_Context ;
  63. LPWSTR m_Namespace ;
  64. IWbemPath *m_NamespacePath ;
  65. IWbemServices *m_Repository ;
  66. class InternalInterface : public CServerObject_StrobeInterface
  67. {
  68. private:
  69. CServerObject_BindingFactory *m_This ;
  70. public:
  71. InternalInterface ( CServerObject_BindingFactory *a_This ) : m_This ( a_This )
  72. {
  73. }
  74. STDMETHODIMP QueryInterface (
  75. REFIID iid ,
  76. LPVOID FAR *iplpv
  77. )
  78. {
  79. *iplpv = NULL ;
  80. if ( iid == IID_IUnknown )
  81. {
  82. *iplpv = ( LPVOID ) this ;
  83. }
  84. else if ( iid == IID_CWbemGlobal_IWmiProviderController )
  85. {
  86. *iplpv = ( LPVOID ) ( CServerObject_StrobeInterface * ) this ;
  87. }
  88. if ( *iplpv )
  89. {
  90. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  91. return ResultFromScode ( S_OK ) ;
  92. }
  93. else
  94. {
  95. return ResultFromScode ( E_NOINTERFACE ) ;
  96. }
  97. }
  98. STDMETHODIMP_( ULONG ) AddRef ()
  99. {
  100. return m_This->InternalAddRef () ;
  101. }
  102. STDMETHODIMP_( ULONG ) Release ()
  103. {
  104. return m_This->InternalRelease () ;
  105. }
  106. WmiStatusCode Strobe ( ULONG &a_NextStrobeDelta )
  107. {
  108. return m_This->Strobe ( a_NextStrobeDelta ) ;
  109. }
  110. WmiStatusCode StrobeBegin ( const ULONG &a_Period )
  111. {
  112. return m_This->StrobeBegin ( a_Period ) ;
  113. }
  114. } ;
  115. InternalInterface m_Internal ;
  116. WmiQueue <IUnknown *,8> m_SvcWrappersContainer;
  117. protected:
  118. public: /* Internal */
  119. CServerObject_BindingFactory (
  120. WmiAllocator &a_Allocator ,
  121. WmiCacheController<BindingFactoryCacheKey> *a_Controller ,
  122. const BindingFactoryCacheKey &a_Key ,
  123. const ULONG &a_Period
  124. ) ;
  125. CServerObject_BindingFactory (
  126. WmiAllocator &a_Allocator
  127. ) ;
  128. ~CServerObject_BindingFactory () ;
  129. IWbemContext *Direct_GetContext () { return m_Context ; }
  130. IWbemPath *Direct_GetNamespacePath () { return m_NamespacePath ; }
  131. LPCWSTR Direct_GetNamespace () { return m_Namespace ; }
  132. IWbemServices *Direct_GetRepository () { return m_Repository ; }
  133. _IWmiProvSS *Direct_GetSubSystem () { return m_SubSystem ; }
  134. HRESULT CacheProvider (
  135. _IWmiProviderSubsystemRegistrar *a_Registrar ,
  136. IWbemContext *a_Context ,
  137. CServerObject_DecoupledClientRegistration_Element &a_Element ,
  138. IUnknown *a_Unknown
  139. ) ;
  140. HRESULT Load (
  141. _IWmiProviderSubsystemRegistrar *a_Registrar ,
  142. IWbemContext *a_Context ,
  143. CServerObject_DecoupledClientRegistration_Element &a_Element
  144. ) ;
  145. HRESULT Load (
  146. CDecoupledAggregator_IWbemProvider *a_Aggregator ,
  147. IWbemContext *a_Context ,
  148. BSTR a_Provider ,
  149. BSTR a_User ,
  150. BSTR a_Locale ,
  151. BSTR a_Scope
  152. ) ;
  153. HRESULT GetHosting (
  154. CServerObject_ProviderRegistrationV1 &a_Registration ,
  155. IWbemContext *a_Context ,
  156. Enum_Hosting &a_Hosting ,
  157. LPCWSTR &a_HostingGroup
  158. ) ;
  159. HRESULT Create (
  160. CServerObject_ProviderRegistrationV1 &a_Registration ,
  161. Enum_Hosting a_Hosting ,
  162. LPCWSTR a_HostingGroup ,
  163. LPCWSTR a_User ,
  164. _IWmiProviderHost **a_Host ,
  165. _IWmiProviderFactory **a_Factory ,
  166. IWbemContext *a_Context
  167. ) ;
  168. HRESULT InitializeHostedService (
  169. CInterceptor_IWbemProvider *a_Interceptor ,
  170. IUnknown *a_Unknown
  171. ) ;
  172. HRESULT InternalGetProvider (
  173. IWbemServices *a_RepositoryService ,
  174. IWbemServices *a_FullService ,
  175. _IWmiProviderHost *a_Host ,
  176. _IWmiProviderFactory *a_Factory ,
  177. CInterceptor_IWbemProvider *a_Interceptor ,
  178. CServerObject_ProviderRegistrationV1 &a_Registration ,
  179. ProviderCacheKey &a_Key ,
  180. LONG a_Flags ,
  181. IWbemContext *a_Context ,
  182. GUID *a_TransactionIdentifier,
  183. LPCWSTR a_User ,
  184. LPCWSTR a_Locale ,
  185. LPCWSTR a_Scope ,
  186. LPCWSTR a_Name ,
  187. void **a_Unknown ,
  188. REFIID a_RIID ,
  189. void **a_Interface
  190. ) ;
  191. HRESULT InternalGetProviderViaProxyRoute (
  192. IWbemServices *a_RepositoryService ,
  193. IWbemServices *a_FullService ,
  194. CInterceptor_IWbemProvider *a_Interceptor ,
  195. CServerObject_ProviderRegistrationV1 &a_Registration ,
  196. Enum_Hosting a_Hosting ,
  197. LPCWSTR a_HostingGroup ,
  198. ProviderCacheKey &a_Key ,
  199. LONG a_Flags ,
  200. IWbemContext *a_Context ,
  201. GUID *a_TransactionIdentifier,
  202. LPCWSTR a_User ,
  203. LPCWSTR a_Locale ,
  204. LPCWSTR a_Scope ,
  205. LPCWSTR a_Name ,
  206. REFIID a_RIID ,
  207. void **a_Interface
  208. ) ;
  209. HRESULT InternalFindProvider (
  210. IWbemServices *a_RepositoryService ,
  211. IWbemServices *a_FullService ,
  212. CServerObject_ProviderRegistrationV1 &a_Registration ,
  213. Enum_Hosting a_Hosting ,
  214. LPCWSTR a_HostingGroup ,
  215. ProviderCacheKey &a_Key ,
  216. LONG a_Flags ,
  217. IWbemContext *a_Context ,
  218. GUID *a_TransactionIdentifier,
  219. LPCWSTR a_User ,
  220. LPCWSTR a_Locale ,
  221. LPCWSTR a_Scope ,
  222. LPCWSTR a_Name ,
  223. REFIID a_RIID ,
  224. void **a_Interface
  225. ) ;
  226. HRESULT GetAggregatedClassProviderViaProxyRoute (
  227. ProviderCacheKey &a_Key ,
  228. LONG a_Flags ,
  229. IWbemContext *a_Context ,
  230. LPCWSTR a_User ,
  231. LPCWSTR a_Locale ,
  232. LPCWSTR a_Scope,
  233. IWbemClassObject *a_Class ,
  234. REFIID a_RIID ,
  235. void **a_Interface
  236. ) ;
  237. HRESULT WaitProvider (
  238. IWbemContext *a_Context ,
  239. REFIID a_RIID ,
  240. void **a_Interface ,
  241. ServiceCacheElement *a_Element ,
  242. _IWmiProviderInitialize *a_Initializer
  243. ) ;
  244. HRESULT SearchSpecificProvider (
  245. IWbemContext *a_Context ,
  246. ProviderCacheKey &a_Key ,
  247. REFIID a_RIID ,
  248. void **a_Interface ,
  249. LPCWSTR a_User ,
  250. LPCWSTR a_Locale
  251. ) ;
  252. HRESULT FindProvider (
  253. IWbemContext *a_Context ,
  254. ProviderCacheKey &a_Key ,
  255. BOOL a_SpecificProvider ,
  256. REFIID a_RIID ,
  257. void **a_Interface ,
  258. LPCWSTR a_User ,
  259. LPCWSTR a_Locale
  260. ) ;
  261. HRESULT GetAggregatedClassProvider (
  262. IWbemServices *a_RepositoryService ,
  263. IWbemServices *a_FullService ,
  264. ProviderCacheKey &a_Key ,
  265. LONG a_Flags ,
  266. IWbemContext *a_Context ,
  267. LPCWSTR a_User ,
  268. LPCWSTR a_Locale ,
  269. LPCWSTR a_Scope,
  270. IWbemClassObject *a_Class ,
  271. REFIID a_RIID ,
  272. void **a_Interface
  273. ) ;
  274. HRESULT InternalFindAggregatedDecoupledProvider (
  275. IWbemServices *a_RepositoryService ,
  276. IWbemServices *a_FullService ,
  277. CServerObject_ProviderRegistrationV1 &a_Registration ,
  278. ProviderCacheKey &a_Key ,
  279. LONG a_Flags ,
  280. IWbemContext *a_Context ,
  281. LPCWSTR a_User ,
  282. LPCWSTR a_Locale ,
  283. LPCWSTR a_Scope ,
  284. LPCWSTR a_Name ,
  285. REFIID a_RIID ,
  286. void **a_Interface
  287. ) ;
  288. public: /* External */
  289. //IUnknown members
  290. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  291. STDMETHODIMP_( ULONG ) AddRef () ;
  292. STDMETHODIMP_( ULONG ) Release () ;
  293. // CServerObject_BindingFactory members
  294. HRESULT STDMETHODCALLTYPE GetClassProvider (
  295. LONG a_Flags ,
  296. IWbemContext *a_Context ,
  297. LPCWSTR a_User ,
  298. LPCWSTR a_Locale ,
  299. LPCWSTR a_Scope,
  300. IWbemClassObject *a_Class ,
  301. REFIID a_RIID ,
  302. void **a_Interface
  303. );
  304. HRESULT STDMETHODCALLTYPE GetDynamicPropertyResolver (
  305. LONG a_Flags ,
  306. IWbemContext *a_Context ,
  307. LPCWSTR a_User ,
  308. LPCWSTR a_Locale ,
  309. REFIID a_RIID ,
  310. void **a_Interface
  311. ) ;
  312. HRESULT STDMETHODCALLTYPE GetHostedProvider (
  313. LONG a_Flags ,
  314. IWbemContext *a_Context ,
  315. GUID *a_TransactionIdentifier,
  316. LPCWSTR a_User ,
  317. LPCWSTR a_Locale ,
  318. LPCWSTR a_Scope,
  319. LPCWSTR a_Name ,
  320. ULONG a_Host ,
  321. LPCWSTR a_HostGroup ,
  322. REFIID a_RIID ,
  323. void **a_Interface
  324. ) ;
  325. HRESULT STDMETHODCALLTYPE GetProvider (
  326. WmiInternalContext a_InternalContext ,
  327. LONG a_Flags ,
  328. IWbemContext *a_Context ,
  329. GUID *a_TransactionIdentifier,
  330. LPCWSTR a_User ,
  331. LPCWSTR a_Locale ,
  332. LPCWSTR a_Scope,
  333. LPCWSTR a_Name ,
  334. REFIID a_RIID ,
  335. void **a_Interface
  336. ) ;
  337. HRESULT STDMETHODCALLTYPE GetDecoupledProvider (
  338. LONG a_Flags ,
  339. IWbemContext *a_Context ,
  340. LPCWSTR a_User ,
  341. LPCWSTR a_Locale ,
  342. LPCWSTR a_Scope,
  343. LPCWSTR a_Name ,
  344. REFIID a_RIID ,
  345. void **a_Interface
  346. ) ;
  347. /* _IWmiProviderConfiguration methods */
  348. HRESULT STDMETHODCALLTYPE Get (
  349. IWbemServices *a_Service ,
  350. long a_Flags ,
  351. IWbemContext *a_Context ,
  352. LPCWSTR a_Class ,
  353. LPCWSTR a_Path ,
  354. IWbemObjectSink *a_Sink
  355. ) ;
  356. HRESULT STDMETHODCALLTYPE Set (
  357. IWbemServices *a_Service ,
  358. long a_Flags ,
  359. IWbemContext *a_Context ,
  360. LPCWSTR a_Provider ,
  361. LPCWSTR a_Class ,
  362. LPCWSTR a_Path ,
  363. IWbemClassObject *a_OldObject ,
  364. IWbemClassObject *a_NewObject
  365. ) ;
  366. HRESULT STDMETHODCALLTYPE Deleted (
  367. IWbemServices *a_Service ,
  368. long a_Flags ,
  369. IWbemContext *a_Context ,
  370. LPCWSTR a_Provider ,
  371. LPCWSTR a_Class ,
  372. LPCWSTR a_Path ,
  373. IWbemClassObject *a_Object
  374. ) ;
  375. HRESULT STDMETHODCALLTYPE Enumerate (
  376. IWbemServices *a_Service ,
  377. long a_Flags ,
  378. IWbemContext *a_Context ,
  379. LPCWSTR a_Class ,
  380. IWbemObjectSink *a_Sink
  381. ) ;
  382. HRESULT STDMETHODCALLTYPE Shutdown (
  383. IWbemServices *a_Service ,
  384. long a_Flags ,
  385. IWbemContext *a_Context ,
  386. LPCWSTR a_Provider ,
  387. ULONG a_MilliSeconds
  388. ) ;
  389. HRESULT STDMETHODCALLTYPE Call (
  390. IWbemServices *a_Service ,
  391. long a_Flags ,
  392. IWbemContext *a_Context ,
  393. LPCWSTR a_Class ,
  394. LPCWSTR a_Path ,
  395. LPCWSTR a_Method,
  396. IWbemClassObject *a_InParams,
  397. IWbemObjectSink *a_Sink
  398. ) ;
  399. HRESULT STDMETHODCALLTYPE Query (
  400. IWbemServices *a_Service ,
  401. long a_Flags ,
  402. IWbemContext *a_Context ,
  403. WBEM_PROVIDER_CONFIGURATION_CLASS_ID a_ClassIdentifier ,
  404. WBEM_PROVIDER_CONFIGURATION_PROPERTY_ID a_PropertyIdentifier ,
  405. VARIANT *a_Value
  406. ) ;
  407. HRESULT STDMETHODCALLTYPE Initialize (
  408. _IWmiProvSS *a_SubSys ,
  409. _IWmiProviderFactory *a_Factory ,
  410. LONG a_Flags ,
  411. IWbemContext *a_Context ,
  412. LPCWSTR a_Namespace ,
  413. IWbemServices *a_Repository ,
  414. IWbemServices *a_Service
  415. ) ;
  416. HRESULT STDMETHODCALLTYPE Shutdown (
  417. LONG a_Flags ,
  418. ULONG a_MaxMilliSeconds ,
  419. IWbemContext *a_Context
  420. ) ;
  421. WmiStatusCode Strobe ( ULONG &a_NextStrobeDelta ) ;
  422. WmiStatusCode StrobeBegin ( const ULONG &a_Period ) ;
  423. };
  424. #endif // _Server_ProviderFactory_H