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.

587 lines
11 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. ProvSubS.h
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _Server_ProviderSubSystem_H
  9. #define _Server_ProviderSubSystem_H
  10. /******************************************************************************
  11. *
  12. * Name:
  13. *
  14. *
  15. * Description:
  16. *
  17. *
  18. *****************************************************************************/
  19. #include "ProvCache.h"
  20. class CInterceptor_IWmiProvSSSink : public _IWmiProvSSSink ,
  21. public VoidPointerContainerElement
  22. {
  23. private:
  24. _IWmiProvSSSink *m_InterceptedSink ;
  25. protected:
  26. public:
  27. CInterceptor_IWmiProvSSSink (
  28. _IWmiProvSSSink *a_InterceptedSink ,
  29. CWbemGlobal_VoidPointerController *a_Controller
  30. ) ;
  31. ~CInterceptor_IWmiProvSSSink () ;
  32. public:
  33. //Non-delegating object IUnknown
  34. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  35. STDMETHODIMP_( ULONG ) AddRef () ;
  36. STDMETHODIMP_( ULONG ) Release () ;
  37. HRESULT STDMETHODCALLTYPE Synchronize (
  38. long a_Flags ,
  39. IWbemContext *a_Context ,
  40. LPCWSTR a_Namespace ,
  41. LPCWSTR a_Provider
  42. ) ;
  43. } ;
  44. /******************************************************************************
  45. *
  46. * Name:
  47. *
  48. *
  49. * Description:
  50. *
  51. *
  52. *****************************************************************************/
  53. class CServerObject_BindingFactory ;
  54. class CServerObject_ProviderSubSystem : public _IWmiProvSS ,
  55. public _IWmiCoreWriteHook ,
  56. public _IWmiProviderConfiguration ,
  57. public IWbemShutdown ,
  58. public ProvSubSysContainerElement ,
  59. public CWbemGlobal_IWmiFactoryController
  60. {
  61. public:
  62. class InternalInterface : public _IWmiCoreWriteHook
  63. {
  64. private:
  65. CServerObject_ProviderSubSystem *m_This ;
  66. public:
  67. InternalInterface ( CServerObject_ProviderSubSystem *a_This ) : m_This ( a_This )
  68. {
  69. }
  70. STDMETHODIMP QueryInterface (
  71. REFIID iid ,
  72. LPVOID FAR *iplpv
  73. )
  74. {
  75. *iplpv = NULL ;
  76. if ( iid == IID_IUnknown )
  77. {
  78. *iplpv = ( LPVOID ) this ;
  79. }
  80. else if ( iid == IID__IWmiCoreWriteHook )
  81. {
  82. *iplpv = ( LPVOID ) ( _IWmiCoreWriteHook * ) this ;
  83. }
  84. if ( *iplpv )
  85. {
  86. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  87. return ResultFromScode ( S_OK ) ;
  88. }
  89. else
  90. {
  91. return ResultFromScode ( E_NOINTERFACE ) ;
  92. }
  93. }
  94. STDMETHODIMP_( ULONG ) AddRef ()
  95. {
  96. return m_This->ProvSubSysContainerElement :: NonCyclicAddRef () ;
  97. }
  98. STDMETHODIMP_( ULONG ) Release ()
  99. {
  100. return m_This->ProvSubSysContainerElement :: NonCyclicRelease () ;
  101. }
  102. HRESULT STDMETHODCALLTYPE PrePut (
  103. long a_Flags ,
  104. long a_UserFlags ,
  105. IWbemContext *a_Context ,
  106. IWbemPath *a_Path ,
  107. LPCWSTR a_Namespace ,
  108. LPCWSTR a_Class ,
  109. _IWmiObject *a_Copy
  110. )
  111. {
  112. return m_This->PrePut (
  113. a_Flags ,
  114. a_UserFlags ,
  115. a_Context ,
  116. a_Path ,
  117. a_Namespace ,
  118. a_Class ,
  119. a_Copy
  120. ) ;
  121. }
  122. HRESULT STDMETHODCALLTYPE PostPut (
  123. long a_Flags ,
  124. HRESULT hRes,
  125. IWbemContext *a_Context ,
  126. IWbemPath *a_Path ,
  127. LPCWSTR a_Namespace ,
  128. LPCWSTR a_Class ,
  129. _IWmiObject *a_New ,
  130. _IWmiObject *a_Old
  131. )
  132. {
  133. return m_This->PostPut (
  134. a_Flags ,
  135. hRes,
  136. a_Context ,
  137. a_Path ,
  138. a_Namespace ,
  139. a_Class ,
  140. a_New ,
  141. a_Old
  142. ) ;
  143. }
  144. HRESULT STDMETHODCALLTYPE PreDelete (
  145. long a_Flags ,
  146. long a_UserFlags ,
  147. IWbemContext *a_Context ,
  148. IWbemPath *a_Path,
  149. LPCWSTR a_Namespace,
  150. LPCWSTR a_Class
  151. )
  152. {
  153. return m_This->PreDelete (
  154. a_Flags ,
  155. a_UserFlags ,
  156. a_Context ,
  157. a_Path,
  158. a_Namespace,
  159. a_Class
  160. ) ;
  161. }
  162. HRESULT STDMETHODCALLTYPE PostDelete (
  163. long a_Flags ,
  164. HRESULT hRes,
  165. IWbemContext *a_Context ,
  166. IWbemPath *a_Path,
  167. LPCWSTR a_Namespace,
  168. LPCWSTR a_Class,
  169. _IWmiObject *a_Old
  170. )
  171. {
  172. return m_This->PostDelete (
  173. a_Flags ,
  174. hRes,
  175. a_Context ,
  176. a_Path,
  177. a_Namespace,
  178. a_Class,
  179. a_Old
  180. ) ;
  181. }
  182. } ;
  183. InternalInterface m_Internal ;
  184. void CallBackInternalRelease () ;
  185. private:
  186. _IWmiCoreServices *m_Core ;
  187. WmiAllocator &m_Allocator ;
  188. CWbemGlobal_VoidPointerController *m_SinkController ;
  189. wchar_t *Strip_Slash ( wchar_t *a_String ) ;
  190. wchar_t *Strip_Server ( wchar_t *a_String , wchar_t *&a_FreeString ) ;
  191. HRESULT IsChild_Namespace ( wchar_t *a_Left , wchar_t *a_Right ) ;
  192. HRESULT GetNamespaceServerPath (
  193. IWbemPath *a_Namespace ,
  194. wchar_t *&a_ServerNamespacePath
  195. ) ;
  196. HRESULT Cache (
  197. LPCWSTR a_Namespace ,
  198. IWbemPath *a_NamespacePath ,
  199. CServerObject_BindingFactory *a_Factory ,
  200. BindingFactoryCacheKey &a_Key ,
  201. REFIID a_RIID ,
  202. void **a_Interface
  203. ) ;
  204. HRESULT CreateAndCache (
  205. IWbemServices *a_Core ,
  206. LONG a_Flags ,
  207. IWbemContext *a_Context ,
  208. LPCWSTR a_Namespace ,
  209. IWbemPath *a_NamespacePath ,
  210. BindingFactoryCacheKey &a_Key ,
  211. REFIID a_RIID ,
  212. void **a_Interface
  213. ) ;
  214. HRESULT GetProvider (
  215. LPCWSTR a_Class ,
  216. IWbemPath *a_Path ,
  217. IWbemClassObject *a_Object ,
  218. LPWSTR &a_Provider
  219. ) ;
  220. HRESULT Call_Load (
  221. long a_Flags ,
  222. IWbemContext *a_Context ,
  223. LPCWSTR a_Class ,
  224. LPCWSTR a_Path ,
  225. LPCWSTR a_Method,
  226. IWbemClassObject *a_InParams,
  227. IWbemObjectSink *a_Sink
  228. ) ;
  229. HRESULT GetDeleteInfo (
  230. IWbemClassObject *a_OldObject ,
  231. LPCWSTR a_Class ,
  232. IWbemPath *a_Path ,
  233. LPWSTR &a_OutClass ,
  234. LPWSTR &a_OutStringPath ,
  235. IWbemPath *&a_OutPathObject
  236. ) ;
  237. HRESULT PostDelete_ProviderRegistration (
  238. long a_Flags ,
  239. HRESULT hRes,
  240. IWbemContext *a_Context ,
  241. IWbemPath *a_Path,
  242. LPCWSTR a_PathString ,
  243. LPCWSTR a_Namespace,
  244. LPCWSTR a_Class,
  245. IWbemClassObject *a_Old
  246. ) ;
  247. HRESULT PostDelete_Namespace (
  248. long a_Flags ,
  249. HRESULT hRes,
  250. IWbemContext *a_Context ,
  251. IWbemPath *a_Path,
  252. LPCWSTR a_PathString ,
  253. LPCWSTR a_Namespace,
  254. LPCWSTR a_Class,
  255. IWbemClassObject *a_Old
  256. ) ;
  257. QueryPreprocessor :: QuadState IsA (
  258. IWbemClassObject *a_Left ,
  259. wchar_t *a_Right
  260. ) ;
  261. HRESULT VerifySecurity (
  262. IWbemContext *a_Context ,
  263. const BSTR a_Provider ,
  264. const BSTR a_NamespacePath
  265. ) ;
  266. HRESULT GetPath (
  267. IWbemClassObject *a_Object ,
  268. IWbemPath *&a_Path ,
  269. LPWSTR &a_PathText
  270. ) ;
  271. static HRESULT ReportEvent (
  272. CServerObject_ProviderRegistrationV1 &a_Registration ,
  273. const BSTR a_NamespacePath
  274. ) ;
  275. HRESULT ClearSinkController () ;
  276. protected:
  277. public:
  278. CServerObject_ProviderSubSystem ( WmiAllocator &a_Allocator , CWbemGlobal_IWmiProvSubSysController *a_Controller ) ;
  279. ~CServerObject_ProviderSubSystem ( void ) ;
  280. HRESULT GetWmiRepositoryService (
  281. IWbemPath *a_Namespace ,
  282. const BSTR a_User ,
  283. const BSTR a_Locale ,
  284. IWbemServices *&a_Service
  285. ) ;
  286. HRESULT GetWmiRepositoryService (
  287. const BSTR a_Namespace ,
  288. const BSTR a_User ,
  289. const BSTR a_Locale ,
  290. IWbemServices *&a_Service
  291. ) ;
  292. HRESULT GetWmiService (
  293. IWbemPath *a_Namespace ,
  294. const BSTR a_User ,
  295. const BSTR a_Locale ,
  296. IWbemServices *&a_Service
  297. ) ;
  298. HRESULT GetWmiService (
  299. const BSTR a_Namespace ,
  300. const BSTR a_User ,
  301. const BSTR a_Locale ,
  302. IWbemServices *&a_Service
  303. ) ;
  304. HRESULT ForwardReload (
  305. long a_Flags ,
  306. IWbemContext *a_Context ,
  307. LPCWSTR a_Namespace ,
  308. LPCWSTR a_Provider
  309. ) ;
  310. //IUnknown members
  311. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  312. STDMETHODIMP_( ULONG ) AddRef () ;
  313. STDMETHODIMP_( ULONG ) Release () ;
  314. // IWmi_ProviderSubSystem members
  315. HRESULT STDMETHODCALLTYPE Create (
  316. IWbemServices *a_Core ,
  317. LONG a_Flags ,
  318. IWbemContext *a_Context ,
  319. LPCWSTR a_Namespace ,
  320. REFIID a_RIID ,
  321. void **a_Interface
  322. ) ;
  323. HRESULT STDMETHODCALLTYPE CreateRefresherManager (
  324. IWbemServices *a_Core ,
  325. LONG a_Flags ,
  326. IWbemContext *a_Context ,
  327. REFIID a_RIID ,
  328. void **a_Interface
  329. ) ;
  330. HRESULT STDMETHODCALLTYPE RegisterNotificationSink (
  331. LONG a_Flags ,
  332. IWbemContext *a_Context ,
  333. _IWmiProvSSSink *a_Sink
  334. ) ;
  335. HRESULT STDMETHODCALLTYPE UnRegisterNotificationSink (
  336. LONG a_Flags ,
  337. IWbemContext *a_Context ,
  338. _IWmiProvSSSink *a_Sink
  339. ) ;
  340. // IWmi_Initialize members
  341. HRESULT STDMETHODCALLTYPE Initialize (
  342. LONG a_Flags ,
  343. IWbemContext *a_Context ,
  344. _IWmiCoreServices *a_Core
  345. ) ;
  346. // IWmi_UnInitialize members
  347. HRESULT STDMETHODCALLTYPE Shutdown (
  348. LONG a_Flags ,
  349. ULONG a_MaxMilliSeconds ,
  350. IWbemContext *a_Context
  351. ) ;
  352. WmiStatusCode Strobe ( ULONG &a_NextStrobeDelta ) ;
  353. WmiStatusCode StrobeBegin ( const ULONG &a_Period ) ;
  354. /* _IWmiProviderConfiguration methods */
  355. HRESULT STDMETHODCALLTYPE Get (
  356. IWbemServices *a_Service ,
  357. long a_Flags ,
  358. IWbemContext *a_Context ,
  359. LPCWSTR a_Class ,
  360. LPCWSTR a_Path ,
  361. IWbemObjectSink *a_Sink
  362. ) ;
  363. HRESULT STDMETHODCALLTYPE Set (
  364. IWbemServices *a_Service ,
  365. long a_Flags ,
  366. IWbemContext *a_Context ,
  367. LPCWSTR a_Provider ,
  368. LPCWSTR a_Class ,
  369. LPCWSTR a_Path ,
  370. IWbemClassObject *a_OldObject ,
  371. IWbemClassObject *a_NewObject
  372. ) ;
  373. HRESULT STDMETHODCALLTYPE Deleted (
  374. IWbemServices *a_Service ,
  375. long a_Flags ,
  376. IWbemContext *a_Context ,
  377. LPCWSTR a_Provider ,
  378. LPCWSTR a_Class ,
  379. LPCWSTR a_Path ,
  380. IWbemClassObject *a_Object
  381. ) ;
  382. HRESULT STDMETHODCALLTYPE Enumerate (
  383. IWbemServices *a_Service ,
  384. long a_Flags ,
  385. IWbemContext *a_Context ,
  386. LPCWSTR a_Class ,
  387. IWbemObjectSink *a_Sink
  388. ) ;
  389. HRESULT STDMETHODCALLTYPE Shutdown (
  390. IWbemServices *a_Service ,
  391. long a_Flags ,
  392. IWbemContext *a_Context ,
  393. LPCWSTR a_Provider ,
  394. ULONG a_MilliSeconds
  395. ) ;
  396. HRESULT STDMETHODCALLTYPE Call (
  397. IWbemServices *a_Service ,
  398. long a_Flags ,
  399. IWbemContext *a_Context ,
  400. LPCWSTR a_Class ,
  401. LPCWSTR a_Path ,
  402. LPCWSTR a_Method,
  403. IWbemClassObject *a_InParams,
  404. IWbemObjectSink *a_Sink
  405. ) ;
  406. HRESULT STDMETHODCALLTYPE Query (
  407. IWbemServices *a_Service ,
  408. long a_Flags ,
  409. IWbemContext *a_Context ,
  410. WBEM_PROVIDER_CONFIGURATION_CLASS_ID a_ClassIdentifier ,
  411. WBEM_PROVIDER_CONFIGURATION_PROPERTY_ID a_PropertyIdentifier ,
  412. VARIANT *a_Value
  413. ) ;
  414. HRESULT STDMETHODCALLTYPE PrePut (
  415. long a_Flags ,
  416. long a_UserFlags ,
  417. IWbemContext *a_Context ,
  418. IWbemPath *a_Path ,
  419. LPCWSTR a_Namespace ,
  420. LPCWSTR a_Class ,
  421. _IWmiObject *a_Copy
  422. ) ;
  423. HRESULT STDMETHODCALLTYPE PostPut (
  424. long a_Flags ,
  425. HRESULT hRes,
  426. IWbemContext *a_Context ,
  427. IWbemPath *a_Path ,
  428. LPCWSTR a_Namespace ,
  429. LPCWSTR a_Class ,
  430. _IWmiObject *a_New ,
  431. _IWmiObject *a_Old
  432. ) ;
  433. HRESULT STDMETHODCALLTYPE PreDelete (
  434. long a_Flags ,
  435. long a_UserFlags ,
  436. IWbemContext *a_Context ,
  437. IWbemPath *a_Path,
  438. LPCWSTR a_Namespace,
  439. LPCWSTR a_Class
  440. ) ;
  441. HRESULT STDMETHODCALLTYPE PostDelete (
  442. long a_Flags ,
  443. HRESULT hRes,
  444. IWbemContext *a_Context ,
  445. IWbemPath *a_Path,
  446. LPCWSTR a_Namespace,
  447. LPCWSTR a_Class,
  448. _IWmiObject *a_Old
  449. ) ;
  450. };
  451. #endif // _Server_ProviderSubSystem_H