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.

6860 lines
147 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 = DecoupledProviderSubSystem_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 = DecoupledProviderSubSystem_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 = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  254. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  255. t_Provider ,
  256. RPC_C_AUTHN_LEVEL_CONNECT ,
  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 = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_UnBoundSync_IWbemUnboundObjectSink , t_Proxy , t_Revert ) ;
  268. }
  269. }
  270. DecoupledProviderSubSystem_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. if (!OS::secureOS_)
  2036. {
  2037. a_Interface = m_Provider_IWbemServices ;
  2038. a_IsProxy = FALSE ;
  2039. return S_OK;
  2040. }
  2041. HRESULT t_Result = S_OK ;
  2042. a_Revert = FALSE ;
  2043. a_Proxy = NULL ;
  2044. a_Impersonating = FALSE ;
  2045. a_OldContext = NULL ;
  2046. a_OldSecurity = NULL ;
  2047. switch ( m_Registration->GetHosting () )
  2048. {
  2049. case e_Hosting_WmiCore:
  2050. case e_Hosting_SharedLocalSystemHost:
  2051. case e_Hosting_SharedLocalServiceHost:
  2052. case e_Hosting_SharedNetworkServiceHost:
  2053. {
  2054. a_Interface = m_Provider_IWbemServices ;
  2055. a_IsProxy = FALSE ;
  2056. }
  2057. break ;
  2058. default:
  2059. {
  2060. t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2061. if ( SUCCEEDED ( t_Result ) )
  2062. {
  2063. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemServices , IID_IWbemServices , m_Provider_IWbemServices , a_Proxy , a_Revert ) ;
  2064. if ( t_Result == WBEM_E_NOT_FOUND )
  2065. {
  2066. a_Interface = m_Provider_IWbemServices ;
  2067. a_IsProxy = FALSE ;
  2068. t_Result = S_OK ;
  2069. }
  2070. else
  2071. {
  2072. if ( SUCCEEDED ( t_Result ) )
  2073. {
  2074. a_IsProxy = TRUE ;
  2075. a_Interface = ( IWbemServices * ) a_Proxy ;
  2076. // Set cloaking on the proxy
  2077. // =========================
  2078. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  2079. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  2080. a_Interface ,
  2081. RPC_C_AUTHN_LEVEL_CONNECT ,
  2082. t_ImpersonationLevel
  2083. ) ;
  2084. if ( SUCCEEDED ( t_Result ) )
  2085. {
  2086. t_Result = OS::CoImpersonateClient () ;
  2087. if ( SUCCEEDED ( t_Result ) )
  2088. {
  2089. }
  2090. else
  2091. {
  2092. t_Result = WBEM_E_ACCESS_DENIED ;
  2093. }
  2094. }
  2095. if ( FAILED ( t_Result ) )
  2096. {
  2097. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState (
  2098. m_ProxyContainer ,
  2099. ProxyIndex_IWbemServices ,
  2100. a_Proxy ,
  2101. a_Revert
  2102. ) ;
  2103. }
  2104. }
  2105. }
  2106. if ( FAILED ( t_Result ) )
  2107. {
  2108. DecoupledProviderSubSystem_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2109. }
  2110. }
  2111. }
  2112. break ;
  2113. }
  2114. return t_Result ;
  2115. }
  2116. /******************************************************************************
  2117. *
  2118. * Name:
  2119. *
  2120. *
  2121. * Description:
  2122. *
  2123. *
  2124. *****************************************************************************/
  2125. HRESULT CInterceptor_DecoupledClient :: End_IWbemServices (
  2126. BOOL a_Impersonating ,
  2127. IUnknown *a_OldContext ,
  2128. IServerSecurity *a_OldSecurity ,
  2129. BOOL a_IsProxy ,
  2130. IWbemServices *a_Interface ,
  2131. BOOL a_Revert ,
  2132. IUnknown *a_Proxy
  2133. )
  2134. {
  2135. if (!OS::secureOS_)
  2136. {
  2137. return S_OK;
  2138. }
  2139. CoRevertToSelf () ;
  2140. if ( a_Proxy )
  2141. {
  2142. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState (
  2143. m_ProxyContainer ,
  2144. ProxyIndex_IWbemServices ,
  2145. a_Proxy ,
  2146. a_Revert
  2147. ) ;
  2148. }
  2149. switch ( m_Registration->GetHosting () )
  2150. {
  2151. case e_Hosting_WmiCore:
  2152. case e_Hosting_SharedLocalSystemHost:
  2153. case e_Hosting_SharedLocalServiceHost:
  2154. case e_Hosting_SharedNetworkServiceHost:
  2155. {
  2156. }
  2157. break ;
  2158. default:
  2159. {
  2160. DecoupledProviderSubSystem_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2161. }
  2162. break ;
  2163. }
  2164. return S_OK ;
  2165. }
  2166. /******************************************************************************
  2167. *
  2168. * Name:
  2169. *
  2170. *
  2171. * Description:
  2172. *
  2173. *
  2174. *****************************************************************************/
  2175. HRESULT CInterceptor_DecoupledClient::OpenNamespace (
  2176. const BSTR a_ObjectPath ,
  2177. long a_Flags ,
  2178. IWbemContext *a_Context ,
  2179. IWbemServices **a_NamespaceService ,
  2180. IWbemCallResult **a_CallResult
  2181. )
  2182. {
  2183. return WBEM_E_NOT_AVAILABLE ;
  2184. }
  2185. /******************************************************************************
  2186. *
  2187. * Name:
  2188. *
  2189. *
  2190. * Description:
  2191. *
  2192. *
  2193. *****************************************************************************/
  2194. HRESULT CInterceptor_DecoupledClient :: CancelAsyncCall (
  2195. IWbemObjectSink *a_Sink
  2196. )
  2197. {
  2198. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2199. if ( m_Provider_IWbemServices )
  2200. {
  2201. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2202. Lock () ;
  2203. WmiStatusCode t_StatusCode = Find (
  2204. a_Sink ,
  2205. t_Iterator
  2206. ) ;
  2207. if ( t_StatusCode == e_StatusCode_Success )
  2208. {
  2209. ObjectSinkContainerElement *t_Element = t_Iterator.GetElement () ;
  2210. UnLock () ;
  2211. IWbemObjectSink *t_ObjectSink = NULL ;
  2212. t_Result = t_Element->QueryInterface ( IID_IWbemObjectSink , ( void ** ) & t_ObjectSink ) ;
  2213. if ( SUCCEEDED ( t_Result ) )
  2214. {
  2215. BOOL t_Impersonating ;
  2216. IUnknown *t_OldContext ;
  2217. IServerSecurity *t_OldSecurity ;
  2218. BOOL t_IsProxy ;
  2219. IWbemServices *t_Interface ;
  2220. BOOL t_Revert ;
  2221. IUnknown *t_Proxy ;
  2222. t_Result = Begin_IWbemServices (
  2223. t_Impersonating ,
  2224. t_OldContext ,
  2225. t_OldSecurity ,
  2226. t_IsProxy ,
  2227. t_Interface ,
  2228. t_Revert ,
  2229. t_Proxy
  2230. ) ;
  2231. if ( SUCCEEDED ( t_Result ) )
  2232. {
  2233. t_Result = t_Interface->CancelAsyncCall (
  2234. t_ObjectSink
  2235. ) ;
  2236. End_IWbemServices (
  2237. t_Impersonating ,
  2238. t_OldContext ,
  2239. t_OldSecurity ,
  2240. t_IsProxy ,
  2241. t_Interface ,
  2242. t_Revert ,
  2243. t_Proxy
  2244. ) ;
  2245. }
  2246. t_ObjectSink->Release () ;
  2247. }
  2248. IWbemShutdown *t_Shutdown = NULL ;
  2249. HRESULT t_TempResult = t_Element->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  2250. if ( SUCCEEDED ( t_TempResult ) )
  2251. {
  2252. t_TempResult = t_Shutdown->Shutdown (
  2253. 0 ,
  2254. 0 ,
  2255. NULL
  2256. ) ;
  2257. t_Shutdown->Release () ;
  2258. }
  2259. t_Element->Release () ;
  2260. }
  2261. else
  2262. {
  2263. UnLock () ;
  2264. t_Result = WBEM_E_NOT_FOUND ;
  2265. }
  2266. }
  2267. return t_Result ;
  2268. }
  2269. /******************************************************************************
  2270. *
  2271. * Name:
  2272. *
  2273. *
  2274. * Description:
  2275. *
  2276. *
  2277. *****************************************************************************/
  2278. HRESULT CInterceptor_DecoupledClient :: QueryObjectSink (
  2279. long a_Flags ,
  2280. IWbemObjectSink **a_Sink
  2281. )
  2282. {
  2283. return WBEM_E_NOT_AVAILABLE ;
  2284. }
  2285. /******************************************************************************
  2286. *
  2287. * Name:
  2288. *
  2289. *
  2290. * Description:
  2291. *
  2292. *
  2293. *****************************************************************************/
  2294. HRESULT CInterceptor_DecoupledClient :: GetObject (
  2295. const BSTR a_ObjectPath ,
  2296. long a_Flags ,
  2297. IWbemContext *a_Context ,
  2298. IWbemClassObject **a_Object ,
  2299. IWbemCallResult **a_CallResult
  2300. )
  2301. {
  2302. return WBEM_E_NOT_AVAILABLE ;
  2303. }
  2304. /******************************************************************************
  2305. *
  2306. * Name:
  2307. *
  2308. *
  2309. * Description:
  2310. *
  2311. *
  2312. *****************************************************************************/
  2313. HRESULT CInterceptor_DecoupledClient :: Helper_GetObjectAsync (
  2314. BOOL a_IsProxy ,
  2315. const BSTR a_ObjectPath ,
  2316. long a_Flags ,
  2317. IWbemContext *a_Context ,
  2318. IWbemObjectSink *a_Sink ,
  2319. IWbemServices *a_Service
  2320. )
  2321. {
  2322. HRESULT t_Result = S_OK ;
  2323. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  2324. IWbemContext *t_ContextCopy = NULL ;
  2325. if ( a_Context )
  2326. {
  2327. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  2328. AdjustGetContext ( t_ContextCopy ) ;
  2329. }
  2330. else
  2331. {
  2332. t_Result = S_OK ;
  2333. }
  2334. if ( SUCCEEDED ( t_Result ) )
  2335. {
  2336. ULONG t_Dependant = 1 ;
  2337. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  2338. m_Allocator ,
  2339. a_Sink ,
  2340. ( IWbemServices * ) this ,
  2341. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2342. FALSE
  2343. ) ;
  2344. if ( t_Sink )
  2345. {
  2346. t_Sink->AddRef () ;
  2347. t_Result = t_Sink->SinkInitialize () ;
  2348. if ( SUCCEEDED ( t_Result ) )
  2349. {
  2350. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2351. Lock () ;
  2352. WmiStatusCode t_StatusCode = Insert (
  2353. *t_Sink ,
  2354. t_Iterator
  2355. ) ;
  2356. if ( t_StatusCode == e_StatusCode_Success )
  2357. {
  2358. UnLock () ;
  2359. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  2360. {
  2361. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  2362. }
  2363. if ( a_IsProxy )
  2364. {
  2365. t_Result = OS::CoImpersonateClient () ;
  2366. }
  2367. else
  2368. {
  2369. t_Result = S_OK ;
  2370. }
  2371. if ( SUCCEEDED ( t_Result ) )
  2372. {
  2373. Increment_ProviderOperation_GetObjectAsync () ;
  2374. try
  2375. {
  2376. t_Result = a_Service->GetObjectAsync (
  2377. a_ObjectPath ,
  2378. a_Flags ,
  2379. t_ContextCopy ,
  2380. t_Sink
  2381. ) ;
  2382. }
  2383. catch ( ... )
  2384. {
  2385. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2386. }
  2387. CoRevertToSelf () ;
  2388. }
  2389. else
  2390. {
  2391. t_Result = WBEM_E_ACCESS_DENIED ;
  2392. }
  2393. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  2394. {
  2395. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  2396. Increment_ProviderOperation_GetObjectAsync () ;
  2397. if ( a_IsProxy )
  2398. {
  2399. t_Result = OS::CoImpersonateClient () ;
  2400. }
  2401. else
  2402. {
  2403. t_Result = S_OK ;
  2404. }
  2405. if ( SUCCEEDED ( t_Result ) )
  2406. {
  2407. try
  2408. {
  2409. t_Result = a_Service->GetObjectAsync (
  2410. a_ObjectPath ,
  2411. a_Flags ,
  2412. t_ContextCopy ,
  2413. t_Sink
  2414. ) ;
  2415. }
  2416. catch ( ... )
  2417. {
  2418. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2419. }
  2420. CoRevertToSelf () ;
  2421. }
  2422. }
  2423. }
  2424. else
  2425. {
  2426. UnLock () ;
  2427. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2428. }
  2429. if ( FAILED ( t_Result ) )
  2430. {
  2431. HRESULT t_TempResult = SetStatus ( L"GetObjectAsync" , NULL , NULL , t_Result , t_Sink ) ;
  2432. }
  2433. }
  2434. t_Sink->Release () ;
  2435. }
  2436. else
  2437. {
  2438. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2439. }
  2440. }
  2441. else
  2442. {
  2443. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2444. }
  2445. if ( t_ContextCopy )
  2446. {
  2447. t_ContextCopy->Release () ;
  2448. }
  2449. return t_Result ;
  2450. }
  2451. /******************************************************************************
  2452. *
  2453. * Name:
  2454. *
  2455. *
  2456. * Description:
  2457. *
  2458. *
  2459. *****************************************************************************/
  2460. HRESULT CInterceptor_DecoupledClient :: GetObjectAsync (
  2461. const BSTR a_ObjectPath ,
  2462. long a_Flags ,
  2463. IWbemContext *a_Context ,
  2464. IWbemObjectSink *a_Sink
  2465. )
  2466. {
  2467. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2468. if ( m_Provider_IWbemServices )
  2469. {
  2470. if ( m_Registration->GetInstanceProviderRegistration ().SupportsGet () || m_Registration->GetClassProviderRegistration ().SupportsGet () )
  2471. {
  2472. BOOL t_Impersonating ;
  2473. IUnknown *t_OldContext ;
  2474. IServerSecurity *t_OldSecurity ;
  2475. BOOL t_IsProxy ;
  2476. IWbemServices *t_Interface ;
  2477. BOOL t_Revert ;
  2478. IUnknown *t_Proxy ;
  2479. t_Result = Begin_IWbemServices (
  2480. t_Impersonating ,
  2481. t_OldContext ,
  2482. t_OldSecurity ,
  2483. t_IsProxy ,
  2484. t_Interface ,
  2485. t_Revert ,
  2486. t_Proxy
  2487. ) ;
  2488. if ( SUCCEEDED ( t_Result ) )
  2489. {
  2490. t_Result = Helper_GetObjectAsync (
  2491. t_IsProxy ,
  2492. a_ObjectPath ,
  2493. a_Flags ,
  2494. a_Context ,
  2495. a_Sink ,
  2496. t_Interface
  2497. ) ;
  2498. End_IWbemServices (
  2499. t_Impersonating ,
  2500. t_OldContext ,
  2501. t_OldSecurity ,
  2502. t_IsProxy ,
  2503. t_Interface ,
  2504. t_Revert ,
  2505. t_Proxy
  2506. ) ;
  2507. }
  2508. }
  2509. }
  2510. return t_Result ;
  2511. }
  2512. /******************************************************************************
  2513. *
  2514. * Name:
  2515. *
  2516. *
  2517. * Description:
  2518. *
  2519. *
  2520. *****************************************************************************/
  2521. HRESULT CInterceptor_DecoupledClient :: PutClass (
  2522. IWbemClassObject *a_Object ,
  2523. long a_Flags ,
  2524. IWbemContext *a_Context ,
  2525. IWbemCallResult **a_CallResult
  2526. )
  2527. {
  2528. return WBEM_E_NOT_AVAILABLE ;
  2529. }
  2530. /******************************************************************************
  2531. *
  2532. * Name:
  2533. *
  2534. *
  2535. * Description:
  2536. *
  2537. *
  2538. *****************************************************************************/
  2539. HRESULT CInterceptor_DecoupledClient :: Helper_PutClassAsync (
  2540. BOOL a_IsProxy ,
  2541. IWbemClassObject *a_Object ,
  2542. long a_Flags ,
  2543. IWbemContext FAR *a_Context ,
  2544. IWbemObjectSink *a_Sink ,
  2545. IWbemServices *a_Service
  2546. )
  2547. {
  2548. HRESULT t_Result = S_OK ;
  2549. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  2550. IWbemContext *t_ContextCopy = NULL ;
  2551. if ( a_Context )
  2552. {
  2553. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  2554. }
  2555. else
  2556. {
  2557. t_Result = S_OK ;
  2558. }
  2559. if ( SUCCEEDED ( t_Result ) )
  2560. {
  2561. ULONG t_Dependant = 1 ;
  2562. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  2563. m_Allocator ,
  2564. a_Sink ,
  2565. ( IWbemServices * ) this ,
  2566. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2567. FALSE
  2568. ) ;
  2569. if ( t_Sink )
  2570. {
  2571. t_Sink->AddRef () ;
  2572. t_Result = t_Sink->SinkInitialize () ;
  2573. if ( SUCCEEDED ( t_Result ) )
  2574. {
  2575. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2576. Lock () ;
  2577. WmiStatusCode t_StatusCode = Insert (
  2578. *t_Sink ,
  2579. t_Iterator
  2580. ) ;
  2581. if ( t_StatusCode == e_StatusCode_Success )
  2582. {
  2583. UnLock () ;
  2584. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  2585. {
  2586. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  2587. }
  2588. if ( a_IsProxy )
  2589. {
  2590. t_Result = OS::CoImpersonateClient () ;
  2591. }
  2592. else
  2593. {
  2594. t_Result = S_OK ;
  2595. }
  2596. if ( SUCCEEDED ( t_Result ) )
  2597. {
  2598. Increment_ProviderOperation_PutClassAsync () ;
  2599. try
  2600. {
  2601. t_Result = a_Service->PutClassAsync (
  2602. a_Object ,
  2603. a_Flags ,
  2604. t_ContextCopy ,
  2605. t_Sink
  2606. ) ;
  2607. }
  2608. catch ( ... )
  2609. {
  2610. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2611. }
  2612. CoRevertToSelf () ;
  2613. }
  2614. else
  2615. {
  2616. t_Result = WBEM_E_ACCESS_DENIED ;
  2617. }
  2618. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  2619. {
  2620. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  2621. if ( a_IsProxy )
  2622. {
  2623. t_Result = OS::CoImpersonateClient () ;
  2624. }
  2625. else
  2626. {
  2627. t_Result = S_OK ;
  2628. }
  2629. if ( SUCCEEDED ( t_Result ) )
  2630. {
  2631. Increment_ProviderOperation_PutClassAsync () ;
  2632. try
  2633. {
  2634. t_Result = a_Service->PutClassAsync (
  2635. a_Object ,
  2636. a_Flags ,
  2637. t_ContextCopy ,
  2638. t_Sink
  2639. ) ;
  2640. }
  2641. catch ( ... )
  2642. {
  2643. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2644. }
  2645. CoRevertToSelf () ;
  2646. }
  2647. else
  2648. {
  2649. t_Result = WBEM_E_ACCESS_DENIED ;
  2650. }
  2651. }
  2652. }
  2653. else
  2654. {
  2655. UnLock () ;
  2656. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2657. }
  2658. if ( FAILED ( t_Result ) )
  2659. {
  2660. HRESULT t_TempResult = SetStatus ( L"PutClassAsync" , NULL , NULL , t_Result , t_Sink ) ;
  2661. }
  2662. }
  2663. t_Sink->Release () ;
  2664. }
  2665. else
  2666. {
  2667. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2668. }
  2669. }
  2670. else
  2671. {
  2672. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2673. }
  2674. if ( t_ContextCopy )
  2675. {
  2676. t_ContextCopy->Release () ;
  2677. }
  2678. return t_Result ;
  2679. }
  2680. /******************************************************************************
  2681. *
  2682. * Name:
  2683. *
  2684. *
  2685. * Description:
  2686. *
  2687. *
  2688. *****************************************************************************/
  2689. HRESULT CInterceptor_DecoupledClient :: PutClassAsync (
  2690. IWbemClassObject *a_Object ,
  2691. long a_Flags ,
  2692. IWbemContext *a_Context ,
  2693. IWbemObjectSink *a_Sink
  2694. )
  2695. {
  2696. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2697. if ( m_Provider_IWbemServices )
  2698. {
  2699. if ( m_Registration->GetClassProviderRegistration ().SupportsPut () )
  2700. {
  2701. BOOL t_Impersonating ;
  2702. IUnknown *t_OldContext ;
  2703. IServerSecurity *t_OldSecurity ;
  2704. BOOL t_IsProxy ;
  2705. IWbemServices *t_Interface ;
  2706. BOOL t_Revert ;
  2707. IUnknown *t_Proxy ;
  2708. t_Result = Begin_IWbemServices (
  2709. t_Impersonating ,
  2710. t_OldContext ,
  2711. t_OldSecurity ,
  2712. t_IsProxy ,
  2713. t_Interface ,
  2714. t_Revert ,
  2715. t_Proxy
  2716. ) ;
  2717. if ( SUCCEEDED ( t_Result ) )
  2718. {
  2719. t_Result = Helper_PutClassAsync (
  2720. t_IsProxy ,
  2721. a_Object ,
  2722. a_Flags ,
  2723. a_Context ,
  2724. a_Sink ,
  2725. t_Interface
  2726. ) ;
  2727. End_IWbemServices (
  2728. t_Impersonating ,
  2729. t_OldContext ,
  2730. t_OldSecurity ,
  2731. t_IsProxy ,
  2732. t_Interface ,
  2733. t_Revert ,
  2734. t_Proxy
  2735. ) ;
  2736. }
  2737. }
  2738. }
  2739. return t_Result ;
  2740. }
  2741. /******************************************************************************
  2742. *
  2743. * Name:
  2744. *
  2745. *
  2746. * Description:
  2747. *
  2748. *
  2749. *****************************************************************************/
  2750. HRESULT CInterceptor_DecoupledClient :: DeleteClass (
  2751. const BSTR a_Class ,
  2752. long a_Flags ,
  2753. IWbemContext *a_Context ,
  2754. IWbemCallResult **a_CallResult
  2755. )
  2756. {
  2757. return WBEM_E_NOT_AVAILABLE ;
  2758. }
  2759. /******************************************************************************
  2760. *
  2761. * Name:
  2762. *
  2763. *
  2764. * Description:
  2765. *
  2766. *
  2767. *****************************************************************************/
  2768. HRESULT CInterceptor_DecoupledClient :: Helper_DeleteClassAsync (
  2769. BOOL a_IsProxy ,
  2770. const BSTR a_Class ,
  2771. long a_Flags ,
  2772. IWbemContext FAR *a_Context ,
  2773. IWbemObjectSink *a_Sink ,
  2774. IWbemServices *a_Service
  2775. )
  2776. {
  2777. HRESULT t_Result = S_OK ;
  2778. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  2779. IWbemContext *t_ContextCopy = NULL ;
  2780. if ( a_Context )
  2781. {
  2782. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  2783. }
  2784. else
  2785. {
  2786. t_Result = S_OK ;
  2787. }
  2788. if ( SUCCEEDED ( t_Result ) )
  2789. {
  2790. ULONG t_Dependant = 1 ;
  2791. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  2792. m_Allocator ,
  2793. a_Sink ,
  2794. ( IWbemServices * ) this ,
  2795. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2796. FALSE
  2797. ) ;
  2798. if ( t_Sink )
  2799. {
  2800. t_Sink->AddRef () ;
  2801. t_Result = t_Sink->SinkInitialize () ;
  2802. if ( SUCCEEDED ( t_Result ) )
  2803. {
  2804. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2805. Lock () ;
  2806. WmiStatusCode t_StatusCode = Insert (
  2807. *t_Sink ,
  2808. t_Iterator
  2809. ) ;
  2810. if ( t_StatusCode == e_StatusCode_Success )
  2811. {
  2812. UnLock () ;
  2813. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  2814. {
  2815. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  2816. }
  2817. if ( a_IsProxy )
  2818. {
  2819. t_Result = OS::CoImpersonateClient () ;
  2820. }
  2821. else
  2822. {
  2823. t_Result = S_OK ;
  2824. }
  2825. if ( SUCCEEDED ( t_Result ) )
  2826. {
  2827. Increment_ProviderOperation_DeleteClassAsync () ;
  2828. try
  2829. {
  2830. t_Result = a_Service->DeleteClassAsync (
  2831. a_Class ,
  2832. a_Flags ,
  2833. t_ContextCopy ,
  2834. t_Sink
  2835. ) ;
  2836. }
  2837. catch ( ... )
  2838. {
  2839. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2840. }
  2841. CoRevertToSelf () ;
  2842. }
  2843. else
  2844. {
  2845. t_Result = WBEM_E_ACCESS_DENIED ;
  2846. }
  2847. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  2848. {
  2849. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  2850. if ( a_IsProxy )
  2851. {
  2852. t_Result = OS::CoImpersonateClient () ;
  2853. }
  2854. else
  2855. {
  2856. t_Result = S_OK ;
  2857. }
  2858. if ( SUCCEEDED ( t_Result ) )
  2859. {
  2860. Increment_ProviderOperation_DeleteClassAsync () ;
  2861. try
  2862. {
  2863. t_Result = a_Service->DeleteClassAsync (
  2864. a_Class ,
  2865. a_Flags ,
  2866. t_ContextCopy ,
  2867. t_Sink
  2868. ) ;
  2869. }
  2870. catch ( ... )
  2871. {
  2872. t_Result = WBEM_E_PROVIDER_FAILURE ;
  2873. }
  2874. CoRevertToSelf () ;
  2875. }
  2876. else
  2877. {
  2878. t_Result = WBEM_E_ACCESS_DENIED ;
  2879. }
  2880. }
  2881. }
  2882. else
  2883. {
  2884. UnLock () ;
  2885. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2886. }
  2887. if ( FAILED ( t_Result ) )
  2888. {
  2889. HRESULT t_TempResult = SetStatus ( L"DeleteClassAsync" , NULL , NULL , t_Result , t_Sink ) ;
  2890. }
  2891. }
  2892. t_Sink->Release () ;
  2893. }
  2894. else
  2895. {
  2896. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2897. }
  2898. }
  2899. else
  2900. {
  2901. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2902. }
  2903. if ( t_ContextCopy )
  2904. {
  2905. t_ContextCopy->Release () ;
  2906. }
  2907. return t_Result ;
  2908. }
  2909. /******************************************************************************
  2910. *
  2911. * Name:
  2912. *
  2913. *
  2914. * Description:
  2915. *
  2916. *
  2917. *****************************************************************************/
  2918. HRESULT CInterceptor_DecoupledClient :: DeleteClassAsync (
  2919. const BSTR a_Class ,
  2920. long a_Flags ,
  2921. IWbemContext *a_Context ,
  2922. IWbemObjectSink *a_Sink
  2923. )
  2924. {
  2925. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  2926. if ( m_Provider_IWbemServices )
  2927. {
  2928. if ( m_Registration->GetClassProviderRegistration ().SupportsDelete () )
  2929. {
  2930. BOOL t_Impersonating ;
  2931. IUnknown *t_OldContext ;
  2932. IServerSecurity *t_OldSecurity ;
  2933. BOOL t_IsProxy ;
  2934. IWbemServices *t_Interface ;
  2935. BOOL t_Revert ;
  2936. IUnknown *t_Proxy ;
  2937. t_Result = Begin_IWbemServices (
  2938. t_Impersonating ,
  2939. t_OldContext ,
  2940. t_OldSecurity ,
  2941. t_IsProxy ,
  2942. t_Interface ,
  2943. t_Revert ,
  2944. t_Proxy
  2945. ) ;
  2946. if ( SUCCEEDED ( t_Result ) )
  2947. {
  2948. t_Result = Helper_DeleteClassAsync (
  2949. t_IsProxy ,
  2950. a_Class ,
  2951. a_Flags ,
  2952. a_Context ,
  2953. a_Sink ,
  2954. t_Interface
  2955. ) ;
  2956. End_IWbemServices (
  2957. t_Impersonating ,
  2958. t_OldContext ,
  2959. t_OldSecurity ,
  2960. t_IsProxy ,
  2961. t_Interface ,
  2962. t_Revert ,
  2963. t_Proxy
  2964. ) ;
  2965. }
  2966. }
  2967. }
  2968. return t_Result ;
  2969. }
  2970. /******************************************************************************
  2971. *
  2972. * Name:
  2973. *
  2974. *
  2975. * Description:
  2976. *
  2977. *
  2978. *****************************************************************************/
  2979. HRESULT CInterceptor_DecoupledClient :: CreateClassEnum (
  2980. const BSTR a_Superclass ,
  2981. long a_Flags,
  2982. IWbemContext *a_Context ,
  2983. IEnumWbemClassObject **a_Enum
  2984. )
  2985. {
  2986. return WBEM_E_NOT_AVAILABLE ;
  2987. }
  2988. /******************************************************************************
  2989. *
  2990. * Name:
  2991. *
  2992. *
  2993. * Description:
  2994. *
  2995. *
  2996. *****************************************************************************/
  2997. HRESULT CInterceptor_DecoupledClient :: Helper_CreateClassEnumAsync (
  2998. BOOL a_IsProxy ,
  2999. const BSTR a_SuperClass ,
  3000. long a_Flags ,
  3001. IWbemContext FAR *a_Context ,
  3002. IWbemObjectSink *a_Sink ,
  3003. IWbemServices *a_Service
  3004. )
  3005. {
  3006. HRESULT t_Result = S_OK ;
  3007. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3008. IWbemContext *t_ContextCopy = NULL ;
  3009. if ( a_Context )
  3010. {
  3011. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3012. }
  3013. else
  3014. {
  3015. t_Result = S_OK ;
  3016. }
  3017. if ( SUCCEEDED ( t_Result ) )
  3018. {
  3019. ULONG t_Dependant = 1 ;
  3020. CDecoupled_Batching_IWbemSyncObjectSink *t_Sink = new CDecoupled_Batching_IWbemSyncObjectSink (
  3021. m_Allocator ,
  3022. a_Sink ,
  3023. ( IWbemServices * ) this ,
  3024. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3025. FALSE
  3026. ) ;
  3027. if ( t_Sink )
  3028. {
  3029. t_Sink->AddRef () ;
  3030. t_Result = t_Sink->SinkInitialize () ;
  3031. if ( SUCCEEDED ( t_Result ) )
  3032. {
  3033. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3034. Lock () ;
  3035. WmiStatusCode t_StatusCode = Insert (
  3036. *t_Sink ,
  3037. t_Iterator
  3038. ) ;
  3039. if ( t_StatusCode == e_StatusCode_Success )
  3040. {
  3041. UnLock () ;
  3042. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3043. {
  3044. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3045. }
  3046. if ( a_IsProxy )
  3047. {
  3048. t_Result = OS::CoImpersonateClient () ;
  3049. }
  3050. else
  3051. {
  3052. t_Result = S_OK ;
  3053. }
  3054. if ( SUCCEEDED ( t_Result ) )
  3055. {
  3056. Increment_ProviderOperation_CreateClassEnumAsync () ;
  3057. try
  3058. {
  3059. t_Result = a_Service->CreateClassEnumAsync (
  3060. a_SuperClass ,
  3061. a_Flags ,
  3062. t_ContextCopy ,
  3063. t_Sink
  3064. ) ;
  3065. }
  3066. catch ( ... )
  3067. {
  3068. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3069. }
  3070. CoRevertToSelf () ;
  3071. }
  3072. else
  3073. {
  3074. t_Result = WBEM_E_ACCESS_DENIED ;
  3075. }
  3076. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3077. {
  3078. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3079. if ( a_IsProxy )
  3080. {
  3081. t_Result = OS::CoImpersonateClient () ;
  3082. }
  3083. else
  3084. {
  3085. t_Result = S_OK ;
  3086. }
  3087. if ( SUCCEEDED ( t_Result ) )
  3088. {
  3089. Increment_ProviderOperation_CreateClassEnumAsync () ;
  3090. try
  3091. {
  3092. t_Result = a_Service->CreateClassEnumAsync (
  3093. a_SuperClass ,
  3094. a_Flags ,
  3095. t_ContextCopy ,
  3096. t_Sink
  3097. ) ;
  3098. }
  3099. catch ( ... )
  3100. {
  3101. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3102. }
  3103. CoRevertToSelf () ;
  3104. }
  3105. else
  3106. {
  3107. t_Result = WBEM_E_ACCESS_DENIED ;
  3108. }
  3109. }
  3110. }
  3111. else
  3112. {
  3113. UnLock () ;
  3114. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3115. }
  3116. if ( FAILED ( t_Result ) )
  3117. {
  3118. HRESULT t_TempResult = SetStatus ( L"CreateClassEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3119. }
  3120. }
  3121. t_Sink->Release () ;
  3122. }
  3123. else
  3124. {
  3125. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3126. }
  3127. }
  3128. else
  3129. {
  3130. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3131. }
  3132. if ( t_ContextCopy )
  3133. {
  3134. t_ContextCopy->Release () ;
  3135. }
  3136. return t_Result ;
  3137. }
  3138. /******************************************************************************
  3139. *
  3140. * Name:
  3141. *
  3142. *
  3143. * Description:
  3144. *
  3145. *
  3146. *****************************************************************************/
  3147. HRESULT CInterceptor_DecoupledClient :: CreateClassEnumAsync (
  3148. const BSTR a_SuperClass ,
  3149. long a_Flags ,
  3150. IWbemContext *a_Context ,
  3151. IWbemObjectSink *a_Sink
  3152. )
  3153. {
  3154. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3155. if ( m_Provider_IWbemServices )
  3156. {
  3157. if ( m_Registration->GetClassProviderRegistration ().SupportsEnumeration () )
  3158. {
  3159. BOOL t_Impersonating ;
  3160. IUnknown *t_OldContext ;
  3161. IServerSecurity *t_OldSecurity ;
  3162. BOOL t_IsProxy ;
  3163. IWbemServices *t_Interface ;
  3164. BOOL t_Revert ;
  3165. IUnknown *t_Proxy ;
  3166. t_Result = Begin_IWbemServices (
  3167. t_Impersonating ,
  3168. t_OldContext ,
  3169. t_OldSecurity ,
  3170. t_IsProxy ,
  3171. t_Interface ,
  3172. t_Revert ,
  3173. t_Proxy
  3174. ) ;
  3175. if ( SUCCEEDED ( t_Result ) )
  3176. {
  3177. t_Result = Helper_CreateClassEnumAsync (
  3178. t_IsProxy ,
  3179. a_SuperClass ,
  3180. a_Flags ,
  3181. a_Context ,
  3182. a_Sink ,
  3183. t_Interface
  3184. ) ;
  3185. End_IWbemServices (
  3186. t_Impersonating ,
  3187. t_OldContext ,
  3188. t_OldSecurity ,
  3189. t_IsProxy ,
  3190. t_Interface ,
  3191. t_Revert ,
  3192. t_Proxy
  3193. ) ;
  3194. }
  3195. }
  3196. }
  3197. return t_Result ;
  3198. }
  3199. /******************************************************************************
  3200. *
  3201. * Name:
  3202. *
  3203. *
  3204. * Description:
  3205. *
  3206. *
  3207. *****************************************************************************/
  3208. HRESULT CInterceptor_DecoupledClient :: PutInstance (
  3209. IWbemClassObject *a_Instance ,
  3210. long a_Flags ,
  3211. IWbemContext *a_Context ,
  3212. IWbemCallResult **a_CallResult
  3213. )
  3214. {
  3215. return WBEM_E_NOT_AVAILABLE ;
  3216. }
  3217. /******************************************************************************
  3218. *
  3219. * Name:
  3220. *
  3221. *
  3222. * Description:
  3223. *
  3224. *
  3225. *****************************************************************************/
  3226. HRESULT CInterceptor_DecoupledClient :: Helper_PutInstanceAsync (
  3227. BOOL a_IsProxy ,
  3228. IWbemClassObject *a_Instance ,
  3229. long a_Flags ,
  3230. IWbemContext FAR *a_Context ,
  3231. IWbemObjectSink *a_Sink ,
  3232. IWbemServices *a_Service
  3233. )
  3234. {
  3235. HRESULT t_Result = S_OK ;
  3236. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3237. IWbemContext *t_ContextCopy = NULL ;
  3238. if ( a_Context )
  3239. {
  3240. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3241. }
  3242. else
  3243. {
  3244. t_Result = S_OK ;
  3245. }
  3246. if ( SUCCEEDED ( t_Result ) )
  3247. {
  3248. ULONG t_Dependant = 1 ;
  3249. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  3250. m_Allocator ,
  3251. a_Sink ,
  3252. ( IWbemServices * ) this ,
  3253. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3254. FALSE
  3255. ) ;
  3256. if ( t_Sink )
  3257. {
  3258. t_Sink->AddRef () ;
  3259. t_Result = t_Sink->SinkInitialize () ;
  3260. if ( SUCCEEDED ( t_Result ) )
  3261. {
  3262. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3263. Lock () ;
  3264. WmiStatusCode t_StatusCode = Insert (
  3265. *t_Sink ,
  3266. t_Iterator
  3267. ) ;
  3268. if ( t_StatusCode == e_StatusCode_Success )
  3269. {
  3270. UnLock () ;
  3271. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3272. {
  3273. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3274. }
  3275. if ( a_IsProxy )
  3276. {
  3277. t_Result = OS::CoImpersonateClient () ;
  3278. }
  3279. else
  3280. {
  3281. t_Result = S_OK ;
  3282. }
  3283. if ( SUCCEEDED ( t_Result ) )
  3284. {
  3285. Increment_ProviderOperation_PutInstanceAsync () ;
  3286. try
  3287. {
  3288. t_Result = a_Service->PutInstanceAsync (
  3289. a_Instance ,
  3290. a_Flags ,
  3291. t_ContextCopy ,
  3292. t_Sink
  3293. ) ;
  3294. }
  3295. catch ( ... )
  3296. {
  3297. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3298. }
  3299. CoRevertToSelf () ;
  3300. }
  3301. else
  3302. {
  3303. t_Result = WBEM_E_ACCESS_DENIED ;
  3304. }
  3305. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3306. {
  3307. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3308. if ( a_IsProxy )
  3309. {
  3310. t_Result = OS::CoImpersonateClient () ;
  3311. }
  3312. else
  3313. {
  3314. t_Result = S_OK ;
  3315. }
  3316. if ( SUCCEEDED ( t_Result ) )
  3317. {
  3318. Increment_ProviderOperation_PutInstanceAsync () ;
  3319. try
  3320. {
  3321. t_Result = a_Service->PutInstanceAsync (
  3322. a_Instance ,
  3323. a_Flags ,
  3324. t_ContextCopy ,
  3325. t_Sink
  3326. ) ;
  3327. }
  3328. catch ( ... )
  3329. {
  3330. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3331. }
  3332. CoRevertToSelf () ;
  3333. }
  3334. else
  3335. {
  3336. t_Result = WBEM_E_ACCESS_DENIED ;
  3337. }
  3338. }
  3339. }
  3340. else
  3341. {
  3342. UnLock () ;
  3343. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3344. }
  3345. if ( FAILED ( t_Result ) )
  3346. {
  3347. HRESULT t_TempResult = SetStatus ( L"PutInstanceAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3348. }
  3349. }
  3350. t_Sink->Release () ;
  3351. }
  3352. else
  3353. {
  3354. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3355. }
  3356. }
  3357. else
  3358. {
  3359. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3360. }
  3361. if ( t_ContextCopy )
  3362. {
  3363. t_ContextCopy->Release () ;
  3364. }
  3365. return t_Result ;
  3366. }
  3367. /******************************************************************************
  3368. *
  3369. * Name:
  3370. *
  3371. *
  3372. * Description:
  3373. *
  3374. *
  3375. *****************************************************************************/
  3376. HRESULT CInterceptor_DecoupledClient :: PutInstanceAsync (
  3377. IWbemClassObject *a_Instance ,
  3378. long a_Flags ,
  3379. IWbemContext *a_Context ,
  3380. IWbemObjectSink *a_Sink
  3381. )
  3382. {
  3383. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3384. if ( m_Provider_IWbemServices )
  3385. {
  3386. if ( m_Registration->GetInstanceProviderRegistration ().SupportsPut () )
  3387. {
  3388. BOOL t_Impersonating ;
  3389. IUnknown *t_OldContext ;
  3390. IServerSecurity *t_OldSecurity ;
  3391. BOOL t_IsProxy ;
  3392. IWbemServices *t_Interface ;
  3393. BOOL t_Revert ;
  3394. IUnknown *t_Proxy ;
  3395. t_Result = Begin_IWbemServices (
  3396. t_Impersonating ,
  3397. t_OldContext ,
  3398. t_OldSecurity ,
  3399. t_IsProxy ,
  3400. t_Interface ,
  3401. t_Revert ,
  3402. t_Proxy
  3403. ) ;
  3404. if ( SUCCEEDED ( t_Result ) )
  3405. {
  3406. t_Result = Helper_PutInstanceAsync (
  3407. t_IsProxy ,
  3408. a_Instance ,
  3409. a_Flags ,
  3410. a_Context ,
  3411. a_Sink ,
  3412. t_Interface
  3413. ) ;
  3414. End_IWbemServices (
  3415. t_Impersonating ,
  3416. t_OldContext ,
  3417. t_OldSecurity ,
  3418. t_IsProxy ,
  3419. t_Interface ,
  3420. t_Revert ,
  3421. t_Proxy
  3422. ) ;
  3423. }
  3424. }
  3425. }
  3426. return t_Result ;
  3427. }
  3428. /******************************************************************************
  3429. *
  3430. * Name:
  3431. *
  3432. *
  3433. * Description:
  3434. *
  3435. *
  3436. *****************************************************************************/
  3437. HRESULT CInterceptor_DecoupledClient :: DeleteInstance (
  3438. const BSTR a_ObjectPath ,
  3439. long a_Flags ,
  3440. IWbemContext *a_Context ,
  3441. IWbemCallResult **a_CallResult
  3442. )
  3443. {
  3444. return WBEM_E_NOT_AVAILABLE ;
  3445. }
  3446. /******************************************************************************
  3447. *
  3448. * Name:
  3449. *
  3450. *
  3451. * Description:
  3452. *
  3453. *
  3454. *****************************************************************************/
  3455. HRESULT CInterceptor_DecoupledClient :: Helper_DeleteInstanceAsync (
  3456. BOOL a_IsProxy ,
  3457. const BSTR a_ObjectPath ,
  3458. long a_Flags ,
  3459. IWbemContext FAR *a_Context ,
  3460. IWbemObjectSink *a_Sink ,
  3461. IWbemServices *a_Service
  3462. )
  3463. {
  3464. HRESULT t_Result = S_OK ;
  3465. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3466. IWbemContext *t_ContextCopy = NULL ;
  3467. if ( a_Context )
  3468. {
  3469. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3470. }
  3471. else
  3472. {
  3473. t_Result = S_OK ;
  3474. }
  3475. if ( SUCCEEDED ( t_Result ) )
  3476. {
  3477. ULONG t_Dependant = 1 ;
  3478. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  3479. m_Allocator ,
  3480. a_Sink ,
  3481. ( IWbemServices * ) this ,
  3482. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3483. FALSE
  3484. ) ;
  3485. if ( t_Sink )
  3486. {
  3487. t_Sink->AddRef () ;
  3488. t_Result = t_Sink->SinkInitialize () ;
  3489. if ( SUCCEEDED ( t_Result ) )
  3490. {
  3491. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3492. Lock () ;
  3493. WmiStatusCode t_StatusCode = Insert (
  3494. *t_Sink ,
  3495. t_Iterator
  3496. ) ;
  3497. if ( t_StatusCode == e_StatusCode_Success )
  3498. {
  3499. UnLock () ;
  3500. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3501. {
  3502. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3503. }
  3504. if ( a_IsProxy )
  3505. {
  3506. t_Result = OS::CoImpersonateClient () ;
  3507. }
  3508. else
  3509. {
  3510. t_Result = S_OK ;
  3511. }
  3512. if ( SUCCEEDED ( t_Result ) )
  3513. {
  3514. Increment_ProviderOperation_DeleteInstanceAsync () ;
  3515. try
  3516. {
  3517. t_Result = a_Service->DeleteInstanceAsync (
  3518. a_ObjectPath ,
  3519. a_Flags ,
  3520. t_ContextCopy ,
  3521. t_Sink
  3522. ) ;
  3523. }
  3524. catch ( ... )
  3525. {
  3526. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3527. }
  3528. CoRevertToSelf () ;
  3529. }
  3530. else
  3531. {
  3532. t_Result = WBEM_E_ACCESS_DENIED ;
  3533. }
  3534. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3535. {
  3536. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3537. if ( a_IsProxy )
  3538. {
  3539. t_Result = OS::CoImpersonateClient () ;
  3540. }
  3541. else
  3542. {
  3543. t_Result = S_OK ;
  3544. }
  3545. if ( SUCCEEDED ( t_Result ) )
  3546. {
  3547. Increment_ProviderOperation_DeleteInstanceAsync () ;
  3548. try
  3549. {
  3550. t_Result = a_Service->DeleteInstanceAsync (
  3551. a_ObjectPath ,
  3552. a_Flags ,
  3553. t_ContextCopy ,
  3554. t_Sink
  3555. ) ;
  3556. }
  3557. catch ( ... )
  3558. {
  3559. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3560. }
  3561. CoRevertToSelf () ;
  3562. }
  3563. else
  3564. {
  3565. t_Result = WBEM_E_ACCESS_DENIED ;
  3566. }
  3567. }
  3568. }
  3569. else
  3570. {
  3571. UnLock () ;
  3572. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3573. }
  3574. if ( FAILED ( t_Result ) )
  3575. {
  3576. HRESULT t_TempResult = SetStatus ( L"DeleteInstanceAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3577. }
  3578. }
  3579. t_Sink->Release () ;
  3580. }
  3581. else
  3582. {
  3583. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3584. }
  3585. }
  3586. else
  3587. {
  3588. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3589. }
  3590. if ( t_ContextCopy )
  3591. {
  3592. t_ContextCopy->Release () ;
  3593. }
  3594. return t_Result ;
  3595. }
  3596. /******************************************************************************
  3597. *
  3598. * Name:
  3599. *
  3600. *
  3601. * Description:
  3602. *
  3603. *
  3604. *****************************************************************************/
  3605. HRESULT CInterceptor_DecoupledClient :: DeleteInstanceAsync (
  3606. const BSTR a_ObjectPath ,
  3607. long a_Flags ,
  3608. IWbemContext *a_Context ,
  3609. IWbemObjectSink *a_Sink
  3610. )
  3611. {
  3612. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3613. if ( m_Provider_IWbemServices )
  3614. {
  3615. if ( m_Registration->GetInstanceProviderRegistration ().SupportsDelete () )
  3616. {
  3617. BOOL t_Impersonating ;
  3618. IUnknown *t_OldContext ;
  3619. IServerSecurity *t_OldSecurity ;
  3620. BOOL t_IsProxy ;
  3621. IWbemServices *t_Interface ;
  3622. BOOL t_Revert ;
  3623. IUnknown *t_Proxy ;
  3624. t_Result = Begin_IWbemServices (
  3625. t_Impersonating ,
  3626. t_OldContext ,
  3627. t_OldSecurity ,
  3628. t_IsProxy ,
  3629. t_Interface ,
  3630. t_Revert ,
  3631. t_Proxy
  3632. ) ;
  3633. if ( SUCCEEDED ( t_Result ) )
  3634. {
  3635. t_Result = Helper_DeleteInstanceAsync (
  3636. t_IsProxy ,
  3637. a_ObjectPath ,
  3638. a_Flags ,
  3639. a_Context ,
  3640. a_Sink ,
  3641. t_Interface
  3642. ) ;
  3643. End_IWbemServices (
  3644. t_Impersonating ,
  3645. t_OldContext ,
  3646. t_OldSecurity ,
  3647. t_IsProxy ,
  3648. t_Interface ,
  3649. t_Revert ,
  3650. t_Proxy
  3651. ) ;
  3652. }
  3653. }
  3654. }
  3655. return t_Result ;
  3656. }
  3657. /******************************************************************************
  3658. *
  3659. * Name:
  3660. *
  3661. *
  3662. * Description:
  3663. *
  3664. *
  3665. *****************************************************************************/
  3666. HRESULT CInterceptor_DecoupledClient :: CreateInstanceEnum (
  3667. const BSTR a_Class ,
  3668. long a_Flags ,
  3669. IWbemContext *a_Context ,
  3670. IEnumWbemClassObject **a_Enum
  3671. )
  3672. {
  3673. return WBEM_E_NOT_AVAILABLE ;
  3674. }
  3675. /******************************************************************************
  3676. *
  3677. * Name:
  3678. *
  3679. *
  3680. * Description:
  3681. *
  3682. *
  3683. *****************************************************************************/
  3684. HRESULT CInterceptor_DecoupledClient :: Helper_CreateInstanceEnumAsync (
  3685. BOOL a_IsProxy ,
  3686. const BSTR a_Class ,
  3687. long a_Flags ,
  3688. IWbemContext *a_Context ,
  3689. IWbemObjectSink *a_Sink ,
  3690. IWbemServices *a_Service
  3691. )
  3692. {
  3693. HRESULT t_Result = S_OK ;
  3694. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3695. IWbemContext *t_ContextCopy = NULL ;
  3696. if ( a_Context )
  3697. {
  3698. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3699. AdjustGetContext ( t_ContextCopy ) ;
  3700. }
  3701. else
  3702. {
  3703. t_Result = S_OK ;
  3704. }
  3705. if ( SUCCEEDED ( t_Result ) )
  3706. {
  3707. ULONG t_Dependant = 1 ;
  3708. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  3709. m_Allocator ,
  3710. a_Sink ,
  3711. ( IWbemServices * ) this ,
  3712. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3713. FALSE
  3714. ) ;
  3715. if ( t_Sink )
  3716. {
  3717. t_Sink->AddRef () ;
  3718. t_Result = t_Sink->SinkInitialize () ;
  3719. if ( SUCCEEDED ( t_Result ) )
  3720. {
  3721. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3722. Lock () ;
  3723. WmiStatusCode t_StatusCode = Insert (
  3724. *t_Sink ,
  3725. t_Iterator
  3726. ) ;
  3727. if ( t_StatusCode == e_StatusCode_Success )
  3728. {
  3729. UnLock () ;
  3730. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3731. {
  3732. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3733. }
  3734. if ( a_IsProxy )
  3735. {
  3736. t_Result = OS::CoImpersonateClient () ;
  3737. }
  3738. else
  3739. {
  3740. t_Result = S_OK ;
  3741. }
  3742. if ( SUCCEEDED ( t_Result ) )
  3743. {
  3744. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  3745. try
  3746. {
  3747. t_Result = a_Service->CreateInstanceEnumAsync (
  3748. a_Class ,
  3749. a_Flags ,
  3750. t_ContextCopy ,
  3751. t_Sink
  3752. ) ;
  3753. }
  3754. catch ( ... )
  3755. {
  3756. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3757. }
  3758. CoRevertToSelf () ;
  3759. }
  3760. else
  3761. {
  3762. t_Result = WBEM_E_ACCESS_DENIED ;
  3763. }
  3764. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3765. {
  3766. if ( a_IsProxy )
  3767. {
  3768. t_Result = OS::CoImpersonateClient () ;
  3769. }
  3770. else
  3771. {
  3772. t_Result = S_OK ;
  3773. }
  3774. if ( SUCCEEDED ( t_Result ) )
  3775. {
  3776. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3777. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  3778. try
  3779. {
  3780. t_Result = a_Service->CreateInstanceEnumAsync (
  3781. a_Class ,
  3782. a_Flags ,
  3783. t_ContextCopy ,
  3784. t_Sink
  3785. ) ;
  3786. }
  3787. catch ( ... )
  3788. {
  3789. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3790. }
  3791. CoRevertToSelf () ;
  3792. }
  3793. }
  3794. }
  3795. else
  3796. {
  3797. UnLock () ;
  3798. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3799. }
  3800. }
  3801. if ( FAILED ( t_Result ) )
  3802. {
  3803. HRESULT t_TempResult = SetStatus ( L"CreateInstanceEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3804. }
  3805. t_Sink->Release () ;
  3806. }
  3807. else
  3808. {
  3809. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3810. }
  3811. }
  3812. else
  3813. {
  3814. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3815. }
  3816. if ( t_ContextCopy )
  3817. {
  3818. t_ContextCopy->Release () ;
  3819. }
  3820. return t_Result ;
  3821. }
  3822. /******************************************************************************
  3823. *
  3824. * Name:
  3825. *
  3826. *
  3827. * Description:
  3828. *
  3829. *
  3830. *****************************************************************************/
  3831. HRESULT CInterceptor_DecoupledClient :: CreateInstanceEnumAsync (
  3832. const BSTR a_Class ,
  3833. long a_Flags ,
  3834. IWbemContext *a_Context ,
  3835. IWbemObjectSink *a_Sink
  3836. )
  3837. {
  3838. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3839. if ( m_Provider_IWbemServices )
  3840. {
  3841. if ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () )
  3842. {
  3843. BOOL t_Impersonating ;
  3844. IUnknown *t_OldContext ;
  3845. IServerSecurity *t_OldSecurity ;
  3846. BOOL t_IsProxy ;
  3847. IWbemServices *t_Interface ;
  3848. BOOL t_Revert ;
  3849. IUnknown *t_Proxy ;
  3850. t_Result = Begin_IWbemServices (
  3851. t_Impersonating ,
  3852. t_OldContext ,
  3853. t_OldSecurity ,
  3854. t_IsProxy ,
  3855. t_Interface ,
  3856. t_Revert ,
  3857. t_Proxy
  3858. ) ;
  3859. if ( SUCCEEDED ( t_Result ) )
  3860. {
  3861. t_Result = Helper_CreateInstanceEnumAsync (
  3862. t_IsProxy ,
  3863. a_Class ,
  3864. a_Flags ,
  3865. a_Context ,
  3866. a_Sink ,
  3867. t_Interface
  3868. ) ;
  3869. End_IWbemServices (
  3870. t_Impersonating ,
  3871. t_OldContext ,
  3872. t_OldSecurity ,
  3873. t_IsProxy ,
  3874. t_Interface ,
  3875. t_Revert ,
  3876. t_Proxy
  3877. ) ;
  3878. }
  3879. }
  3880. }
  3881. return t_Result ;
  3882. }
  3883. /******************************************************************************
  3884. *
  3885. * Name:
  3886. *
  3887. *
  3888. * Description:
  3889. *
  3890. *
  3891. *****************************************************************************/
  3892. HRESULT CInterceptor_DecoupledClient :: ExecQuery (
  3893. const BSTR a_QueryLanguage ,
  3894. const BSTR a_Query ,
  3895. long a_Flags ,
  3896. IWbemContext *a_Context ,
  3897. IEnumWbemClassObject **a_Enum
  3898. )
  3899. {
  3900. return WBEM_E_NOT_AVAILABLE ;
  3901. }
  3902. /******************************************************************************
  3903. *
  3904. * Name:
  3905. *
  3906. *
  3907. * Description:
  3908. *
  3909. *
  3910. *****************************************************************************/
  3911. HRESULT CInterceptor_DecoupledClient :: Helper_ExecQueryAsync (
  3912. BOOL a_IsProxy ,
  3913. const BSTR a_QueryLanguage ,
  3914. const BSTR a_Query,
  3915. long a_Flags ,
  3916. IWbemContext FAR *a_Context ,
  3917. IWbemObjectSink *a_Sink ,
  3918. IWbemServices *a_Service
  3919. )
  3920. {
  3921. HRESULT t_Result = S_OK ;
  3922. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3923. IWbemContext *t_ContextCopy = NULL ;
  3924. if ( SUCCEEDED ( t_Result ) )
  3925. {
  3926. if ( a_Context )
  3927. {
  3928. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3929. if ( SUCCEEDED ( t_Result ) )
  3930. {
  3931. }
  3932. else
  3933. {
  3934. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3935. }
  3936. }
  3937. else
  3938. {
  3939. t_Result = S_OK ;
  3940. }
  3941. }
  3942. if ( SUCCEEDED ( t_Result ) )
  3943. {
  3944. ULONG t_Dependant = 1 ;
  3945. if ( ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_UnarySelect ) || ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_V1ProviderDefined ) )
  3946. {
  3947. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  3948. m_Allocator ,
  3949. a_Sink ,
  3950. ( IWbemServices * ) this ,
  3951. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3952. FALSE
  3953. ) ;
  3954. if ( t_Sink )
  3955. {
  3956. t_Sink->AddRef () ;
  3957. t_Result = t_Sink->SinkInitialize () ;
  3958. if ( SUCCEEDED ( t_Result ) )
  3959. {
  3960. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3961. Lock () ;
  3962. WmiStatusCode t_StatusCode = Insert (
  3963. *t_Sink ,
  3964. t_Iterator
  3965. ) ;
  3966. if ( t_StatusCode == e_StatusCode_Success )
  3967. {
  3968. UnLock () ;
  3969. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3970. {
  3971. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3972. }
  3973. if ( a_IsProxy )
  3974. {
  3975. t_Result = OS::CoImpersonateClient () ;
  3976. }
  3977. else
  3978. {
  3979. t_Result = S_OK ;
  3980. }
  3981. if ( SUCCEEDED ( t_Result ) )
  3982. {
  3983. Increment_ProviderOperation_ExecQueryAsync () ;
  3984. try
  3985. {
  3986. t_Result = a_Service->ExecQueryAsync (
  3987. a_QueryLanguage ,
  3988. a_Query,
  3989. a_Flags ,
  3990. t_ContextCopy ,
  3991. t_Sink
  3992. ) ;
  3993. }
  3994. catch ( ... )
  3995. {
  3996. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3997. }
  3998. CoRevertToSelf () ;
  3999. }
  4000. else
  4001. {
  4002. t_Result = WBEM_E_ACCESS_DENIED ;
  4003. }
  4004. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4005. {
  4006. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4007. if ( a_IsProxy )
  4008. {
  4009. t_Result = OS::CoImpersonateClient () ;
  4010. }
  4011. else
  4012. {
  4013. t_Result = S_OK ;
  4014. }
  4015. if ( SUCCEEDED ( t_Result ) )
  4016. {
  4017. Increment_ProviderOperation_ExecQueryAsync () ;
  4018. try
  4019. {
  4020. t_Result = a_Service->ExecQueryAsync (
  4021. a_QueryLanguage ,
  4022. a_Query,
  4023. a_Flags ,
  4024. t_ContextCopy ,
  4025. t_Sink
  4026. ) ;
  4027. }
  4028. catch ( ... )
  4029. {
  4030. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4031. }
  4032. CoRevertToSelf () ;
  4033. }
  4034. else
  4035. {
  4036. t_Result = WBEM_E_ACCESS_DENIED ;
  4037. }
  4038. }
  4039. }
  4040. else
  4041. {
  4042. UnLock () ;
  4043. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4044. }
  4045. if ( FAILED ( t_Result ) )
  4046. {
  4047. HRESULT t_TempResult = SetStatus ( L"ExecQueryAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4048. }
  4049. }
  4050. t_Sink->Release () ;
  4051. }
  4052. else
  4053. {
  4054. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4055. }
  4056. }
  4057. else if ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () )
  4058. {
  4059. IWbemQuery *t_QueryFilter = NULL ;
  4060. t_Result = DecoupledProviderSubSystem_Globals :: CreateInstance (
  4061. CLSID_WbemQuery ,
  4062. NULL ,
  4063. CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER ,
  4064. IID_IWbemQuery ,
  4065. ( void ** ) & t_QueryFilter
  4066. ) ;
  4067. if ( SUCCEEDED ( t_Result ) )
  4068. {
  4069. t_Result = t_QueryFilter->Parse (
  4070. a_QueryLanguage ,
  4071. a_Query ,
  4072. 0
  4073. ) ;
  4074. if ( SUCCEEDED ( t_Result ) )
  4075. {
  4076. SWbemRpnEncodedQuery *t_Expression = NULL ;
  4077. t_Result = t_QueryFilter->GetAnalysis (
  4078. WMIQ_ANALYSIS_RPN_SEQUENCE ,
  4079. 0 ,
  4080. ( void ** ) & t_Expression
  4081. ) ;
  4082. if ( SUCCEEDED ( t_Result ) )
  4083. {
  4084. if ( t_Expression->m_uFromTargetType == WMIQ_RPN_FROM_UNARY )
  4085. {
  4086. BSTR t_Class = SysAllocString ( t_Expression->m_ppszFromList [ 0 ] ) ;
  4087. if ( t_Class )
  4088. {
  4089. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  4090. m_Allocator ,
  4091. a_Sink ,
  4092. ( IWbemServices * ) this ,
  4093. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4094. FALSE
  4095. ) ;
  4096. if ( t_Sink )
  4097. {
  4098. t_Sink->AddRef () ;
  4099. t_Result = t_Sink->SinkInitialize () ;
  4100. if ( SUCCEEDED ( t_Result ) )
  4101. {
  4102. a_Sink->SetStatus ( WBEM_STATUS_REQUIREMENTS , 0 , NULL , NULL ) ;
  4103. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4104. Lock () ;
  4105. WmiStatusCode t_StatusCode = Insert (
  4106. *t_Sink ,
  4107. t_Iterator
  4108. ) ;
  4109. if ( t_StatusCode == e_StatusCode_Success )
  4110. {
  4111. UnLock () ;
  4112. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4113. {
  4114. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4115. }
  4116. if ( a_IsProxy )
  4117. {
  4118. t_Result = OS::CoImpersonateClient () ;
  4119. }
  4120. else
  4121. {
  4122. t_Result = S_OK ;
  4123. }
  4124. if ( SUCCEEDED ( t_Result ) )
  4125. {
  4126. a_Sink->SetStatus ( WBEM_STATUS_REQUIREMENTS , 0 , NULL , NULL ) ;
  4127. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  4128. try
  4129. {
  4130. t_Result = a_Service->CreateInstanceEnumAsync (
  4131. t_Class ,
  4132. a_Flags ,
  4133. t_ContextCopy ,
  4134. t_Sink
  4135. ) ;
  4136. }
  4137. catch ( ... )
  4138. {
  4139. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4140. }
  4141. CoRevertToSelf () ;
  4142. }
  4143. else
  4144. {
  4145. t_Result = WBEM_E_ACCESS_DENIED ;
  4146. }
  4147. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4148. {
  4149. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4150. if ( a_IsProxy )
  4151. {
  4152. t_Result = OS::CoImpersonateClient () ;
  4153. }
  4154. else
  4155. {
  4156. t_Result = S_OK ;
  4157. }
  4158. if ( SUCCEEDED ( t_Result ) )
  4159. {
  4160. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  4161. try
  4162. {
  4163. t_Result = a_Service->CreateInstanceEnumAsync (
  4164. t_Class ,
  4165. a_Flags ,
  4166. t_ContextCopy ,
  4167. t_Sink
  4168. ) ;
  4169. }
  4170. catch ( ... )
  4171. {
  4172. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4173. }
  4174. CoRevertToSelf () ;
  4175. }
  4176. else
  4177. {
  4178. t_Result = WBEM_E_ACCESS_DENIED ;
  4179. }
  4180. }
  4181. }
  4182. else
  4183. {
  4184. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4185. }
  4186. }
  4187. if ( FAILED ( t_Result ) )
  4188. {
  4189. HRESULT t_TempResult = SetStatus ( L"CreateInstanceEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4190. }
  4191. t_Sink->Release () ;
  4192. }
  4193. else
  4194. {
  4195. SysFreeString ( t_Class ) ;
  4196. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4197. }
  4198. }
  4199. else
  4200. {
  4201. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4202. }
  4203. }
  4204. else
  4205. {
  4206. t_Result = WBEM_E_NOT_SUPPORTED ;
  4207. }
  4208. t_QueryFilter->FreeMemory ( t_Expression ) ;
  4209. }
  4210. else
  4211. {
  4212. t_Result = WBEM_E_UNEXPECTED ;
  4213. }
  4214. }
  4215. else
  4216. {
  4217. t_Result = WBEM_E_NOT_SUPPORTED ;
  4218. }
  4219. t_QueryFilter->Release () ;
  4220. }
  4221. else
  4222. {
  4223. t_Result = WBEM_E_CRITICAL_ERROR ;
  4224. }
  4225. }
  4226. else
  4227. {
  4228. t_Result = WBEM_E_NOT_SUPPORTED ;
  4229. }
  4230. }
  4231. if ( t_ContextCopy )
  4232. {
  4233. t_ContextCopy->Release () ;
  4234. }
  4235. return t_Result ;
  4236. }
  4237. /******************************************************************************
  4238. *
  4239. * Name:
  4240. *
  4241. *
  4242. * Description:
  4243. *
  4244. *
  4245. *****************************************************************************/
  4246. HRESULT CInterceptor_DecoupledClient :: ExecQueryAsync (
  4247. const BSTR a_QueryLanguage ,
  4248. const BSTR a_Query,
  4249. long a_Flags ,
  4250. IWbemContext *a_Context ,
  4251. IWbemObjectSink *a_Sink
  4252. )
  4253. {
  4254. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4255. if ( m_Provider_IWbemServices )
  4256. {
  4257. if ( ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_UnarySelect ) || ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_V1ProviderDefined ) || ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () ) )
  4258. {
  4259. BOOL t_Impersonating ;
  4260. IUnknown *t_OldContext ;
  4261. IServerSecurity *t_OldSecurity ;
  4262. BOOL t_IsProxy ;
  4263. IWbemServices *t_Interface ;
  4264. BOOL t_Revert ;
  4265. IUnknown *t_Proxy ;
  4266. t_Result = Begin_IWbemServices (
  4267. t_Impersonating ,
  4268. t_OldContext ,
  4269. t_OldSecurity ,
  4270. t_IsProxy ,
  4271. t_Interface ,
  4272. t_Revert ,
  4273. t_Proxy
  4274. ) ;
  4275. if ( SUCCEEDED ( t_Result ) )
  4276. {
  4277. t_Result = Helper_ExecQueryAsync (
  4278. t_IsProxy ,
  4279. a_QueryLanguage ,
  4280. a_Query,
  4281. a_Flags ,
  4282. a_Context ,
  4283. a_Sink ,
  4284. t_Interface
  4285. ) ;
  4286. End_IWbemServices (
  4287. t_Impersonating ,
  4288. t_OldContext ,
  4289. t_OldSecurity ,
  4290. t_IsProxy ,
  4291. t_Interface ,
  4292. t_Revert ,
  4293. t_Proxy
  4294. ) ;
  4295. }
  4296. }
  4297. }
  4298. return t_Result ;
  4299. }
  4300. /******************************************************************************
  4301. *
  4302. * Name:
  4303. *
  4304. *
  4305. * Description:
  4306. *
  4307. *
  4308. *****************************************************************************/
  4309. HRESULT CInterceptor_DecoupledClient :: ExecNotificationQuery (
  4310. const BSTR a_QueryLanguage ,
  4311. const BSTR a_Query ,
  4312. long a_Flags ,
  4313. IWbemContext *a_Context ,
  4314. IEnumWbemClassObject **a_Enum
  4315. )
  4316. {
  4317. return WBEM_E_NOT_AVAILABLE ;
  4318. }
  4319. /******************************************************************************
  4320. *
  4321. * Name:
  4322. *
  4323. *
  4324. * Description:
  4325. *
  4326. *
  4327. *****************************************************************************/
  4328. HRESULT CInterceptor_DecoupledClient :: ExecNotificationQueryAsync (
  4329. const BSTR a_QueryLanguage ,
  4330. const BSTR a_Query ,
  4331. long a_Flags ,
  4332. IWbemContext *a_Context ,
  4333. IWbemObjectSink *a_Sink
  4334. )
  4335. {
  4336. return WBEM_E_NOT_AVAILABLE ;
  4337. }
  4338. /******************************************************************************
  4339. *
  4340. * Name:
  4341. *
  4342. *
  4343. * Description:
  4344. *
  4345. *
  4346. *****************************************************************************/
  4347. HRESULT CInterceptor_DecoupledClient :: ExecMethod (
  4348. const BSTR a_ObjectPath ,
  4349. const BSTR a_MethodName ,
  4350. long a_Flags ,
  4351. IWbemContext *a_Context ,
  4352. IWbemClassObject *a_InParams ,
  4353. IWbemClassObject **a_OutParams ,
  4354. IWbemCallResult **a_CallResult
  4355. )
  4356. {
  4357. return WBEM_E_NOT_AVAILABLE ;
  4358. }
  4359. /******************************************************************************
  4360. *
  4361. * Name:
  4362. *
  4363. *
  4364. * Description:
  4365. *
  4366. *
  4367. *****************************************************************************/
  4368. HRESULT CInterceptor_DecoupledClient :: Helper_ExecMethodAsync (
  4369. BOOL a_IsProxy ,
  4370. const BSTR a_ObjectPath ,
  4371. const BSTR a_MethodName ,
  4372. long a_Flags ,
  4373. IWbemContext *a_Context ,
  4374. IWbemClassObject *a_InParams ,
  4375. IWbemObjectSink *a_Sink ,
  4376. IWbemServices *a_Service
  4377. )
  4378. {
  4379. HRESULT t_Result = S_OK ;
  4380. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  4381. IWbemContext *t_ContextCopy = NULL ;
  4382. if ( a_Context )
  4383. {
  4384. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  4385. AdjustGetContext ( t_ContextCopy ) ;
  4386. }
  4387. else
  4388. {
  4389. t_Result = S_OK ;
  4390. }
  4391. if ( SUCCEEDED ( t_Result ) )
  4392. {
  4393. ULONG t_Dependant = 1 ;
  4394. CDecoupled_IWbemSyncObjectSink *t_Sink = new CDecoupled_IWbemSyncObjectSink (
  4395. m_Allocator ,
  4396. a_Sink ,
  4397. ( IWbemServices * ) this ,
  4398. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4399. FALSE
  4400. ) ;
  4401. if ( t_Sink )
  4402. {
  4403. t_Sink->AddRef () ;
  4404. t_Result = t_Sink->SinkInitialize () ;
  4405. if ( SUCCEEDED ( t_Result ) )
  4406. {
  4407. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4408. Lock () ;
  4409. WmiStatusCode t_StatusCode = Insert (
  4410. *t_Sink ,
  4411. t_Iterator
  4412. ) ;
  4413. if ( t_StatusCode == e_StatusCode_Success )
  4414. {
  4415. UnLock () ;
  4416. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4417. {
  4418. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4419. }
  4420. if ( a_IsProxy )
  4421. {
  4422. t_Result = OS::CoImpersonateClient () ;
  4423. }
  4424. else
  4425. {
  4426. t_Result = S_OK ;
  4427. }
  4428. if ( SUCCEEDED ( t_Result ) )
  4429. {
  4430. Increment_ProviderOperation_ExecMethodAsync () ;
  4431. try
  4432. {
  4433. t_Result = a_Service->ExecMethodAsync (
  4434. a_ObjectPath ,
  4435. a_MethodName ,
  4436. a_Flags ,
  4437. t_ContextCopy ,
  4438. a_InParams ,
  4439. t_Sink
  4440. ) ;
  4441. }
  4442. catch ( ... )
  4443. {
  4444. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4445. }
  4446. CoRevertToSelf () ;
  4447. }
  4448. else
  4449. {
  4450. t_Result = WBEM_E_ACCESS_DENIED ;
  4451. }
  4452. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4453. {
  4454. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4455. if ( a_IsProxy )
  4456. {
  4457. t_Result = OS::CoImpersonateClient () ;
  4458. }
  4459. else
  4460. {
  4461. t_Result = S_OK ;
  4462. }
  4463. if ( SUCCEEDED ( t_Result ) )
  4464. {
  4465. Increment_ProviderOperation_ExecMethodAsync () ;
  4466. try
  4467. {
  4468. t_Result = a_Service->ExecMethodAsync (
  4469. a_ObjectPath ,
  4470. a_MethodName ,
  4471. a_Flags ,
  4472. t_ContextCopy ,
  4473. a_InParams ,
  4474. t_Sink
  4475. ) ;
  4476. }
  4477. catch ( ... )
  4478. {
  4479. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4480. }
  4481. CoRevertToSelf () ;
  4482. }
  4483. else
  4484. {
  4485. t_Result = WBEM_E_ACCESS_DENIED ;
  4486. }
  4487. }
  4488. }
  4489. else
  4490. {
  4491. UnLock () ;
  4492. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4493. }
  4494. if ( FAILED ( t_Result ) )
  4495. {
  4496. HRESULT t_TempResult = SetStatus ( L"ExecMethodAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4497. }
  4498. }
  4499. t_Sink->Release () ;
  4500. }
  4501. else
  4502. {
  4503. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4504. }
  4505. }
  4506. else
  4507. {
  4508. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4509. }
  4510. if ( t_ContextCopy )
  4511. {
  4512. t_ContextCopy->Release () ;
  4513. }
  4514. return t_Result ;
  4515. }
  4516. /******************************************************************************
  4517. *
  4518. * Name:
  4519. *
  4520. *
  4521. * Description:
  4522. *
  4523. *
  4524. *****************************************************************************/
  4525. HRESULT CInterceptor_DecoupledClient :: ExecMethodAsync (
  4526. const BSTR a_ObjectPath ,
  4527. const BSTR a_MethodName ,
  4528. long a_Flags ,
  4529. IWbemContext *a_Context ,
  4530. IWbemClassObject *a_InParams ,
  4531. IWbemObjectSink *a_Sink
  4532. )
  4533. {
  4534. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4535. if ( m_Provider_IWbemServices )
  4536. {
  4537. if ( m_Registration->GetMethodProviderRegistration ().SupportsMethods () )
  4538. {
  4539. BOOL t_Impersonating ;
  4540. IUnknown *t_OldContext ;
  4541. IServerSecurity *t_OldSecurity ;
  4542. BOOL t_IsProxy ;
  4543. IWbemServices *t_Interface ;
  4544. BOOL t_Revert ;
  4545. IUnknown *t_Proxy ;
  4546. t_Result = Begin_IWbemServices (
  4547. t_Impersonating ,
  4548. t_OldContext ,
  4549. t_OldSecurity ,
  4550. t_IsProxy ,
  4551. t_Interface ,
  4552. t_Revert ,
  4553. t_Proxy
  4554. ) ;
  4555. if ( SUCCEEDED ( t_Result ) )
  4556. {
  4557. t_Result = Helper_ExecMethodAsync (
  4558. t_IsProxy ,
  4559. a_ObjectPath ,
  4560. a_MethodName ,
  4561. a_Flags ,
  4562. a_Context ,
  4563. a_InParams ,
  4564. a_Sink ,
  4565. t_Interface
  4566. ) ;
  4567. End_IWbemServices (
  4568. t_Impersonating ,
  4569. t_OldContext ,
  4570. t_OldSecurity ,
  4571. t_IsProxy ,
  4572. t_Interface ,
  4573. t_Revert ,
  4574. t_Proxy
  4575. ) ;
  4576. }
  4577. }
  4578. }
  4579. return t_Result ;
  4580. }
  4581. /******************************************************************************
  4582. *
  4583. * Name:
  4584. *
  4585. *
  4586. * Description:
  4587. *
  4588. *
  4589. *****************************************************************************/
  4590. HRESULT CInterceptor_DecoupledClient :: GetProperty (
  4591. long a_Flags ,
  4592. const BSTR a_Locale ,
  4593. const BSTR a_ClassMapping ,
  4594. const BSTR a_InstanceMapping ,
  4595. const BSTR a_PropertyMapping ,
  4596. VARIANT *a_Value
  4597. )
  4598. {
  4599. if ( m_Provider_IWbemPropertyProvider )
  4600. {
  4601. if ( m_Registration->GetPropertyProviderRegistration ().SupportsGet () )
  4602. {
  4603. Increment_ProviderOperation_GetProperty () ;
  4604. HRESULT t_Result = S_OK ;
  4605. try
  4606. {
  4607. t_Result = m_Provider_IWbemPropertyProvider->GetProperty (
  4608. a_Flags ,
  4609. a_Locale ,
  4610. a_ClassMapping ,
  4611. a_InstanceMapping ,
  4612. a_PropertyMapping ,
  4613. a_Value
  4614. ) ;
  4615. CoRevertToSelf () ;
  4616. }
  4617. catch ( ... )
  4618. {
  4619. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4620. CoRevertToSelf () ;
  4621. }
  4622. return t_Result ;
  4623. }
  4624. }
  4625. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4626. }
  4627. /******************************************************************************
  4628. *
  4629. * Name:
  4630. *
  4631. *
  4632. * Description:
  4633. *
  4634. *
  4635. *****************************************************************************/
  4636. HRESULT CInterceptor_DecoupledClient :: PutProperty (
  4637. long a_Flags ,
  4638. const BSTR a_Locale ,
  4639. const BSTR a_ClassMapping ,
  4640. const BSTR a_InstanceMapping ,
  4641. const BSTR a_PropertyMapping ,
  4642. const VARIANT *a_Value
  4643. )
  4644. {
  4645. if ( m_Provider_IWbemPropertyProvider )
  4646. {
  4647. if ( m_Registration->GetPropertyProviderRegistration ().SupportsPut () )
  4648. {
  4649. Increment_ProviderOperation_PutProperty () ;
  4650. HRESULT t_Result = S_OK ;
  4651. try
  4652. {
  4653. t_Result = m_Provider_IWbemPropertyProvider->PutProperty (
  4654. a_Flags ,
  4655. a_Locale ,
  4656. a_ClassMapping ,
  4657. a_InstanceMapping ,
  4658. a_PropertyMapping ,
  4659. a_Value
  4660. ) ;
  4661. CoRevertToSelf () ;
  4662. return t_Result ;
  4663. }
  4664. catch ( ... )
  4665. {
  4666. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4667. CoRevertToSelf () ;
  4668. }
  4669. return t_Result ;
  4670. }
  4671. }
  4672. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4673. }
  4674. /******************************************************************************
  4675. *
  4676. * Name:
  4677. *
  4678. *
  4679. * Description:
  4680. *
  4681. *
  4682. *****************************************************************************/
  4683. HRESULT CInterceptor_DecoupledClient ::ProvideEvents (
  4684. IWbemObjectSink *a_Sink ,
  4685. long a_Flags
  4686. )
  4687. {
  4688. if ( m_Provider_IWbemEventProvider )
  4689. {
  4690. BOOL t_Impersonating = FALSE ;
  4691. IUnknown *t_OldContext = NULL ;
  4692. IServerSecurity *t_OldSecurity = NULL ;
  4693. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4694. if ( SUCCEEDED ( t_Result ) )
  4695. {
  4696. BOOL t_Revert = FALSE ;
  4697. IUnknown *t_Proxy = NULL ;
  4698. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProvider , IID_IWbemEventProvider , m_Provider_IWbemEventProvider , t_Proxy , t_Revert ) ;
  4699. if ( t_Result == WBEM_E_NOT_FOUND )
  4700. {
  4701. Increment_ProviderOperation_ProvideEvents () ;
  4702. try
  4703. {
  4704. t_Result = m_Provider_IWbemEventProvider->ProvideEvents (
  4705. a_Sink ,
  4706. a_Flags
  4707. ) ;
  4708. }
  4709. catch ( ... )
  4710. {
  4711. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4712. }
  4713. CoRevertToSelf () ;
  4714. }
  4715. else
  4716. {
  4717. if ( SUCCEEDED ( t_Result ) )
  4718. {
  4719. IWbemEventProvider *t_Provider = ( IWbemEventProvider * ) t_Proxy ;
  4720. // Set cloaking on the proxy
  4721. // =========================
  4722. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  4723. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  4724. t_Provider ,
  4725. RPC_C_AUTHN_LEVEL_CONNECT ,
  4726. t_ImpersonationLevel
  4727. ) ;
  4728. if ( SUCCEEDED ( t_Result ) )
  4729. {
  4730. t_Result = OS::CoImpersonateClient () ;
  4731. if ( SUCCEEDED ( t_Result ) )
  4732. {
  4733. Increment_ProviderOperation_ProvideEvents () ;
  4734. try
  4735. {
  4736. t_Result = t_Provider->ProvideEvents (
  4737. a_Sink ,
  4738. a_Flags
  4739. ) ;
  4740. }
  4741. catch ( ... )
  4742. {
  4743. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4744. }
  4745. CoRevertToSelf () ;
  4746. }
  4747. else
  4748. {
  4749. t_Result = WBEM_E_ACCESS_DENIED ;
  4750. }
  4751. }
  4752. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProvider , t_Proxy , t_Revert ) ;
  4753. }
  4754. }
  4755. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4756. }
  4757. return t_Result ;
  4758. }
  4759. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4760. }
  4761. /******************************************************************************
  4762. *
  4763. * Name:
  4764. *
  4765. *
  4766. * Description:
  4767. *
  4768. *
  4769. *****************************************************************************/
  4770. HRESULT CInterceptor_DecoupledClient ::NewQuery (
  4771. unsigned long a_Id ,
  4772. WBEM_WSTR a_QueryLanguage ,
  4773. WBEM_WSTR a_Query
  4774. )
  4775. {
  4776. if ( m_Provider_IWbemEventProviderQuerySink )
  4777. {
  4778. BOOL t_Impersonating = FALSE ;
  4779. IUnknown *t_OldContext = NULL ;
  4780. IServerSecurity *t_OldSecurity = NULL ;
  4781. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4782. if ( SUCCEEDED ( t_Result ) )
  4783. {
  4784. BOOL t_Revert = FALSE ;
  4785. IUnknown *t_Proxy = NULL ;
  4786. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , IID_IWbemEventProviderQuerySink , m_Provider_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4787. if ( t_Result == WBEM_E_NOT_FOUND )
  4788. {
  4789. Increment_ProviderOperation_NewQuery () ;
  4790. try
  4791. {
  4792. t_Result = m_Provider_IWbemEventProviderQuerySink->NewQuery (
  4793. a_Id ,
  4794. a_QueryLanguage ,
  4795. a_Query
  4796. ) ;
  4797. }
  4798. catch ( ... )
  4799. {
  4800. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4801. }
  4802. CoRevertToSelf () ;
  4803. }
  4804. else
  4805. {
  4806. if ( SUCCEEDED ( t_Result ) )
  4807. {
  4808. IWbemEventProviderQuerySink *t_Provider = ( IWbemEventProviderQuerySink * ) t_Proxy ;
  4809. // Set cloaking on the proxy
  4810. // =========================
  4811. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  4812. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  4813. t_Provider ,
  4814. RPC_C_AUTHN_LEVEL_CONNECT ,
  4815. t_ImpersonationLevel
  4816. ) ;
  4817. if ( SUCCEEDED ( t_Result ) )
  4818. {
  4819. t_Result = OS::CoImpersonateClient () ;
  4820. if ( SUCCEEDED ( t_Result ) )
  4821. {
  4822. Increment_ProviderOperation_NewQuery () ;
  4823. try
  4824. {
  4825. t_Result = t_Provider->NewQuery (
  4826. a_Id ,
  4827. a_QueryLanguage ,
  4828. a_Query
  4829. ) ;
  4830. }
  4831. catch ( ... )
  4832. {
  4833. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4834. }
  4835. CoRevertToSelf () ;
  4836. }
  4837. else
  4838. {
  4839. t_Result = WBEM_E_ACCESS_DENIED ;
  4840. }
  4841. }
  4842. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4843. }
  4844. }
  4845. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4846. }
  4847. return t_Result ;
  4848. }
  4849. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4850. }
  4851. /******************************************************************************
  4852. *
  4853. * Name:
  4854. *
  4855. *
  4856. * Description:
  4857. *
  4858. *
  4859. *****************************************************************************/
  4860. HRESULT CInterceptor_DecoupledClient ::CancelQuery (
  4861. unsigned long a_Id
  4862. )
  4863. {
  4864. if ( m_Provider_IWbemEventProviderQuerySink )
  4865. {
  4866. BOOL t_Impersonating = FALSE ;
  4867. IUnknown *t_OldContext = NULL ;
  4868. IServerSecurity *t_OldSecurity = NULL ;
  4869. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4870. if ( SUCCEEDED ( t_Result ) )
  4871. {
  4872. BOOL t_Revert = FALSE ;
  4873. IUnknown *t_Proxy = NULL ;
  4874. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , IID_IWbemEventProviderQuerySink , m_Provider_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4875. if ( t_Result == WBEM_E_NOT_FOUND )
  4876. {
  4877. Increment_ProviderOperation_CancelQuery () ;
  4878. try
  4879. {
  4880. t_Result = m_Provider_IWbemEventProviderQuerySink->CancelQuery (
  4881. a_Id
  4882. ) ;
  4883. }
  4884. catch ( ... )
  4885. {
  4886. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4887. }
  4888. CoRevertToSelf () ;
  4889. }
  4890. else
  4891. {
  4892. if ( SUCCEEDED ( t_Result ) )
  4893. {
  4894. IWbemEventProviderQuerySink *t_Provider = ( IWbemEventProviderQuerySink * ) t_Proxy ;
  4895. // Set cloaking on the proxy
  4896. // =========================
  4897. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  4898. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  4899. t_Provider ,
  4900. RPC_C_AUTHN_LEVEL_CONNECT ,
  4901. t_ImpersonationLevel
  4902. ) ;
  4903. if ( SUCCEEDED ( t_Result ) )
  4904. {
  4905. t_Result = OS::CoImpersonateClient () ;
  4906. if ( SUCCEEDED ( t_Result ) )
  4907. {
  4908. Increment_ProviderOperation_CancelQuery () ;
  4909. try
  4910. {
  4911. t_Result = t_Provider->CancelQuery (
  4912. a_Id
  4913. ) ;
  4914. }
  4915. catch ( ... )
  4916. {
  4917. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4918. }
  4919. CoRevertToSelf () ;
  4920. }
  4921. else
  4922. {
  4923. t_Result = WBEM_E_ACCESS_DENIED ;
  4924. }
  4925. }
  4926. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderQuerySink , t_Proxy , t_Revert ) ;
  4927. }
  4928. }
  4929. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4930. }
  4931. return t_Result ;
  4932. }
  4933. return WBEM_E_PROVIDER_NOT_CAPABLE;
  4934. }
  4935. /******************************************************************************
  4936. *
  4937. * Name:
  4938. *
  4939. *
  4940. * Description:
  4941. *
  4942. *
  4943. *****************************************************************************/
  4944. HRESULT CInterceptor_DecoupledClient ::AccessCheck (
  4945. WBEM_CWSTR a_QueryLanguage ,
  4946. WBEM_CWSTR a_Query ,
  4947. long a_SidLength ,
  4948. const BYTE *a_Sid
  4949. )
  4950. {
  4951. if ( m_Provider_IWbemEventProviderSecurity )
  4952. {
  4953. BOOL t_Impersonating = FALSE ;
  4954. IUnknown *t_OldContext = NULL ;
  4955. IServerSecurity *t_OldSecurity = NULL ;
  4956. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  4957. if ( SUCCEEDED ( t_Result ) )
  4958. {
  4959. BOOL t_Revert = FALSE ;
  4960. IUnknown *t_Proxy = NULL ;
  4961. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderSecurity , IID_IWbemEventProviderSecurity , m_Provider_IWbemEventProviderSecurity , t_Proxy , t_Revert ) ;
  4962. if ( t_Result == WBEM_E_NOT_FOUND )
  4963. {
  4964. Increment_ProviderOperation_AccessCheck () ;
  4965. try
  4966. {
  4967. t_Result = m_Provider_IWbemEventProviderSecurity->AccessCheck (
  4968. a_QueryLanguage ,
  4969. a_Query ,
  4970. a_SidLength ,
  4971. a_Sid
  4972. ) ;
  4973. }
  4974. catch ( ... )
  4975. {
  4976. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4977. }
  4978. CoRevertToSelf () ;
  4979. }
  4980. else
  4981. {
  4982. if ( SUCCEEDED ( t_Result ) )
  4983. {
  4984. IWbemEventProviderSecurity *t_Provider = ( IWbemEventProviderSecurity * ) t_Proxy ;
  4985. // Set cloaking on the proxy
  4986. // =========================
  4987. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  4988. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  4989. t_Provider ,
  4990. RPC_C_AUTHN_LEVEL_CONNECT ,
  4991. t_ImpersonationLevel
  4992. ) ;
  4993. if ( SUCCEEDED ( t_Result ) )
  4994. {
  4995. t_Result = OS::CoImpersonateClient () ;
  4996. if ( SUCCEEDED ( t_Result ) )
  4997. {
  4998. Increment_ProviderOperation_AccessCheck () ;
  4999. try
  5000. {
  5001. t_Result = t_Provider->AccessCheck (
  5002. a_QueryLanguage ,
  5003. a_Query ,
  5004. a_SidLength ,
  5005. a_Sid
  5006. ) ;
  5007. }
  5008. catch ( ... )
  5009. {
  5010. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5011. }
  5012. CoRevertToSelf () ;
  5013. }
  5014. else
  5015. {
  5016. t_Result = WBEM_E_ACCESS_DENIED ;
  5017. }
  5018. }
  5019. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventProviderSecurity , t_Proxy , t_Revert ) ;
  5020. }
  5021. }
  5022. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5023. }
  5024. return t_Result ;
  5025. }
  5026. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5027. }
  5028. /******************************************************************************
  5029. *
  5030. * Name:
  5031. *
  5032. *
  5033. * Description:
  5034. *
  5035. *
  5036. *****************************************************************************/
  5037. HRESULT CInterceptor_DecoupledClient ::SetRegistrationObject (
  5038. long a_Flags ,
  5039. IWbemClassObject *a_ProviderRegistration
  5040. )
  5041. {
  5042. if ( m_Provider_IWbemProviderIdentity )
  5043. {
  5044. BOOL t_Impersonating = FALSE ;
  5045. IUnknown *t_OldContext = NULL ;
  5046. IServerSecurity *t_OldSecurity = NULL ;
  5047. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5048. if ( SUCCEEDED ( t_Result ) )
  5049. {
  5050. BOOL t_Revert = FALSE ;
  5051. IUnknown *t_Proxy = NULL ;
  5052. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemProviderIdentity , IID_IWbemProviderIdentity , m_Provider_IWbemProviderIdentity , t_Proxy , t_Revert ) ;
  5053. if ( t_Result == WBEM_E_NOT_FOUND )
  5054. {
  5055. Increment_ProviderOperation_SetRegistrationObject () ;
  5056. try
  5057. {
  5058. t_Result = m_Provider_IWbemProviderIdentity->SetRegistrationObject (
  5059. a_Flags ,
  5060. a_ProviderRegistration
  5061. ) ;
  5062. }
  5063. catch ( ... )
  5064. {
  5065. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5066. }
  5067. CoRevertToSelf () ;
  5068. }
  5069. else
  5070. {
  5071. if ( SUCCEEDED ( t_Result ) )
  5072. {
  5073. IWbemProviderIdentity *t_Provider = ( IWbemProviderIdentity * ) t_Proxy ;
  5074. // Set cloaking on the proxy
  5075. // =========================
  5076. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  5077. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  5078. t_Provider ,
  5079. RPC_C_AUTHN_LEVEL_CONNECT ,
  5080. t_ImpersonationLevel
  5081. ) ;
  5082. if ( SUCCEEDED ( t_Result ) )
  5083. {
  5084. t_Result = OS::CoImpersonateClient () ;
  5085. if ( SUCCEEDED ( t_Result ) )
  5086. {
  5087. Increment_ProviderOperation_SetRegistrationObject () ;
  5088. try
  5089. {
  5090. t_Result = t_Provider->SetRegistrationObject (
  5091. a_Flags ,
  5092. a_ProviderRegistration
  5093. ) ;
  5094. }
  5095. catch ( ... )
  5096. {
  5097. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5098. }
  5099. CoRevertToSelf () ;
  5100. }
  5101. else
  5102. {
  5103. t_Result = WBEM_E_ACCESS_DENIED ;
  5104. }
  5105. }
  5106. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemProviderIdentity , t_Proxy , t_Revert ) ;
  5107. }
  5108. }
  5109. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5110. }
  5111. return t_Result ;
  5112. }
  5113. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5114. }
  5115. /******************************************************************************
  5116. *
  5117. * Name:
  5118. *
  5119. *
  5120. * Description:
  5121. *
  5122. *
  5123. *****************************************************************************/
  5124. HRESULT CInterceptor_DecoupledClient ::FindConsumer (
  5125. IWbemClassObject *a_LogicalConsumer ,
  5126. IWbemUnboundObjectSink **a_Consumer
  5127. )
  5128. {
  5129. if ( m_Provider_IWbemEventConsumerProvider )
  5130. {
  5131. IWbemUnboundObjectSink *t_Consumer = NULL ;
  5132. BOOL t_Impersonating = FALSE ;
  5133. IUnknown *t_OldContext = NULL ;
  5134. IServerSecurity *t_OldSecurity = NULL ;
  5135. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5136. if ( SUCCEEDED ( t_Result ) )
  5137. {
  5138. BOOL t_Revert = FALSE ;
  5139. IUnknown *t_Proxy = NULL ;
  5140. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProvider , IID_IWbemEventConsumerProvider , m_Provider_IWbemEventConsumerProvider , t_Proxy , t_Revert ) ;
  5141. if ( t_Result == WBEM_E_NOT_FOUND )
  5142. {
  5143. Increment_ProviderOperation_FindConsumer () ;
  5144. try
  5145. {
  5146. t_Result = m_Provider_IWbemEventConsumerProvider->FindConsumer (
  5147. a_LogicalConsumer ,
  5148. & t_Consumer
  5149. ) ;
  5150. }
  5151. catch ( ... )
  5152. {
  5153. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5154. }
  5155. CoRevertToSelf () ;
  5156. }
  5157. else
  5158. {
  5159. if ( SUCCEEDED ( t_Result ) )
  5160. {
  5161. IWbemEventConsumerProvider *t_Provider = ( IWbemEventConsumerProvider * ) t_Proxy ;
  5162. // Set cloaking on the proxy
  5163. // =========================
  5164. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  5165. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  5166. t_Provider ,
  5167. RPC_C_AUTHN_LEVEL_CONNECT ,
  5168. t_ImpersonationLevel
  5169. ) ;
  5170. if ( SUCCEEDED ( t_Result ) )
  5171. {
  5172. t_Result = OS::CoImpersonateClient () ;
  5173. if ( SUCCEEDED ( t_Result ) )
  5174. {
  5175. Increment_ProviderOperation_FindConsumer () ;
  5176. try
  5177. {
  5178. t_Result = t_Provider->FindConsumer (
  5179. a_LogicalConsumer ,
  5180. & t_Consumer
  5181. ) ;
  5182. }
  5183. catch ( ... )
  5184. {
  5185. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5186. }
  5187. CoRevertToSelf () ;
  5188. }
  5189. else
  5190. {
  5191. t_Result = WBEM_E_ACCESS_DENIED ;
  5192. }
  5193. }
  5194. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProvider , t_Proxy , t_Revert ) ;
  5195. }
  5196. }
  5197. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5198. }
  5199. if ( SUCCEEDED ( t_Result ) )
  5200. {
  5201. if ( a_Consumer )
  5202. {
  5203. CInterceptor_IWbemDecoupledUnboundObjectSink *t_UnboundObjectSink = new CInterceptor_IWbemDecoupledUnboundObjectSink (
  5204. m_Allocator ,
  5205. t_Consumer ,
  5206. this ,
  5207. *m_Registration
  5208. ) ;
  5209. if ( t_UnboundObjectSink )
  5210. {
  5211. t_UnboundObjectSink->AddRef () ;
  5212. t_Result = t_UnboundObjectSink->Initialize () ;
  5213. if ( SUCCEEDED ( t_Result ) )
  5214. {
  5215. CWbemGlobal_VoidPointerController_Container_Iterator t_Iterator ;
  5216. Lock () ;
  5217. WmiStatusCode t_StatusCode = Insert (
  5218. *t_UnboundObjectSink ,
  5219. t_Iterator
  5220. ) ;
  5221. if ( t_StatusCode == e_StatusCode_Success )
  5222. {
  5223. UnLock () ;
  5224. *a_Consumer = t_UnboundObjectSink ;
  5225. t_UnboundObjectSink->AddRef () ;
  5226. }
  5227. else
  5228. {
  5229. UnLock () ;
  5230. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5231. }
  5232. }
  5233. t_UnboundObjectSink->Release () ;
  5234. }
  5235. }
  5236. }
  5237. if ( t_Consumer )
  5238. {
  5239. t_Consumer->Release () ;
  5240. }
  5241. return t_Result ;
  5242. }
  5243. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5244. }
  5245. /******************************************************************************
  5246. *
  5247. * Name:
  5248. *
  5249. *
  5250. * Description:
  5251. *
  5252. *
  5253. *****************************************************************************/
  5254. HRESULT CInterceptor_DecoupledClient ::ValidateSubscription (
  5255. IWbemClassObject *a_LogicalConsumer
  5256. )
  5257. {
  5258. if ( m_Provider_IWbemEventConsumerProviderEx )
  5259. {
  5260. BOOL t_Impersonating = FALSE ;
  5261. IUnknown *t_OldContext = NULL ;
  5262. IServerSecurity *t_OldSecurity = NULL ;
  5263. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5264. if ( SUCCEEDED ( t_Result ) )
  5265. {
  5266. BOOL t_Revert = FALSE ;
  5267. IUnknown *t_Proxy = NULL ;
  5268. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProviderEx , IID_IWbemEventConsumerProviderEx , m_Provider_IWbemEventConsumerProviderEx , t_Proxy , t_Revert ) ;
  5269. if ( t_Result == WBEM_E_NOT_FOUND )
  5270. {
  5271. Increment_ProviderOperation_ValidateSubscription () ;
  5272. try
  5273. {
  5274. t_Result = m_Provider_IWbemEventConsumerProviderEx->ValidateSubscription (
  5275. a_LogicalConsumer
  5276. ) ;
  5277. }
  5278. catch ( ... )
  5279. {
  5280. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5281. }
  5282. CoRevertToSelf () ;
  5283. }
  5284. else
  5285. {
  5286. if ( SUCCEEDED ( t_Result ) )
  5287. {
  5288. IWbemEventConsumerProviderEx *t_Provider = ( IWbemEventConsumerProviderEx * ) t_Proxy ;
  5289. // Set cloaking on the proxy
  5290. // =========================
  5291. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  5292. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  5293. t_Provider ,
  5294. RPC_C_AUTHN_LEVEL_CONNECT ,
  5295. t_ImpersonationLevel
  5296. ) ;
  5297. if ( SUCCEEDED ( t_Result ) )
  5298. {
  5299. t_Result = OS::CoImpersonateClient () ;
  5300. if ( SUCCEEDED ( t_Result ) )
  5301. {
  5302. Increment_ProviderOperation_ValidateSubscription () ;
  5303. try
  5304. {
  5305. t_Result = t_Provider->ValidateSubscription (
  5306. a_LogicalConsumer
  5307. ) ;
  5308. }
  5309. catch ( ... )
  5310. {
  5311. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5312. }
  5313. CoRevertToSelf () ;
  5314. }
  5315. else
  5316. {
  5317. t_Result = WBEM_E_ACCESS_DENIED ;
  5318. }
  5319. }
  5320. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemEventConsumerProviderEx , t_Proxy , t_Revert ) ;
  5321. }
  5322. }
  5323. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5324. }
  5325. return t_Result ;
  5326. }
  5327. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5328. }
  5329. /******************************************************************************
  5330. *
  5331. * Name:
  5332. *
  5333. *
  5334. * Description:
  5335. *
  5336. *
  5337. *****************************************************************************/
  5338. HRESULT CInterceptor_DecoupledClient :: IndicateToConsumer (
  5339. IWbemClassObject *a_LogicalConsumer ,
  5340. long a_ObjectCount ,
  5341. IWbemClassObject **a_Objects
  5342. )
  5343. {
  5344. if ( m_Provider_IWbemUnboundObjectSink )
  5345. {
  5346. BOOL t_Impersonating = FALSE ;
  5347. IUnknown *t_OldContext = NULL ;
  5348. IServerSecurity *t_OldSecurity = NULL ;
  5349. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5350. if ( SUCCEEDED ( t_Result ) )
  5351. {
  5352. BOOL t_Revert = FALSE ;
  5353. IUnknown *t_Proxy = NULL ;
  5354. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemUnboundObjectSink , IID_IWbemUnboundObjectSink , m_Provider_IWbemUnboundObjectSink , t_Proxy , t_Revert ) ;
  5355. if ( t_Result == WBEM_E_NOT_FOUND )
  5356. {
  5357. t_Result = m_Provider_IWbemUnboundObjectSink->IndicateToConsumer (
  5358. a_LogicalConsumer ,
  5359. a_ObjectCount ,
  5360. a_Objects
  5361. ) ;
  5362. }
  5363. else
  5364. {
  5365. if ( SUCCEEDED ( t_Result ) )
  5366. {
  5367. IWbemUnboundObjectSink *t_Provider = ( IWbemUnboundObjectSink * ) t_Proxy ;
  5368. // Set cloaking on the proxy
  5369. // =========================
  5370. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  5371. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  5372. t_Provider ,
  5373. RPC_C_AUTHN_LEVEL_CONNECT ,
  5374. t_ImpersonationLevel
  5375. ) ;
  5376. if ( SUCCEEDED ( t_Result ) )
  5377. {
  5378. t_Result = t_Provider->IndicateToConsumer (
  5379. a_LogicalConsumer ,
  5380. a_ObjectCount ,
  5381. a_Objects
  5382. ) ;
  5383. }
  5384. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemUnboundObjectSink , t_Proxy , t_Revert ) ;
  5385. }
  5386. }
  5387. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5388. }
  5389. return t_Result ;
  5390. }
  5391. return WBEM_E_PROVIDER_NOT_CAPABLE;
  5392. }
  5393. /******************************************************************************
  5394. *
  5395. * Name:
  5396. *
  5397. *
  5398. * Description:
  5399. *
  5400. *
  5401. *****************************************************************************/
  5402. HRESULT CInterceptor_DecoupledClient :: Initialize (
  5403. LPWSTR a_User ,
  5404. LONG a_Flags ,
  5405. LPWSTR a_Namespace ,
  5406. LPWSTR a_Locale ,
  5407. IWbemServices *a_CoreService ,
  5408. IWbemContext *a_Context ,
  5409. IWbemProviderInitSink *a_Sink
  5410. )
  5411. {
  5412. HRESULT t_Result = S_OK ;
  5413. if ( m_Unknown )
  5414. {
  5415. IWbemProviderInit *t_Provider = NULL ;
  5416. t_Result = m_Unknown->QueryInterface ( IID_IWbemProviderInit , ( void ** ) & t_Provider ) ;
  5417. if ( SUCCEEDED ( t_Result ) )
  5418. {
  5419. try
  5420. {
  5421. t_Result = t_Provider->Initialize (
  5422. a_User,
  5423. a_Flags,
  5424. a_Namespace,
  5425. a_Locale,
  5426. a_CoreService,
  5427. a_Context,
  5428. a_Sink
  5429. ) ;
  5430. }
  5431. catch ( ... )
  5432. {
  5433. t_Result = WBEM_E_PROVIDER_LOAD_FAILURE ;
  5434. }
  5435. t_Provider->Release () ;
  5436. }
  5437. else
  5438. {
  5439. t_Result = WBEM_E_PROVIDER_LOAD_FAILURE ;
  5440. }
  5441. }
  5442. else
  5443. {
  5444. t_Result = WBEM_E_PROVIDER_LOAD_FAILURE ;
  5445. }
  5446. a_Sink->SetStatus ( t_Result , 0 ) ;
  5447. return t_Result ;
  5448. }
  5449. /******************************************************************************
  5450. *
  5451. * Name:
  5452. *
  5453. *
  5454. * Description:
  5455. *
  5456. *
  5457. *****************************************************************************/
  5458. HRESULT CInterceptor_DecoupledClient :: Internal_Initialize (
  5459. WmiInternalContext a_InternalContext ,
  5460. LPWSTR a_User ,
  5461. LONG a_Flags ,
  5462. LPWSTR a_Namespace ,
  5463. LPWSTR a_Locale ,
  5464. IWbemServices *a_CoreService ,
  5465. IWbemContext *a_Context ,
  5466. IWbemProviderInitSink *a_Sink
  5467. )
  5468. {
  5469. BOOL t_Impersonating = FALSE ;
  5470. IUnknown *t_OldContext = NULL ;
  5471. IServerSecurity *t_OldSecurity = NULL ;
  5472. HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  5473. a_InternalContext ,
  5474. t_Impersonating ,
  5475. t_OldContext ,
  5476. t_OldSecurity
  5477. ) ;
  5478. if ( SUCCEEDED ( t_Result ) )
  5479. {
  5480. t_Result = Initialize (
  5481. a_User ,
  5482. a_Flags ,
  5483. a_Namespace ,
  5484. a_Locale ,
  5485. a_CoreService ,
  5486. a_Context ,
  5487. a_Sink
  5488. ) ;
  5489. DecoupledProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5490. }
  5491. return t_Result ;
  5492. }
  5493. /******************************************************************************
  5494. *
  5495. * Name:
  5496. *
  5497. *
  5498. * Description:
  5499. *
  5500. *
  5501. *****************************************************************************/
  5502. HRESULT CInterceptor_DecoupledClient :: ProviderInitialize ()
  5503. {
  5504. HRESULT t_Result = S_OK ;
  5505. WmiStatusCode t_StatusCode = CWbemGlobal_IWmiObjectSinkController :: Initialize () ;
  5506. if ( t_StatusCode != e_StatusCode_Success )
  5507. {
  5508. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5509. }
  5510. if ( SUCCEEDED ( t_Result ) )
  5511. {
  5512. t_StatusCode = m_ProxyContainer.Initialize () ;
  5513. if ( t_StatusCode != e_StatusCode_Success )
  5514. {
  5515. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5516. }
  5517. }
  5518. return t_Result ;
  5519. }
  5520. /******************************************************************************
  5521. *
  5522. * Name:
  5523. *
  5524. *
  5525. * Description:
  5526. *
  5527. *
  5528. *****************************************************************************/
  5529. HRESULT CInterceptor_DecoupledClient :: GetSite ( DWORD *a_ProcessIdentifier )
  5530. {
  5531. HRESULT t_Result = S_OK ;
  5532. if ( a_ProcessIdentifier )
  5533. {
  5534. *a_ProcessIdentifier = GetCurrentProcessId () ;
  5535. }
  5536. else
  5537. {
  5538. t_Result = WBEM_E_INVALID_PARAMETER ;
  5539. }
  5540. return t_Result ;
  5541. }
  5542. /******************************************************************************
  5543. *
  5544. * Name:
  5545. *
  5546. *
  5547. * Description:
  5548. *
  5549. *
  5550. *****************************************************************************/
  5551. HRESULT CInterceptor_DecoupledClient :: SetContainer ( IUnknown *a_Container )
  5552. {
  5553. return WBEM_E_NOT_AVAILABLE ;
  5554. }
  5555. /******************************************************************************
  5556. *
  5557. * Name:
  5558. *
  5559. *
  5560. * Description:
  5561. *
  5562. *
  5563. *****************************************************************************/
  5564. HRESULT CInterceptor_DecoupledClient :: Shutdown (
  5565. LONG a_Flags ,
  5566. ULONG a_MaxMilliSeconds ,
  5567. IWbemContext *a_Context
  5568. )
  5569. {
  5570. HRESULT t_Result = S_OK ;
  5571. IWbemShutdown *t_Shutdown = NULL ;
  5572. if ( m_Unknown )
  5573. {
  5574. t_Result = m_Unknown->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  5575. if ( SUCCEEDED ( t_Result ) )
  5576. {
  5577. BOOL t_Impersonating = FALSE ;
  5578. IUnknown *t_OldContext = NULL ;
  5579. IServerSecurity *t_OldSecurity = NULL ;
  5580. t_Result = DecoupledProviderSubSystem_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5581. if ( SUCCEEDED ( t_Result ) )
  5582. {
  5583. BOOL t_Revert = FALSE ;
  5584. IUnknown *t_Proxy = NULL ;
  5585. t_Result = DecoupledProviderSubSystem_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemShutdown , IID_IWbemShutdown , t_Shutdown , t_Proxy , t_Revert ) ;
  5586. if ( t_Result == WBEM_E_NOT_FOUND )
  5587. {
  5588. try
  5589. {
  5590. t_Result = t_Shutdown->Shutdown (
  5591. a_Flags ,
  5592. a_MaxMilliSeconds ,
  5593. a_Context
  5594. ) ;
  5595. }
  5596. catch ( ... )
  5597. {
  5598. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5599. }
  5600. CoRevertToSelf () ;
  5601. }
  5602. else
  5603. {
  5604. if ( SUCCEEDED ( t_Result ) )
  5605. {
  5606. IWbemShutdown *t_Provider = ( IWbemShutdown * ) t_Proxy ;
  5607. // Set cloaking on the proxy
  5608. // =========================
  5609. DWORD t_ImpersonationLevel = DecoupledProviderSubSystem_Globals :: GetCurrentImpersonationLevel () ;
  5610. t_Result = DecoupledProviderSubSystem_Globals :: SetCloaking (
  5611. t_Provider ,
  5612. RPC_C_AUTHN_LEVEL_CONNECT ,
  5613. t_ImpersonationLevel
  5614. ) ;
  5615. if ( SUCCEEDED ( t_Result ) )
  5616. {
  5617. t_Result = OS::CoImpersonateClient () ;
  5618. if ( SUCCEEDED ( t_Result ) )
  5619. {
  5620. try
  5621. {
  5622. t_Result = t_Provider->Shutdown (
  5623. a_Flags ,
  5624. a_MaxMilliSeconds ,
  5625. a_Context
  5626. ) ;
  5627. }
  5628. catch ( ... )
  5629. {
  5630. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5631. }
  5632. CoRevertToSelf () ;
  5633. }
  5634. }
  5635. HRESULT t_TempResult = DecoupledProviderSubSystem_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemShutdown , t_Proxy , t_Revert ) ;
  5636. }
  5637. }
  5638. DecoupledProviderSubSystem_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  5639. }
  5640. t_Shutdown->Release () ;
  5641. }
  5642. }
  5643. Lock () ;
  5644. CWbemGlobal_IWmiObjectSinkController_Container *t_Container = NULL ;
  5645. GetContainer ( t_Container ) ;
  5646. IWbemShutdown **t_ShutdownElements = new IWbemShutdown * [ t_Container->Size () ] ;
  5647. if ( t_ShutdownElements )
  5648. {
  5649. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator = t_Container->Begin ();
  5650. ULONG t_Count = 0 ;
  5651. while ( ! t_Iterator.Null () )
  5652. {
  5653. t_Result = t_Iterator.GetElement ()->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_ShutdownElements [ t_Count ] ) ;
  5654. t_Iterator.Increment () ;
  5655. t_Count ++ ;
  5656. }
  5657. UnLock () ;
  5658. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  5659. {
  5660. if ( t_ShutdownElements [ t_Index ] )
  5661. {
  5662. t_Result = t_ShutdownElements [ t_Index ]->Shutdown (
  5663. a_Flags ,
  5664. a_MaxMilliSeconds ,
  5665. a_Context
  5666. ) ;
  5667. t_ShutdownElements [ t_Index ]->Release () ;
  5668. }
  5669. }
  5670. delete [] t_ShutdownElements ;
  5671. }
  5672. else
  5673. {
  5674. UnLock () ;
  5675. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5676. }
  5677. CWbemGlobal_IWmiObjectSinkController :: Shutdown () ;
  5678. return t_Result ;
  5679. }