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.

6849 lines
146 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. XXXX
  5. Abstract:
  6. History:
  7. --*/
  8. #include "PreComp.h"
  9. #include <wbemint.h>
  10. #include <stdio.h>
  11. #include "CGlobals.h"
  12. #include "Globals.h"
  13. #include "ProvInterceptor.h"
  14. /******************************************************************************
  15. *
  16. * Name:
  17. *
  18. *
  19. * Description:
  20. *
  21. *
  22. *****************************************************************************/
  23. #pragma warning( disable : 4355 )
  24. CInterceptor_IWbemDecoupledUnboundObjectSink :: CInterceptor_IWbemDecoupledUnboundObjectSink (
  25. WmiAllocator &a_Allocator ,
  26. IUnknown *a_ServerSideProvider ,
  27. CWbemGlobal_IWmiObjectSinkController *a_Controller ,
  28. CServerObject_ProviderRegistrationV1 &a_Registration
  29. ) : VoidPointerContainerElement (
  30. a_Controller ,
  31. this
  32. ) ,
  33. m_Allocator ( a_Allocator ) ,
  34. m_Unknown ( NULL ) ,
  35. m_Provider_IWbemUnboundObjectSink ( NULL ) ,
  36. m_Registration ( & a_Registration ) ,
  37. m_ProxyContainer ( a_Allocator , ProxyIndex_UnBoundSync_Size , MAX_PROXIES )
  38. {
  39. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_CInterceptor_IWbemDecoupledUnboundObjectSink_ObjectsInProgress ) ;
  40. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  41. if ( m_Registration )
  42. {
  43. m_Registration->AddRef () ;
  44. }
  45. if ( a_ServerSideProvider )
  46. {
  47. m_Unknown = a_ServerSideProvider ;
  48. m_Unknown->AddRef () ;
  49. HRESULT t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemUnboundObjectSink , ( void ** ) & m_Provider_IWbemUnboundObjectSink ) ;
  50. }
  51. }
  52. #pragma warning( default : 4355 )
  53. /******************************************************************************
  54. *
  55. * Name:
  56. *
  57. *
  58. * Description:
  59. *
  60. *
  61. *****************************************************************************/
  62. CInterceptor_IWbemDecoupledUnboundObjectSink :: ~CInterceptor_IWbemDecoupledUnboundObjectSink ()
  63. {
  64. if ( m_Unknown )
  65. {
  66. m_Unknown->Release () ;
  67. }
  68. if ( m_Provider_IWbemUnboundObjectSink )
  69. {
  70. m_Provider_IWbemUnboundObjectSink->Release () ;
  71. }
  72. if ( m_Registration )
  73. {
  74. m_Registration->Release () ;
  75. }
  76. WmiStatusCode t_StatusCode = m_ProxyContainer.UnInitialize () ;
  77. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_CInterceptor_IWbemDecoupledUnboundObjectSink_ObjectsInProgress ) ;
  78. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  79. }
  80. /******************************************************************************
  81. *
  82. * Name:
  83. *
  84. *
  85. * Description:
  86. *
  87. *
  88. *****************************************************************************/
  89. HRESULT CInterceptor_IWbemDecoupledUnboundObjectSink :: Initialize ()
  90. {
  91. HRESULT t_Result = S_OK ;
  92. WmiStatusCode t_StatusCode = m_ProxyContainer.Initialize () ;
  93. if ( t_StatusCode != e_StatusCode_Success )
  94. {
  95. t_Result = WBEM_E_OUT_OF_MEMORY ;
  96. }
  97. return t_Result ;
  98. }
  99. /******************************************************************************
  100. *
  101. * Name:
  102. *
  103. *
  104. * Description:
  105. *
  106. *
  107. *****************************************************************************/
  108. STDMETHODIMP_( ULONG ) CInterceptor_IWbemDecoupledUnboundObjectSink :: AddRef ()
  109. {
  110. return VoidPointerContainerElement :: AddRef () ;
  111. }
  112. /******************************************************************************
  113. *
  114. * Name:
  115. *
  116. *
  117. * Description:
  118. *
  119. *
  120. *****************************************************************************/
  121. STDMETHODIMP_(ULONG) CInterceptor_IWbemDecoupledUnboundObjectSink :: Release ()
  122. {
  123. return VoidPointerContainerElement :: Release () ;
  124. }
  125. /******************************************************************************
  126. *
  127. * Name:
  128. *
  129. *
  130. * Description:
  131. *
  132. *
  133. *****************************************************************************/
  134. STDMETHODIMP CInterceptor_IWbemDecoupledUnboundObjectSink :: QueryInterface (
  135. REFIID iid ,
  136. LPVOID FAR *iplpv
  137. )
  138. {
  139. *iplpv = NULL ;
  140. if ( iid == IID_IUnknown )
  141. {
  142. *iplpv = ( LPVOID ) this ;
  143. }
  144. else if ( iid == IID_IWbemUnboundObjectSink )
  145. {
  146. if ( m_Provider_IWbemUnboundObjectSink )
  147. {
  148. *iplpv = ( LPVOID ) ( IWbemUnboundObjectSink * ) this ;
  149. }
  150. }
  151. else if ( iid == IID_Internal_IWbemUnboundObjectSink )
  152. {
  153. if ( m_Provider_IWbemUnboundObjectSink )
  154. {
  155. *iplpv = ( LPVOID ) ( Internal_IWbemUnboundObjectSink * ) this ;
  156. }
  157. }
  158. else if ( iid == IID__IWmiProviderSite )
  159. {
  160. *iplpv = ( LPVOID ) ( _IWmiProviderSite * ) this ;
  161. }
  162. else if ( iid == IID_IWbemShutdown )
  163. {
  164. *iplpv = ( LPVOID ) ( IWbemShutdown * ) this ;
  165. }
  166. if ( *iplpv )
  167. {
  168. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  169. return ResultFromScode ( S_OK ) ;
  170. }
  171. else
  172. {
  173. return ResultFromScode ( E_NOINTERFACE ) ;
  174. }
  175. }
  176. /******************************************************************************
  177. *
  178. * Name:
  179. *
  180. *
  181. * Description:
  182. *
  183. *
  184. *****************************************************************************/
  185. HRESULT CInterceptor_IWbemDecoupledUnboundObjectSink :: Internal_IndicateToConsumer (
  186. WmiInternalContext a_InternalContext ,
  187. IWbemClassObject *a_LogicalConsumer ,
  188. long a_ObjectCount ,
  189. IWbemClassObject **a_Objects
  190. )
  191. {
  192. BOOL t_Impersonating = FALSE ;
  193. IUnknown *t_OldContext = NULL ;
  194. IServerSecurity *t_OldSecurity = NULL ;
  195. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  196. a_InternalContext ,
  197. t_Impersonating ,
  198. t_OldContext ,
  199. t_OldSecurity
  200. ) ;
  201. if ( SUCCEEDED ( t_Result ) )
  202. {
  203. t_Result = IndicateToConsumer (
  204. a_LogicalConsumer ,
  205. a_ObjectCount ,
  206. a_Objects
  207. ) ;
  208. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  209. }
  210. return t_Result ;
  211. }
  212. /******************************************************************************
  213. *
  214. * Name:
  215. *
  216. *
  217. * Description:
  218. *
  219. *
  220. *****************************************************************************/
  221. HRESULT CInterceptor_IWbemDecoupledUnboundObjectSink :: IndicateToConsumer (
  222. IWbemClassObject *a_LogicalConsumer ,
  223. long a_ObjectCount ,
  224. IWbemClassObject **a_Objects
  225. )
  226. {
  227. if ( m_Provider_IWbemUnboundObjectSink )
  228. {
  229. BOOL t_Impersonating = FALSE ;
  230. IUnknown *t_OldContext = NULL ;
  231. IServerSecurity *t_OldSecurity = NULL ;
  232. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  233. if ( SUCCEEDED ( t_Result ) )
  234. {
  235. BOOL t_Revert = FALSE ;
  236. IUnknown *t_Proxy = NULL ;
  237. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_UnBoundSync_IWbemUnboundObjectSink , IID_IWbemUnboundObjectSink , m_Provider_IWbemUnboundObjectSink , t_Proxy , t_Revert ) ;
  238. if ( t_Result == WBEM_E_NOT_FOUND )
  239. {
  240. t_Result = m_Provider_IWbemUnboundObjectSink->IndicateToConsumer (
  241. a_LogicalConsumer ,
  242. a_ObjectCount ,
  243. a_Objects
  244. ) ;
  245. }
  246. else
  247. {
  248. if ( SUCCEEDED ( t_Result ) )
  249. {
  250. IWbemUnboundObjectSink *t_Provider = ( IWbemUnboundObjectSink * ) t_Proxy ;
  251. // Set cloaking on the proxy
  252. // =========================
  253. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  254. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  255. t_Provider ,
  256. RPC_C_AUTHN_LEVEL_DEFAULT ,
  257. t_ImpersonationLevel
  258. ) ;
  259. if ( SUCCEEDED ( t_Result ) )
  260. {
  261. t_Result = t_Provider->IndicateToConsumer (
  262. a_LogicalConsumer ,
  263. a_ObjectCount ,
  264. a_Objects
  265. ) ;
  266. }
  267. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_UnBoundSync_IWbemUnboundObjectSink , t_Proxy , t_Revert ) ;
  268. }
  269. }
  270. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  271. }
  272. return t_Result ;
  273. }
  274. return WBEM_E_PROVIDER_NOT_CAPABLE;
  275. }
  276. /******************************************************************************
  277. *
  278. * Name:
  279. *
  280. *
  281. * Description:
  282. *
  283. *
  284. *****************************************************************************/
  285. HRESULT CInterceptor_IWbemDecoupledUnboundObjectSink :: GetSite ( DWORD *a_ProcessIdentifier )
  286. {
  287. HRESULT t_Result = S_OK ;
  288. if ( a_ProcessIdentifier )
  289. {
  290. *a_ProcessIdentifier = GetCurrentProcessId () ;
  291. }
  292. else
  293. {
  294. t_Result = WBEM_E_INVALID_PARAMETER ;
  295. }
  296. return t_Result ;
  297. }
  298. /******************************************************************************
  299. *
  300. * Name:
  301. *
  302. *
  303. * Description:
  304. *
  305. *
  306. *****************************************************************************/
  307. HRESULT CInterceptor_IWbemDecoupledUnboundObjectSink :: SetContainer ( IUnknown *a_Container )
  308. {
  309. return WBEM_E_NOT_AVAILABLE ;
  310. }
  311. /******************************************************************************
  312. *
  313. * Name:
  314. *
  315. *
  316. * Description:
  317. *
  318. *
  319. *****************************************************************************/
  320. HRESULT CInterceptor_IWbemDecoupledUnboundObjectSink :: Shutdown (
  321. LONG a_Flags ,
  322. ULONG a_MaxMilliSeconds ,
  323. IWbemContext *a_Context
  324. )
  325. {
  326. return S_OK ;
  327. }
  328. /******************************************************************************
  329. *
  330. * Name:
  331. *
  332. *
  333. * Description:
  334. *
  335. *
  336. *****************************************************************************/
  337. #pragma warning( disable : 4355 )
  338. CDecoupled_IWbemSyncObjectSink :: CDecoupled_IWbemSyncObjectSink (
  339. WmiAllocator &a_Allocator ,
  340. IWbemObjectSink *a_InterceptedSink ,
  341. IUnknown *a_Unknown ,
  342. CWbemGlobal_IWmiObjectSinkController *a_Controller ,
  343. ULONG a_Dependant
  344. ) : CCommon_IWbemSyncObjectSink (
  345. a_Allocator ,
  346. a_InterceptedSink ,
  347. a_Unknown ,
  348. a_Controller ,
  349. a_Dependant
  350. )
  351. {
  352. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_CDecoupled_IWbemSyncObjectSink_ObjectsInProgress ) ;
  353. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  354. }
  355. #pragma warning( default : 4355 )
  356. /******************************************************************************
  357. *
  358. * Name:
  359. *
  360. *
  361. * Description:
  362. *
  363. *
  364. *****************************************************************************/
  365. CDecoupled_IWbemSyncObjectSink :: ~CDecoupled_IWbemSyncObjectSink ()
  366. {
  367. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_CDecoupled_IWbemSyncObjectSink_ObjectsInProgress ) ;
  368. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  369. }
  370. /******************************************************************************
  371. *
  372. * Name:
  373. *
  374. *
  375. * Description:
  376. *
  377. *
  378. *****************************************************************************/
  379. #pragma warning( disable : 4355 )
  380. CDecoupled_Batching_IWbemSyncObjectSink :: CDecoupled_Batching_IWbemSyncObjectSink (
  381. WmiAllocator &a_Allocator ,
  382. IWbemObjectSink *a_InterceptedSink ,
  383. IUnknown *a_Unknown ,
  384. CWbemGlobal_IWmiObjectSinkController *a_Controller ,
  385. ULONG a_Dependant
  386. ) : CCommon_Batching_IWbemSyncObjectSink (
  387. a_Allocator ,
  388. a_InterceptedSink ,
  389. a_Unknown ,
  390. a_Controller ,
  391. a_Dependant
  392. )
  393. {
  394. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_CDecoupled_Batching_IWbemSyncObjectSink_ObjectsInProgress ) ;
  395. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  396. }
  397. #pragma warning( default : 4355 )
  398. /******************************************************************************
  399. *
  400. * Name:
  401. *
  402. *
  403. * Description:
  404. *
  405. *
  406. *****************************************************************************/
  407. CDecoupled_Batching_IWbemSyncObjectSink :: ~CDecoupled_Batching_IWbemSyncObjectSink ()
  408. {
  409. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_CDecoupled_Batching_IWbemSyncObjectSink_ObjectsInProgress ) ;
  410. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  411. }
  412. /******************************************************************************
  413. *
  414. * Name:
  415. *
  416. *
  417. * Description:
  418. *
  419. *
  420. *****************************************************************************/
  421. #pragma warning( disable : 4355 )
  422. CInterceptor_DecoupledClient :: CInterceptor_DecoupledClient (
  423. WmiAllocator &a_Allocator ,
  424. IUnknown *a_ServerSideProvider ,
  425. IWbemServices *a_CoreStub ,
  426. CServerObject_ProviderRegistrationV1 &a_Registration
  427. ) : m_ReferenceCount ( 0 ) ,
  428. m_Allocator ( a_Allocator ) ,
  429. CWbemGlobal_IWmiObjectSinkController ( a_Allocator ) ,
  430. m_Unknown ( NULL ) ,
  431. m_Provider_IWbemServices ( NULL ) ,
  432. m_Provider_IWbemPropertyProvider ( NULL ) ,
  433. m_Provider_IWbemEventProvider ( NULL ) ,
  434. m_Provider_IWbemEventProviderQuerySink ( NULL ) ,
  435. m_Provider_IWbemEventProviderSecurity ( NULL ) ,
  436. m_Provider_IWbemEventConsumerProvider ( NULL ) ,
  437. m_Provider_IWbemEventConsumerProviderEx ( NULL ) ,
  438. m_Provider_IWbemUnboundObjectSink ( NULL ) ,
  439. m_CoreStub ( a_CoreStub ) ,
  440. m_Registration ( & a_Registration ) ,
  441. m_Locale ( NULL ) ,
  442. m_User ( NULL ) ,
  443. m_Namespace ( NULL ) ,
  444. m_ProxyContainer ( a_Allocator , ProxyIndex_Provider_Size , MAX_PROXIES )
  445. {
  446. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_CInterceptor_DecoupledClient_ObjectsInProgress ) ;
  447. InterlockedIncrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  448. if ( m_Registration )
  449. {
  450. m_Registration->AddRef () ;
  451. }
  452. if ( a_ServerSideProvider )
  453. {
  454. m_Unknown = a_ServerSideProvider ;
  455. m_Unknown->AddRef () ;
  456. HRESULT t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemServices , ( void ** ) & m_Provider_IWbemServices ) ;
  457. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemPropertyProvider , ( void ** ) & m_Provider_IWbemPropertyProvider ) ;
  458. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventProvider , ( void ** ) & m_Provider_IWbemEventProvider ) ;
  459. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventProviderQuerySink , ( void ** ) & m_Provider_IWbemEventProviderQuerySink ) ;
  460. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventProviderSecurity , ( void ** ) & m_Provider_IWbemEventProviderSecurity ) ;
  461. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventConsumerProviderEx , ( void ** ) & m_Provider_IWbemEventConsumerProviderEx ) ;
  462. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventConsumerProvider , ( void ** ) & m_Provider_IWbemEventConsumerProvider ) ;
  463. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemUnboundObjectSink , ( void ** ) & m_Provider_IWbemUnboundObjectSink ) ;
  464. }
  465. if ( m_CoreStub )
  466. {
  467. m_CoreStub->AddRef () ;
  468. }
  469. }
  470. #pragma warning( default : 4355 )
  471. /******************************************************************************
  472. *
  473. * Name:
  474. *
  475. *
  476. * Description:
  477. *
  478. *
  479. *****************************************************************************/
  480. CInterceptor_DecoupledClient :: ~CInterceptor_DecoupledClient ()
  481. {
  482. if ( m_Unknown )
  483. {
  484. m_Unknown->Release () ;
  485. }
  486. if ( m_Provider_IWbemServices )
  487. {
  488. m_Provider_IWbemServices->Release () ;
  489. }
  490. if ( m_Provider_IWbemPropertyProvider )
  491. {
  492. m_Provider_IWbemPropertyProvider->Release () ;
  493. }
  494. if ( m_Provider_IWbemEventProvider )
  495. {
  496. m_Provider_IWbemEventProvider->Release () ;
  497. }
  498. if ( m_Provider_IWbemEventProviderQuerySink )
  499. {
  500. m_Provider_IWbemEventProviderQuerySink->Release () ;
  501. }
  502. if ( m_Provider_IWbemEventProviderSecurity )
  503. {
  504. m_Provider_IWbemEventProviderSecurity->Release () ;
  505. }
  506. if ( m_Provider_IWbemEventConsumerProviderEx )
  507. {
  508. m_Provider_IWbemEventConsumerProviderEx->Release () ;
  509. }
  510. if ( m_Provider_IWbemEventConsumerProvider )
  511. {
  512. m_Provider_IWbemEventConsumerProvider->Release () ;
  513. }
  514. if ( m_Provider_IWbemUnboundObjectSink )
  515. {
  516. m_Provider_IWbemUnboundObjectSink->Release () ;
  517. }
  518. if ( m_CoreStub )
  519. {
  520. m_CoreStub->Release () ;
  521. }
  522. WmiStatusCode t_StatusCode = m_ProxyContainer.UnInitialize () ;
  523. t_StatusCode = CWbemGlobal_IWmiObjectSinkController :: UnInitialize () ;
  524. if ( m_Namespace )
  525. {
  526. SysFreeString ( m_Namespace ) ;
  527. }
  528. if ( m_Locale )
  529. {
  530. SysFreeString ( m_Locale ) ;
  531. }
  532. if ( m_User )
  533. {
  534. SysFreeString ( m_User ) ;
  535. }
  536. if ( m_Registration )
  537. {
  538. m_Registration->Release () ;
  539. }
  540. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_CInterceptor_DecoupledClient_ObjectsInProgress ) ;
  541. InterlockedDecrement ( & DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress ) ;
  542. }
  543. /******************************************************************************
  544. *
  545. * Name:
  546. *
  547. *
  548. * Description:
  549. *
  550. *
  551. *****************************************************************************/
  552. STDMETHODIMP_( ULONG ) CInterceptor_DecoupledClient :: AddRef ()
  553. {
  554. return InterlockedIncrement ( & m_ReferenceCount ) ;
  555. }
  556. /******************************************************************************
  557. *
  558. * Name:
  559. *
  560. *
  561. * Description:
  562. *
  563. *
  564. *****************************************************************************/
  565. STDMETHODIMP_(ULONG) CInterceptor_DecoupledClient :: Release ()
  566. {
  567. ULONG t_ReferenceCount = InterlockedDecrement ( & m_ReferenceCount ) ;
  568. if ( t_ReferenceCount == 0 )
  569. {
  570. delete this ;
  571. }
  572. return t_ReferenceCount ;
  573. }
  574. /******************************************************************************
  575. *
  576. * Name:
  577. *
  578. *
  579. * Description:
  580. *
  581. *
  582. *****************************************************************************/
  583. STDMETHODIMP CInterceptor_DecoupledClient :: QueryInterface (
  584. REFIID a_Riid ,
  585. LPVOID FAR *a_Void
  586. )
  587. {
  588. *a_Void = NULL ;
  589. if ( a_Riid == IID_IUnknown )
  590. {
  591. *a_Void = ( LPVOID ) this ;
  592. }
  593. if ( a_Riid == IID_IWbemProviderInit )
  594. {
  595. *a_Void = ( LPVOID ) ( IWbemProviderInit * ) this ;
  596. }
  597. if ( a_Riid == IID_Internal_IWbemProviderInit )
  598. {
  599. *a_Void = ( LPVOID ) ( Internal_IWbemProviderInit * ) this ;
  600. }
  601. else if ( a_Riid == IID_IWbemServices )
  602. {
  603. if ( m_Provider_IWbemServices )
  604. {
  605. *a_Void = ( LPVOID ) ( IWbemServices * ) this ;
  606. }
  607. }
  608. else if ( a_Riid == IID_IWbemPropertyProvider )
  609. {
  610. if ( m_Provider_IWbemPropertyProvider )
  611. {
  612. *a_Void = ( LPVOID ) ( IWbemPropertyProvider * ) this ;
  613. }
  614. }
  615. else if ( a_Riid == IID_IWbemEventProvider )
  616. {
  617. if ( m_Provider_IWbemEventProvider )
  618. {
  619. *a_Void = ( LPVOID ) ( IWbemEventProvider * ) this ;
  620. }
  621. }
  622. else if ( a_Riid == IID_IWbemEventProviderQuerySink )
  623. {
  624. if ( m_Provider_IWbemEventProviderQuerySink )
  625. {
  626. *a_Void = ( LPVOID ) ( IWbemEventProviderQuerySink * ) this ;
  627. }
  628. }
  629. else if ( a_Riid == IID_IWbemEventProviderSecurity )
  630. {
  631. if ( m_Provider_IWbemEventProviderSecurity )
  632. {
  633. *a_Void = ( LPVOID ) ( IWbemEventProviderSecurity * ) this ;
  634. }
  635. }
  636. else if ( a_Riid == IID_IWbemEventConsumerProvider )
  637. {
  638. if ( m_Provider_IWbemEventConsumerProvider )
  639. {
  640. *a_Void = ( LPVOID ) ( IWbemEventConsumerProvider * ) this ;
  641. }
  642. }
  643. else if ( a_Riid == IID_IWbemEventConsumerProviderEx )
  644. {
  645. if ( m_Provider_IWbemEventConsumerProviderEx )
  646. {
  647. *a_Void = ( LPVOID ) ( IWbemEventConsumerProviderEx * ) this ;
  648. }
  649. }
  650. else if ( a_Riid == IID_IWbemUnboundObjectSink )
  651. {
  652. if ( m_Provider_IWbemUnboundObjectSink )
  653. {
  654. *a_Void = ( LPVOID ) ( IWbemUnboundObjectSink * ) this ;
  655. }
  656. }
  657. else if ( a_Riid == IID__IWmiProviderInitialize )
  658. {
  659. *a_Void = ( LPVOID ) ( _IWmiProviderInitialize * ) this ;
  660. }
  661. else if ( a_Riid == IID__IWmiProviderSite )
  662. {
  663. *a_Void = ( LPVOID ) ( _IWmiProviderSite * ) this ;
  664. }
  665. else if ( a_Riid == IID_IWbemShutdown )
  666. {
  667. *a_Void = ( LPVOID ) ( IWbemShutdown * ) this ;
  668. }
  669. else if ( a_Riid == IID__IWmiProviderConfiguration )
  670. {
  671. *a_Void = ( LPVOID ) ( _IWmiProviderConfiguration * ) this ;
  672. }
  673. else if ( a_Riid == IID_Internal_IWbemServices )
  674. {
  675. if ( m_Provider_IWbemServices )
  676. {
  677. *a_Void = ( LPVOID ) ( Internal_IWbemServices * ) this ;
  678. }
  679. }
  680. else if ( a_Riid == IID_Internal_IWbemPropertyProvider )
  681. {
  682. if ( m_Provider_IWbemPropertyProvider )
  683. {
  684. *a_Void = ( LPVOID ) ( Internal_IWbemPropertyProvider * ) this ;
  685. }
  686. }
  687. else if ( a_Riid == IID_Internal_IWbemEventProvider )
  688. {
  689. if ( m_Provider_IWbemEventProvider )
  690. {
  691. *a_Void = ( LPVOID ) ( Internal_IWbemEventProvider * ) this ;
  692. }
  693. }
  694. else if ( a_Riid == IID_Internal_IWbemEventProviderQuerySink )
  695. {
  696. if ( m_Provider_IWbemEventProviderQuerySink )
  697. {
  698. *a_Void = ( LPVOID ) ( Internal_IWbemEventProviderQuerySink * ) this ;
  699. }
  700. }
  701. else if ( a_Riid == IID_Internal_IWbemEventProviderSecurity )
  702. {
  703. if ( m_Provider_IWbemEventProviderSecurity )
  704. {
  705. *a_Void = ( LPVOID ) ( Internal_IWbemEventProviderSecurity * ) this ;
  706. }
  707. }
  708. else if ( a_Riid == IID_Internal_IWbemEventConsumerProvider )
  709. {
  710. if ( m_Provider_IWbemEventConsumerProvider )
  711. {
  712. *a_Void = ( LPVOID ) ( Internal_IWbemEventConsumerProvider * ) this ;
  713. }
  714. }
  715. else if ( a_Riid == IID_Internal_IWbemEventConsumerProviderEx )
  716. {
  717. if ( m_Provider_IWbemEventConsumerProviderEx )
  718. {
  719. *a_Void = ( LPVOID ) ( Internal_IWbemEventConsumerProviderEx * ) this ;
  720. }
  721. }
  722. else if ( a_Riid == IID_Internal_IWbemUnboundObjectSink )
  723. {
  724. if ( m_Provider_IWbemUnboundObjectSink )
  725. {
  726. *a_Void = ( LPVOID ) ( Internal_IWbemUnboundObjectSink * ) this ;
  727. }
  728. }
  729. if ( *a_Void )
  730. {
  731. ( ( LPUNKNOWN ) *a_Void )->AddRef () ;
  732. return ResultFromScode ( S_OK ) ;
  733. }
  734. else
  735. {
  736. return ResultFromScode ( E_NOINTERFACE ) ;
  737. }
  738. }
  739. /******************************************************************************
  740. *
  741. * Name:
  742. *
  743. *
  744. * Description:
  745. *
  746. *
  747. *****************************************************************************/
  748. HRESULT CInterceptor_DecoupledClient :: Internal_OpenNamespace (
  749. WmiInternalContext a_InternalContext ,
  750. const BSTR a_ObjectPath ,
  751. long a_Flags ,
  752. IWbemContext *a_Context ,
  753. IWbemServices **a_NamespaceService ,
  754. IWbemCallResult **a_CallResult
  755. )
  756. {
  757. BOOL t_Impersonating = FALSE ;
  758. IUnknown *t_OldContext = NULL ;
  759. IServerSecurity *t_OldSecurity = NULL ;
  760. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  761. a_InternalContext ,
  762. t_Impersonating ,
  763. t_OldContext ,
  764. t_OldSecurity
  765. ) ;
  766. if ( SUCCEEDED ( t_Result ) )
  767. {
  768. t_Result = OpenNamespace (
  769. a_ObjectPath ,
  770. a_Flags ,
  771. a_Context ,
  772. a_NamespaceService ,
  773. a_CallResult
  774. ) ;
  775. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  776. }
  777. return t_Result ;
  778. }
  779. /******************************************************************************
  780. *
  781. * Name:
  782. *
  783. *
  784. * Description:
  785. *
  786. *
  787. *****************************************************************************/
  788. HRESULT CInterceptor_DecoupledClient :: Internal_CancelAsyncCall (
  789. WmiInternalContext a_InternalContext ,
  790. IWbemObjectSink *a_Sink
  791. )
  792. {
  793. BOOL t_Impersonating = FALSE ;
  794. IUnknown *t_OldContext = NULL ;
  795. IServerSecurity *t_OldSecurity = NULL ;
  796. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  797. a_InternalContext ,
  798. t_Impersonating ,
  799. t_OldContext ,
  800. t_OldSecurity
  801. ) ;
  802. if ( SUCCEEDED ( t_Result ) )
  803. {
  804. t_Result = CancelAsyncCall (
  805. a_Sink
  806. ) ;
  807. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  808. }
  809. return t_Result ;
  810. }
  811. /******************************************************************************
  812. *
  813. * Name:
  814. *
  815. *
  816. * Description:
  817. *
  818. *
  819. *****************************************************************************/
  820. HRESULT CInterceptor_DecoupledClient :: Internal_QueryObjectSink (
  821. WmiInternalContext a_InternalContext ,
  822. long a_Flags ,
  823. IWbemObjectSink **a_Sink
  824. )
  825. {
  826. BOOL t_Impersonating = FALSE ;
  827. IUnknown *t_OldContext = NULL ;
  828. IServerSecurity *t_OldSecurity = NULL ;
  829. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  830. a_InternalContext ,
  831. t_Impersonating ,
  832. t_OldContext ,
  833. t_OldSecurity
  834. ) ;
  835. if ( SUCCEEDED ( t_Result ) )
  836. {
  837. t_Result = QueryObjectSink (
  838. a_Flags ,
  839. a_Sink
  840. ) ;
  841. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  842. }
  843. return t_Result ;
  844. }
  845. /******************************************************************************
  846. *
  847. * Name:
  848. *
  849. *
  850. * Description:
  851. *
  852. *
  853. *****************************************************************************/
  854. HRESULT CInterceptor_DecoupledClient :: Internal_GetObject (
  855. WmiInternalContext a_InternalContext ,
  856. const BSTR a_ObjectPath ,
  857. long a_Flags ,
  858. IWbemContext *a_Context ,
  859. IWbemClassObject **a_Object ,
  860. IWbemCallResult **a_CallResult
  861. )
  862. {
  863. BOOL t_Impersonating = FALSE ;
  864. IUnknown *t_OldContext = NULL ;
  865. IServerSecurity *t_OldSecurity = NULL ;
  866. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  867. a_InternalContext ,
  868. t_Impersonating ,
  869. t_OldContext ,
  870. t_OldSecurity
  871. ) ;
  872. if ( SUCCEEDED ( t_Result ) )
  873. {
  874. t_Result = GetObject (
  875. a_ObjectPath ,
  876. a_Flags ,
  877. a_Context ,
  878. a_Object ,
  879. a_CallResult
  880. ) ;
  881. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  882. }
  883. return t_Result ;
  884. }
  885. /******************************************************************************
  886. *
  887. * Name:
  888. *
  889. *
  890. * Description:
  891. *
  892. *
  893. *****************************************************************************/
  894. HRESULT CInterceptor_DecoupledClient :: Internal_GetObjectAsync (
  895. WmiInternalContext a_InternalContext ,
  896. const BSTR a_ObjectPath ,
  897. long a_Flags ,
  898. IWbemContext *a_Context ,
  899. IWbemObjectSink *a_Sink
  900. )
  901. {
  902. BOOL t_Impersonating = FALSE ;
  903. IUnknown *t_OldContext = NULL ;
  904. IServerSecurity *t_OldSecurity = NULL ;
  905. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  906. a_InternalContext ,
  907. t_Impersonating ,
  908. t_OldContext ,
  909. t_OldSecurity
  910. ) ;
  911. if ( SUCCEEDED ( t_Result ) )
  912. {
  913. t_Result = GetObjectAsync (
  914. a_ObjectPath ,
  915. a_Flags ,
  916. a_Context ,
  917. a_Sink
  918. ) ;
  919. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  920. }
  921. return t_Result ;
  922. }
  923. /******************************************************************************
  924. *
  925. * Name:
  926. *
  927. *
  928. * Description:
  929. *
  930. *
  931. *****************************************************************************/
  932. HRESULT CInterceptor_DecoupledClient :: Internal_PutClass (
  933. WmiInternalContext a_InternalContext ,
  934. IWbemClassObject *a_Object ,
  935. long a_Flags ,
  936. IWbemContext *a_Context ,
  937. IWbemCallResult **a_CallResult
  938. )
  939. {
  940. BOOL t_Impersonating = FALSE ;
  941. IUnknown *t_OldContext = NULL ;
  942. IServerSecurity *t_OldSecurity = NULL ;
  943. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  944. a_InternalContext ,
  945. t_Impersonating ,
  946. t_OldContext ,
  947. t_OldSecurity
  948. ) ;
  949. if ( SUCCEEDED ( t_Result ) )
  950. {
  951. t_Result = PutClass (
  952. a_Object ,
  953. a_Flags ,
  954. a_Context ,
  955. a_CallResult
  956. ) ;
  957. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  958. }
  959. return t_Result ;
  960. }
  961. /******************************************************************************
  962. *
  963. * Name:
  964. *
  965. *
  966. * Description:
  967. *
  968. *
  969. *****************************************************************************/
  970. HRESULT CInterceptor_DecoupledClient :: Internal_PutClassAsync (
  971. WmiInternalContext a_InternalContext ,
  972. IWbemClassObject *a_Object ,
  973. long a_Flags ,
  974. IWbemContext *a_Context ,
  975. IWbemObjectSink *a_Sink
  976. )
  977. {
  978. BOOL t_Impersonating = FALSE ;
  979. IUnknown *t_OldContext = NULL ;
  980. IServerSecurity *t_OldSecurity = NULL ;
  981. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  982. a_InternalContext ,
  983. t_Impersonating ,
  984. t_OldContext ,
  985. t_OldSecurity
  986. ) ;
  987. if ( SUCCEEDED ( t_Result ) )
  988. {
  989. t_Result = PutClassAsync (
  990. a_Object ,
  991. a_Flags ,
  992. a_Context ,
  993. a_Sink
  994. ) ;
  995. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  996. }
  997. return t_Result ;
  998. }
  999. /******************************************************************************
  1000. *
  1001. * Name:
  1002. *
  1003. *
  1004. * Description:
  1005. *
  1006. *
  1007. *****************************************************************************/
  1008. HRESULT CInterceptor_DecoupledClient :: Internal_DeleteClass (
  1009. WmiInternalContext a_InternalContext ,
  1010. const BSTR a_Class ,
  1011. long a_Flags ,
  1012. IWbemContext *a_Context ,
  1013. IWbemCallResult **a_CallResult
  1014. )
  1015. {
  1016. BOOL t_Impersonating = FALSE ;
  1017. IUnknown *t_OldContext = NULL ;
  1018. IServerSecurity *t_OldSecurity = NULL ;
  1019. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1020. a_InternalContext ,
  1021. t_Impersonating ,
  1022. t_OldContext ,
  1023. t_OldSecurity
  1024. ) ;
  1025. if ( SUCCEEDED ( t_Result ) )
  1026. {
  1027. t_Result = DeleteClass (
  1028. a_Class ,
  1029. a_Flags ,
  1030. a_Context ,
  1031. a_CallResult
  1032. ) ;
  1033. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1034. }
  1035. return t_Result ;
  1036. }
  1037. /******************************************************************************
  1038. *
  1039. * Name:
  1040. *
  1041. *
  1042. * Description:
  1043. *
  1044. *
  1045. *****************************************************************************/
  1046. HRESULT CInterceptor_DecoupledClient :: Internal_DeleteClassAsync (
  1047. WmiInternalContext a_InternalContext ,
  1048. const BSTR a_Class ,
  1049. long a_Flags ,
  1050. IWbemContext *a_Context ,
  1051. IWbemObjectSink *a_Sink
  1052. )
  1053. {
  1054. BOOL t_Impersonating = FALSE ;
  1055. IUnknown *t_OldContext = NULL ;
  1056. IServerSecurity *t_OldSecurity = NULL ;
  1057. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1058. a_InternalContext ,
  1059. t_Impersonating ,
  1060. t_OldContext ,
  1061. t_OldSecurity
  1062. ) ;
  1063. if ( SUCCEEDED ( t_Result ) )
  1064. {
  1065. t_Result = DeleteClassAsync (
  1066. a_Class ,
  1067. a_Flags ,
  1068. a_Context ,
  1069. a_Sink
  1070. ) ;
  1071. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1072. }
  1073. return t_Result ;
  1074. }
  1075. /******************************************************************************
  1076. *
  1077. * Name:
  1078. *
  1079. *
  1080. * Description:
  1081. *
  1082. *
  1083. *****************************************************************************/
  1084. HRESULT CInterceptor_DecoupledClient :: Internal_CreateClassEnum (
  1085. WmiInternalContext a_InternalContext ,
  1086. const BSTR a_SuperClass ,
  1087. long a_Flags,
  1088. IWbemContext *a_Context ,
  1089. IEnumWbemClassObject **a_Enum
  1090. )
  1091. {
  1092. BOOL t_Impersonating = FALSE ;
  1093. IUnknown *t_OldContext = NULL ;
  1094. IServerSecurity *t_OldSecurity = NULL ;
  1095. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1096. a_InternalContext ,
  1097. t_Impersonating ,
  1098. t_OldContext ,
  1099. t_OldSecurity
  1100. ) ;
  1101. if ( SUCCEEDED ( t_Result ) )
  1102. {
  1103. t_Result = CreateClassEnum (
  1104. a_SuperClass ,
  1105. a_Flags,
  1106. a_Context ,
  1107. a_Enum
  1108. ) ;
  1109. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1110. }
  1111. return t_Result ;
  1112. }
  1113. /******************************************************************************
  1114. *
  1115. * Name:
  1116. *
  1117. *
  1118. * Description:
  1119. *
  1120. *
  1121. *****************************************************************************/
  1122. HRESULT CInterceptor_DecoupledClient :: Internal_CreateClassEnumAsync (
  1123. WmiInternalContext a_InternalContext ,
  1124. const BSTR a_SuperClass ,
  1125. long a_Flags ,
  1126. IWbemContext *a_Context ,
  1127. IWbemObjectSink *a_Sink
  1128. )
  1129. {
  1130. BOOL t_Impersonating = FALSE ;
  1131. IUnknown *t_OldContext = NULL ;
  1132. IServerSecurity *t_OldSecurity = NULL ;
  1133. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1134. a_InternalContext ,
  1135. t_Impersonating ,
  1136. t_OldContext ,
  1137. t_OldSecurity
  1138. ) ;
  1139. if ( SUCCEEDED ( t_Result ) )
  1140. {
  1141. t_Result = CreateClassEnumAsync (
  1142. a_SuperClass ,
  1143. a_Flags,
  1144. a_Context ,
  1145. a_Sink
  1146. ) ;
  1147. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1148. }
  1149. return t_Result ;
  1150. }
  1151. /******************************************************************************
  1152. *
  1153. * Name:
  1154. *
  1155. *
  1156. * Description:
  1157. *
  1158. *
  1159. *****************************************************************************/
  1160. HRESULT CInterceptor_DecoupledClient :: Internal_PutInstance (
  1161. WmiInternalContext a_InternalContext ,
  1162. IWbemClassObject *a_Instance ,
  1163. long a_Flags ,
  1164. IWbemContext *a_Context ,
  1165. IWbemCallResult **a_CallResult
  1166. )
  1167. {
  1168. BOOL t_Impersonating = FALSE ;
  1169. IUnknown *t_OldContext = NULL ;
  1170. IServerSecurity *t_OldSecurity = NULL ;
  1171. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1172. a_InternalContext ,
  1173. t_Impersonating ,
  1174. t_OldContext ,
  1175. t_OldSecurity
  1176. ) ;
  1177. if ( SUCCEEDED ( t_Result ) )
  1178. {
  1179. t_Result = PutInstance (
  1180. a_Instance ,
  1181. a_Flags ,
  1182. a_Context ,
  1183. a_CallResult
  1184. ) ;
  1185. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1186. }
  1187. return t_Result ;
  1188. }
  1189. /******************************************************************************
  1190. *
  1191. * Name:
  1192. *
  1193. *
  1194. * Description:
  1195. *
  1196. *
  1197. *****************************************************************************/
  1198. HRESULT CInterceptor_DecoupledClient :: Internal_PutInstanceAsync (
  1199. WmiInternalContext a_InternalContext ,
  1200. IWbemClassObject *a_Instance ,
  1201. long a_Flags ,
  1202. IWbemContext *a_Context ,
  1203. IWbemObjectSink *a_Sink
  1204. )
  1205. {
  1206. BOOL t_Impersonating = FALSE ;
  1207. IUnknown *t_OldContext = NULL ;
  1208. IServerSecurity *t_OldSecurity = NULL ;
  1209. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1210. a_InternalContext ,
  1211. t_Impersonating ,
  1212. t_OldContext ,
  1213. t_OldSecurity
  1214. ) ;
  1215. if ( SUCCEEDED ( t_Result ) )
  1216. {
  1217. t_Result = PutInstanceAsync (
  1218. a_Instance ,
  1219. a_Flags ,
  1220. a_Context ,
  1221. a_Sink
  1222. ) ;
  1223. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1224. }
  1225. return t_Result ;
  1226. }
  1227. /******************************************************************************
  1228. *
  1229. * Name:
  1230. *
  1231. *
  1232. * Description:
  1233. *
  1234. *
  1235. *****************************************************************************/
  1236. HRESULT CInterceptor_DecoupledClient :: Internal_DeleteInstance (
  1237. WmiInternalContext a_InternalContext ,
  1238. const BSTR a_ObjectPath ,
  1239. long a_Flags ,
  1240. IWbemContext *a_Context ,
  1241. IWbemCallResult **a_CallResult
  1242. )
  1243. {
  1244. BOOL t_Impersonating = FALSE ;
  1245. IUnknown *t_OldContext = NULL ;
  1246. IServerSecurity *t_OldSecurity = NULL ;
  1247. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1248. a_InternalContext ,
  1249. t_Impersonating ,
  1250. t_OldContext ,
  1251. t_OldSecurity
  1252. ) ;
  1253. if ( SUCCEEDED ( t_Result ) )
  1254. {
  1255. t_Result = DeleteInstance (
  1256. a_ObjectPath ,
  1257. a_Flags ,
  1258. a_Context ,
  1259. a_CallResult
  1260. ) ;
  1261. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1262. }
  1263. return t_Result ;
  1264. }
  1265. /******************************************************************************
  1266. *
  1267. * Name:
  1268. *
  1269. *
  1270. * Description:
  1271. *
  1272. *
  1273. *****************************************************************************/
  1274. HRESULT CInterceptor_DecoupledClient :: Internal_DeleteInstanceAsync (
  1275. WmiInternalContext a_InternalContext ,
  1276. const BSTR a_ObjectPath ,
  1277. long a_Flags ,
  1278. IWbemContext *a_Context ,
  1279. IWbemObjectSink *a_Sink
  1280. )
  1281. {
  1282. BOOL t_Impersonating = FALSE ;
  1283. IUnknown *t_OldContext = NULL ;
  1284. IServerSecurity *t_OldSecurity = NULL ;
  1285. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1286. a_InternalContext ,
  1287. t_Impersonating ,
  1288. t_OldContext ,
  1289. t_OldSecurity
  1290. ) ;
  1291. if ( SUCCEEDED ( t_Result ) )
  1292. {
  1293. t_Result = DeleteInstanceAsync (
  1294. a_ObjectPath ,
  1295. a_Flags ,
  1296. a_Context ,
  1297. a_Sink
  1298. ) ;
  1299. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1300. }
  1301. return t_Result ;
  1302. }
  1303. /******************************************************************************
  1304. *
  1305. * Name:
  1306. *
  1307. *
  1308. * Description:
  1309. *
  1310. *
  1311. *****************************************************************************/
  1312. HRESULT CInterceptor_DecoupledClient :: Internal_CreateInstanceEnum (
  1313. WmiInternalContext a_InternalContext ,
  1314. const BSTR a_Class ,
  1315. long a_Flags ,
  1316. IWbemContext *a_Context ,
  1317. IEnumWbemClassObject **a_Enum
  1318. )
  1319. {
  1320. BOOL t_Impersonating = FALSE ;
  1321. IUnknown *t_OldContext = NULL ;
  1322. IServerSecurity *t_OldSecurity = NULL ;
  1323. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1324. a_InternalContext ,
  1325. t_Impersonating ,
  1326. t_OldContext ,
  1327. t_OldSecurity
  1328. ) ;
  1329. if ( SUCCEEDED ( t_Result ) )
  1330. {
  1331. t_Result = CreateInstanceEnum (
  1332. a_Class ,
  1333. a_Flags ,
  1334. a_Context ,
  1335. a_Enum
  1336. ) ;
  1337. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1338. }
  1339. return t_Result ;
  1340. }
  1341. /******************************************************************************
  1342. *
  1343. * Name:
  1344. *
  1345. *
  1346. * Description:
  1347. *
  1348. *
  1349. *****************************************************************************/
  1350. HRESULT CInterceptor_DecoupledClient :: Internal_CreateInstanceEnumAsync (
  1351. WmiInternalContext a_InternalContext ,
  1352. const BSTR a_Class ,
  1353. long a_Flags ,
  1354. IWbemContext *a_Context ,
  1355. IWbemObjectSink *a_Sink
  1356. )
  1357. {
  1358. BOOL t_Impersonating = FALSE ;
  1359. IUnknown *t_OldContext = NULL ;
  1360. IServerSecurity *t_OldSecurity = NULL ;
  1361. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1362. a_InternalContext ,
  1363. t_Impersonating ,
  1364. t_OldContext ,
  1365. t_OldSecurity
  1366. ) ;
  1367. if ( SUCCEEDED ( t_Result ) )
  1368. {
  1369. t_Result = CreateInstanceEnumAsync (
  1370. a_Class ,
  1371. a_Flags ,
  1372. a_Context ,
  1373. a_Sink
  1374. ) ;
  1375. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1376. }
  1377. return t_Result ;
  1378. }
  1379. /******************************************************************************
  1380. *
  1381. * Name:
  1382. *
  1383. *
  1384. * Description:
  1385. *
  1386. *
  1387. *****************************************************************************/
  1388. HRESULT CInterceptor_DecoupledClient :: Internal_ExecQuery (
  1389. WmiInternalContext a_InternalContext ,
  1390. const BSTR a_QueryLanguage ,
  1391. const BSTR a_Query ,
  1392. long a_Flags ,
  1393. IWbemContext *a_Context ,
  1394. IEnumWbemClassObject **a_Enum
  1395. )
  1396. {
  1397. BOOL t_Impersonating = FALSE ;
  1398. IUnknown *t_OldContext = NULL ;
  1399. IServerSecurity *t_OldSecurity = NULL ;
  1400. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1401. a_InternalContext ,
  1402. t_Impersonating ,
  1403. t_OldContext ,
  1404. t_OldSecurity
  1405. ) ;
  1406. if ( SUCCEEDED ( t_Result ) )
  1407. {
  1408. t_Result = ExecQuery (
  1409. a_QueryLanguage ,
  1410. a_Query ,
  1411. a_Flags ,
  1412. a_Context ,
  1413. a_Enum
  1414. ) ;
  1415. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1416. }
  1417. return t_Result ;
  1418. }
  1419. /******************************************************************************
  1420. *
  1421. * Name:
  1422. *
  1423. *
  1424. * Description:
  1425. *
  1426. *
  1427. *****************************************************************************/
  1428. HRESULT CInterceptor_DecoupledClient :: Internal_ExecQueryAsync (
  1429. WmiInternalContext a_InternalContext ,
  1430. const BSTR a_QueryLanguage ,
  1431. const BSTR a_Query,
  1432. long a_Flags ,
  1433. IWbemContext *a_Context ,
  1434. IWbemObjectSink *a_Sink
  1435. )
  1436. {
  1437. BOOL t_Impersonating = FALSE ;
  1438. IUnknown *t_OldContext = NULL ;
  1439. IServerSecurity *t_OldSecurity = NULL ;
  1440. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1441. a_InternalContext ,
  1442. t_Impersonating ,
  1443. t_OldContext ,
  1444. t_OldSecurity
  1445. ) ;
  1446. if ( SUCCEEDED ( t_Result ) )
  1447. {
  1448. t_Result = ExecQueryAsync (
  1449. a_QueryLanguage ,
  1450. a_Query,
  1451. a_Flags ,
  1452. a_Context ,
  1453. a_Sink
  1454. ) ;
  1455. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1456. }
  1457. return t_Result ;
  1458. }
  1459. /******************************************************************************
  1460. *
  1461. * Name:
  1462. *
  1463. *
  1464. * Description:
  1465. *
  1466. *
  1467. *****************************************************************************/
  1468. HRESULT CInterceptor_DecoupledClient :: Internal_ExecNotificationQuery (
  1469. WmiInternalContext a_InternalContext ,
  1470. const BSTR a_QueryLanguage ,
  1471. const BSTR a_Query ,
  1472. long a_Flags ,
  1473. IWbemContext *a_Context ,
  1474. IEnumWbemClassObject **a_Enum
  1475. )
  1476. {
  1477. BOOL t_Impersonating = FALSE ;
  1478. IUnknown *t_OldContext = NULL ;
  1479. IServerSecurity *t_OldSecurity = NULL ;
  1480. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1481. a_InternalContext ,
  1482. t_Impersonating ,
  1483. t_OldContext ,
  1484. t_OldSecurity
  1485. ) ;
  1486. if ( SUCCEEDED ( t_Result ) )
  1487. {
  1488. t_Result = ExecNotificationQuery (
  1489. a_QueryLanguage ,
  1490. a_Query ,
  1491. a_Flags ,
  1492. a_Context ,
  1493. a_Enum
  1494. ) ;
  1495. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1496. }
  1497. return t_Result ;
  1498. }
  1499. /******************************************************************************
  1500. *
  1501. * Name:
  1502. *
  1503. *
  1504. * Description:
  1505. *
  1506. *
  1507. *****************************************************************************/
  1508. HRESULT CInterceptor_DecoupledClient :: Internal_ExecNotificationQueryAsync (
  1509. WmiInternalContext a_InternalContext ,
  1510. const BSTR a_QueryLanguage ,
  1511. const BSTR a_Query ,
  1512. long a_Flags ,
  1513. IWbemContext *a_Context ,
  1514. IWbemObjectSink *a_Sink
  1515. )
  1516. {
  1517. BOOL t_Impersonating = FALSE ;
  1518. IUnknown *t_OldContext = NULL ;
  1519. IServerSecurity *t_OldSecurity = NULL ;
  1520. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1521. a_InternalContext ,
  1522. t_Impersonating ,
  1523. t_OldContext ,
  1524. t_OldSecurity
  1525. ) ;
  1526. if ( SUCCEEDED ( t_Result ) )
  1527. {
  1528. t_Result = ExecNotificationQueryAsync (
  1529. a_QueryLanguage ,
  1530. a_Query ,
  1531. a_Flags ,
  1532. a_Context ,
  1533. a_Sink
  1534. ) ;
  1535. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1536. }
  1537. return t_Result ;
  1538. }
  1539. /******************************************************************************
  1540. *
  1541. * Name:
  1542. *
  1543. *
  1544. * Description:
  1545. *
  1546. *
  1547. *****************************************************************************/
  1548. HRESULT CInterceptor_DecoupledClient :: Internal_ExecMethod (
  1549. WmiInternalContext a_InternalContext ,
  1550. const BSTR a_ObjectPath ,
  1551. const BSTR a_MethodName ,
  1552. long a_Flags ,
  1553. IWbemContext *a_Context ,
  1554. IWbemClassObject *a_InParams ,
  1555. IWbemClassObject **a_OutParams ,
  1556. IWbemCallResult **a_CallResult
  1557. )
  1558. {
  1559. BOOL t_Impersonating = FALSE ;
  1560. IUnknown *t_OldContext = NULL ;
  1561. IServerSecurity *t_OldSecurity = NULL ;
  1562. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1563. a_InternalContext ,
  1564. t_Impersonating ,
  1565. t_OldContext ,
  1566. t_OldSecurity
  1567. ) ;
  1568. if ( SUCCEEDED ( t_Result ) )
  1569. {
  1570. t_Result = ExecMethod (
  1571. a_ObjectPath ,
  1572. a_MethodName ,
  1573. a_Flags ,
  1574. a_Context ,
  1575. a_InParams ,
  1576. a_OutParams ,
  1577. a_CallResult
  1578. ) ;
  1579. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1580. }
  1581. return t_Result ;
  1582. }
  1583. /******************************************************************************
  1584. *
  1585. * Name:
  1586. *
  1587. *
  1588. * Description:
  1589. *
  1590. *
  1591. *****************************************************************************/
  1592. HRESULT CInterceptor_DecoupledClient :: Internal_ExecMethodAsync (
  1593. WmiInternalContext a_InternalContext ,
  1594. const BSTR a_ObjectPath ,
  1595. const BSTR a_MethodName ,
  1596. long a_Flags ,
  1597. IWbemContext *a_Context ,
  1598. IWbemClassObject *a_InParams ,
  1599. IWbemObjectSink *a_Sink
  1600. )
  1601. {
  1602. BOOL t_Impersonating = FALSE ;
  1603. IUnknown *t_OldContext = NULL ;
  1604. IServerSecurity *t_OldSecurity = NULL ;
  1605. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1606. a_InternalContext ,
  1607. t_Impersonating ,
  1608. t_OldContext ,
  1609. t_OldSecurity
  1610. ) ;
  1611. if ( SUCCEEDED ( t_Result ) )
  1612. {
  1613. t_Result = ExecMethodAsync (
  1614. a_ObjectPath ,
  1615. a_MethodName ,
  1616. a_Flags ,
  1617. a_Context ,
  1618. a_InParams ,
  1619. a_Sink
  1620. ) ;
  1621. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1622. }
  1623. return t_Result ;
  1624. }
  1625. /******************************************************************************
  1626. *
  1627. * Name:
  1628. *
  1629. *
  1630. * Description:
  1631. *
  1632. *
  1633. *****************************************************************************/
  1634. HRESULT CInterceptor_DecoupledClient :: Internal_GetProperty (
  1635. WmiInternalContext a_InternalContext ,
  1636. long a_Flags ,
  1637. const BSTR a_Locale ,
  1638. const BSTR a_ClassMapping ,
  1639. const BSTR a_InstanceMapping ,
  1640. const BSTR a_PropertyMapping ,
  1641. VARIANT *a_Value
  1642. )
  1643. {
  1644. BOOL t_Impersonating = FALSE ;
  1645. IUnknown *t_OldContext = NULL ;
  1646. IServerSecurity *t_OldSecurity = NULL ;
  1647. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1648. a_InternalContext ,
  1649. t_Impersonating ,
  1650. t_OldContext ,
  1651. t_OldSecurity
  1652. ) ;
  1653. if ( SUCCEEDED ( t_Result ) )
  1654. {
  1655. t_Result = GetProperty (
  1656. a_Flags ,
  1657. a_Locale ,
  1658. a_ClassMapping ,
  1659. a_InstanceMapping ,
  1660. a_PropertyMapping ,
  1661. a_Value
  1662. ) ;
  1663. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1664. }
  1665. return t_Result ;
  1666. }
  1667. /******************************************************************************
  1668. *
  1669. * Name:
  1670. *
  1671. *
  1672. * Description:
  1673. *
  1674. *
  1675. *****************************************************************************/
  1676. HRESULT CInterceptor_DecoupledClient :: Internal_PutProperty (
  1677. WmiInternalContext a_InternalContext ,
  1678. long a_Flags ,
  1679. const BSTR a_Locale ,
  1680. const BSTR a_ClassMapping ,
  1681. const BSTR a_InstanceMapping ,
  1682. const BSTR a_PropertyMapping ,
  1683. const VARIANT *a_Value
  1684. )
  1685. {
  1686. BOOL t_Impersonating = FALSE ;
  1687. IUnknown *t_OldContext = NULL ;
  1688. IServerSecurity *t_OldSecurity = NULL ;
  1689. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1690. a_InternalContext ,
  1691. t_Impersonating ,
  1692. t_OldContext ,
  1693. t_OldSecurity
  1694. ) ;
  1695. if ( SUCCEEDED ( t_Result ) )
  1696. {
  1697. t_Result = PutProperty (
  1698. a_Flags ,
  1699. a_Locale ,
  1700. a_ClassMapping ,
  1701. a_InstanceMapping ,
  1702. a_PropertyMapping ,
  1703. a_Value
  1704. ) ;
  1705. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1706. }
  1707. return t_Result ;
  1708. }
  1709. /******************************************************************************
  1710. *
  1711. * Name:
  1712. *
  1713. *
  1714. * Description:
  1715. *
  1716. *
  1717. *****************************************************************************/
  1718. HRESULT CInterceptor_DecoupledClient :: Internal_ProvideEvents (
  1719. WmiInternalContext a_InternalContext ,
  1720. IWbemObjectSink *a_Sink ,
  1721. long a_Flags
  1722. )
  1723. {
  1724. BOOL t_Impersonating = FALSE ;
  1725. IUnknown *t_OldContext = NULL ;
  1726. IServerSecurity *t_OldSecurity = NULL ;
  1727. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1728. a_InternalContext ,
  1729. t_Impersonating ,
  1730. t_OldContext ,
  1731. t_OldSecurity
  1732. ) ;
  1733. if ( SUCCEEDED ( t_Result ) )
  1734. {
  1735. t_Result = ProvideEvents (
  1736. a_Sink ,
  1737. a_Flags
  1738. ) ;
  1739. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1740. }
  1741. return t_Result ;
  1742. }
  1743. /******************************************************************************
  1744. *
  1745. * Name:
  1746. *
  1747. *
  1748. * Description:
  1749. *
  1750. *
  1751. *****************************************************************************/
  1752. HRESULT CInterceptor_DecoupledClient :: Internal_NewQuery (
  1753. WmiInternalContext a_InternalContext ,
  1754. unsigned long a_Id ,
  1755. WBEM_WSTR a_QueryLanguage ,
  1756. WBEM_WSTR a_Query
  1757. )
  1758. {
  1759. BOOL t_Impersonating = FALSE ;
  1760. IUnknown *t_OldContext = NULL ;
  1761. IServerSecurity *t_OldSecurity = NULL ;
  1762. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1763. a_InternalContext ,
  1764. t_Impersonating ,
  1765. t_OldContext ,
  1766. t_OldSecurity
  1767. ) ;
  1768. if ( SUCCEEDED ( t_Result ) )
  1769. {
  1770. t_Result = NewQuery (
  1771. a_Id ,
  1772. a_QueryLanguage ,
  1773. a_Query
  1774. ) ;
  1775. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1776. }
  1777. return t_Result ;
  1778. }
  1779. /******************************************************************************
  1780. *
  1781. * Name:
  1782. *
  1783. *
  1784. * Description:
  1785. *
  1786. *
  1787. *****************************************************************************/
  1788. HRESULT CInterceptor_DecoupledClient :: Internal_CancelQuery (
  1789. WmiInternalContext a_InternalContext ,
  1790. unsigned long a_Id
  1791. )
  1792. {
  1793. BOOL t_Impersonating = FALSE ;
  1794. IUnknown *t_OldContext = NULL ;
  1795. IServerSecurity *t_OldSecurity = NULL ;
  1796. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1797. a_InternalContext ,
  1798. t_Impersonating ,
  1799. t_OldContext ,
  1800. t_OldSecurity
  1801. ) ;
  1802. if ( SUCCEEDED ( t_Result ) )
  1803. {
  1804. t_Result = CancelQuery (
  1805. a_Id
  1806. ) ;
  1807. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1808. }
  1809. return t_Result ;
  1810. }
  1811. /******************************************************************************
  1812. *
  1813. * Name:
  1814. *
  1815. *
  1816. * Description:
  1817. *
  1818. *
  1819. *****************************************************************************/
  1820. HRESULT CInterceptor_DecoupledClient :: Internal_AccessCheck (
  1821. WmiInternalContext a_InternalContext ,
  1822. WBEM_CWSTR a_QueryLanguage ,
  1823. WBEM_CWSTR a_Query ,
  1824. long a_SidLength ,
  1825. const BYTE *a_Sid
  1826. )
  1827. {
  1828. BOOL t_Impersonating = FALSE ;
  1829. IUnknown *t_OldContext = NULL ;
  1830. IServerSecurity *t_OldSecurity = NULL ;
  1831. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1832. a_InternalContext ,
  1833. t_Impersonating ,
  1834. t_OldContext ,
  1835. t_OldSecurity
  1836. ) ;
  1837. if ( SUCCEEDED ( t_Result ) )
  1838. {
  1839. t_Result = AccessCheck (
  1840. a_QueryLanguage ,
  1841. a_Query ,
  1842. a_SidLength ,
  1843. a_Sid
  1844. ) ;
  1845. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1846. }
  1847. return t_Result ;
  1848. }
  1849. /******************************************************************************
  1850. *
  1851. * Name:
  1852. *
  1853. *
  1854. * Description:
  1855. *
  1856. *
  1857. *****************************************************************************/
  1858. HRESULT CInterceptor_DecoupledClient :: Internal_FindConsumer (
  1859. WmiInternalContext a_InternalContext ,
  1860. IWbemClassObject *a_LogicalConsumer ,
  1861. IWbemUnboundObjectSink **a_Consumer
  1862. )
  1863. {
  1864. BOOL t_Impersonating = FALSE ;
  1865. IUnknown *t_OldContext = NULL ;
  1866. IServerSecurity *t_OldSecurity = NULL ;
  1867. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1868. a_InternalContext ,
  1869. t_Impersonating ,
  1870. t_OldContext ,
  1871. t_OldSecurity
  1872. ) ;
  1873. if ( SUCCEEDED ( t_Result ) )
  1874. {
  1875. t_Result = FindConsumer (
  1876. a_LogicalConsumer ,
  1877. a_Consumer
  1878. ) ;
  1879. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1880. }
  1881. return t_Result ;
  1882. }
  1883. /******************************************************************************
  1884. *
  1885. * Name:
  1886. *
  1887. *
  1888. * Description:
  1889. *
  1890. *
  1891. *****************************************************************************/
  1892. HRESULT CInterceptor_DecoupledClient :: Internal_ValidateSubscription (
  1893. WmiInternalContext a_InternalContext ,
  1894. IWbemClassObject *a_LogicalConsumer
  1895. )
  1896. {
  1897. BOOL t_Impersonating = FALSE ;
  1898. IUnknown *t_OldContext = NULL ;
  1899. IServerSecurity *t_OldSecurity = NULL ;
  1900. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1901. a_InternalContext ,
  1902. t_Impersonating ,
  1903. t_OldContext ,
  1904. t_OldSecurity
  1905. ) ;
  1906. if ( SUCCEEDED ( t_Result ) )
  1907. {
  1908. t_Result = ValidateSubscription (
  1909. a_LogicalConsumer
  1910. ) ;
  1911. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1912. }
  1913. return t_Result ;
  1914. }
  1915. /******************************************************************************
  1916. *
  1917. * Name:
  1918. *
  1919. *
  1920. * Description:
  1921. *
  1922. *
  1923. *****************************************************************************/
  1924. HRESULT CInterceptor_DecoupledClient :: Internal_IndicateToConsumer (
  1925. WmiInternalContext a_InternalContext ,
  1926. IWbemClassObject *a_LogicalConsumer ,
  1927. long a_ObjectCount ,
  1928. IWbemClassObject **a_Objects
  1929. )
  1930. {
  1931. BOOL t_Impersonating = FALSE ;
  1932. IUnknown *t_OldContext = NULL ;
  1933. IServerSecurity *t_OldSecurity = NULL ;
  1934. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1935. a_InternalContext ,
  1936. t_Impersonating ,
  1937. t_OldContext ,
  1938. t_OldSecurity
  1939. ) ;
  1940. if ( SUCCEEDED ( t_Result ) )
  1941. {
  1942. t_Result = IndicateToConsumer (
  1943. a_LogicalConsumer ,
  1944. a_ObjectCount ,
  1945. a_Objects
  1946. ) ;
  1947. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1948. }
  1949. return t_Result ;
  1950. }
  1951. /******************************************************************************
  1952. *
  1953. * Name:
  1954. *
  1955. *
  1956. * Description:
  1957. *
  1958. *
  1959. *****************************************************************************/
  1960. HRESULT CInterceptor_DecoupledClient :: AdjustGetContext (
  1961. IWbemContext *a_Context
  1962. )
  1963. {
  1964. // See if per-property get are being used.
  1965. // ========================================
  1966. HRESULT t_Result = S_OK ;
  1967. if ( a_Context )
  1968. {
  1969. VARIANT t_Variant ;
  1970. VariantInit ( & t_Variant ) ;
  1971. t_Result = a_Context->GetValue ( L"__GET_EXTENSIONS" , 0, & t_Variant ) ;
  1972. if ( SUCCEEDED ( t_Result ) )
  1973. {
  1974. // If here, they are being used. Next we have to check and see
  1975. // if the reentrancy flag is set or not.
  1976. // =============================================================
  1977. VariantClear ( & t_Variant ) ;
  1978. t_Result = a_Context->GetValue ( L"__GET_EXT_CLIENT_REQUEST" , 0 , & t_Variant ) ;
  1979. if ( SUCCEEDED ( t_Result ) )
  1980. {
  1981. VariantClear ( & t_Variant ) ;
  1982. a_Context->DeleteValue ( L"__GET_EXT_CLIENT_REQUEST" , 0 ) ;
  1983. }
  1984. else
  1985. {
  1986. // If here, we have to clear out the get extensions.
  1987. // =================================================
  1988. a_Context->DeleteValue ( L"__GET_EXTENSIONS" , 0 ) ;
  1989. a_Context->DeleteValue ( L"__GET_EXT_CLIENT_REQUEST" , 0 ) ;
  1990. a_Context->DeleteValue ( L"__GET_EXT_KEYS_ONLY" , 0 ) ;
  1991. a_Context->DeleteValue ( L"__GET_EXT_PROPERTIES" , 0 ) ;
  1992. }
  1993. }
  1994. }
  1995. return S_OK ;
  1996. }
  1997. /******************************************************************************
  1998. *
  1999. * Name:
  2000. *
  2001. *
  2002. * Description:
  2003. *
  2004. *
  2005. *****************************************************************************/
  2006. HRESULT CInterceptor_DecoupledClient :: SetStatus (
  2007. LPWSTR a_Operation ,
  2008. LPWSTR a_Parameters ,
  2009. LPWSTR a_Description ,
  2010. HRESULT a_Result ,
  2011. IWbemObjectSink *a_Sink
  2012. )
  2013. {
  2014. return a_Sink->SetStatus ( 0 , a_Result , NULL , NULL ) ;
  2015. }
  2016. /******************************************************************************
  2017. *
  2018. * Name:
  2019. *
  2020. *
  2021. * Description:
  2022. *
  2023. *
  2024. *****************************************************************************/
  2025. HRESULT CInterceptor_DecoupledClient :: Begin_IWbemServices (
  2026. BOOL &a_Impersonating ,
  2027. IUnknown *&a_OldContext ,
  2028. IServerSecurity *&a_OldSecurity ,
  2029. BOOL &a_IsProxy ,
  2030. IWbemServices *&a_Interface ,
  2031. BOOL &a_Revert ,
  2032. IUnknown *&a_Proxy
  2033. )
  2034. {
  2035. HRESULT t_Result = S_OK ;
  2036. a_Revert = FALSE ;
  2037. a_Proxy = NULL ;
  2038. a_Impersonating = FALSE ;
  2039. a_OldContext = NULL ;
  2040. a_OldSecurity = NULL ;
  2041. switch ( m_Registration->GetHosting () )
  2042. {
  2043. case e_Hosting_WmiCore:
  2044. case e_Hosting_SharedLocalSystemHost:
  2045. case e_Hosting_SharedLocalServiceHost:
  2046. case e_Hosting_SharedNetworkServiceHost:
  2047. {
  2048. a_Interface = m_Provider_IWbemServices ;
  2049. a_IsProxy = FALSE ;
  2050. }
  2051. break ;
  2052. default:
  2053. {
  2054. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2055. if ( SUCCEEDED ( t_Result ) )
  2056. {
  2057. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemServices , IID_IWbemServices , m_Provider_IWbemServices , a_Proxy , a_Revert ) ;
  2058. if ( t_Result == WBEM_E_NOT_FOUND )
  2059. {
  2060. a_Interface = m_Provider_IWbemServices ;
  2061. a_IsProxy = FALSE ;
  2062. t_Result = S_OK ;
  2063. }
  2064. else
  2065. {
  2066. if ( SUCCEEDED ( t_Result ) )
  2067. {
  2068. a_IsProxy = TRUE ;
  2069. a_Interface = ( IWbemServices * ) a_Proxy ;
  2070. // Set cloaking on the proxy
  2071. // =========================
  2072. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  2073. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  2074. a_Interface ,
  2075. RPC_C_AUTHN_LEVEL_DEFAULT ,
  2076. t_ImpersonationLevel
  2077. ) ;
  2078. if ( SUCCEEDED ( t_Result ) )
  2079. {
  2080. t_Result = CoImpersonateClient () ;
  2081. if ( SUCCEEDED ( t_Result ) )
  2082. {
  2083. }
  2084. else
  2085. {
  2086. t_Result = WBEM_E_ACCESS_DENIED ;
  2087. }
  2088. }
  2089. if ( FAILED ( t_Result ) )
  2090. {
  2091. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  2092. m_ProxyContainer ,
  2093. ProxyIndex_IWbemServices ,
  2094. a_Proxy ,
  2095. a_Revert
  2096. ) ;
  2097. }
  2098. }
  2099. }
  2100. if ( FAILED ( t_Result ) )
  2101. {
  2102. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2103. }
  2104. }
  2105. }
  2106. break ;
  2107. }
  2108. return t_Result ;
  2109. }
  2110. /******************************************************************************
  2111. *
  2112. * Name:
  2113. *
  2114. *
  2115. * Description:
  2116. *
  2117. *
  2118. *****************************************************************************/
  2119. HRESULT CInterceptor_DecoupledClient :: End_IWbemServices (
  2120. BOOL a_Impersonating ,
  2121. IUnknown *a_OldContext ,
  2122. IServerSecurity *a_OldSecurity ,
  2123. BOOL a_IsProxy ,
  2124. IWbemServices *a_Interface ,
  2125. BOOL a_Revert ,
  2126. IUnknown *a_Proxy
  2127. )
  2128. {
  2129. CoRevertToSelf () ;
  2130. if ( a_Proxy )
  2131. {
  2132. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  2133. m_ProxyContainer ,
  2134. ProxyIndex_IWbemServices ,
  2135. a_Proxy ,
  2136. a_Revert
  2137. ) ;
  2138. }
  2139. switch ( m_Registration->GetHosting () )
  2140. {
  2141. case e_Hosting_WmiCore:
  2142. case e_Hosting_SharedLocalSystemHost:
  2143. case e_Hosting_SharedLocalServiceHost:
  2144. case e_Hosting_SharedNetworkServiceHost:
  2145. {
  2146. }
  2147. break ;
  2148. default:
  2149. {
  2150. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2151. }
  2152. break ;
  2153. }
  2154. return S_OK ;
  2155. }
  2156. /******************************************************************************
  2157. *
  2158. * Name:
  2159. *
  2160. *
  2161. * Description:
  2162. *
  2163. *
  2164. *****************************************************************************/
  2165. HRESULT CInterceptor_DecoupledClient::OpenNamespace (
  2166. const BSTR a_ObjectPath ,
  2167. long a_Flags ,
  2168. IWbemContext *a_Context ,
  2169. IWbemServices **a_NamespaceService ,
  2170. IWbemCallResult **a_CallResult
  2171. )
  2172. {
  2173. return WBEM_E_NOT_AVAILABLE ;
  2174. }
  2175. /******************************************************************************
  2176. *
  2177. * Name:
  2178. *
  2179. *
  2180. * Description:
  2181. *
  2182. *
  2183. *****************************************************************************/
  2184. HRESULT CInterceptor_DecoupledClient :: CancelAsyncCall (
  2185. IWbemObjectSink *a_Sink
  2186. )
  2187. {
  2188. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2189. if ( m_Provider_IWbemServices )
  2190. {
  2191. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2192. Lock () ;
  2193. WmiStatusCode t_StatusCode = Find (
  2194. a_Sink ,
  2195. t_Iterator
  2196. ) ;
  2197. if ( t_StatusCode == e_StatusCode_Success )
  2198. {
  2199. ObjectSinkContainerElement *t_Element = t_Iterator.GetElement () ;
  2200. UnLock () ;
  2201. IWbemObjectSink *t_ObjectSink = NULL ;
  2202. t_Result = t_Element->QueryInterface ( IID_IWbemObjectSink , ( void ** ) & t_ObjectSink ) ;
  2203. if ( SUCCEEDED ( t_Result ) )
  2204. {
  2205. BOOL t_Impersonating ;
  2206. IUnknown *t_OldContext ;
  2207. IServerSecurity *t_OldSecurity ;
  2208. BOOL t_IsProxy ;
  2209. IWbemServices *t_Interface ;
  2210. BOOL t_Revert ;
  2211. IUnknown *t_Proxy ;
  2212. t_Result = Begin_IWbemServices (
  2213. t_Impersonating ,
  2214. t_OldContext ,
  2215. t_OldSecurity ,
  2216. t_IsProxy ,
  2217. t_Interface ,
  2218. t_Revert ,
  2219. t_Proxy
  2220. ) ;
  2221. if ( SUCCEEDED ( t_Result ) )
  2222. {
  2223. t_Result = t_Interface->CancelAsyncCall (
  2224. t_ObjectSink
  2225. ) ;
  2226. End_IWbemServices (
  2227. t_Impersonating ,
  2228. t_OldContext ,
  2229. t_OldSecurity ,
  2230. t_IsProxy ,
  2231. t_Interface ,
  2232. t_Revert ,
  2233. t_Proxy
  2234. ) ;
  2235. }
  2236. t_ObjectSink->Release () ;
  2237. }
  2238. IWbemShutdown *t_Shutdown = NULL ;
  2239. HRESULT t_TempResult = t_Element->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  2240. if ( SUCCEEDED ( t_TempResult ) )
  2241. {
  2242. t_TempResult = t_Shutdown->Shutdown (
  2243. 0 ,
  2244. 0 ,
  2245. NULL
  2246. ) ;
  2247. t_Shutdown->Release () ;
  2248. }
  2249. t_Element->Release () ;
  2250. }
  2251. else
  2252. {
  2253. UnLock () ;
  2254. t_Result = WBEM_E_NOT_FOUND ;
  2255. }
  2256. }
  2257. return t_Result ;
  2258. }
  2259. /******************************************************************************
  2260. *
  2261. * Name:
  2262. *
  2263. *
  2264. * Description:
  2265. *
  2266. *
  2267. *****************************************************************************/
  2268. HRESULT CInterceptor_DecoupledClient :: QueryObjectSink (
  2269. long a_Flags ,
  2270. IWbemObjectSink **a_Sink
  2271. )
  2272. {
  2273. return WBEM_E_NOT_AVAILABLE ;
  2274. }
  2275. /******************************************************************************
  2276. *
  2277. * Name:
  2278. *
  2279. *
  2280. * Description:
  2281. *
  2282. *
  2283. *****************************************************************************/
  2284. HRESULT CInterceptor_DecoupledClient :: GetObject (
  2285. const BSTR a_ObjectPath ,
  2286. long a_Flags ,
  2287. IWbemContext *a_Context ,
  2288. IWbemClassObject **a_Object ,
  2289. IWbemCallResult **a_CallResult
  2290. )
  2291. {
  2292. return WBEM_E_NOT_AVAILABLE ;
  2293. }
  2294. /******************************************************************************
  2295. *
  2296. * Name:
  2297. *
  2298. *
  2299. * Description:
  2300. *
  2301. *
  2302. *****************************************************************************/
  2303. HRESULT CInterceptor_DecoupledClient :: Helper_GetObjectAsync (
  2304. BOOL a_IsProxy ,
  2305. const BSTR a_ObjectPath ,
  2306. long a_Flags ,
  2307. IWbemContext *a_Context ,
  2308. IWbemObjectSink *a_Sink ,
  2309. IWbemServices *a_Service
  2310. )
  2311. {
  2312. HRESULT t_Result = S_OK ;
  2313. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  2314. IWbemContext *t_ContextCopy = NULL ;
  2315. if ( a_Context )
  2316. {
  2317. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  2318. AdjustGetContext ( t_ContextCopy ) ;
  2319. }
  2320. else
  2321. {
  2322. t_Result = S_OK ;
  2323. }
  2324. if ( SUCCEEDED ( t_Result ) )
  2325. {
  2326. ULONG t_Dependant = 1 ;
  2327. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  2328. m_Allocator ,
  2329. a_Sink ,
  2330. ( IWbemServices * ) this ,
  2331. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2332. FALSE
  2333. ) ;
  2334. if ( t_Sink )
  2335. {
  2336. t_Sink->AddRef () ;
  2337. t_Result = t_Sink->SinkInitialize () ;
  2338. if ( SUCCEEDED ( t_Result ) )
  2339. {
  2340. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2341. Lock () ;
  2342. WmiStatusCode t_StatusCode = Insert (
  2343. *t_Sink ,
  2344. t_Iterator
  2345. ) ;
  2346. if ( t_StatusCode == e_StatusCode_Success )
  2347. {
  2348. UnLock () ;
  2349. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  2350. {
  2351. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  2352. }
  2353. if ( a_IsProxy )
  2354. {
  2355. t_Result = CoImpersonateClient () ;
  2356. }
  2357. else
  2358. {
  2359. t_Result = S_OK ;
  2360. }
  2361. if ( SUCCEEDED ( t_Result ) )
  2362. {
  2363. Increment_ProviderOperation_GetObjectAsync () ;
  2364. try
  2365. {
  2366. t_Result = a_Service->GetObjectAsync (
  2367. a_ObjectPath ,
  2368. a_Flags ,
  2369. t_ContextCopy ,
  2370. t_Sink
  2371. ) ;
  2372. }
  2373. catch ( ... )
  2374. {
  2375. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2376. }
  2377. CoRevertToSelf () ;
  2378. }
  2379. else
  2380. {
  2381. t_Result = WBEM_E_ACCESS_DENIED ;
  2382. }
  2383. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  2384. {
  2385. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  2386. Increment_ProviderOperation_GetObjectAsync () ;
  2387. if ( a_IsProxy )
  2388. {
  2389. t_Result = CoImpersonateClient () ;
  2390. }
  2391. else
  2392. {
  2393. t_Result = S_OK ;
  2394. }
  2395. if ( SUCCEEDED ( t_Result ) )
  2396. {
  2397. try
  2398. {
  2399. t_Result = a_Service->GetObjectAsync (
  2400. a_ObjectPath ,
  2401. a_Flags ,
  2402. t_ContextCopy ,
  2403. t_Sink
  2404. ) ;
  2405. }
  2406. catch ( ... )
  2407. {
  2408. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2409. }
  2410. CoRevertToSelf () ;
  2411. }
  2412. }
  2413. }
  2414. else
  2415. {
  2416. UnLock () ;
  2417. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2418. }
  2419. if ( FAILED ( t_Result ) )
  2420. {
  2421. HRESULT t_TempResult = SetStatus ( L"GetObjectAsync" , NULL , NULL , t_Result , t_Sink ) ;
  2422. }
  2423. }
  2424. t_Sink->Release () ;
  2425. }
  2426. else
  2427. {
  2428. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2429. }
  2430. }
  2431. else
  2432. {
  2433. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2434. }
  2435. if ( t_ContextCopy )
  2436. {
  2437. t_ContextCopy->Release () ;
  2438. }
  2439. return t_Result ;
  2440. }
  2441. /******************************************************************************
  2442. *
  2443. * Name:
  2444. *
  2445. *
  2446. * Description:
  2447. *
  2448. *
  2449. *****************************************************************************/
  2450. HRESULT CInterceptor_DecoupledClient :: GetObjectAsync (
  2451. const BSTR a_ObjectPath ,
  2452. long a_Flags ,
  2453. IWbemContext *a_Context ,
  2454. IWbemObjectSink *a_Sink
  2455. )
  2456. {
  2457. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2458. if ( m_Provider_IWbemServices )
  2459. {
  2460. if ( m_Registration->GetInstanceProviderRegistration ().SupportsGet () || m_Registration->GetClassProviderRegistration ().SupportsGet () )
  2461. {
  2462. BOOL t_Impersonating ;
  2463. IUnknown *t_OldContext ;
  2464. IServerSecurity *t_OldSecurity ;
  2465. BOOL t_IsProxy ;
  2466. IWbemServices *t_Interface ;
  2467. BOOL t_Revert ;
  2468. IUnknown *t_Proxy ;
  2469. t_Result = Begin_IWbemServices (
  2470. t_Impersonating ,
  2471. t_OldContext ,
  2472. t_OldSecurity ,
  2473. t_IsProxy ,
  2474. t_Interface ,
  2475. t_Revert ,
  2476. t_Proxy
  2477. ) ;
  2478. if ( SUCCEEDED ( t_Result ) )
  2479. {
  2480. t_Result = Helper_GetObjectAsync (
  2481. t_IsProxy ,
  2482. a_ObjectPath ,
  2483. a_Flags ,
  2484. a_Context ,
  2485. a_Sink ,
  2486. t_Interface
  2487. ) ;
  2488. End_IWbemServices (
  2489. t_Impersonating ,
  2490. t_OldContext ,
  2491. t_OldSecurity ,
  2492. t_IsProxy ,
  2493. t_Interface ,
  2494. t_Revert ,
  2495. t_Proxy
  2496. ) ;
  2497. }
  2498. }
  2499. }
  2500. return t_Result ;
  2501. }
  2502. /******************************************************************************
  2503. *
  2504. * Name:
  2505. *
  2506. *
  2507. * Description:
  2508. *
  2509. *
  2510. *****************************************************************************/
  2511. HRESULT CInterceptor_DecoupledClient :: PutClass (
  2512. IWbemClassObject *a_Object ,
  2513. long a_Flags ,
  2514. IWbemContext *a_Context ,
  2515. IWbemCallResult **a_CallResult
  2516. )
  2517. {
  2518. return WBEM_E_NOT_AVAILABLE ;
  2519. }
  2520. /******************************************************************************
  2521. *
  2522. * Name:
  2523. *
  2524. *
  2525. * Description:
  2526. *
  2527. *
  2528. *****************************************************************************/
  2529. HRESULT CInterceptor_DecoupledClient :: Helper_PutClassAsync (
  2530. BOOL a_IsProxy ,
  2531. IWbemClassObject *a_Object ,
  2532. long a_Flags ,
  2533. IWbemContext FAR *a_Context ,
  2534. IWbemObjectSink *a_Sink ,
  2535. IWbemServices *a_Service
  2536. )
  2537. {
  2538. HRESULT t_Result = S_OK ;
  2539. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  2540. IWbemContext *t_ContextCopy = NULL ;
  2541. if ( a_Context )
  2542. {
  2543. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  2544. }
  2545. else
  2546. {
  2547. t_Result = S_OK ;
  2548. }
  2549. if ( SUCCEEDED ( t_Result ) )
  2550. {
  2551. ULONG t_Dependant = 1 ;
  2552. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  2553. m_Allocator ,
  2554. a_Sink ,
  2555. ( IWbemServices * ) this ,
  2556. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2557. FALSE
  2558. ) ;
  2559. if ( t_Sink )
  2560. {
  2561. t_Sink->AddRef () ;
  2562. t_Result = t_Sink->SinkInitialize () ;
  2563. if ( SUCCEEDED ( t_Result ) )
  2564. {
  2565. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2566. Lock () ;
  2567. WmiStatusCode t_StatusCode = Insert (
  2568. *t_Sink ,
  2569. t_Iterator
  2570. ) ;
  2571. if ( t_StatusCode == e_StatusCode_Success )
  2572. {
  2573. UnLock () ;
  2574. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  2575. {
  2576. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  2577. }
  2578. if ( a_IsProxy )
  2579. {
  2580. t_Result = CoImpersonateClient () ;
  2581. }
  2582. else
  2583. {
  2584. t_Result = S_OK ;
  2585. }
  2586. if ( SUCCEEDED ( t_Result ) )
  2587. {
  2588. Increment_ProviderOperation_PutClassAsync () ;
  2589. try
  2590. {
  2591. t_Result = a_Service->PutClassAsync (
  2592. a_Object ,
  2593. a_Flags ,
  2594. t_ContextCopy ,
  2595. t_Sink
  2596. ) ;
  2597. }
  2598. catch ( ... )
  2599. {
  2600. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2601. }
  2602. CoRevertToSelf () ;
  2603. }
  2604. else
  2605. {
  2606. t_Result = WBEM_E_ACCESS_DENIED ;
  2607. }
  2608. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  2609. {
  2610. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  2611. if ( a_IsProxy )
  2612. {
  2613. t_Result = CoImpersonateClient () ;
  2614. }
  2615. else
  2616. {
  2617. t_Result = S_OK ;
  2618. }
  2619. if ( SUCCEEDED ( t_Result ) )
  2620. {
  2621. Increment_ProviderOperation_PutClassAsync () ;
  2622. try
  2623. {
  2624. t_Result = a_Service->PutClassAsync (
  2625. a_Object ,
  2626. a_Flags ,
  2627. t_ContextCopy ,
  2628. t_Sink
  2629. ) ;
  2630. }
  2631. catch ( ... )
  2632. {
  2633. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2634. }
  2635. CoRevertToSelf () ;
  2636. }
  2637. else
  2638. {
  2639. t_Result = WBEM_E_ACCESS_DENIED ;
  2640. }
  2641. }
  2642. }
  2643. else
  2644. {
  2645. UnLock () ;
  2646. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2647. }
  2648. if ( FAILED ( t_Result ) )
  2649. {
  2650. HRESULT t_TempResult = SetStatus ( L"PutClassAsync" , NULL , NULL , t_Result , t_Sink ) ;
  2651. }
  2652. }
  2653. t_Sink->Release () ;
  2654. }
  2655. else
  2656. {
  2657. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2658. }
  2659. }
  2660. else
  2661. {
  2662. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2663. }
  2664. if ( t_ContextCopy )
  2665. {
  2666. t_ContextCopy->Release () ;
  2667. }
  2668. return t_Result ;
  2669. }
  2670. /******************************************************************************
  2671. *
  2672. * Name:
  2673. *
  2674. *
  2675. * Description:
  2676. *
  2677. *
  2678. *****************************************************************************/
  2679. HRESULT CInterceptor_DecoupledClient :: PutClassAsync (
  2680. IWbemClassObject *a_Object ,
  2681. long a_Flags ,
  2682. IWbemContext *a_Context ,
  2683. IWbemObjectSink *a_Sink
  2684. )
  2685. {
  2686. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2687. if ( m_Provider_IWbemServices )
  2688. {
  2689. if ( m_Registration->GetClassProviderRegistration ().SupportsPut () )
  2690. {
  2691. BOOL t_Impersonating ;
  2692. IUnknown *t_OldContext ;
  2693. IServerSecurity *t_OldSecurity ;
  2694. BOOL t_IsProxy ;
  2695. IWbemServices *t_Interface ;
  2696. BOOL t_Revert ;
  2697. IUnknown *t_Proxy ;
  2698. t_Result = Begin_IWbemServices (
  2699. t_Impersonating ,
  2700. t_OldContext ,
  2701. t_OldSecurity ,
  2702. t_IsProxy ,
  2703. t_Interface ,
  2704. t_Revert ,
  2705. t_Proxy
  2706. ) ;
  2707. if ( SUCCEEDED ( t_Result ) )
  2708. {
  2709. t_Result = Helper_PutClassAsync (
  2710. t_IsProxy ,
  2711. a_Object ,
  2712. a_Flags ,
  2713. a_Context ,
  2714. a_Sink ,
  2715. t_Interface
  2716. ) ;
  2717. End_IWbemServices (
  2718. t_Impersonating ,
  2719. t_OldContext ,
  2720. t_OldSecurity ,
  2721. t_IsProxy ,
  2722. t_Interface ,
  2723. t_Revert ,
  2724. t_Proxy
  2725. ) ;
  2726. }
  2727. }
  2728. }
  2729. return t_Result ;
  2730. }
  2731. /******************************************************************************
  2732. *
  2733. * Name:
  2734. *
  2735. *
  2736. * Description:
  2737. *
  2738. *
  2739. *****************************************************************************/
  2740. HRESULT CInterceptor_DecoupledClient :: DeleteClass (
  2741. const BSTR a_Class ,
  2742. long a_Flags ,
  2743. IWbemContext *a_Context ,
  2744. IWbemCallResult **a_CallResult
  2745. )
  2746. {
  2747. return WBEM_E_NOT_AVAILABLE ;
  2748. }
  2749. /******************************************************************************
  2750. *
  2751. * Name:
  2752. *
  2753. *
  2754. * Description:
  2755. *
  2756. *
  2757. *****************************************************************************/
  2758. HRESULT CInterceptor_DecoupledClient :: Helper_DeleteClassAsync (
  2759. BOOL a_IsProxy ,
  2760. const BSTR a_Class ,
  2761. long a_Flags ,
  2762. IWbemContext FAR *a_Context ,
  2763. IWbemObjectSink *a_Sink ,
  2764. IWbemServices *a_Service
  2765. )
  2766. {
  2767. HRESULT t_Result = S_OK ;
  2768. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  2769. IWbemContext *t_ContextCopy = NULL ;
  2770. if ( a_Context )
  2771. {
  2772. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  2773. }
  2774. else
  2775. {
  2776. t_Result = S_OK ;
  2777. }
  2778. if ( SUCCEEDED ( t_Result ) )
  2779. {
  2780. ULONG t_Dependant = 1 ;
  2781. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  2782. m_Allocator ,
  2783. a_Sink ,
  2784. ( IWbemServices * ) this ,
  2785. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2786. FALSE
  2787. ) ;
  2788. if ( t_Sink )
  2789. {
  2790. t_Sink->AddRef () ;
  2791. t_Result = t_Sink->SinkInitialize () ;
  2792. if ( SUCCEEDED ( t_Result ) )
  2793. {
  2794. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2795. Lock () ;
  2796. WmiStatusCode t_StatusCode = Insert (
  2797. *t_Sink ,
  2798. t_Iterator
  2799. ) ;
  2800. if ( t_StatusCode == e_StatusCode_Success )
  2801. {
  2802. UnLock () ;
  2803. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  2804. {
  2805. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  2806. }
  2807. if ( a_IsProxy )
  2808. {
  2809. t_Result = CoImpersonateClient () ;
  2810. }
  2811. else
  2812. {
  2813. t_Result = S_OK ;
  2814. }
  2815. if ( SUCCEEDED ( t_Result ) )
  2816. {
  2817. Increment_ProviderOperation_DeleteClassAsync () ;
  2818. try
  2819. {
  2820. t_Result = a_Service->DeleteClassAsync (
  2821. a_Class ,
  2822. a_Flags ,
  2823. t_ContextCopy ,
  2824. t_Sink
  2825. ) ;
  2826. }
  2827. catch ( ... )
  2828. {
  2829. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2830. }
  2831. CoRevertToSelf () ;
  2832. }
  2833. else
  2834. {
  2835. t_Result = WBEM_E_ACCESS_DENIED ;
  2836. }
  2837. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  2838. {
  2839. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  2840. if ( a_IsProxy )
  2841. {
  2842. t_Result = CoImpersonateClient () ;
  2843. }
  2844. else
  2845. {
  2846. t_Result = S_OK ;
  2847. }
  2848. if ( SUCCEEDED ( t_Result ) )
  2849. {
  2850. Increment_ProviderOperation_DeleteClassAsync () ;
  2851. try
  2852. {
  2853. t_Result = a_Service->DeleteClassAsync (
  2854. a_Class ,
  2855. a_Flags ,
  2856. t_ContextCopy ,
  2857. t_Sink
  2858. ) ;
  2859. }
  2860. catch ( ... )
  2861. {
  2862. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2863. }
  2864. CoRevertToSelf () ;
  2865. }
  2866. else
  2867. {
  2868. t_Result = WBEM_E_ACCESS_DENIED ;
  2869. }
  2870. }
  2871. }
  2872. else
  2873. {
  2874. UnLock () ;
  2875. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2876. }
  2877. if ( FAILED ( t_Result ) )
  2878. {
  2879. HRESULT t_TempResult = SetStatus ( L"DeleteClassAsync" , NULL , NULL , t_Result , t_Sink ) ;
  2880. }
  2881. }
  2882. t_Sink->Release () ;
  2883. }
  2884. else
  2885. {
  2886. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2887. }
  2888. }
  2889. else
  2890. {
  2891. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2892. }
  2893. if ( t_ContextCopy )
  2894. {
  2895. t_ContextCopy->Release () ;
  2896. }
  2897. return t_Result ;
  2898. }
  2899. /******************************************************************************
  2900. *
  2901. * Name:
  2902. *
  2903. *
  2904. * Description:
  2905. *
  2906. *
  2907. *****************************************************************************/
  2908. HRESULT CInterceptor_DecoupledClient :: DeleteClassAsync (
  2909. const BSTR a_Class ,
  2910. long a_Flags ,
  2911. IWbemContext *a_Context ,
  2912. IWbemObjectSink *a_Sink
  2913. )
  2914. {
  2915. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2916. if ( m_Provider_IWbemServices )
  2917. {
  2918. if ( m_Registration->GetClassProviderRegistration ().SupportsDelete () )
  2919. {
  2920. BOOL t_Impersonating ;
  2921. IUnknown *t_OldContext ;
  2922. IServerSecurity *t_OldSecurity ;
  2923. BOOL t_IsProxy ;
  2924. IWbemServices *t_Interface ;
  2925. BOOL t_Revert ;
  2926. IUnknown *t_Proxy ;
  2927. t_Result = Begin_IWbemServices (
  2928. t_Impersonating ,
  2929. t_OldContext ,
  2930. t_OldSecurity ,
  2931. t_IsProxy ,
  2932. t_Interface ,
  2933. t_Revert ,
  2934. t_Proxy
  2935. ) ;
  2936. if ( SUCCEEDED ( t_Result ) )
  2937. {
  2938. t_Result = Helper_DeleteClassAsync (
  2939. t_IsProxy ,
  2940. a_Class ,
  2941. a_Flags ,
  2942. a_Context ,
  2943. a_Sink ,
  2944. t_Interface
  2945. ) ;
  2946. End_IWbemServices (
  2947. t_Impersonating ,
  2948. t_OldContext ,
  2949. t_OldSecurity ,
  2950. t_IsProxy ,
  2951. t_Interface ,
  2952. t_Revert ,
  2953. t_Proxy
  2954. ) ;
  2955. }
  2956. }
  2957. }
  2958. return t_Result ;
  2959. }
  2960. /******************************************************************************
  2961. *
  2962. * Name:
  2963. *
  2964. *
  2965. * Description:
  2966. *
  2967. *
  2968. *****************************************************************************/
  2969. HRESULT CInterceptor_DecoupledClient :: CreateClassEnum (
  2970. const BSTR a_Superclass ,
  2971. long a_Flags,
  2972. IWbemContext *a_Context ,
  2973. IEnumWbemClassObject **a_Enum
  2974. )
  2975. {
  2976. return WBEM_E_NOT_AVAILABLE ;
  2977. }
  2978. /******************************************************************************
  2979. *
  2980. * Name:
  2981. *
  2982. *
  2983. * Description:
  2984. *
  2985. *
  2986. *****************************************************************************/
  2987. HRESULT CInterceptor_DecoupledClient :: Helper_CreateClassEnumAsync (
  2988. BOOL a_IsProxy ,
  2989. const BSTR a_SuperClass ,
  2990. long a_Flags ,
  2991. IWbemContext FAR *a_Context ,
  2992. IWbemObjectSink *a_Sink ,
  2993. IWbemServices *a_Service
  2994. )
  2995. {
  2996. HRESULT t_Result = S_OK ;
  2997. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  2998. IWbemContext *t_ContextCopy = NULL ;
  2999. if ( a_Context )
  3000. {
  3001. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3002. }
  3003. else
  3004. {
  3005. t_Result = S_OK ;
  3006. }
  3007. if ( SUCCEEDED ( t_Result ) )
  3008. {
  3009. ULONG t_Dependant = 1 ;
  3010. CDecoupled_Batching_IWbemSyncObjectSink *t_Sink = new CDecoupled_Batching_IWbemSyncObjectSink (
  3011. m_Allocator ,
  3012. a_Sink ,
  3013. ( IWbemServices * ) this ,
  3014. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3015. FALSE
  3016. ) ;
  3017. if ( t_Sink )
  3018. {
  3019. t_Sink->AddRef () ;
  3020. t_Result = t_Sink->SinkInitialize () ;
  3021. if ( SUCCEEDED ( t_Result ) )
  3022. {
  3023. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3024. Lock () ;
  3025. WmiStatusCode t_StatusCode = Insert (
  3026. *t_Sink ,
  3027. t_Iterator
  3028. ) ;
  3029. if ( t_StatusCode == e_StatusCode_Success )
  3030. {
  3031. UnLock () ;
  3032. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3033. {
  3034. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3035. }
  3036. if ( a_IsProxy )
  3037. {
  3038. t_Result = CoImpersonateClient () ;
  3039. }
  3040. else
  3041. {
  3042. t_Result = S_OK ;
  3043. }
  3044. if ( SUCCEEDED ( t_Result ) )
  3045. {
  3046. Increment_ProviderOperation_CreateClassEnumAsync () ;
  3047. try
  3048. {
  3049. t_Result = a_Service->CreateClassEnumAsync (
  3050. a_SuperClass ,
  3051. a_Flags ,
  3052. t_ContextCopy ,
  3053. t_Sink
  3054. ) ;
  3055. }
  3056. catch ( ... )
  3057. {
  3058. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3059. }
  3060. CoRevertToSelf () ;
  3061. }
  3062. else
  3063. {
  3064. t_Result = WBEM_E_ACCESS_DENIED ;
  3065. }
  3066. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3067. {
  3068. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3069. if ( a_IsProxy )
  3070. {
  3071. t_Result = CoImpersonateClient () ;
  3072. }
  3073. else
  3074. {
  3075. t_Result = S_OK ;
  3076. }
  3077. if ( SUCCEEDED ( t_Result ) )
  3078. {
  3079. Increment_ProviderOperation_CreateClassEnumAsync () ;
  3080. try
  3081. {
  3082. t_Result = a_Service->CreateClassEnumAsync (
  3083. a_SuperClass ,
  3084. a_Flags ,
  3085. t_ContextCopy ,
  3086. t_Sink
  3087. ) ;
  3088. }
  3089. catch ( ... )
  3090. {
  3091. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3092. }
  3093. CoRevertToSelf () ;
  3094. }
  3095. else
  3096. {
  3097. t_Result = WBEM_E_ACCESS_DENIED ;
  3098. }
  3099. }
  3100. }
  3101. else
  3102. {
  3103. UnLock () ;
  3104. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3105. }
  3106. if ( FAILED ( t_Result ) )
  3107. {
  3108. HRESULT t_TempResult = SetStatus ( L"CreateClassEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3109. }
  3110. }
  3111. t_Sink->Release () ;
  3112. }
  3113. else
  3114. {
  3115. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3116. }
  3117. }
  3118. else
  3119. {
  3120. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3121. }
  3122. if ( t_ContextCopy )
  3123. {
  3124. t_ContextCopy->Release () ;
  3125. }
  3126. return t_Result ;
  3127. }
  3128. /******************************************************************************
  3129. *
  3130. * Name:
  3131. *
  3132. *
  3133. * Description:
  3134. *
  3135. *
  3136. *****************************************************************************/
  3137. HRESULT CInterceptor_DecoupledClient :: CreateClassEnumAsync (
  3138. const BSTR a_SuperClass ,
  3139. long a_Flags ,
  3140. IWbemContext *a_Context ,
  3141. IWbemObjectSink *a_Sink
  3142. )
  3143. {
  3144. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3145. if ( m_Provider_IWbemServices )
  3146. {
  3147. if ( m_Registration->GetClassProviderRegistration ().SupportsEnumeration () )
  3148. {
  3149. BOOL t_Impersonating ;
  3150. IUnknown *t_OldContext ;
  3151. IServerSecurity *t_OldSecurity ;
  3152. BOOL t_IsProxy ;
  3153. IWbemServices *t_Interface ;
  3154. BOOL t_Revert ;
  3155. IUnknown *t_Proxy ;
  3156. t_Result = Begin_IWbemServices (
  3157. t_Impersonating ,
  3158. t_OldContext ,
  3159. t_OldSecurity ,
  3160. t_IsProxy ,
  3161. t_Interface ,
  3162. t_Revert ,
  3163. t_Proxy
  3164. ) ;
  3165. if ( SUCCEEDED ( t_Result ) )
  3166. {
  3167. t_Result = Helper_CreateClassEnumAsync (
  3168. t_IsProxy ,
  3169. a_SuperClass ,
  3170. a_Flags ,
  3171. a_Context ,
  3172. a_Sink ,
  3173. t_Interface
  3174. ) ;
  3175. End_IWbemServices (
  3176. t_Impersonating ,
  3177. t_OldContext ,
  3178. t_OldSecurity ,
  3179. t_IsProxy ,
  3180. t_Interface ,
  3181. t_Revert ,
  3182. t_Proxy
  3183. ) ;
  3184. }
  3185. }
  3186. }
  3187. return t_Result ;
  3188. }
  3189. /******************************************************************************
  3190. *
  3191. * Name:
  3192. *
  3193. *
  3194. * Description:
  3195. *
  3196. *
  3197. *****************************************************************************/
  3198. HRESULT CInterceptor_DecoupledClient :: PutInstance (
  3199. IWbemClassObject *a_Instance ,
  3200. long a_Flags ,
  3201. IWbemContext *a_Context ,
  3202. IWbemCallResult **a_CallResult
  3203. )
  3204. {
  3205. return WBEM_E_NOT_AVAILABLE ;
  3206. }
  3207. /******************************************************************************
  3208. *
  3209. * Name:
  3210. *
  3211. *
  3212. * Description:
  3213. *
  3214. *
  3215. *****************************************************************************/
  3216. HRESULT CInterceptor_DecoupledClient :: Helper_PutInstanceAsync (
  3217. BOOL a_IsProxy ,
  3218. IWbemClassObject *a_Instance ,
  3219. long a_Flags ,
  3220. IWbemContext FAR *a_Context ,
  3221. IWbemObjectSink *a_Sink ,
  3222. IWbemServices *a_Service
  3223. )
  3224. {
  3225. HRESULT t_Result = S_OK ;
  3226. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3227. IWbemContext *t_ContextCopy = NULL ;
  3228. if ( a_Context )
  3229. {
  3230. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3231. }
  3232. else
  3233. {
  3234. t_Result = S_OK ;
  3235. }
  3236. if ( SUCCEEDED ( t_Result ) )
  3237. {
  3238. ULONG t_Dependant = 1 ;
  3239. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  3240. m_Allocator ,
  3241. a_Sink ,
  3242. ( IWbemServices * ) this ,
  3243. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3244. FALSE
  3245. ) ;
  3246. if ( t_Sink )
  3247. {
  3248. t_Sink->AddRef () ;
  3249. t_Result = t_Sink->SinkInitialize () ;
  3250. if ( SUCCEEDED ( t_Result ) )
  3251. {
  3252. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3253. Lock () ;
  3254. WmiStatusCode t_StatusCode = Insert (
  3255. *t_Sink ,
  3256. t_Iterator
  3257. ) ;
  3258. if ( t_StatusCode == e_StatusCode_Success )
  3259. {
  3260. UnLock () ;
  3261. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3262. {
  3263. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3264. }
  3265. if ( a_IsProxy )
  3266. {
  3267. t_Result = CoImpersonateClient () ;
  3268. }
  3269. else
  3270. {
  3271. t_Result = S_OK ;
  3272. }
  3273. if ( SUCCEEDED ( t_Result ) )
  3274. {
  3275. Increment_ProviderOperation_PutInstanceAsync () ;
  3276. try
  3277. {
  3278. t_Result = a_Service->PutInstanceAsync (
  3279. a_Instance ,
  3280. a_Flags ,
  3281. t_ContextCopy ,
  3282. t_Sink
  3283. ) ;
  3284. }
  3285. catch ( ... )
  3286. {
  3287. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3288. }
  3289. CoRevertToSelf () ;
  3290. }
  3291. else
  3292. {
  3293. t_Result = WBEM_E_ACCESS_DENIED ;
  3294. }
  3295. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3296. {
  3297. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3298. if ( a_IsProxy )
  3299. {
  3300. t_Result = CoImpersonateClient () ;
  3301. }
  3302. else
  3303. {
  3304. t_Result = S_OK ;
  3305. }
  3306. if ( SUCCEEDED ( t_Result ) )
  3307. {
  3308. Increment_ProviderOperation_PutInstanceAsync () ;
  3309. try
  3310. {
  3311. t_Result = a_Service->PutInstanceAsync (
  3312. a_Instance ,
  3313. a_Flags ,
  3314. t_ContextCopy ,
  3315. t_Sink
  3316. ) ;
  3317. }
  3318. catch ( ... )
  3319. {
  3320. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3321. }
  3322. CoRevertToSelf () ;
  3323. }
  3324. else
  3325. {
  3326. t_Result = WBEM_E_ACCESS_DENIED ;
  3327. }
  3328. }
  3329. }
  3330. else
  3331. {
  3332. UnLock () ;
  3333. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3334. }
  3335. if ( FAILED ( t_Result ) )
  3336. {
  3337. HRESULT t_TempResult = SetStatus ( L"PutInstanceAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3338. }
  3339. }
  3340. t_Sink->Release () ;
  3341. }
  3342. else
  3343. {
  3344. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3345. }
  3346. }
  3347. else
  3348. {
  3349. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3350. }
  3351. if ( t_ContextCopy )
  3352. {
  3353. t_ContextCopy->Release () ;
  3354. }
  3355. return t_Result ;
  3356. }
  3357. /******************************************************************************
  3358. *
  3359. * Name:
  3360. *
  3361. *
  3362. * Description:
  3363. *
  3364. *
  3365. *****************************************************************************/
  3366. HRESULT CInterceptor_DecoupledClient :: PutInstanceAsync (
  3367. IWbemClassObject *a_Instance ,
  3368. long a_Flags ,
  3369. IWbemContext *a_Context ,
  3370. IWbemObjectSink *a_Sink
  3371. )
  3372. {
  3373. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3374. if ( m_Provider_IWbemServices )
  3375. {
  3376. if ( m_Registration->GetInstanceProviderRegistration ().SupportsPut () )
  3377. {
  3378. BOOL t_Impersonating ;
  3379. IUnknown *t_OldContext ;
  3380. IServerSecurity *t_OldSecurity ;
  3381. BOOL t_IsProxy ;
  3382. IWbemServices *t_Interface ;
  3383. BOOL t_Revert ;
  3384. IUnknown *t_Proxy ;
  3385. t_Result = Begin_IWbemServices (
  3386. t_Impersonating ,
  3387. t_OldContext ,
  3388. t_OldSecurity ,
  3389. t_IsProxy ,
  3390. t_Interface ,
  3391. t_Revert ,
  3392. t_Proxy
  3393. ) ;
  3394. if ( SUCCEEDED ( t_Result ) )
  3395. {
  3396. t_Result = Helper_PutInstanceAsync (
  3397. t_IsProxy ,
  3398. a_Instance ,
  3399. a_Flags ,
  3400. a_Context ,
  3401. a_Sink ,
  3402. t_Interface
  3403. ) ;
  3404. End_IWbemServices (
  3405. t_Impersonating ,
  3406. t_OldContext ,
  3407. t_OldSecurity ,
  3408. t_IsProxy ,
  3409. t_Interface ,
  3410. t_Revert ,
  3411. t_Proxy
  3412. ) ;
  3413. }
  3414. }
  3415. }
  3416. return t_Result ;
  3417. }
  3418. /******************************************************************************
  3419. *
  3420. * Name:
  3421. *
  3422. *
  3423. * Description:
  3424. *
  3425. *
  3426. *****************************************************************************/
  3427. HRESULT CInterceptor_DecoupledClient :: DeleteInstance (
  3428. const BSTR a_ObjectPath ,
  3429. long a_Flags ,
  3430. IWbemContext *a_Context ,
  3431. IWbemCallResult **a_CallResult
  3432. )
  3433. {
  3434. return WBEM_E_NOT_AVAILABLE ;
  3435. }
  3436. /******************************************************************************
  3437. *
  3438. * Name:
  3439. *
  3440. *
  3441. * Description:
  3442. *
  3443. *
  3444. *****************************************************************************/
  3445. HRESULT CInterceptor_DecoupledClient :: Helper_DeleteInstanceAsync (
  3446. BOOL a_IsProxy ,
  3447. const BSTR a_ObjectPath ,
  3448. long a_Flags ,
  3449. IWbemContext FAR *a_Context ,
  3450. IWbemObjectSink *a_Sink ,
  3451. IWbemServices *a_Service
  3452. )
  3453. {
  3454. HRESULT t_Result = S_OK ;
  3455. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3456. IWbemContext *t_ContextCopy = NULL ;
  3457. if ( a_Context )
  3458. {
  3459. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3460. }
  3461. else
  3462. {
  3463. t_Result = S_OK ;
  3464. }
  3465. if ( SUCCEEDED ( t_Result ) )
  3466. {
  3467. ULONG t_Dependant = 1 ;
  3468. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  3469. m_Allocator ,
  3470. a_Sink ,
  3471. ( IWbemServices * ) this ,
  3472. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3473. FALSE
  3474. ) ;
  3475. if ( t_Sink )
  3476. {
  3477. t_Sink->AddRef () ;
  3478. t_Result = t_Sink->SinkInitialize () ;
  3479. if ( SUCCEEDED ( t_Result ) )
  3480. {
  3481. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3482. Lock () ;
  3483. WmiStatusCode t_StatusCode = Insert (
  3484. *t_Sink ,
  3485. t_Iterator
  3486. ) ;
  3487. if ( t_StatusCode == e_StatusCode_Success )
  3488. {
  3489. UnLock () ;
  3490. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3491. {
  3492. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3493. }
  3494. if ( a_IsProxy )
  3495. {
  3496. t_Result = CoImpersonateClient () ;
  3497. }
  3498. else
  3499. {
  3500. t_Result = S_OK ;
  3501. }
  3502. if ( SUCCEEDED ( t_Result ) )
  3503. {
  3504. Increment_ProviderOperation_DeleteInstanceAsync () ;
  3505. try
  3506. {
  3507. t_Result = a_Service->DeleteInstanceAsync (
  3508. a_ObjectPath ,
  3509. a_Flags ,
  3510. t_ContextCopy ,
  3511. t_Sink
  3512. ) ;
  3513. }
  3514. catch ( ... )
  3515. {
  3516. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3517. }
  3518. CoRevertToSelf () ;
  3519. }
  3520. else
  3521. {
  3522. t_Result = WBEM_E_ACCESS_DENIED ;
  3523. }
  3524. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3525. {
  3526. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3527. if ( a_IsProxy )
  3528. {
  3529. t_Result = CoImpersonateClient () ;
  3530. }
  3531. else
  3532. {
  3533. t_Result = S_OK ;
  3534. }
  3535. if ( SUCCEEDED ( t_Result ) )
  3536. {
  3537. Increment_ProviderOperation_DeleteInstanceAsync () ;
  3538. try
  3539. {
  3540. t_Result = a_Service->DeleteInstanceAsync (
  3541. a_ObjectPath ,
  3542. a_Flags ,
  3543. t_ContextCopy ,
  3544. t_Sink
  3545. ) ;
  3546. }
  3547. catch ( ... )
  3548. {
  3549. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3550. }
  3551. CoRevertToSelf () ;
  3552. }
  3553. else
  3554. {
  3555. t_Result = WBEM_E_ACCESS_DENIED ;
  3556. }
  3557. }
  3558. }
  3559. else
  3560. {
  3561. UnLock () ;
  3562. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3563. }
  3564. if ( FAILED ( t_Result ) )
  3565. {
  3566. HRESULT t_TempResult = SetStatus ( L"DeleteInstanceAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3567. }
  3568. }
  3569. t_Sink->Release () ;
  3570. }
  3571. else
  3572. {
  3573. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3574. }
  3575. }
  3576. else
  3577. {
  3578. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3579. }
  3580. if ( t_ContextCopy )
  3581. {
  3582. t_ContextCopy->Release () ;
  3583. }
  3584. return t_Result ;
  3585. }
  3586. /******************************************************************************
  3587. *
  3588. * Name:
  3589. *
  3590. *
  3591. * Description:
  3592. *
  3593. *
  3594. *****************************************************************************/
  3595. HRESULT CInterceptor_DecoupledClient :: DeleteInstanceAsync (
  3596. const BSTR a_ObjectPath ,
  3597. long a_Flags ,
  3598. IWbemContext *a_Context ,
  3599. IWbemObjectSink *a_Sink
  3600. )
  3601. {
  3602. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3603. if ( m_Provider_IWbemServices )
  3604. {
  3605. if ( m_Registration->GetInstanceProviderRegistration ().SupportsDelete () )
  3606. {
  3607. BOOL t_Impersonating ;
  3608. IUnknown *t_OldContext ;
  3609. IServerSecurity *t_OldSecurity ;
  3610. BOOL t_IsProxy ;
  3611. IWbemServices *t_Interface ;
  3612. BOOL t_Revert ;
  3613. IUnknown *t_Proxy ;
  3614. t_Result = Begin_IWbemServices (
  3615. t_Impersonating ,
  3616. t_OldContext ,
  3617. t_OldSecurity ,
  3618. t_IsProxy ,
  3619. t_Interface ,
  3620. t_Revert ,
  3621. t_Proxy
  3622. ) ;
  3623. if ( SUCCEEDED ( t_Result ) )
  3624. {
  3625. t_Result = Helper_DeleteInstanceAsync (
  3626. t_IsProxy ,
  3627. a_ObjectPath ,
  3628. a_Flags ,
  3629. a_Context ,
  3630. a_Sink ,
  3631. t_Interface
  3632. ) ;
  3633. End_IWbemServices (
  3634. t_Impersonating ,
  3635. t_OldContext ,
  3636. t_OldSecurity ,
  3637. t_IsProxy ,
  3638. t_Interface ,
  3639. t_Revert ,
  3640. t_Proxy
  3641. ) ;
  3642. }
  3643. }
  3644. }
  3645. return t_Result ;
  3646. }
  3647. /******************************************************************************
  3648. *
  3649. * Name:
  3650. *
  3651. *
  3652. * Description:
  3653. *
  3654. *
  3655. *****************************************************************************/
  3656. HRESULT CInterceptor_DecoupledClient :: CreateInstanceEnum (
  3657. const BSTR a_Class ,
  3658. long a_Flags ,
  3659. IWbemContext *a_Context ,
  3660. IEnumWbemClassObject **a_Enum
  3661. )
  3662. {
  3663. return WBEM_E_NOT_AVAILABLE ;
  3664. }
  3665. /******************************************************************************
  3666. *
  3667. * Name:
  3668. *
  3669. *
  3670. * Description:
  3671. *
  3672. *
  3673. *****************************************************************************/
  3674. HRESULT CInterceptor_DecoupledClient :: Helper_CreateInstanceEnumAsync (
  3675. BOOL a_IsProxy ,
  3676. const BSTR a_Class ,
  3677. long a_Flags ,
  3678. IWbemContext *a_Context ,
  3679. IWbemObjectSink *a_Sink ,
  3680. IWbemServices *a_Service
  3681. )
  3682. {
  3683. HRESULT t_Result = S_OK ;
  3684. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3685. IWbemContext *t_ContextCopy = NULL ;
  3686. if ( a_Context )
  3687. {
  3688. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3689. AdjustGetContext ( t_ContextCopy ) ;
  3690. }
  3691. else
  3692. {
  3693. t_Result = S_OK ;
  3694. }
  3695. if ( SUCCEEDED ( t_Result ) )
  3696. {
  3697. ULONG t_Dependant = 1 ;
  3698. CDecoupled_Batching_IWbemSyncObjectSink *t_Sink = new CDecoupled_Batching_IWbemSyncObjectSink (
  3699. m_Allocator ,
  3700. a_Sink ,
  3701. ( IWbemServices * ) this ,
  3702. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3703. FALSE
  3704. ) ;
  3705. if ( t_Sink )
  3706. {
  3707. t_Sink->AddRef () ;
  3708. t_Result = t_Sink->SinkInitialize () ;
  3709. if ( SUCCEEDED ( t_Result ) )
  3710. {
  3711. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3712. Lock () ;
  3713. WmiStatusCode t_StatusCode = Insert (
  3714. *t_Sink ,
  3715. t_Iterator
  3716. ) ;
  3717. if ( t_StatusCode == e_StatusCode_Success )
  3718. {
  3719. UnLock () ;
  3720. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3721. {
  3722. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3723. }
  3724. if ( a_IsProxy )
  3725. {
  3726. t_Result = CoImpersonateClient () ;
  3727. }
  3728. else
  3729. {
  3730. t_Result = S_OK ;
  3731. }
  3732. if ( SUCCEEDED ( t_Result ) )
  3733. {
  3734. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  3735. try
  3736. {
  3737. t_Result = a_Service->CreateInstanceEnumAsync (
  3738. a_Class ,
  3739. a_Flags ,
  3740. t_ContextCopy ,
  3741. t_Sink
  3742. ) ;
  3743. }
  3744. catch ( ... )
  3745. {
  3746. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3747. }
  3748. CoRevertToSelf () ;
  3749. }
  3750. else
  3751. {
  3752. t_Result = WBEM_E_ACCESS_DENIED ;
  3753. }
  3754. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3755. {
  3756. if ( a_IsProxy )
  3757. {
  3758. t_Result = CoImpersonateClient () ;
  3759. }
  3760. else
  3761. {
  3762. t_Result = S_OK ;
  3763. }
  3764. if ( SUCCEEDED ( t_Result ) )
  3765. {
  3766. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3767. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  3768. try
  3769. {
  3770. t_Result = a_Service->CreateInstanceEnumAsync (
  3771. a_Class ,
  3772. a_Flags ,
  3773. t_ContextCopy ,
  3774. t_Sink
  3775. ) ;
  3776. }
  3777. catch ( ... )
  3778. {
  3779. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3780. }
  3781. CoRevertToSelf () ;
  3782. }
  3783. }
  3784. }
  3785. else
  3786. {
  3787. UnLock () ;
  3788. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3789. }
  3790. }
  3791. if ( FAILED ( t_Result ) )
  3792. {
  3793. HRESULT t_TempResult = SetStatus ( L"CreateInstanceEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3794. }
  3795. t_Sink->Release () ;
  3796. }
  3797. else
  3798. {
  3799. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3800. }
  3801. }
  3802. else
  3803. {
  3804. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3805. }
  3806. if ( t_ContextCopy )
  3807. {
  3808. t_ContextCopy->Release () ;
  3809. }
  3810. return t_Result ;
  3811. }
  3812. /******************************************************************************
  3813. *
  3814. * Name:
  3815. *
  3816. *
  3817. * Description:
  3818. *
  3819. *
  3820. *****************************************************************************/
  3821. HRESULT CInterceptor_DecoupledClient :: CreateInstanceEnumAsync (
  3822. const BSTR a_Class ,
  3823. long a_Flags ,
  3824. IWbemContext *a_Context ,
  3825. IWbemObjectSink *a_Sink
  3826. )
  3827. {
  3828. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3829. if ( m_Provider_IWbemServices )
  3830. {
  3831. if ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () )
  3832. {
  3833. BOOL t_Impersonating ;
  3834. IUnknown *t_OldContext ;
  3835. IServerSecurity *t_OldSecurity ;
  3836. BOOL t_IsProxy ;
  3837. IWbemServices *t_Interface ;
  3838. BOOL t_Revert ;
  3839. IUnknown *t_Proxy ;
  3840. t_Result = Begin_IWbemServices (
  3841. t_Impersonating ,
  3842. t_OldContext ,
  3843. t_OldSecurity ,
  3844. t_IsProxy ,
  3845. t_Interface ,
  3846. t_Revert ,
  3847. t_Proxy
  3848. ) ;
  3849. if ( SUCCEEDED ( t_Result ) )
  3850. {
  3851. t_Result = Helper_CreateInstanceEnumAsync (
  3852. t_IsProxy ,
  3853. a_Class ,
  3854. a_Flags ,
  3855. a_Context ,
  3856. a_Sink ,
  3857. t_Interface
  3858. ) ;
  3859. End_IWbemServices (
  3860. t_Impersonating ,
  3861. t_OldContext ,
  3862. t_OldSecurity ,
  3863. t_IsProxy ,
  3864. t_Interface ,
  3865. t_Revert ,
  3866. t_Proxy
  3867. ) ;
  3868. }
  3869. }
  3870. }
  3871. return t_Result ;
  3872. }
  3873. /******************************************************************************
  3874. *
  3875. * Name:
  3876. *
  3877. *
  3878. * Description:
  3879. *
  3880. *
  3881. *****************************************************************************/
  3882. HRESULT CInterceptor_DecoupledClient :: ExecQuery (
  3883. const BSTR a_QueryLanguage ,
  3884. const BSTR a_Query ,
  3885. long a_Flags ,
  3886. IWbemContext *a_Context ,
  3887. IEnumWbemClassObject **a_Enum
  3888. )
  3889. {
  3890. return WBEM_E_NOT_AVAILABLE ;
  3891. }
  3892. /******************************************************************************
  3893. *
  3894. * Name:
  3895. *
  3896. *
  3897. * Description:
  3898. *
  3899. *
  3900. *****************************************************************************/
  3901. HRESULT CInterceptor_DecoupledClient :: Helper_ExecQueryAsync (
  3902. BOOL a_IsProxy ,
  3903. const BSTR a_QueryLanguage ,
  3904. const BSTR a_Query,
  3905. long a_Flags ,
  3906. IWbemContext FAR *a_Context ,
  3907. IWbemObjectSink *a_Sink ,
  3908. IWbemServices *a_Service
  3909. )
  3910. {
  3911. HRESULT t_Result = S_OK ;
  3912. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3913. IWbemContext *t_ContextCopy = NULL ;
  3914. if ( SUCCEEDED ( t_Result ) )
  3915. {
  3916. if ( a_Context )
  3917. {
  3918. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3919. if ( SUCCEEDED ( t_Result ) )
  3920. {
  3921. }
  3922. else
  3923. {
  3924. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3925. }
  3926. }
  3927. else
  3928. {
  3929. t_Result = S_OK ;
  3930. }
  3931. }
  3932. if ( SUCCEEDED ( t_Result ) )
  3933. {
  3934. ULONG t_Dependant = 1 ;
  3935. if ( ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_UnarySelect ) || ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_V1ProviderDefined ) )
  3936. {
  3937. CDecoupled_Batching_IWbemSyncObjectSink *t_Sink = new CDecoupled_Batching_IWbemSyncObjectSink (
  3938. m_Allocator ,
  3939. a_Sink ,
  3940. ( IWbemServices * ) this ,
  3941. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3942. FALSE
  3943. ) ;
  3944. if ( t_Sink )
  3945. {
  3946. t_Sink->AddRef () ;
  3947. t_Result = t_Sink->SinkInitialize () ;
  3948. if ( SUCCEEDED ( t_Result ) )
  3949. {
  3950. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3951. Lock () ;
  3952. WmiStatusCode t_StatusCode = Insert (
  3953. *t_Sink ,
  3954. t_Iterator
  3955. ) ;
  3956. if ( t_StatusCode == e_StatusCode_Success )
  3957. {
  3958. UnLock () ;
  3959. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3960. {
  3961. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3962. }
  3963. if ( a_IsProxy )
  3964. {
  3965. t_Result = CoImpersonateClient () ;
  3966. }
  3967. else
  3968. {
  3969. t_Result = S_OK ;
  3970. }
  3971. if ( SUCCEEDED ( t_Result ) )
  3972. {
  3973. Increment_ProviderOperation_ExecQueryAsync () ;
  3974. try
  3975. {
  3976. t_Result = a_Service->ExecQueryAsync (
  3977. a_QueryLanguage ,
  3978. a_Query,
  3979. a_Flags ,
  3980. t_ContextCopy ,
  3981. t_Sink
  3982. ) ;
  3983. }
  3984. catch ( ... )
  3985. {
  3986. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3987. }
  3988. CoRevertToSelf () ;
  3989. }
  3990. else
  3991. {
  3992. t_Result = WBEM_E_ACCESS_DENIED ;
  3993. }
  3994. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3995. {
  3996. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3997. if ( a_IsProxy )
  3998. {
  3999. t_Result = CoImpersonateClient () ;
  4000. }
  4001. else
  4002. {
  4003. t_Result = S_OK ;
  4004. }
  4005. if ( SUCCEEDED ( t_Result ) )
  4006. {
  4007. Increment_ProviderOperation_ExecQueryAsync () ;
  4008. try
  4009. {
  4010. t_Result = a_Service->ExecQueryAsync (
  4011. a_QueryLanguage ,
  4012. a_Query,
  4013. a_Flags ,
  4014. t_ContextCopy ,
  4015. t_Sink
  4016. ) ;
  4017. }
  4018. catch ( ... )
  4019. {
  4020. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4021. }
  4022. CoRevertToSelf () ;
  4023. }
  4024. else
  4025. {
  4026. t_Result = WBEM_E_ACCESS_DENIED ;
  4027. }
  4028. }
  4029. }
  4030. else
  4031. {
  4032. UnLock () ;
  4033. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4034. }
  4035. if ( FAILED ( t_Result ) )
  4036. {
  4037. HRESULT t_TempResult = SetStatus ( L"ExecQueryAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4038. }
  4039. }
  4040. t_Sink->Release () ;
  4041. }
  4042. else
  4043. {
  4044. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4045. }
  4046. }
  4047. else if ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () )
  4048. {
  4049. IWbemQuery *t_QueryFilter = NULL ;
  4050. t_Result = ProviderSubSystem_Common_Globals :: CreateInstance (
  4051. CLSID_WbemQuery ,
  4052. NULL ,
  4053. CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER ,
  4054. IID_IWbemQuery ,
  4055. ( void ** ) & t_QueryFilter
  4056. ) ;
  4057. if ( SUCCEEDED ( t_Result ) )
  4058. {
  4059. t_Result = t_QueryFilter->Parse (
  4060. a_QueryLanguage ,
  4061. a_Query ,
  4062. 0
  4063. ) ;
  4064. if ( SUCCEEDED ( t_Result ) )
  4065. {
  4066. SWbemRpnEncodedQuery *t_Expression = NULL ;
  4067. t_Result = t_QueryFilter->GetAnalysis (
  4068. WMIQ_ANALYSIS_RPN_SEQUENCE ,
  4069. 0 ,
  4070. ( void ** ) & t_Expression
  4071. ) ;
  4072. if ( SUCCEEDED ( t_Result ) )
  4073. {
  4074. if ( t_Expression->m_uFromTargetType == WMIQ_RPN_FROM_UNARY )
  4075. {
  4076. BSTR t_Class = SysAllocString ( t_Expression->m_ppszFromList [ 0 ] ) ;
  4077. if ( t_Class )
  4078. {
  4079. CDecoupled_Batching_IWbemSyncObjectSink *t_Sink = new CDecoupled_Batching_IWbemSyncObjectSink (
  4080. m_Allocator ,
  4081. a_Sink ,
  4082. ( IWbemServices * ) this ,
  4083. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4084. FALSE
  4085. ) ;
  4086. if ( t_Sink )
  4087. {
  4088. t_Sink->AddRef () ;
  4089. t_Result = t_Sink->SinkInitialize () ;
  4090. if ( SUCCEEDED ( t_Result ) )
  4091. {
  4092. a_Sink->SetStatus ( WBEM_STATUS_REQUIREMENTS , 0 , NULL , NULL ) ;
  4093. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4094. Lock () ;
  4095. WmiStatusCode t_StatusCode = Insert (
  4096. *t_Sink ,
  4097. t_Iterator
  4098. ) ;
  4099. if ( t_StatusCode == e_StatusCode_Success )
  4100. {
  4101. UnLock () ;
  4102. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4103. {
  4104. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4105. }
  4106. if ( a_IsProxy )
  4107. {
  4108. t_Result = CoImpersonateClient () ;
  4109. }
  4110. else
  4111. {
  4112. t_Result = S_OK ;
  4113. }
  4114. if ( SUCCEEDED ( t_Result ) )
  4115. {
  4116. a_Sink->SetStatus ( WBEM_STATUS_REQUIREMENTS , 0 , NULL , NULL ) ;
  4117. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  4118. try
  4119. {
  4120. t_Result = a_Service->CreateInstanceEnumAsync (
  4121. t_Class ,
  4122. a_Flags ,
  4123. t_ContextCopy ,
  4124. t_Sink
  4125. ) ;
  4126. }
  4127. catch ( ... )
  4128. {
  4129. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4130. }
  4131. CoRevertToSelf () ;
  4132. }
  4133. else
  4134. {
  4135. t_Result = WBEM_E_ACCESS_DENIED ;
  4136. }
  4137. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4138. {
  4139. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4140. if ( a_IsProxy )
  4141. {
  4142. t_Result = CoImpersonateClient () ;
  4143. }
  4144. else
  4145. {
  4146. t_Result = S_OK ;
  4147. }
  4148. if ( SUCCEEDED ( t_Result ) )
  4149. {
  4150. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  4151. try
  4152. {
  4153. t_Result = a_Service->CreateInstanceEnumAsync (
  4154. t_Class ,
  4155. a_Flags ,
  4156. t_ContextCopy ,
  4157. t_Sink
  4158. ) ;
  4159. }
  4160. catch ( ... )
  4161. {
  4162. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4163. }
  4164. CoRevertToSelf () ;
  4165. }
  4166. else
  4167. {
  4168. t_Result = WBEM_E_ACCESS_DENIED ;
  4169. }
  4170. }
  4171. }
  4172. else
  4173. {
  4174. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4175. }
  4176. }
  4177. if ( FAILED ( t_Result ) )
  4178. {
  4179. HRESULT t_TempResult = SetStatus ( L"CreateInstanceEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4180. }
  4181. t_Sink->Release () ;
  4182. }
  4183. else
  4184. {
  4185. SysFreeString ( t_Class ) ;
  4186. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4187. }
  4188. }
  4189. else
  4190. {
  4191. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4192. }
  4193. }
  4194. else
  4195. {
  4196. t_Result = WBEM_E_NOT_SUPPORTED ;
  4197. }
  4198. t_QueryFilter->FreeMemory ( t_Expression ) ;
  4199. }
  4200. else
  4201. {
  4202. t_Result = WBEM_E_UNEXPECTED ;
  4203. }
  4204. }
  4205. else
  4206. {
  4207. t_Result = WBEM_E_NOT_SUPPORTED ;
  4208. }
  4209. t_QueryFilter->Release () ;
  4210. }
  4211. else
  4212. {
  4213. t_Result = WBEM_E_CRITICAL_ERROR ;
  4214. }
  4215. }
  4216. else
  4217. {
  4218. t_Result = WBEM_E_NOT_SUPPORTED ;
  4219. }
  4220. }
  4221. if ( t_ContextCopy )
  4222. {
  4223. t_ContextCopy->Release () ;
  4224. }
  4225. return t_Result ;
  4226. }
  4227. /******************************************************************************
  4228. *
  4229. * Name:
  4230. *
  4231. *
  4232. * Description:
  4233. *
  4234. *
  4235. *****************************************************************************/
  4236. HRESULT CInterceptor_DecoupledClient :: ExecQueryAsync (
  4237. const BSTR a_QueryLanguage ,
  4238. const BSTR a_Query,
  4239. long a_Flags ,
  4240. IWbemContext *a_Context ,
  4241. IWbemObjectSink *a_Sink
  4242. )
  4243. {
  4244. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4245. if ( m_Provider_IWbemServices )
  4246. {
  4247. if ( ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_UnarySelect ) || ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_V1ProviderDefined ) || ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () ) )
  4248. {
  4249. BOOL t_Impersonating ;
  4250. IUnknown *t_OldContext ;
  4251. IServerSecurity *t_OldSecurity ;
  4252. BOOL t_IsProxy ;
  4253. IWbemServices *t_Interface ;
  4254. BOOL t_Revert ;
  4255. IUnknown *t_Proxy ;
  4256. t_Result = Begin_IWbemServices (
  4257. t_Impersonating ,
  4258. t_OldContext ,
  4259. t_OldSecurity ,
  4260. t_IsProxy ,
  4261. t_Interface ,
  4262. t_Revert ,
  4263. t_Proxy
  4264. ) ;
  4265. if ( SUCCEEDED ( t_Result ) )
  4266. {
  4267. t_Result = Helper_ExecQueryAsync (
  4268. t_IsProxy ,
  4269. a_QueryLanguage ,
  4270. a_Query,
  4271. a_Flags ,
  4272. a_Context ,
  4273. a_Sink ,
  4274. t_Interface
  4275. ) ;
  4276. End_IWbemServices (
  4277. t_Impersonating ,
  4278. t_OldContext ,
  4279. t_OldSecurity ,
  4280. t_IsProxy ,
  4281. t_Interface ,
  4282. t_Revert ,
  4283. t_Proxy
  4284. ) ;
  4285. }
  4286. }
  4287. }
  4288. return t_Result ;
  4289. }
  4290. /******************************************************************************
  4291. *
  4292. * Name:
  4293. *
  4294. *
  4295. * Description:
  4296. *
  4297. *
  4298. *****************************************************************************/
  4299. HRESULT CInterceptor_DecoupledClient :: ExecNotificationQuery (
  4300. const BSTR a_QueryLanguage ,
  4301. const BSTR a_Query ,
  4302. long a_Flags ,
  4303. IWbemContext *a_Context ,
  4304. IEnumWbemClassObject **a_Enum
  4305. )
  4306. {
  4307. return WBEM_E_NOT_AVAILABLE ;
  4308. }
  4309. /******************************************************************************
  4310. *
  4311. * Name:
  4312. *
  4313. *
  4314. * Description:
  4315. *
  4316. *
  4317. *****************************************************************************/
  4318. HRESULT CInterceptor_DecoupledClient :: ExecNotificationQueryAsync (
  4319. const BSTR a_QueryLanguage ,
  4320. const BSTR a_Query ,
  4321. long a_Flags ,
  4322. IWbemContext *a_Context ,
  4323. IWbemObjectSink *a_Sink
  4324. )
  4325. {
  4326. return WBEM_E_NOT_AVAILABLE ;
  4327. }
  4328. /******************************************************************************
  4329. *
  4330. * Name:
  4331. *
  4332. *
  4333. * Description:
  4334. *
  4335. *
  4336. *****************************************************************************/
  4337. HRESULT CInterceptor_DecoupledClient :: ExecMethod (
  4338. const BSTR a_ObjectPath ,
  4339. const BSTR a_MethodName ,
  4340. long a_Flags ,
  4341. IWbemContext *a_Context ,
  4342. IWbemClassObject *a_InParams ,
  4343. IWbemClassObject **a_OutParams ,
  4344. IWbemCallResult **a_CallResult
  4345. )
  4346. {
  4347. return WBEM_E_NOT_AVAILABLE ;
  4348. }
  4349. /******************************************************************************
  4350. *
  4351. * Name:
  4352. *
  4353. *
  4354. * Description:
  4355. *
  4356. *
  4357. *****************************************************************************/
  4358. HRESULT CInterceptor_DecoupledClient :: Helper_ExecMethodAsync (
  4359. BOOL a_IsProxy ,
  4360. const BSTR a_ObjectPath ,
  4361. const BSTR a_MethodName ,
  4362. long a_Flags ,
  4363. IWbemContext *a_Context ,
  4364. IWbemClassObject *a_InParams ,
  4365. IWbemObjectSink *a_Sink ,
  4366. IWbemServices *a_Service
  4367. )
  4368. {
  4369. HRESULT t_Result = S_OK ;
  4370. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  4371. IWbemContext *t_ContextCopy = NULL ;
  4372. if ( a_Context )
  4373. {
  4374. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  4375. AdjustGetContext ( t_ContextCopy ) ;
  4376. }
  4377. else
  4378. {
  4379. t_Result = S_OK ;
  4380. }
  4381. if ( SUCCEEDED ( t_Result ) )
  4382. {
  4383. ULONG t_Dependant = 1 ;
  4384. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  4385. m_Allocator ,
  4386. a_Sink ,
  4387. ( IWbemServices * ) this ,
  4388. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4389. FALSE
  4390. ) ;
  4391. if ( t_Sink )
  4392. {
  4393. t_Sink->AddRef () ;
  4394. t_Result = t_Sink->SinkInitialize () ;
  4395. if ( SUCCEEDED ( t_Result ) )
  4396. {
  4397. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4398. Lock () ;
  4399. WmiStatusCode t_StatusCode = Insert (
  4400. *t_Sink ,
  4401. t_Iterator
  4402. ) ;
  4403. if ( t_StatusCode == e_StatusCode_Success )
  4404. {
  4405. UnLock () ;
  4406. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4407. {
  4408. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4409. }
  4410. if ( a_IsProxy )
  4411. {
  4412. t_Result = CoImpersonateClient () ;
  4413. }
  4414. else
  4415. {
  4416. t_Result = S_OK ;
  4417. }
  4418. if ( SUCCEEDED ( t_Result ) )
  4419. {
  4420. Increment_ProviderOperation_ExecMethodAsync () ;
  4421. try
  4422. {
  4423. t_Result = a_Service->ExecMethodAsync (
  4424. a_ObjectPath ,
  4425. a_MethodName ,
  4426. a_Flags ,
  4427. t_ContextCopy ,
  4428. a_InParams ,
  4429. t_Sink
  4430. ) ;
  4431. }
  4432. catch ( ... )
  4433. {
  4434. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4435. }
  4436. CoRevertToSelf () ;
  4437. }
  4438. else
  4439. {
  4440. t_Result = WBEM_E_ACCESS_DENIED ;
  4441. }
  4442. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4443. {
  4444. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4445. if ( a_IsProxy )
  4446. {
  4447. t_Result = CoImpersonateClient () ;
  4448. }
  4449. else
  4450. {
  4451. t_Result = S_OK ;
  4452. }
  4453. if ( SUCCEEDED ( t_Result ) )
  4454. {
  4455. Increment_ProviderOperation_ExecMethodAsync () ;
  4456. try
  4457. {
  4458. t_Result = a_Service->ExecMethodAsync (
  4459. a_ObjectPath ,
  4460. a_MethodName ,
  4461. a_Flags ,
  4462. t_ContextCopy ,
  4463. a_InParams ,
  4464. t_Sink
  4465. ) ;
  4466. }
  4467. catch ( ... )
  4468. {
  4469. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4470. }
  4471. CoRevertToSelf () ;
  4472. }
  4473. else
  4474. {
  4475. t_Result = WBEM_E_ACCESS_DENIED ;
  4476. }
  4477. }
  4478. }
  4479. else
  4480. {
  4481. UnLock () ;
  4482. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4483. }
  4484. if ( FAILED ( t_Result ) )
  4485. {
  4486. HRESULT t_TempResult = SetStatus ( L"ExecMethodAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4487. }
  4488. }
  4489. t_Sink->Release () ;
  4490. }
  4491. else
  4492. {
  4493. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4494. }
  4495. }
  4496. else
  4497. {
  4498. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4499. }
  4500. if ( t_ContextCopy )
  4501. {
  4502. t_ContextCopy->Release () ;
  4503. }
  4504. return t_Result ;
  4505. }
  4506. /******************************************************************************
  4507. *
  4508. * Name:
  4509. *
  4510. *
  4511. * Description:
  4512. *
  4513. *
  4514. *****************************************************************************/
  4515. HRESULT CInterceptor_DecoupledClient :: ExecMethodAsync (
  4516. const BSTR a_ObjectPath ,
  4517. const BSTR a_MethodName ,
  4518. long a_Flags ,
  4519. IWbemContext *a_Context ,
  4520. IWbemClassObject *a_InParams ,
  4521. IWbemObjectSink *a_Sink
  4522. )
  4523. {
  4524. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4525. if ( m_Provider_IWbemServices )
  4526. {
  4527. if ( m_Registration->GetMethodProviderRegistration ().SupportsMethods () )
  4528. {
  4529. BOOL t_Impersonating ;
  4530. IUnknown *t_OldContext ;
  4531. IServerSecurity *t_OldSecurity ;
  4532. BOOL t_IsProxy ;
  4533. IWbemServices *t_Interface ;
  4534. BOOL t_Revert ;
  4535. IUnknown *t_Proxy ;
  4536. t_Result = Begin_IWbemServices (
  4537. t_Impersonating ,
  4538. t_OldContext ,
  4539. t_OldSecurity ,
  4540. t_IsProxy ,
  4541. t_Interface ,
  4542. t_Revert ,
  4543. t_Proxy
  4544. ) ;
  4545. if ( SUCCEEDED ( t_Result ) )
  4546. {
  4547. t_Result = Helper_ExecMethodAsync (
  4548. t_IsProxy ,
  4549. a_ObjectPath ,
  4550. a_MethodName ,
  4551. a_Flags ,
  4552. a_Context ,
  4553. a_InParams ,
  4554. a_Sink ,
  4555. t_Interface
  4556. ) ;
  4557. End_IWbemServices (
  4558. t_Impersonating ,
  4559. t_OldContext ,
  4560. t_OldSecurity ,
  4561. t_IsProxy ,
  4562. t_Interface ,
  4563. t_Revert ,
  4564. t_Proxy
  4565. ) ;
  4566. }
  4567. }
  4568. }
  4569. return t_Result ;
  4570. }
  4571. /******************************************************************************
  4572. *
  4573. * Name:
  4574. *
  4575. *
  4576. * Description:
  4577. *
  4578. *
  4579. *****************************************************************************/
  4580. HRESULT CInterceptor_DecoupledClient :: GetProperty (
  4581. long a_Flags ,
  4582. const BSTR a_Locale ,
  4583. const BSTR a_ClassMapping ,
  4584. const BSTR a_InstanceMapping ,
  4585. const BSTR a_PropertyMapping ,
  4586. VARIANT *a_Value
  4587. )
  4588. {
  4589. if ( m_Provider_IWbemPropertyProvider )
  4590. {
  4591. if ( m_Registration->GetPropertyProviderRegistration ().SupportsGet () )
  4592. {
  4593. Increment_ProviderOperation_GetProperty () ;
  4594. HRESULT t_Result = S_OK ;
  4595. try
  4596. {
  4597. t_Result = m_Provider_IWbemPropertyProvider->GetProperty (
  4598. a_Flags ,
  4599. a_Locale ,
  4600. a_ClassMapping ,
  4601. a_InstanceMapping ,
  4602. a_PropertyMapping ,
  4603. a_Value
  4604. ) ;
  4605. CoRevertToSelf () ;
  4606. }
  4607. catch ( ... )
  4608. {
  4609. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4610. CoRevertToSelf () ;
  4611. }
  4612. return t_Result ;
  4613. }
  4614. }
  4615. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4616. }
  4617. /******************************************************************************
  4618. *
  4619. * Name:
  4620. *
  4621. *
  4622. * Description:
  4623. *
  4624. *
  4625. *****************************************************************************/
  4626. HRESULT CInterceptor_DecoupledClient :: PutProperty (
  4627. long a_Flags ,
  4628. const BSTR a_Locale ,
  4629. const BSTR a_ClassMapping ,
  4630. const BSTR a_InstanceMapping ,
  4631. const BSTR a_PropertyMapping ,
  4632. const VARIANT *a_Value
  4633. )
  4634. {
  4635. if ( m_Provider_IWbemPropertyProvider )
  4636. {
  4637. if ( m_Registration->GetPropertyProviderRegistration ().SupportsPut () )
  4638. {
  4639. Increment_ProviderOperation_PutProperty () ;
  4640. HRESULT t_Result = S_OK ;
  4641. try
  4642. {
  4643. t_Result = m_Provider_IWbemPropertyProvider->PutProperty (
  4644. a_Flags ,
  4645. a_Locale ,
  4646. a_ClassMapping ,
  4647. a_InstanceMapping ,
  4648. a_PropertyMapping ,
  4649. a_Value
  4650. ) ;
  4651. CoRevertToSelf () ;
  4652. return t_Result ;
  4653. }
  4654. catch ( ... )
  4655. {
  4656. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4657. CoRevertToSelf () ;
  4658. }
  4659. return t_Result ;
  4660. }
  4661. }
  4662. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4663. }
  4664. /******************************************************************************
  4665. *
  4666. * Name:
  4667. *
  4668. *
  4669. * Description:
  4670. *
  4671. *
  4672. *****************************************************************************/
  4673. HRESULT CInterceptor_DecoupledClient ::ProvideEvents (
  4674. IWbemObjectSink *a_Sink ,
  4675. long a_Flags
  4676. )
  4677. {
  4678. if ( m_Provider_IWbemEventProvider )
  4679. {
  4680. BOOL t_Impersonating = FALSE ;
  4681. IUnknown *t_OldContext = NULL ;
  4682. IServerSecurity *t_OldSecurity = NULL ;
  4683. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4684. if ( SUCCEEDED ( t_Result ) )
  4685. {
  4686. BOOL t_Revert = FALSE ;
  4687. IUnknown *t_Proxy = NULL ;
  4688. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProvider , IID_IWbemEventProvider , m_Provider_IWbemEventProvider , t_Proxy , t_Revert ) ;
  4689. if ( t_Result == WBEM_E_NOT_FOUND )
  4690. {
  4691. Increment_ProviderOperation_ProvideEvents () ;
  4692. try
  4693. {
  4694. t_Result = m_Provider_IWbemEventProvider->ProvideEvents (
  4695. a_Sink ,
  4696. a_Flags
  4697. ) ;
  4698. }
  4699. catch ( ... )
  4700. {
  4701. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4702. }
  4703. CoRevertToSelf () ;
  4704. }
  4705. else
  4706. {
  4707. if ( SUCCEEDED ( t_Result ) )
  4708. {
  4709. IWbemEventProvider *t_Provider = ( IWbemEventProvider * ) t_Proxy ;
  4710. // Set cloaking on the proxy
  4711. // =========================
  4712. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  4713. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  4714. t_Provider ,
  4715. RPC_C_AUTHN_LEVEL_DEFAULT ,
  4716. t_ImpersonationLevel
  4717. ) ;
  4718. if ( SUCCEEDED ( t_Result ) )
  4719. {
  4720. t_Result = CoImpersonateClient () ;
  4721. if ( SUCCEEDED ( t_Result ) )
  4722. {
  4723. Increment_ProviderOperation_ProvideEvents () ;
  4724. try
  4725. {
  4726. t_Result = t_Provider->ProvideEvents (
  4727. a_Sink ,
  4728. a_Flags
  4729. ) ;
  4730. }
  4731. catch ( ... )
  4732. {
  4733. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4734. }
  4735. CoRevertToSelf () ;
  4736. }
  4737. else
  4738. {
  4739. t_Result = WBEM_E_ACCESS_DENIED ;
  4740. }
  4741. }
  4742. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProvider , t_Proxy , t_Revert ) ;
  4743. }
  4744. }
  4745. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4746. }
  4747. return t_Result ;
  4748. }
  4749. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4750. }
  4751. /******************************************************************************
  4752. *
  4753. * Name:
  4754. *
  4755. *
  4756. * Description:
  4757. *
  4758. *
  4759. *****************************************************************************/
  4760. HRESULT CInterceptor_DecoupledClient ::NewQuery (
  4761. unsigned long a_Id ,
  4762. WBEM_WSTR a_QueryLanguage ,
  4763. WBEM_WSTR a_Query
  4764. )
  4765. {
  4766. if ( m_Provider_IWbemEventProviderQuerySink )
  4767. {
  4768. BOOL t_Impersonating = FALSE ;
  4769. IUnknown *t_OldContext = NULL ;
  4770. IServerSecurity *t_OldSecurity = NULL ;
  4771. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4772. if ( SUCCEEDED ( t_Result ) )
  4773. {
  4774. BOOL t_Revert = FALSE ;
  4775. IUnknown *t_Proxy = NULL ;
  4776. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , IID_IWbemEventProviderQuerySink , m_Provider_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4777. if ( t_Result == WBEM_E_NOT_FOUND )
  4778. {
  4779. Increment_ProviderOperation_NewQuery () ;
  4780. try
  4781. {
  4782. t_Result = m_Provider_IWbemEventProviderQuerySink->NewQuery (
  4783. a_Id ,
  4784. a_QueryLanguage ,
  4785. a_Query
  4786. ) ;
  4787. }
  4788. catch ( ... )
  4789. {
  4790. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4791. }
  4792. CoRevertToSelf () ;
  4793. }
  4794. else
  4795. {
  4796. if ( SUCCEEDED ( t_Result ) )
  4797. {
  4798. IWbemEventProviderQuerySink *t_Provider = ( IWbemEventProviderQuerySink * ) t_Proxy ;
  4799. // Set cloaking on the proxy
  4800. // =========================
  4801. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  4802. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  4803. t_Provider ,
  4804. RPC_C_AUTHN_LEVEL_DEFAULT ,
  4805. t_ImpersonationLevel
  4806. ) ;
  4807. if ( SUCCEEDED ( t_Result ) )
  4808. {
  4809. t_Result = CoImpersonateClient () ;
  4810. if ( SUCCEEDED ( t_Result ) )
  4811. {
  4812. Increment_ProviderOperation_NewQuery () ;
  4813. try
  4814. {
  4815. t_Result = t_Provider->NewQuery (
  4816. a_Id ,
  4817. a_QueryLanguage ,
  4818. a_Query
  4819. ) ;
  4820. }
  4821. catch ( ... )
  4822. {
  4823. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4824. }
  4825. CoRevertToSelf () ;
  4826. }
  4827. else
  4828. {
  4829. t_Result = WBEM_E_ACCESS_DENIED ;
  4830. }
  4831. }
  4832. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4833. }
  4834. }
  4835. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4836. }
  4837. return t_Result ;
  4838. }
  4839. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4840. }
  4841. /******************************************************************************
  4842. *
  4843. * Name:
  4844. *
  4845. *
  4846. * Description:
  4847. *
  4848. *
  4849. *****************************************************************************/
  4850. HRESULT CInterceptor_DecoupledClient ::CancelQuery (
  4851. unsigned long a_Id
  4852. )
  4853. {
  4854. if ( m_Provider_IWbemEventProviderQuerySink )
  4855. {
  4856. BOOL t_Impersonating = FALSE ;
  4857. IUnknown *t_OldContext = NULL ;
  4858. IServerSecurity *t_OldSecurity = NULL ;
  4859. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4860. if ( SUCCEEDED ( t_Result ) )
  4861. {
  4862. BOOL t_Revert = FALSE ;
  4863. IUnknown *t_Proxy = NULL ;
  4864. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , IID_IWbemEventProviderQuerySink , m_Provider_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4865. if ( t_Result == WBEM_E_NOT_FOUND )
  4866. {
  4867. Increment_ProviderOperation_CancelQuery () ;
  4868. try
  4869. {
  4870. t_Result = m_Provider_IWbemEventProviderQuerySink->CancelQuery (
  4871. a_Id
  4872. ) ;
  4873. }
  4874. catch ( ... )
  4875. {
  4876. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4877. }
  4878. CoRevertToSelf () ;
  4879. }
  4880. else
  4881. {
  4882. if ( SUCCEEDED ( t_Result ) )
  4883. {
  4884. IWbemEventProviderQuerySink *t_Provider = ( IWbemEventProviderQuerySink * ) t_Proxy ;
  4885. // Set cloaking on the proxy
  4886. // =========================
  4887. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  4888. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  4889. t_Provider ,
  4890. RPC_C_AUTHN_LEVEL_DEFAULT ,
  4891. t_ImpersonationLevel
  4892. ) ;
  4893. if ( SUCCEEDED ( t_Result ) )
  4894. {
  4895. t_Result = CoImpersonateClient () ;
  4896. if ( SUCCEEDED ( t_Result ) )
  4897. {
  4898. Increment_ProviderOperation_CancelQuery () ;
  4899. try
  4900. {
  4901. t_Result = t_Provider->CancelQuery (
  4902. a_Id
  4903. ) ;
  4904. }
  4905. catch ( ... )
  4906. {
  4907. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4908. }
  4909. CoRevertToSelf () ;
  4910. }
  4911. else
  4912. {
  4913. t_Result = WBEM_E_ACCESS_DENIED ;
  4914. }
  4915. }
  4916. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4917. }
  4918. }
  4919. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4920. }
  4921. return t_Result ;
  4922. }
  4923. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4924. }
  4925. /******************************************************************************
  4926. *
  4927. * Name:
  4928. *
  4929. *
  4930. * Description:
  4931. *
  4932. *
  4933. *****************************************************************************/
  4934. HRESULT CInterceptor_DecoupledClient ::AccessCheck (
  4935. WBEM_CWSTR a_QueryLanguage ,
  4936. WBEM_CWSTR a_Query ,
  4937. long a_SidLength ,
  4938. const BYTE *a_Sid
  4939. )
  4940. {
  4941. if ( m_Provider_IWbemEventProviderSecurity )
  4942. {
  4943. BOOL t_Impersonating = FALSE ;
  4944. IUnknown *t_OldContext = NULL ;
  4945. IServerSecurity *t_OldSecurity = NULL ;
  4946. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4947. if ( SUCCEEDED ( t_Result ) )
  4948. {
  4949. BOOL t_Revert = FALSE ;
  4950. IUnknown *t_Proxy = NULL ;
  4951. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderSecurity , IID_IWbemEventProviderSecurity , m_Provider_IWbemEventProviderSecurity , t_Proxy , t_Revert ) ;
  4952. if ( t_Result == WBEM_E_NOT_FOUND )
  4953. {
  4954. Increment_ProviderOperation_AccessCheck () ;
  4955. try
  4956. {
  4957. t_Result = m_Provider_IWbemEventProviderSecurity->AccessCheck (
  4958. a_QueryLanguage ,
  4959. a_Query ,
  4960. a_SidLength ,
  4961. a_Sid
  4962. ) ;
  4963. }
  4964. catch ( ... )
  4965. {
  4966. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4967. }
  4968. CoRevertToSelf () ;
  4969. }
  4970. else
  4971. {
  4972. if ( SUCCEEDED ( t_Result ) )
  4973. {
  4974. IWbemEventProviderSecurity *t_Provider = ( IWbemEventProviderSecurity * ) t_Proxy ;
  4975. // Set cloaking on the proxy
  4976. // =========================
  4977. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  4978. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  4979. t_Provider ,
  4980. RPC_C_AUTHN_LEVEL_DEFAULT ,
  4981. t_ImpersonationLevel
  4982. ) ;
  4983. if ( SUCCEEDED ( t_Result ) )
  4984. {
  4985. t_Result = CoImpersonateClient () ;
  4986. if ( SUCCEEDED ( t_Result ) )
  4987. {
  4988. Increment_ProviderOperation_AccessCheck () ;
  4989. try
  4990. {
  4991. t_Result = t_Provider->AccessCheck (
  4992. a_QueryLanguage ,
  4993. a_Query ,
  4994. a_SidLength ,
  4995. a_Sid
  4996. ) ;
  4997. }
  4998. catch ( ... )
  4999. {
  5000. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5001. }
  5002. CoRevertToSelf () ;
  5003. }
  5004. else
  5005. {
  5006. t_Result = WBEM_E_ACCESS_DENIED ;
  5007. }
  5008. }
  5009. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderSecurity , t_Proxy , t_Revert ) ;
  5010. }
  5011. }
  5012. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5013. }
  5014. return t_Result ;
  5015. }
  5016. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5017. }
  5018. /******************************************************************************
  5019. *
  5020. * Name:
  5021. *
  5022. *
  5023. * Description:
  5024. *
  5025. *
  5026. *****************************************************************************/
  5027. HRESULT CInterceptor_DecoupledClient ::SetRegistrationObject (
  5028. long a_Flags ,
  5029. IWbemClassObject *a_ProviderRegistration
  5030. )
  5031. {
  5032. if ( m_Provider_IWbemProviderIdentity )
  5033. {
  5034. BOOL t_Impersonating = FALSE ;
  5035. IUnknown *t_OldContext = NULL ;
  5036. IServerSecurity *t_OldSecurity = NULL ;
  5037. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5038. if ( SUCCEEDED ( t_Result ) )
  5039. {
  5040. BOOL t_Revert = FALSE ;
  5041. IUnknown *t_Proxy = NULL ;
  5042. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemProviderIdentity , IID_IWbemProviderIdentity , m_Provider_IWbemProviderIdentity , t_Proxy , t_Revert ) ;
  5043. if ( t_Result == WBEM_E_NOT_FOUND )
  5044. {
  5045. Increment_ProviderOperation_SetRegistrationObject () ;
  5046. try
  5047. {
  5048. t_Result = m_Provider_IWbemProviderIdentity->SetRegistrationObject (
  5049. a_Flags ,
  5050. a_ProviderRegistration
  5051. ) ;
  5052. }
  5053. catch ( ... )
  5054. {
  5055. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5056. }
  5057. CoRevertToSelf () ;
  5058. }
  5059. else
  5060. {
  5061. if ( SUCCEEDED ( t_Result ) )
  5062. {
  5063. IWbemProviderIdentity *t_Provider = ( IWbemProviderIdentity * ) t_Proxy ;
  5064. // Set cloaking on the proxy
  5065. // =========================
  5066. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  5067. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  5068. t_Provider ,
  5069. RPC_C_AUTHN_LEVEL_DEFAULT ,
  5070. t_ImpersonationLevel
  5071. ) ;
  5072. if ( SUCCEEDED ( t_Result ) )
  5073. {
  5074. t_Result = CoImpersonateClient () ;
  5075. if ( SUCCEEDED ( t_Result ) )
  5076. {
  5077. Increment_ProviderOperation_SetRegistrationObject () ;
  5078. try
  5079. {
  5080. t_Result = t_Provider->SetRegistrationObject (
  5081. a_Flags ,
  5082. a_ProviderRegistration
  5083. ) ;
  5084. }
  5085. catch ( ... )
  5086. {
  5087. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5088. }
  5089. CoRevertToSelf () ;
  5090. }
  5091. else
  5092. {
  5093. t_Result = WBEM_E_ACCESS_DENIED ;
  5094. }
  5095. }
  5096. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemProviderIdentity , t_Proxy , t_Revert ) ;
  5097. }
  5098. }
  5099. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5100. }
  5101. return t_Result ;
  5102. }
  5103. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5104. }
  5105. /******************************************************************************
  5106. *
  5107. * Name:
  5108. *
  5109. *
  5110. * Description:
  5111. *
  5112. *
  5113. *****************************************************************************/
  5114. HRESULT CInterceptor_DecoupledClient ::FindConsumer (
  5115. IWbemClassObject *a_LogicalConsumer ,
  5116. IWbemUnboundObjectSink **a_Consumer
  5117. )
  5118. {
  5119. if ( m_Provider_IWbemEventConsumerProvider )
  5120. {
  5121. IWbemUnboundObjectSink *t_Consumer = NULL ;
  5122. BOOL t_Impersonating = FALSE ;
  5123. IUnknown *t_OldContext = NULL ;
  5124. IServerSecurity *t_OldSecurity = NULL ;
  5125. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5126. if ( SUCCEEDED ( t_Result ) )
  5127. {
  5128. BOOL t_Revert = FALSE ;
  5129. IUnknown *t_Proxy = NULL ;
  5130. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProvider , IID_IWbemEventConsumerProvider , m_Provider_IWbemEventConsumerProvider , t_Proxy , t_Revert ) ;
  5131. if ( t_Result == WBEM_E_NOT_FOUND )
  5132. {
  5133. Increment_ProviderOperation_FindConsumer () ;
  5134. try
  5135. {
  5136. t_Result = m_Provider_IWbemEventConsumerProvider->FindConsumer (
  5137. a_LogicalConsumer ,
  5138. & t_Consumer
  5139. ) ;
  5140. }
  5141. catch ( ... )
  5142. {
  5143. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5144. }
  5145. CoRevertToSelf () ;
  5146. }
  5147. else
  5148. {
  5149. if ( SUCCEEDED ( t_Result ) )
  5150. {
  5151. IWbemEventConsumerProvider *t_Provider = ( IWbemEventConsumerProvider * ) t_Proxy ;
  5152. // Set cloaking on the proxy
  5153. // =========================
  5154. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  5155. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  5156. t_Provider ,
  5157. RPC_C_AUTHN_LEVEL_DEFAULT ,
  5158. t_ImpersonationLevel
  5159. ) ;
  5160. if ( SUCCEEDED ( t_Result ) )
  5161. {
  5162. t_Result = CoImpersonateClient () ;
  5163. if ( SUCCEEDED ( t_Result ) )
  5164. {
  5165. Increment_ProviderOperation_FindConsumer () ;
  5166. try
  5167. {
  5168. t_Result = t_Provider->FindConsumer (
  5169. a_LogicalConsumer ,
  5170. & t_Consumer
  5171. ) ;
  5172. }
  5173. catch ( ... )
  5174. {
  5175. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5176. }
  5177. CoRevertToSelf () ;
  5178. }
  5179. else
  5180. {
  5181. t_Result = WBEM_E_ACCESS_DENIED ;
  5182. }
  5183. }
  5184. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProvider , t_Proxy , t_Revert ) ;
  5185. }
  5186. }
  5187. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5188. }
  5189. if ( SUCCEEDED ( t_Result ) )
  5190. {
  5191. if ( a_Consumer )
  5192. {
  5193. CInterceptor_IWbemDecoupledUnboundObjectSink *t_UnboundObjectSink = new CInterceptor_IWbemDecoupledUnboundObjectSink (
  5194. m_Allocator ,
  5195. t_Consumer ,
  5196. this ,
  5197. *m_Registration
  5198. ) ;
  5199. if ( t_UnboundObjectSink )
  5200. {
  5201. t_UnboundObjectSink->AddRef () ;
  5202. t_Result = t_UnboundObjectSink->Initialize () ;
  5203. if ( SUCCEEDED ( t_Result ) )
  5204. {
  5205. CWbemGlobal_VoidPointerController_Container_Iterator t_Iterator ;
  5206. Lock () ;
  5207. WmiStatusCode t_StatusCode = Insert (
  5208. *t_UnboundObjectSink ,
  5209. t_Iterator
  5210. ) ;
  5211. if ( t_StatusCode == e_StatusCode_Success )
  5212. {
  5213. UnLock () ;
  5214. *a_Consumer = t_UnboundObjectSink ;
  5215. t_UnboundObjectSink->AddRef () ;
  5216. }
  5217. else
  5218. {
  5219. UnLock () ;
  5220. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5221. }
  5222. }
  5223. t_UnboundObjectSink->Release () ;
  5224. }
  5225. }
  5226. }
  5227. if ( t_Consumer )
  5228. {
  5229. t_Consumer->Release () ;
  5230. }
  5231. return t_Result ;
  5232. }
  5233. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5234. }
  5235. /******************************************************************************
  5236. *
  5237. * Name:
  5238. *
  5239. *
  5240. * Description:
  5241. *
  5242. *
  5243. *****************************************************************************/
  5244. HRESULT CInterceptor_DecoupledClient ::ValidateSubscription (
  5245. IWbemClassObject *a_LogicalConsumer
  5246. )
  5247. {
  5248. if ( m_Provider_IWbemEventConsumerProviderEx )
  5249. {
  5250. BOOL t_Impersonating = FALSE ;
  5251. IUnknown *t_OldContext = NULL ;
  5252. IServerSecurity *t_OldSecurity = NULL ;
  5253. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5254. if ( SUCCEEDED ( t_Result ) )
  5255. {
  5256. BOOL t_Revert = FALSE ;
  5257. IUnknown *t_Proxy = NULL ;
  5258. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProviderEx , IID_IWbemEventConsumerProviderEx , m_Provider_IWbemEventConsumerProviderEx , t_Proxy , t_Revert ) ;
  5259. if ( t_Result == WBEM_E_NOT_FOUND )
  5260. {
  5261. Increment_ProviderOperation_ValidateSubscription () ;
  5262. try
  5263. {
  5264. t_Result = m_Provider_IWbemEventConsumerProviderEx->ValidateSubscription (
  5265. a_LogicalConsumer
  5266. ) ;
  5267. }
  5268. catch ( ... )
  5269. {
  5270. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5271. }
  5272. CoRevertToSelf () ;
  5273. }
  5274. else
  5275. {
  5276. if ( SUCCEEDED ( t_Result ) )
  5277. {
  5278. IWbemEventConsumerProviderEx *t_Provider = ( IWbemEventConsumerProviderEx * ) t_Proxy ;
  5279. // Set cloaking on the proxy
  5280. // =========================
  5281. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  5282. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  5283. t_Provider ,
  5284. RPC_C_AUTHN_LEVEL_DEFAULT ,
  5285. t_ImpersonationLevel
  5286. ) ;
  5287. if ( SUCCEEDED ( t_Result ) )
  5288. {
  5289. t_Result = CoImpersonateClient () ;
  5290. if ( SUCCEEDED ( t_Result ) )
  5291. {
  5292. Increment_ProviderOperation_ValidateSubscription () ;
  5293. try
  5294. {
  5295. t_Result = t_Provider->ValidateSubscription (
  5296. a_LogicalConsumer
  5297. ) ;
  5298. }
  5299. catch ( ... )
  5300. {
  5301. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5302. }
  5303. CoRevertToSelf () ;
  5304. }
  5305. else
  5306. {
  5307. t_Result = WBEM_E_ACCESS_DENIED ;
  5308. }
  5309. }
  5310. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProviderEx , t_Proxy , t_Revert ) ;
  5311. }
  5312. }
  5313. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5314. }
  5315. return t_Result ;
  5316. }
  5317. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5318. }
  5319. /******************************************************************************
  5320. *
  5321. * Name:
  5322. *
  5323. *
  5324. * Description:
  5325. *
  5326. *
  5327. *****************************************************************************/
  5328. HRESULT CInterceptor_DecoupledClient :: IndicateToConsumer (
  5329. IWbemClassObject *a_LogicalConsumer ,
  5330. long a_ObjectCount ,
  5331. IWbemClassObject **a_Objects
  5332. )
  5333. {
  5334. if ( m_Provider_IWbemUnboundObjectSink )
  5335. {
  5336. BOOL t_Impersonating = FALSE ;
  5337. IUnknown *t_OldContext = NULL ;
  5338. IServerSecurity *t_OldSecurity = NULL ;
  5339. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5340. if ( SUCCEEDED ( t_Result ) )
  5341. {
  5342. BOOL t_Revert = FALSE ;
  5343. IUnknown *t_Proxy = NULL ;
  5344. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemUnboundObjectSink , IID_IWbemUnboundObjectSink , m_Provider_IWbemUnboundObjectSink , t_Proxy , t_Revert ) ;
  5345. if ( t_Result == WBEM_E_NOT_FOUND )
  5346. {
  5347. t_Result = m_Provider_IWbemUnboundObjectSink->IndicateToConsumer (
  5348. a_LogicalConsumer ,
  5349. a_ObjectCount ,
  5350. a_Objects
  5351. ) ;
  5352. }
  5353. else
  5354. {
  5355. if ( SUCCEEDED ( t_Result ) )
  5356. {
  5357. IWbemUnboundObjectSink *t_Provider = ( IWbemUnboundObjectSink * ) t_Proxy ;
  5358. // Set cloaking on the proxy
  5359. // =========================
  5360. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  5361. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  5362. t_Provider ,
  5363. RPC_C_AUTHN_LEVEL_DEFAULT ,
  5364. t_ImpersonationLevel
  5365. ) ;
  5366. if ( SUCCEEDED ( t_Result ) )
  5367. {
  5368. t_Result = t_Provider->IndicateToConsumer (
  5369. a_LogicalConsumer ,
  5370. a_ObjectCount ,
  5371. a_Objects
  5372. ) ;
  5373. }
  5374. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemUnboundObjectSink , t_Proxy , t_Revert ) ;
  5375. }
  5376. }
  5377. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5378. }
  5379. return t_Result ;
  5380. }
  5381. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5382. }
  5383. /******************************************************************************
  5384. *
  5385. * Name:
  5386. *
  5387. *
  5388. * Description:
  5389. *
  5390. *
  5391. *****************************************************************************/
  5392. HRESULT CInterceptor_DecoupledClient :: Initialize (
  5393. LPWSTR a_User ,
  5394. LONG a_Flags ,
  5395. LPWSTR a_Namespace ,
  5396. LPWSTR a_Locale ,
  5397. IWbemServices *a_CoreService ,
  5398. IWbemContext *a_Context ,
  5399. IWbemProviderInitSink *a_Sink
  5400. )
  5401. {
  5402. HRESULT t_Result = S_OK ;
  5403. if ( m_Unknown )
  5404. {
  5405. IWbemProviderInit *t_Provider = NULL ;
  5406. t_Result = m_Unknown->QueryInterface ( IID_IWbemProviderInit , ( void ** ) & t_Provider ) ;
  5407. if ( SUCCEEDED ( t_Result ) )
  5408. {
  5409. try
  5410. {
  5411. t_Result = t_Provider->Initialize (
  5412. a_User,
  5413. a_Flags,
  5414. a_Namespace,
  5415. a_Locale,
  5416. a_CoreService,
  5417. a_Context,
  5418. a_Sink
  5419. ) ;
  5420. }
  5421. catch ( ... )
  5422. {
  5423. t_Result = WBEM_E_PROVIDER_LOAD_FAILURE ;
  5424. }
  5425. t_Provider->Release () ;
  5426. }
  5427. else
  5428. {
  5429. t_Result = WBEM_E_PROVIDER_LOAD_FAILURE ;
  5430. }
  5431. }
  5432. else
  5433. {
  5434. t_Result = WBEM_E_PROVIDER_LOAD_FAILURE ;
  5435. }
  5436. a_Sink->SetStatus ( t_Result , 0 ) ;
  5437. return t_Result ;
  5438. }
  5439. /******************************************************************************
  5440. *
  5441. * Name:
  5442. *
  5443. *
  5444. * Description:
  5445. *
  5446. *
  5447. *****************************************************************************/
  5448. HRESULT CInterceptor_DecoupledClient :: Internal_Initialize (
  5449. WmiInternalContext a_InternalContext ,
  5450. LPWSTR a_User ,
  5451. LONG a_Flags ,
  5452. LPWSTR a_Namespace ,
  5453. LPWSTR a_Locale ,
  5454. IWbemServices *a_CoreService ,
  5455. IWbemContext *a_Context ,
  5456. IWbemProviderInitSink *a_Sink
  5457. )
  5458. {
  5459. BOOL t_Impersonating = FALSE ;
  5460. IUnknown *t_OldContext = NULL ;
  5461. IServerSecurity *t_OldSecurity = NULL ;
  5462. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  5463. a_InternalContext ,
  5464. t_Impersonating ,
  5465. t_OldContext ,
  5466. t_OldSecurity
  5467. ) ;
  5468. if ( SUCCEEDED ( t_Result ) )
  5469. {
  5470. t_Result = Initialize (
  5471. a_User ,
  5472. a_Flags ,
  5473. a_Namespace ,
  5474. a_Locale ,
  5475. a_CoreService ,
  5476. a_Context ,
  5477. a_Sink
  5478. ) ;
  5479. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5480. }
  5481. return t_Result ;
  5482. }
  5483. /******************************************************************************
  5484. *
  5485. * Name:
  5486. *
  5487. *
  5488. * Description:
  5489. *
  5490. *
  5491. *****************************************************************************/
  5492. HRESULT CInterceptor_DecoupledClient :: ProviderInitialize ()
  5493. {
  5494. HRESULT t_Result = S_OK ;
  5495. WmiStatusCode t_StatusCode = CWbemGlobal_IWmiObjectSinkController :: Initialize () ;
  5496. if ( t_StatusCode != e_StatusCode_Success )
  5497. {
  5498. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5499. }
  5500. if ( SUCCEEDED ( t_Result ) )
  5501. {
  5502. t_StatusCode = m_ProxyContainer.Initialize () ;
  5503. if ( t_StatusCode != e_StatusCode_Success )
  5504. {
  5505. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5506. }
  5507. }
  5508. return t_Result ;
  5509. }
  5510. /******************************************************************************
  5511. *
  5512. * Name:
  5513. *
  5514. *
  5515. * Description:
  5516. *
  5517. *
  5518. *****************************************************************************/
  5519. HRESULT CInterceptor_DecoupledClient :: GetSite ( DWORD *a_ProcessIdentifier )
  5520. {
  5521. HRESULT t_Result = S_OK ;
  5522. if ( a_ProcessIdentifier )
  5523. {
  5524. *a_ProcessIdentifier = GetCurrentProcessId () ;
  5525. }
  5526. else
  5527. {
  5528. t_Result = WBEM_E_INVALID_PARAMETER ;
  5529. }
  5530. return t_Result ;
  5531. }
  5532. /******************************************************************************
  5533. *
  5534. * Name:
  5535. *
  5536. *
  5537. * Description:
  5538. *
  5539. *
  5540. *****************************************************************************/
  5541. HRESULT CInterceptor_DecoupledClient :: SetContainer ( IUnknown *a_Container )
  5542. {
  5543. return WBEM_E_NOT_AVAILABLE ;
  5544. }
  5545. /******************************************************************************
  5546. *
  5547. * Name:
  5548. *
  5549. *
  5550. * Description:
  5551. *
  5552. *
  5553. *****************************************************************************/
  5554. HRESULT CInterceptor_DecoupledClient :: Shutdown (
  5555. LONG a_Flags ,
  5556. ULONG a_MaxMilliSeconds ,
  5557. IWbemContext *a_Context
  5558. )
  5559. {
  5560. HRESULT t_Result = S_OK ;
  5561. IWbemShutdown *t_Shutdown = NULL ;
  5562. if ( m_Unknown )
  5563. {
  5564. t_Result = m_Unknown->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  5565. if ( SUCCEEDED ( t_Result ) )
  5566. {
  5567. BOOL t_Impersonating = FALSE ;
  5568. IUnknown *t_OldContext = NULL ;
  5569. IServerSecurity *t_OldSecurity = NULL ;
  5570. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5571. if ( SUCCEEDED ( t_Result ) )
  5572. {
  5573. BOOL t_Revert = FALSE ;
  5574. IUnknown *t_Proxy = NULL ;
  5575. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemShutdown , IID_IWbemShutdown , t_Shutdown , t_Proxy , t_Revert ) ;
  5576. if ( t_Result == WBEM_E_NOT_FOUND )
  5577. {
  5578. try
  5579. {
  5580. t_Result = t_Shutdown->Shutdown (
  5581. a_Flags ,
  5582. a_MaxMilliSeconds ,
  5583. a_Context
  5584. ) ;
  5585. }
  5586. catch ( ... )
  5587. {
  5588. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5589. }
  5590. CoRevertToSelf () ;
  5591. }
  5592. else
  5593. {
  5594. if ( SUCCEEDED ( t_Result ) )
  5595. {
  5596. IWbemShutdown *t_Provider = ( IWbemShutdown * ) t_Proxy ;
  5597. // Set cloaking on the proxy
  5598. // =========================
  5599. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  5600. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  5601. t_Provider ,
  5602. RPC_C_AUTHN_LEVEL_DEFAULT ,
  5603. t_ImpersonationLevel
  5604. ) ;
  5605. if ( SUCCEEDED ( t_Result ) )
  5606. {
  5607. t_Result = CoImpersonateClient () ;
  5608. if ( SUCCEEDED ( t_Result ) )
  5609. {
  5610. try
  5611. {
  5612. t_Result = t_Provider->Shutdown (
  5613. a_Flags ,
  5614. a_MaxMilliSeconds ,
  5615. a_Context
  5616. ) ;
  5617. }
  5618. catch ( ... )
  5619. {
  5620. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5621. }
  5622. CoRevertToSelf () ;
  5623. }
  5624. }
  5625. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemShutdown , t_Proxy , t_Revert ) ;
  5626. }
  5627. }
  5628. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5629. }
  5630. t_Shutdown->Release () ;
  5631. }
  5632. }
  5633. Lock () ;
  5634. CWbemGlobal_IWmiObjectSinkController_Container *t_Container = NULL ;
  5635. GetContainer ( t_Container ) ;
  5636. IWbemShutdown **t_ShutdownElements = new IWbemShutdown * [ t_Container->Size () ] ;
  5637. if ( t_ShutdownElements )
  5638. {
  5639. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator = t_Container->Begin ();
  5640. ULONG t_Count = 0 ;
  5641. while ( ! t_Iterator.Null () )
  5642. {
  5643. t_Result = t_Iterator.GetElement ()->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_ShutdownElements [ t_Count ] ) ;
  5644. t_Iterator.Increment () ;
  5645. t_Count ++ ;
  5646. }
  5647. UnLock () ;
  5648. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  5649. {
  5650. if ( t_ShutdownElements [ t_Index ] )
  5651. {
  5652. t_Result = t_ShutdownElements [ t_Index ]->Shutdown (
  5653. a_Flags ,
  5654. a_MaxMilliSeconds ,
  5655. a_Context
  5656. ) ;
  5657. t_ShutdownElements [ t_Index ]->Release () ;
  5658. }
  5659. }
  5660. delete [] t_ShutdownElements ;
  5661. }
  5662. else
  5663. {
  5664. UnLock () ;
  5665. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5666. }
  5667. CWbemGlobal_IWmiObjectSinkController :: Shutdown () ;
  5668. return t_Result ;
  5669. }