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.

10591 lines
222 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 <NCObjApi.h>
  12. #include "Globals.h"
  13. #include "CGlobals.h"
  14. #include "ProvFact.h"
  15. #include "ProvObSk.h"
  16. #include "ProvInSk.h"
  17. #include "ProvWsv.h"
  18. #include "ProvCache.h"
  19. #include "arrtempl.h"
  20. #include "Guids.h"
  21. #ifdef WMIASLOCAL
  22. #include "Main.h"
  23. #endif
  24. /******************************************************************************
  25. *
  26. * Name:
  27. *
  28. *
  29. * Description:
  30. *
  31. *
  32. *****************************************************************************/
  33. void CheckThreadToken ()
  34. {
  35. HANDLE t_ThreadToken ;
  36. BOOL t_Status = OpenThreadToken (
  37. GetCurrentThread () ,
  38. MAXIMUM_ALLOWED ,
  39. TRUE ,
  40. & t_ThreadToken
  41. ) ;
  42. if ( ! t_Status )
  43. {
  44. DWORD t_LastError = GetLastError () ;
  45. if ( t_LastError == ERROR_ACCESS_DENIED )
  46. {
  47. #ifdef DBG
  48. DebugBreak () ;
  49. #endif
  50. }
  51. }
  52. else
  53. {
  54. CloseHandle ( t_ThreadToken ) ;
  55. }
  56. }
  57. /******************************************************************************
  58. *
  59. * Name:
  60. *
  61. *
  62. * Description:
  63. *
  64. *
  65. *****************************************************************************/
  66. #pragma warning( disable : 4355 )
  67. CInterceptor_IWbemSyncUnboundObjectSink :: CInterceptor_IWbemSyncUnboundObjectSink (
  68. WmiAllocator &a_Allocator ,
  69. IUnknown *a_ServerSideProvider ,
  70. CWbemGlobal_IWmiObjectSinkController *a_Controller ,
  71. CServerObject_ProviderRegistrationV1 &a_Registration
  72. ) : VoidPointerContainerElement (
  73. a_Controller ,
  74. this
  75. ) ,
  76. m_Allocator ( a_Allocator ) ,
  77. m_Unknown ( NULL ) ,
  78. m_Provider_IWbemUnboundObjectSink ( NULL ) ,
  79. m_Registration ( & a_Registration ) ,
  80. m_ProxyContainer ( a_Allocator , ProxyIndex_UnBoundSync_Size , MAX_PROXIES )
  81. {
  82. InterlockedIncrement ( & ProviderSubSystem_Globals :: s_CInterceptor_IWbemSyncUnboundObjectSink_ObjectsInProgress ) ;
  83. ProviderSubSystem_Globals :: Increment_Global_Object_Count () ;
  84. if ( m_Registration )
  85. {
  86. m_Registration->AddRef () ;
  87. }
  88. if ( a_ServerSideProvider )
  89. {
  90. m_Unknown = a_ServerSideProvider ;
  91. m_Unknown->AddRef () ;
  92. HRESULT t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemUnboundObjectSink , ( void ** ) & m_Provider_IWbemUnboundObjectSink ) ;
  93. if (FAILED(t_Result)) DEBUGTRACE((LOG_PROVSS," CInterceptor_IWbemSyncUnboundObjectSink->QI hr = %08x\n",t_Result));
  94. }
  95. }
  96. #pragma warning( default : 4355 )
  97. /******************************************************************************
  98. *
  99. * Name:
  100. *
  101. *
  102. * Description:
  103. *
  104. *
  105. *****************************************************************************/
  106. CInterceptor_IWbemSyncUnboundObjectSink :: ~CInterceptor_IWbemSyncUnboundObjectSink ()
  107. {
  108. if ( m_Unknown )
  109. {
  110. m_Unknown->Release () ;
  111. }
  112. if ( m_Provider_IWbemUnboundObjectSink )
  113. {
  114. m_Provider_IWbemUnboundObjectSink->Release () ;
  115. }
  116. if ( m_Registration )
  117. {
  118. m_Registration->Release () ;
  119. }
  120. InterlockedDecrement ( & ProviderSubSystem_Globals :: s_CInterceptor_IWbemSyncUnboundObjectSink_ObjectsInProgress ) ;
  121. ProviderSubSystem_Globals :: Decrement_Global_Object_Count () ;
  122. }
  123. /******************************************************************************
  124. *
  125. * Name:
  126. *
  127. *
  128. * Description:
  129. *
  130. *
  131. *****************************************************************************/
  132. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: Initialize ()
  133. {
  134. HRESULT t_Result = S_OK ;
  135. WmiStatusCode t_StatusCode = m_ProxyContainer.Initialize () ;
  136. if ( t_StatusCode != e_StatusCode_Success )
  137. {
  138. t_Result = WBEM_E_OUT_OF_MEMORY ;
  139. }
  140. return t_Result ;
  141. }
  142. /******************************************************************************
  143. *
  144. * Name:
  145. *
  146. *
  147. * Description:
  148. *
  149. *
  150. *****************************************************************************/
  151. STDMETHODIMP_( ULONG ) CInterceptor_IWbemSyncUnboundObjectSink :: AddRef ()
  152. {
  153. return VoidPointerContainerElement :: AddRef () ;
  154. }
  155. /******************************************************************************
  156. *
  157. * Name:
  158. *
  159. *
  160. * Description:
  161. *
  162. *
  163. *****************************************************************************/
  164. STDMETHODIMP_(ULONG) CInterceptor_IWbemSyncUnboundObjectSink :: Release ()
  165. {
  166. return VoidPointerContainerElement :: Release () ;
  167. }
  168. /******************************************************************************
  169. *
  170. * Name:
  171. *
  172. *
  173. * Description:
  174. *
  175. *
  176. *****************************************************************************/
  177. STDMETHODIMP CInterceptor_IWbemSyncUnboundObjectSink :: QueryInterface (
  178. REFIID iid ,
  179. LPVOID FAR *iplpv
  180. )
  181. {
  182. *iplpv = NULL ;
  183. if ( iid == IID_IUnknown )
  184. {
  185. *iplpv = ( LPVOID ) this ;
  186. }
  187. else if ( iid == IID_IWbemUnboundObjectSink )
  188. {
  189. if ( m_Provider_IWbemUnboundObjectSink )
  190. {
  191. *iplpv = ( LPVOID ) ( IWbemUnboundObjectSink * ) this ;
  192. }
  193. }
  194. else if ( iid == IID_Internal_IWbemUnboundObjectSink )
  195. {
  196. if ( m_Provider_IWbemUnboundObjectSink )
  197. {
  198. *iplpv = ( LPVOID ) ( Internal_IWbemUnboundObjectSink * ) this ;
  199. }
  200. }
  201. else if ( iid == IID__IWmiProviderSite )
  202. {
  203. *iplpv = ( LPVOID ) ( _IWmiProviderSite * ) this ;
  204. }
  205. else if ( iid == IID_IWbemShutdown )
  206. {
  207. *iplpv = ( LPVOID ) ( IWbemShutdown * ) this ;
  208. }
  209. if ( *iplpv )
  210. {
  211. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  212. return ResultFromScode ( S_OK ) ;
  213. }
  214. else
  215. {
  216. return ResultFromScode ( E_NOINTERFACE ) ;
  217. }
  218. }
  219. /******************************************************************************
  220. *
  221. * Name:
  222. *
  223. *
  224. * Description:
  225. *
  226. *
  227. *****************************************************************************/
  228. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: Begin_Interface_Consumer (
  229. bool a_Identify ,
  230. IUnknown *a_ServerInterface ,
  231. REFIID a_InterfaceIdentifier ,
  232. DWORD a_ProxyIndex ,
  233. BOOL &a_Impersonating ,
  234. IUnknown *&a_OldContext ,
  235. IServerSecurity *&a_OldSecurity ,
  236. BOOL &a_IsProxy ,
  237. IUnknown *&a_Interface ,
  238. BOOL &a_Revert ,
  239. IUnknown *&a_Proxy
  240. )
  241. {
  242. HRESULT t_Result = S_OK ;
  243. a_Revert = FALSE ;
  244. a_Proxy = NULL ;
  245. a_Impersonating = FALSE ;
  246. a_OldContext = NULL ;
  247. a_OldSecurity = NULL ;
  248. if ( a_Identify )
  249. {
  250. DWORD t_AuthenticationLevel = 0 ;
  251. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation (
  252. a_OldContext ,
  253. a_OldSecurity ,
  254. a_Impersonating ,
  255. & t_AuthenticationLevel
  256. ) ;
  257. if ( SUCCEEDED ( t_Result ) )
  258. {
  259. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState (
  260. m_ProxyContainer ,
  261. a_ProxyIndex ,
  262. a_InterfaceIdentifier ,
  263. a_ServerInterface ,
  264. a_Proxy ,
  265. a_Revert
  266. ) ;
  267. if ( t_Result == WBEM_E_NOT_FOUND )
  268. {
  269. a_Interface = a_ServerInterface ;
  270. a_IsProxy = FALSE ;
  271. }
  272. else
  273. {
  274. if ( SUCCEEDED ( t_Result ) )
  275. {
  276. a_IsProxy = TRUE ;
  277. a_Interface = ( IUnknown * ) a_Proxy ;
  278. // Set cloaking on the proxy
  279. // =========================
  280. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  281. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  282. a_Interface ,
  283. RPC_C_AUTHN_LEVEL_DEFAULT ,
  284. t_ImpersonationLevel
  285. ) ;
  286. if ( FAILED ( t_Result ) )
  287. {
  288. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  289. m_ProxyContainer ,
  290. a_ProxyIndex ,
  291. a_Proxy ,
  292. a_Revert
  293. ) ;
  294. }
  295. }
  296. }
  297. if ( FAILED ( t_Result ) && t_Result != WBEM_E_NOT_FOUND )
  298. {
  299. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  300. }
  301. }
  302. }
  303. else
  304. {
  305. DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
  306. IServerSecurity *t_ServerSecurity = NULL ;
  307. HRESULT t_TempResult = CoGetCallContext ( IID_IUnknown , ( void ** ) & t_ServerSecurity ) ;
  308. if ( SUCCEEDED ( t_TempResult ) )
  309. {
  310. t_Result = CoImpersonateClient () ;
  311. if ( SUCCEEDED ( t_Result ) )
  312. {
  313. t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  314. CoRevertToSelf () ;
  315. }
  316. t_ServerSecurity->Release () ;
  317. }
  318. if ( SUCCEEDED ( t_Result ) )
  319. {
  320. if ( t_ImpersonationLevel == RPC_C_IMP_LEVEL_IDENTIFY )
  321. {
  322. t_Result = CoSwitchCallContext ( NULL , &a_OldContext ) ;
  323. if ( SUCCEEDED ( t_Result ) )
  324. {
  325. t_Result = a_OldContext->QueryInterface ( IID_IServerSecurity , ( void ** ) & a_OldSecurity ) ;
  326. if ( SUCCEEDED ( t_Result ) )
  327. {
  328. a_Impersonating = a_OldSecurity->IsImpersonating () ;
  329. }
  330. }
  331. a_Interface = a_ServerInterface ;
  332. a_IsProxy = FALSE ;
  333. }
  334. else
  335. {
  336. DWORD t_AuthenticationLevel = 0 ;
  337. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation (
  338. a_OldContext ,
  339. a_OldSecurity ,
  340. a_Impersonating ,
  341. & t_AuthenticationLevel
  342. ) ;
  343. if ( SUCCEEDED ( t_Result ) )
  344. {
  345. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState (
  346. m_ProxyContainer ,
  347. a_ProxyIndex ,
  348. a_InterfaceIdentifier ,
  349. a_ServerInterface ,
  350. a_Proxy ,
  351. a_Revert
  352. ) ;
  353. if ( t_Result == WBEM_E_NOT_FOUND )
  354. {
  355. t_Result = S_OK ;
  356. a_Interface = a_ServerInterface ;
  357. a_IsProxy = FALSE ;
  358. }
  359. else
  360. {
  361. if ( SUCCEEDED ( t_Result ) )
  362. {
  363. a_IsProxy = TRUE ;
  364. a_Interface = ( IUnknown * ) a_Proxy ;
  365. // Set cloaking on the proxy
  366. // =========================
  367. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  368. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  369. a_Interface ,
  370. RPC_C_AUTHN_LEVEL_DEFAULT ,
  371. t_ImpersonationLevel
  372. ) ;
  373. if ( FAILED ( t_Result ) )
  374. {
  375. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  376. m_ProxyContainer ,
  377. a_ProxyIndex ,
  378. a_Proxy ,
  379. a_Revert
  380. ) ;
  381. }
  382. }
  383. }
  384. if ( FAILED ( t_Result ) && t_Result != WBEM_E_NOT_FOUND )
  385. {
  386. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  387. }
  388. }
  389. }
  390. }
  391. }
  392. return t_Result ;
  393. }
  394. /******************************************************************************
  395. *
  396. * Name:
  397. *
  398. *
  399. * Description:
  400. *
  401. *
  402. *****************************************************************************/
  403. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: End_Interface_Consumer (
  404. IUnknown *a_ServerInterface ,
  405. REFIID a_InterfaceIdentifier ,
  406. DWORD a_ProxyIndex ,
  407. BOOL a_Impersonating ,
  408. IUnknown *a_OldContext ,
  409. IServerSecurity *a_OldSecurity ,
  410. BOOL a_IsProxy ,
  411. IUnknown *a_Interface ,
  412. BOOL a_Revert ,
  413. IUnknown *a_Proxy
  414. )
  415. {
  416. CoRevertToSelf () ;
  417. if ( a_Proxy )
  418. {
  419. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  420. m_ProxyContainer ,
  421. a_ProxyIndex ,
  422. a_Proxy ,
  423. a_Revert
  424. ) ;
  425. }
  426. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  427. return S_OK ;
  428. }
  429. /******************************************************************************
  430. *
  431. * Name:
  432. *
  433. *
  434. * Description:
  435. *
  436. *
  437. *****************************************************************************/
  438. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: Internal_IndicateToConsumer (
  439. WmiInternalContext a_InternalContext ,
  440. IWbemClassObject *a_LogicalConsumer ,
  441. long a_ObjectCount ,
  442. IWbemClassObject **a_Objects
  443. )
  444. {
  445. #if DBG
  446. CheckThreadToken () ;
  447. #endif
  448. BOOL t_Impersonating = FALSE ;
  449. IUnknown *t_OldContext = NULL ;
  450. IServerSecurity *t_OldSecurity = NULL ;
  451. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  452. a_InternalContext ,
  453. t_Impersonating ,
  454. t_OldContext ,
  455. t_OldSecurity
  456. ) ;
  457. if ( SUCCEEDED ( t_Result ) )
  458. {
  459. t_Result = InternalEx_IndicateToConsumer (
  460. true ,
  461. a_LogicalConsumer ,
  462. a_ObjectCount ,
  463. a_Objects
  464. ) ;
  465. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  466. }
  467. return t_Result ;
  468. }
  469. /******************************************************************************
  470. *
  471. * Name:
  472. *
  473. *
  474. * Description:
  475. *
  476. *
  477. *****************************************************************************/
  478. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: IndicateToConsumer (
  479. IWbemClassObject *a_LogicalConsumer ,
  480. long a_ObjectCount ,
  481. IWbemClassObject **a_Objects
  482. )
  483. {
  484. return InternalEx_IndicateToConsumer (
  485. false ,
  486. a_LogicalConsumer ,
  487. a_ObjectCount ,
  488. a_Objects
  489. ) ;
  490. }
  491. /******************************************************************************
  492. *
  493. * Name:
  494. *
  495. *
  496. * Description:
  497. *
  498. *
  499. *****************************************************************************/
  500. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: InternalEx_IndicateToConsumer (
  501. bool a_Identify ,
  502. IWbemClassObject *a_LogicalConsumer ,
  503. long a_ObjectCount ,
  504. IWbemClassObject **a_Objects
  505. )
  506. {
  507. if ( m_Provider_IWbemUnboundObjectSink )
  508. {
  509. IUnknown *t_ServerInterface = m_Provider_IWbemUnboundObjectSink ;
  510. REFIID t_InterfaceIdentifier = IID_IWbemUnboundObjectSink ;
  511. DWORD t_ProxyIndex = ProxyIndex_UnBound_IWbemUnboundObjectSink ;
  512. BOOL t_Impersonating ;
  513. IUnknown *t_OldContext ;
  514. IServerSecurity *t_OldSecurity ;
  515. BOOL t_IsProxy ;
  516. IUnknown *t_Interface ;
  517. BOOL t_Revert ;
  518. IUnknown *t_Proxy ;
  519. HRESULT t_Result = Begin_Interface_Consumer (
  520. a_Identify ,
  521. t_ServerInterface ,
  522. t_InterfaceIdentifier ,
  523. t_ProxyIndex ,
  524. t_Impersonating ,
  525. t_OldContext ,
  526. t_OldSecurity ,
  527. t_IsProxy ,
  528. t_Interface ,
  529. t_Revert ,
  530. t_Proxy
  531. ) ;
  532. if ( SUCCEEDED ( t_Result ) )
  533. {
  534. try
  535. {
  536. t_Result = ( ( IWbemUnboundObjectSink * ) t_Interface )->IndicateToConsumer (
  537. a_LogicalConsumer ,
  538. a_ObjectCount ,
  539. a_Objects
  540. ) ;
  541. }
  542. catch ( ... )
  543. {
  544. t_Result = WBEM_E_PROVIDER_FAILURE ;
  545. }
  546. End_Interface_Consumer (
  547. t_ServerInterface ,
  548. t_InterfaceIdentifier ,
  549. t_ProxyIndex ,
  550. t_Impersonating ,
  551. t_OldContext ,
  552. t_OldSecurity ,
  553. t_IsProxy ,
  554. t_Interface ,
  555. t_Revert ,
  556. t_Proxy
  557. ) ;
  558. }
  559. return t_Result ;
  560. }
  561. return WBEM_E_PROVIDER_NOT_CAPABLE;
  562. }
  563. /******************************************************************************
  564. *
  565. * Name:
  566. *
  567. *
  568. * Description:
  569. *
  570. *
  571. *****************************************************************************/
  572. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: Shutdown (
  573. LONG a_Flags ,
  574. ULONG a_MaxMilliSeconds ,
  575. IWbemContext *a_Context
  576. )
  577. {
  578. return S_OK ;
  579. }
  580. /******************************************************************************
  581. *
  582. * Name:
  583. *
  584. *
  585. * Description:
  586. *
  587. *
  588. *****************************************************************************/
  589. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: GetSite ( DWORD *a_ProcessIdentifier )
  590. {
  591. HRESULT t_Result = S_OK ;
  592. if ( a_ProcessIdentifier )
  593. {
  594. *a_ProcessIdentifier = GetCurrentProcessId () ;
  595. }
  596. else
  597. {
  598. t_Result = WBEM_E_INVALID_PARAMETER ;
  599. }
  600. return t_Result ;
  601. }
  602. /******************************************************************************
  603. *
  604. * Name:
  605. *
  606. *
  607. * Description:
  608. *
  609. *
  610. *****************************************************************************/
  611. HRESULT CInterceptor_IWbemSyncUnboundObjectSink :: SetContainer ( IUnknown *a_Container )
  612. {
  613. return WBEM_E_NOT_AVAILABLE ;
  614. }
  615. /******************************************************************************
  616. *
  617. * Name:
  618. *
  619. *
  620. * Description:
  621. *
  622. *
  623. *****************************************************************************/
  624. #pragma warning( disable : 4355 )
  625. CInterceptor_IWbemSyncProvider :: CInterceptor_IWbemSyncProvider (
  626. WmiAllocator &a_Allocator ,
  627. IUnknown *a_ServerSideProvider ,
  628. IWbemServices *a_CoreStub ,
  629. CWbemGlobal_IWbemSyncProviderController *a_Controller ,
  630. IWbemContext *a_InitializationContext ,
  631. CServerObject_ProviderRegistrationV1 &a_Registration ,
  632. GUID &a_Guid
  633. ) : CWbemGlobal_IWmiObjectSinkController ( a_Allocator ) ,
  634. SyncProviderContainerElement (
  635. a_Controller ,
  636. a_Guid
  637. ) ,
  638. m_Allocator ( a_Allocator ) ,
  639. m_Unknown ( NULL ) ,
  640. m_Provider_IWbemServices ( NULL ) ,
  641. m_Provider_IWbemPropertyProvider ( NULL ) ,
  642. m_Provider_IWbemHiPerfProvider ( NULL ) ,
  643. m_Provider_IWbemEventProvider ( NULL ) ,
  644. m_Provider_IWbemEventProviderQuerySink ( NULL ) ,
  645. m_Provider_IWbemEventProviderSecurity ( NULL ) ,
  646. m_Provider_IWbemEventConsumerProvider ( NULL ) ,
  647. m_Provider_IWbemEventConsumerProviderEx ( NULL ) ,
  648. m_Provider_IWbemUnboundObjectSink ( NULL ) ,
  649. m_ExtendedStatusObject ( NULL ) ,
  650. m_CoreStub ( a_CoreStub ) ,
  651. m_Quota ( NULL ) ,
  652. m_Registration ( & a_Registration ) ,
  653. m_Locale ( NULL ) ,
  654. m_User ( NULL ) ,
  655. m_Namespace ( NULL ) ,
  656. m_ProxyContainer ( a_Allocator , ProxyIndex_Provider_Size , MAX_PROXIES ) ,
  657. m_ProviderOperation_GetObjectAsync ( 0 ) ,
  658. m_ProviderOperation_PutClassAsync ( 0 ) ,
  659. m_ProviderOperation_DeleteClassAsync ( 0 ) ,
  660. m_ProviderOperation_CreateClassEnumAsync ( 0 ) ,
  661. m_ProviderOperation_PutInstanceAsync ( 0 ) ,
  662. m_ProviderOperation_DeleteInstanceAsync ( 0 ) ,
  663. m_ProviderOperation_CreateInstanceEnumAsync ( 0 ) ,
  664. m_ProviderOperation_ExecQueryAsync ( 0 ) ,
  665. m_ProviderOperation_ExecNotificationQueryAsync ( 0 ) ,
  666. m_ProviderOperation_ExecMethodAsync ( 0 ) ,
  667. m_ProviderOperation_QueryInstances ( 0 ) ,
  668. m_ProviderOperation_CreateRefresher ( 0 ) ,
  669. m_ProviderOperation_CreateRefreshableObject ( 0 ) ,
  670. m_ProviderOperation_StopRefreshing ( 0 ) ,
  671. m_ProviderOperation_CreateRefreshableEnum ( 0 ) ,
  672. m_ProviderOperation_GetObjects ( 0 ) ,
  673. m_ProviderOperation_GetProperty ( 0 ) ,
  674. m_ProviderOperation_PutProperty ( 0 ) ,
  675. m_ProviderOperation_ProvideEvents ( 0 ) ,
  676. m_ProviderOperation_NewQuery ( 0 ) ,
  677. m_ProviderOperation_CancelQuery ( 0 ) ,
  678. m_ProviderOperation_AccessCheck ( 0 ) ,
  679. m_ProviderOperation_SetRegistrationObject ( 0 ) ,
  680. m_ProviderOperation_FindConsumer ( 0 ) ,
  681. m_ProviderOperation_ValidateSubscription ( 0 ) ,
  682. m_Initialized ( 0 ) ,
  683. m_InitializeResult ( S_OK ) ,
  684. m_InitializedEvent ( NULL ) ,
  685. m_InitializationContext ( a_InitializationContext )
  686. {
  687. InterlockedIncrement ( & ProviderSubSystem_Globals :: s_CInterceptor_IWbemSyncProvider_ObjectsInProgress ) ;
  688. ProviderSubSystem_Globals :: Increment_Global_Object_Count () ;
  689. if ( a_InitializationContext )
  690. {
  691. a_InitializationContext->AddRef () ;
  692. }
  693. if ( m_Registration )
  694. {
  695. m_Registration->AddRef () ;
  696. }
  697. if ( m_CoreStub )
  698. {
  699. m_CoreStub->AddRef () ;
  700. }
  701. if ( a_ServerSideProvider )
  702. {
  703. m_Unknown = a_ServerSideProvider ;
  704. m_Unknown->AddRef () ;
  705. HRESULT t_Result;
  706. BOOL t_OneSucceded = FALSE;
  707. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemServices , ( void ** ) & m_Provider_IWbemServices ) ;
  708. if ( FAILED( t_Result) )
  709. {
  710. if (t_Result != E_NOINTERFACE )
  711. {
  712. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemServices) hr = %08x\n",t_Result ));
  713. m_InitializeResult = t_Result ;
  714. return ;
  715. }
  716. }
  717. else
  718. t_OneSucceded = TRUE;
  719. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemPropertyProvider , ( void ** ) & m_Provider_IWbemPropertyProvider ) ;
  720. if ( FAILED( t_Result) )
  721. {
  722. if (E_NOINTERFACE != t_Result)
  723. {
  724. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemPropertyProvider) hr = %08x\n",t_Result ));
  725. m_InitializeResult = t_Result ;
  726. return ;
  727. }
  728. }
  729. else
  730. t_OneSucceded = TRUE;
  731. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventProvider , ( void ** ) & m_Provider_IWbemEventProvider ) ;
  732. if ( FAILED( t_Result) )
  733. {
  734. if (E_NOINTERFACE != t_Result)
  735. {
  736. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemEventProvider) hr = %08x\n",t_Result ));
  737. m_InitializeResult = t_Result ;
  738. return ;
  739. }
  740. }
  741. else
  742. t_OneSucceded = TRUE;
  743. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventProviderQuerySink , ( void ** ) & m_Provider_IWbemEventProviderQuerySink ) ;
  744. if ( FAILED( t_Result) )
  745. {
  746. if (E_NOINTERFACE != t_Result)
  747. {
  748. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemEventProviderQuerySink) hr = %08x\n",t_Result ));
  749. m_InitializeResult = t_Result ;
  750. return ;
  751. }
  752. }
  753. else
  754. t_OneSucceded = TRUE;
  755. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventProviderSecurity , ( void ** ) & m_Provider_IWbemEventProviderSecurity ) ;
  756. if ( FAILED( t_Result) )
  757. {
  758. if (E_NOINTERFACE != t_Result)
  759. {
  760. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemEventProviderSecurity) hr = %08x\n",t_Result ));
  761. m_InitializeResult = t_Result ;
  762. return ;
  763. }
  764. }
  765. else
  766. t_OneSucceded = TRUE;
  767. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventConsumerProviderEx , ( void ** ) & m_Provider_IWbemEventConsumerProviderEx ) ;
  768. if ( FAILED( t_Result) )
  769. {
  770. if (E_NOINTERFACE != t_Result)
  771. {
  772. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemEventConsumerProviderEx ) hr = %08x\n",t_Result ));
  773. m_InitializeResult = t_Result ;
  774. return ;
  775. }
  776. }
  777. else
  778. t_OneSucceded = TRUE;
  779. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemEventConsumerProvider , ( void ** ) & m_Provider_IWbemEventConsumerProvider ) ;
  780. if ( FAILED( t_Result) )
  781. {
  782. if (E_NOINTERFACE != t_Result)
  783. {
  784. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemEventConsumerProvider) hr = %08x\n",t_Result ));
  785. m_InitializeResult = t_Result ;
  786. return ;
  787. }
  788. }
  789. else
  790. t_OneSucceded = TRUE;
  791. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemUnboundObjectSink , ( void ** ) & m_Provider_IWbemUnboundObjectSink ) ;
  792. if ( FAILED( t_Result) )
  793. {
  794. if (E_NOINTERFACE != t_Result)
  795. {
  796. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemUnboundObjectSink) hr = %08x\n",t_Result ));
  797. m_InitializeResult = t_Result ;
  798. return ;
  799. }
  800. }
  801. else
  802. t_OneSucceded = TRUE;
  803. t_Result = a_ServerSideProvider->QueryInterface ( IID_IWbemHiPerfProvider , ( void ** ) & m_Provider_IWbemHiPerfProvider ) ;
  804. if ( FAILED( t_Result) )
  805. {
  806. if ( E_NOINTERFACE != t_Result )
  807. {
  808. DEBUGTRACE((LOG_PROVSS," ServerSideProvider->QI(IID_IWbemHiPerfProvider) hr = %08x\n",t_Result ));
  809. m_InitializeResult = t_Result ;
  810. return ;
  811. }
  812. }
  813. else
  814. t_OneSucceded = TRUE;
  815. if (FALSE == t_OneSucceded)
  816. {
  817. m_InitializeResult = E_NOINTERFACE;
  818. }
  819. }
  820. }
  821. #pragma warning( default : 4355 )
  822. /******************************************************************************
  823. *
  824. * Name:
  825. *
  826. *
  827. * Description:
  828. *
  829. *
  830. *****************************************************************************/
  831. CInterceptor_IWbemSyncProvider :: ~CInterceptor_IWbemSyncProvider ()
  832. {
  833. WmiSetAndCommitObject (
  834. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_UnLoadOperationEvent ] ,
  835. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  836. m_Namespace ,
  837. m_Registration->GetProviderName () ,
  838. m_User ,
  839. m_Locale ,
  840. NULL
  841. ) ;
  842. if ( m_ExtendedStatusObject )
  843. {
  844. m_ExtendedStatusObject->Release () ;
  845. }
  846. if ( m_Unknown )
  847. {
  848. m_Unknown->Release () ;
  849. }
  850. if ( m_Provider_IWbemServices )
  851. {
  852. m_Provider_IWbemServices->Release () ;
  853. }
  854. if ( m_Provider_IWbemPropertyProvider )
  855. {
  856. m_Provider_IWbemPropertyProvider->Release () ;
  857. }
  858. if ( m_Provider_IWbemHiPerfProvider )
  859. {
  860. m_Provider_IWbemHiPerfProvider->Release () ;
  861. }
  862. if ( m_Provider_IWbemEventProvider )
  863. {
  864. m_Provider_IWbemEventProvider->Release () ;
  865. }
  866. if ( m_Provider_IWbemEventProviderQuerySink )
  867. {
  868. m_Provider_IWbemEventProviderQuerySink->Release () ;
  869. }
  870. if ( m_Provider_IWbemEventProviderSecurity )
  871. {
  872. m_Provider_IWbemEventProviderSecurity->Release () ;
  873. }
  874. if ( m_Provider_IWbemEventConsumerProviderEx )
  875. {
  876. m_Provider_IWbemEventConsumerProviderEx->Release () ;
  877. }
  878. if ( m_Provider_IWbemEventConsumerProvider )
  879. {
  880. m_Provider_IWbemEventConsumerProvider->Release () ;
  881. }
  882. if ( m_Provider_IWbemUnboundObjectSink )
  883. {
  884. m_Provider_IWbemUnboundObjectSink->Release () ;
  885. }
  886. if ( m_CoreStub )
  887. {
  888. m_CoreStub->Release () ;
  889. }
  890. if ( m_Quota )
  891. {
  892. m_Quota->Release () ;
  893. }
  894. WmiStatusCode t_StatusCode = m_ProxyContainer.UnInitialize () ;
  895. if ( m_InitializationContext )
  896. {
  897. m_InitializationContext->Release () ;
  898. }
  899. if ( m_InitializedEvent )
  900. {
  901. CloseHandle ( m_InitializedEvent ) ;
  902. }
  903. if ( m_Namespace )
  904. {
  905. SysFreeString ( m_Namespace ) ;
  906. }
  907. if ( m_Locale )
  908. {
  909. SysFreeString ( m_Locale ) ;
  910. }
  911. if ( m_User )
  912. {
  913. SysFreeString ( m_User ) ;
  914. }
  915. if ( m_Registration )
  916. {
  917. m_Registration->Release () ;
  918. }
  919. CWbemGlobal_IWmiObjectSinkController :: UnInitialize () ;
  920. InterlockedDecrement ( & ProviderSubSystem_Globals :: s_CInterceptor_IWbemSyncProvider_ObjectsInProgress ) ;
  921. ProviderSubSystem_Globals :: Decrement_Global_Object_Count () ;
  922. #ifdef WMIASLOCAL
  923. SetProviderDestruction();
  924. #endif
  925. }
  926. /******************************************************************************
  927. *
  928. * Name:
  929. *
  930. *
  931. * Description:
  932. *
  933. *
  934. *****************************************************************************/
  935. STDMETHODIMP_( ULONG ) CInterceptor_IWbemSyncProvider :: AddRef ()
  936. {
  937. return SyncProviderContainerElement :: AddRef () ;
  938. }
  939. /******************************************************************************
  940. *
  941. * Name:
  942. *
  943. *
  944. * Description:
  945. *
  946. *
  947. *****************************************************************************/
  948. STDMETHODIMP_(ULONG) CInterceptor_IWbemSyncProvider :: Release ()
  949. {
  950. return SyncProviderContainerElement :: Release () ;
  951. }
  952. /******************************************************************************
  953. *
  954. * Name:
  955. *
  956. *
  957. * Description:
  958. *
  959. *
  960. *****************************************************************************/
  961. STDMETHODIMP CInterceptor_IWbemSyncProvider :: QueryInterface (
  962. REFIID iid ,
  963. LPVOID FAR *iplpv
  964. )
  965. {
  966. *iplpv = NULL ;
  967. if ( iid == IID_IUnknown )
  968. {
  969. *iplpv = ( LPVOID ) this ;
  970. }
  971. else if ( iid == IID_IWbemServices )
  972. {
  973. if ( m_Provider_IWbemServices || m_Provider_IWbemHiPerfProvider )
  974. {
  975. *iplpv = ( LPVOID ) ( IWbemServices * ) this ;
  976. }
  977. }
  978. else if ( iid == IID_IWbemPropertyProvider )
  979. {
  980. if ( m_Provider_IWbemPropertyProvider )
  981. {
  982. *iplpv = ( LPVOID ) ( IWbemPropertyProvider * ) this ;
  983. }
  984. }
  985. else if ( iid == IID_IWbemHiPerfProvider )
  986. {
  987. if ( m_Provider_IWbemHiPerfProvider )
  988. {
  989. *iplpv = ( LPVOID ) ( IWbemHiPerfProvider * ) this ;
  990. }
  991. }
  992. else if ( iid == IID_IWbemEventProvider )
  993. {
  994. if ( m_Provider_IWbemEventProvider )
  995. {
  996. *iplpv = ( LPVOID ) ( IWbemEventProvider * ) this ;
  997. }
  998. }
  999. else if ( iid == IID_IWbemEventProviderQuerySink )
  1000. {
  1001. if ( m_Provider_IWbemEventProviderQuerySink )
  1002. {
  1003. *iplpv = ( LPVOID ) ( IWbemEventProviderQuerySink * ) this ;
  1004. }
  1005. }
  1006. else if ( iid == IID_IWbemEventProviderSecurity )
  1007. {
  1008. if ( m_Provider_IWbemEventProviderSecurity )
  1009. {
  1010. *iplpv = ( LPVOID ) ( IWbemEventProviderSecurity * ) this ;
  1011. }
  1012. }
  1013. else if ( iid == IID_IWbemEventConsumerProvider )
  1014. {
  1015. if ( m_Provider_IWbemEventConsumerProvider )
  1016. {
  1017. *iplpv = ( LPVOID ) ( IWbemEventConsumerProvider * ) this ;
  1018. }
  1019. }
  1020. else if ( iid == IID_IWbemEventConsumerProviderEx )
  1021. {
  1022. if ( m_Provider_IWbemEventConsumerProviderEx )
  1023. {
  1024. *iplpv = ( LPVOID ) ( IWbemEventConsumerProviderEx * ) this ;
  1025. }
  1026. }
  1027. else if ( iid == IID_IWbemUnboundObjectSink )
  1028. {
  1029. if ( m_Provider_IWbemUnboundObjectSink )
  1030. {
  1031. *iplpv = ( LPVOID ) ( IWbemUnboundObjectSink * ) this ;
  1032. }
  1033. }
  1034. else if ( iid == IID__IWmiProviderSite )
  1035. {
  1036. *iplpv = ( LPVOID ) ( _IWmiProviderSite * ) this ;
  1037. }
  1038. else if ( iid == IID__IWmiProviderQuota )
  1039. {
  1040. *iplpv = ( LPVOID ) ( _IWmiProviderQuota * ) this ;
  1041. }
  1042. else if ( iid == IID__IWmiProviderInitialize )
  1043. {
  1044. *iplpv = ( LPVOID ) ( _IWmiProviderInitialize * ) this ;
  1045. }
  1046. else if ( iid == IID_IWbemShutdown )
  1047. {
  1048. *iplpv = ( LPVOID ) ( IWbemShutdown * ) this ;
  1049. }
  1050. else if ( iid == IID__IWmiProviderConfiguration )
  1051. {
  1052. *iplpv = ( LPVOID ) ( _IWmiProviderConfiguration * ) this ;
  1053. }
  1054. else if ( iid == IID_CWbemGlobal_IWmiObjectSinkController )
  1055. {
  1056. *iplpv = ( LPVOID ) ( CWbemGlobal_IWmiObjectSinkController * ) this ;
  1057. }
  1058. else if ( iid == IID_CacheElement )
  1059. {
  1060. *iplpv = ( LPVOID ) ( SyncProviderContainerElement * ) this ;
  1061. }
  1062. else if ( iid == IID_Internal_IWbemServices )
  1063. {
  1064. if ( m_Provider_IWbemServices || m_Provider_IWbemHiPerfProvider )
  1065. {
  1066. *iplpv = ( LPVOID ) ( Internal_IWbemServices * ) this ;
  1067. }
  1068. }
  1069. else if ( iid == IID_Internal_IWbemPropertyProvider )
  1070. {
  1071. if ( m_Provider_IWbemPropertyProvider )
  1072. {
  1073. *iplpv = ( LPVOID ) ( Internal_IWbemPropertyProvider * ) this ;
  1074. }
  1075. }
  1076. else if ( iid == IID_Internal_IWbemEventProvider )
  1077. {
  1078. if ( m_Provider_IWbemEventProvider )
  1079. {
  1080. *iplpv = ( LPVOID ) ( Internal_IWbemEventProvider * ) this ;
  1081. }
  1082. }
  1083. else if ( iid == IID_Internal_IWbemEventProviderQuerySink )
  1084. {
  1085. if ( m_Provider_IWbemEventProviderQuerySink )
  1086. {
  1087. *iplpv = ( LPVOID ) ( Internal_IWbemEventProviderQuerySink * ) this ;
  1088. }
  1089. }
  1090. else if ( iid == IID_Internal_IWbemEventProviderSecurity )
  1091. {
  1092. if ( m_Provider_IWbemEventProviderSecurity )
  1093. {
  1094. *iplpv = ( LPVOID ) ( Internal_IWbemEventProviderSecurity * ) this ;
  1095. }
  1096. }
  1097. else if ( iid == IID_Internal_IWbemEventConsumerProvider )
  1098. {
  1099. if ( m_Provider_IWbemEventConsumerProvider )
  1100. {
  1101. *iplpv = ( LPVOID ) ( Internal_IWbemEventConsumerProvider * ) this ;
  1102. }
  1103. }
  1104. else if ( iid == IID_Internal_IWbemEventConsumerProviderEx )
  1105. {
  1106. if ( m_Provider_IWbemEventConsumerProviderEx )
  1107. {
  1108. *iplpv = ( LPVOID ) ( Internal_IWbemEventConsumerProviderEx * ) this ;
  1109. }
  1110. }
  1111. else if ( iid == IID_Internal_IWbemUnboundObjectSink )
  1112. {
  1113. if ( m_Provider_IWbemUnboundObjectSink )
  1114. {
  1115. *iplpv = ( LPVOID ) ( Internal_IWbemUnboundObjectSink * ) this ;
  1116. }
  1117. }
  1118. else if ( iid == IID_Internal_IWmiProviderConfiguration )
  1119. {
  1120. *iplpv = ( LPVOID ) ( Internal_IWmiProviderConfiguration * ) this ;
  1121. }
  1122. if ( *iplpv )
  1123. {
  1124. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  1125. return ResultFromScode ( S_OK ) ;
  1126. }
  1127. else
  1128. {
  1129. return ResultFromScode ( E_NOINTERFACE ) ;
  1130. }
  1131. }
  1132. /******************************************************************************
  1133. *
  1134. * Name:
  1135. *
  1136. *
  1137. * Description:
  1138. *
  1139. *
  1140. *****************************************************************************/
  1141. HRESULT CInterceptor_IWbemSyncProvider :: Internal_OpenNamespace (
  1142. WmiInternalContext a_InternalContext ,
  1143. const BSTR a_ObjectPath ,
  1144. long a_Flags ,
  1145. IWbemContext *a_Context ,
  1146. IWbemServices **a_NamespaceService ,
  1147. IWbemCallResult **a_CallResult
  1148. )
  1149. {
  1150. #if DBG
  1151. CheckThreadToken () ;
  1152. #endif
  1153. BOOL t_Impersonating = FALSE ;
  1154. IUnknown *t_OldContext = NULL ;
  1155. IServerSecurity *t_OldSecurity = NULL ;
  1156. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1157. a_InternalContext ,
  1158. t_Impersonating ,
  1159. t_OldContext ,
  1160. t_OldSecurity
  1161. ) ;
  1162. if ( SUCCEEDED ( t_Result ) )
  1163. {
  1164. t_Result = OpenNamespace (
  1165. a_ObjectPath ,
  1166. a_Flags ,
  1167. a_Context ,
  1168. a_NamespaceService ,
  1169. a_CallResult
  1170. ) ;
  1171. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1172. }
  1173. return t_Result ;
  1174. }
  1175. /******************************************************************************
  1176. *
  1177. * Name:
  1178. *
  1179. *
  1180. * Description:
  1181. *
  1182. *
  1183. *****************************************************************************/
  1184. HRESULT CInterceptor_IWbemSyncProvider :: Internal_CancelAsyncCall (
  1185. WmiInternalContext a_InternalContext ,
  1186. IWbemObjectSink *a_Sink
  1187. )
  1188. {
  1189. #if DBG
  1190. CheckThreadToken () ;
  1191. #endif
  1192. BOOL t_Impersonating = FALSE ;
  1193. IUnknown *t_OldContext = NULL ;
  1194. IServerSecurity *t_OldSecurity = NULL ;
  1195. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1196. a_InternalContext ,
  1197. t_Impersonating ,
  1198. t_OldContext ,
  1199. t_OldSecurity
  1200. ) ;
  1201. if ( SUCCEEDED ( t_Result ) )
  1202. {
  1203. t_Result = CancelAsyncCall (
  1204. a_Sink
  1205. ) ;
  1206. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1207. }
  1208. return t_Result ;
  1209. }
  1210. /******************************************************************************
  1211. *
  1212. * Name:
  1213. *
  1214. *
  1215. * Description:
  1216. *
  1217. *
  1218. *****************************************************************************/
  1219. HRESULT CInterceptor_IWbemSyncProvider :: Internal_QueryObjectSink (
  1220. WmiInternalContext a_InternalContext ,
  1221. long a_Flags ,
  1222. IWbemObjectSink **a_Sink
  1223. )
  1224. {
  1225. #if DBG
  1226. CheckThreadToken () ;
  1227. #endif
  1228. BOOL t_Impersonating = FALSE ;
  1229. IUnknown *t_OldContext = NULL ;
  1230. IServerSecurity *t_OldSecurity = NULL ;
  1231. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1232. a_InternalContext ,
  1233. t_Impersonating ,
  1234. t_OldContext ,
  1235. t_OldSecurity
  1236. ) ;
  1237. if ( SUCCEEDED ( t_Result ) )
  1238. {
  1239. t_Result = QueryObjectSink (
  1240. a_Flags ,
  1241. a_Sink
  1242. ) ;
  1243. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1244. }
  1245. return t_Result ;
  1246. }
  1247. /******************************************************************************
  1248. *
  1249. * Name:
  1250. *
  1251. *
  1252. * Description:
  1253. *
  1254. *
  1255. *****************************************************************************/
  1256. HRESULT CInterceptor_IWbemSyncProvider :: Internal_GetObject (
  1257. WmiInternalContext a_InternalContext ,
  1258. const BSTR a_ObjectPath ,
  1259. long a_Flags ,
  1260. IWbemContext *a_Context ,
  1261. IWbemClassObject **a_Object ,
  1262. IWbemCallResult **a_CallResult
  1263. )
  1264. {
  1265. #if DBG
  1266. CheckThreadToken () ;
  1267. #endif
  1268. BOOL t_Impersonating = FALSE ;
  1269. IUnknown *t_OldContext = NULL ;
  1270. IServerSecurity *t_OldSecurity = NULL ;
  1271. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1272. a_InternalContext ,
  1273. t_Impersonating ,
  1274. t_OldContext ,
  1275. t_OldSecurity
  1276. ) ;
  1277. if ( SUCCEEDED ( t_Result ) )
  1278. {
  1279. t_Result = GetObject (
  1280. a_ObjectPath ,
  1281. a_Flags ,
  1282. a_Context ,
  1283. a_Object ,
  1284. a_CallResult
  1285. ) ;
  1286. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1287. }
  1288. return t_Result ;
  1289. }
  1290. /******************************************************************************
  1291. *
  1292. * Name:
  1293. *
  1294. *
  1295. * Description:
  1296. *
  1297. *
  1298. *****************************************************************************/
  1299. HRESULT CInterceptor_IWbemSyncProvider :: Internal_GetObjectAsync (
  1300. WmiInternalContext a_InternalContext ,
  1301. const BSTR a_ObjectPath ,
  1302. long a_Flags ,
  1303. IWbemContext *a_Context ,
  1304. IWbemObjectSink *a_Sink
  1305. )
  1306. {
  1307. #if DBG
  1308. CheckThreadToken () ;
  1309. #endif
  1310. BOOL t_Impersonating = FALSE ;
  1311. IUnknown *t_OldContext = NULL ;
  1312. IServerSecurity *t_OldSecurity = NULL ;
  1313. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1314. a_InternalContext ,
  1315. t_Impersonating ,
  1316. t_OldContext ,
  1317. t_OldSecurity
  1318. ) ;
  1319. if ( SUCCEEDED ( t_Result ) )
  1320. {
  1321. t_Result = GetObjectAsync (
  1322. a_ObjectPath ,
  1323. a_Flags ,
  1324. a_Context ,
  1325. a_Sink
  1326. ) ;
  1327. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1328. }
  1329. return t_Result ;
  1330. }
  1331. /******************************************************************************
  1332. *
  1333. * Name:
  1334. *
  1335. *
  1336. * Description:
  1337. *
  1338. *
  1339. *****************************************************************************/
  1340. HRESULT CInterceptor_IWbemSyncProvider :: Internal_PutClass (
  1341. WmiInternalContext a_InternalContext ,
  1342. IWbemClassObject *a_Object ,
  1343. long a_Flags ,
  1344. IWbemContext *a_Context ,
  1345. IWbemCallResult **a_CallResult
  1346. )
  1347. {
  1348. #if DBG
  1349. CheckThreadToken () ;
  1350. #endif
  1351. BOOL t_Impersonating = FALSE ;
  1352. IUnknown *t_OldContext = NULL ;
  1353. IServerSecurity *t_OldSecurity = NULL ;
  1354. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1355. a_InternalContext ,
  1356. t_Impersonating ,
  1357. t_OldContext ,
  1358. t_OldSecurity
  1359. ) ;
  1360. if ( SUCCEEDED ( t_Result ) )
  1361. {
  1362. t_Result = PutClass (
  1363. a_Object ,
  1364. a_Flags ,
  1365. a_Context ,
  1366. a_CallResult
  1367. ) ;
  1368. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1369. }
  1370. return t_Result ;
  1371. }
  1372. /******************************************************************************
  1373. *
  1374. * Name:
  1375. *
  1376. *
  1377. * Description:
  1378. *
  1379. *
  1380. *****************************************************************************/
  1381. HRESULT CInterceptor_IWbemSyncProvider :: Internal_PutClassAsync (
  1382. WmiInternalContext a_InternalContext ,
  1383. IWbemClassObject *a_Object ,
  1384. long a_Flags ,
  1385. IWbemContext *a_Context ,
  1386. IWbemObjectSink *a_Sink
  1387. )
  1388. {
  1389. #if DBG
  1390. CheckThreadToken () ;
  1391. #endif
  1392. BOOL t_Impersonating = FALSE ;
  1393. IUnknown *t_OldContext = NULL ;
  1394. IServerSecurity *t_OldSecurity = NULL ;
  1395. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1396. a_InternalContext ,
  1397. t_Impersonating ,
  1398. t_OldContext ,
  1399. t_OldSecurity
  1400. ) ;
  1401. if ( SUCCEEDED ( t_Result ) )
  1402. {
  1403. t_Result = PutClassAsync (
  1404. a_Object ,
  1405. a_Flags ,
  1406. a_Context ,
  1407. a_Sink
  1408. ) ;
  1409. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1410. }
  1411. return t_Result ;
  1412. }
  1413. /******************************************************************************
  1414. *
  1415. * Name:
  1416. *
  1417. *
  1418. * Description:
  1419. *
  1420. *
  1421. *****************************************************************************/
  1422. HRESULT CInterceptor_IWbemSyncProvider :: Internal_DeleteClass (
  1423. WmiInternalContext a_InternalContext ,
  1424. const BSTR a_Class ,
  1425. long a_Flags ,
  1426. IWbemContext *a_Context ,
  1427. IWbemCallResult **a_CallResult
  1428. )
  1429. {
  1430. #if DBG
  1431. CheckThreadToken () ;
  1432. #endif
  1433. BOOL t_Impersonating = FALSE ;
  1434. IUnknown *t_OldContext = NULL ;
  1435. IServerSecurity *t_OldSecurity = NULL ;
  1436. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1437. a_InternalContext ,
  1438. t_Impersonating ,
  1439. t_OldContext ,
  1440. t_OldSecurity
  1441. ) ;
  1442. if ( SUCCEEDED ( t_Result ) )
  1443. {
  1444. t_Result = DeleteClass (
  1445. a_Class ,
  1446. a_Flags ,
  1447. a_Context ,
  1448. a_CallResult
  1449. ) ;
  1450. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1451. }
  1452. return t_Result ;
  1453. }
  1454. /******************************************************************************
  1455. *
  1456. * Name:
  1457. *
  1458. *
  1459. * Description:
  1460. *
  1461. *
  1462. *****************************************************************************/
  1463. HRESULT CInterceptor_IWbemSyncProvider :: Internal_DeleteClassAsync (
  1464. WmiInternalContext a_InternalContext ,
  1465. const BSTR a_Class ,
  1466. long a_Flags ,
  1467. IWbemContext *a_Context ,
  1468. IWbemObjectSink *a_Sink
  1469. )
  1470. {
  1471. #if DBG
  1472. CheckThreadToken () ;
  1473. #endif
  1474. BOOL t_Impersonating = FALSE ;
  1475. IUnknown *t_OldContext = NULL ;
  1476. IServerSecurity *t_OldSecurity = NULL ;
  1477. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1478. a_InternalContext ,
  1479. t_Impersonating ,
  1480. t_OldContext ,
  1481. t_OldSecurity
  1482. ) ;
  1483. if ( SUCCEEDED ( t_Result ) )
  1484. {
  1485. t_Result = DeleteClassAsync (
  1486. a_Class ,
  1487. a_Flags ,
  1488. a_Context ,
  1489. a_Sink
  1490. ) ;
  1491. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1492. }
  1493. return t_Result ;
  1494. }
  1495. /******************************************************************************
  1496. *
  1497. * Name:
  1498. *
  1499. *
  1500. * Description:
  1501. *
  1502. *
  1503. *****************************************************************************/
  1504. HRESULT CInterceptor_IWbemSyncProvider :: Internal_CreateClassEnum (
  1505. WmiInternalContext a_InternalContext ,
  1506. const BSTR a_SuperClass ,
  1507. long a_Flags,
  1508. IWbemContext *a_Context ,
  1509. IEnumWbemClassObject **a_Enum
  1510. )
  1511. {
  1512. #if DBG
  1513. CheckThreadToken () ;
  1514. #endif
  1515. BOOL t_Impersonating = FALSE ;
  1516. IUnknown *t_OldContext = NULL ;
  1517. IServerSecurity *t_OldSecurity = NULL ;
  1518. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1519. a_InternalContext ,
  1520. t_Impersonating ,
  1521. t_OldContext ,
  1522. t_OldSecurity
  1523. ) ;
  1524. if ( SUCCEEDED ( t_Result ) )
  1525. {
  1526. t_Result = CreateClassEnum (
  1527. a_SuperClass ,
  1528. a_Flags,
  1529. a_Context ,
  1530. a_Enum
  1531. ) ;
  1532. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1533. }
  1534. return t_Result ;
  1535. }
  1536. /******************************************************************************
  1537. *
  1538. * Name:
  1539. *
  1540. *
  1541. * Description:
  1542. *
  1543. *
  1544. *****************************************************************************/
  1545. HRESULT CInterceptor_IWbemSyncProvider :: Internal_CreateClassEnumAsync (
  1546. WmiInternalContext a_InternalContext ,
  1547. const BSTR a_SuperClass ,
  1548. long a_Flags ,
  1549. IWbemContext *a_Context ,
  1550. IWbemObjectSink *a_Sink
  1551. )
  1552. {
  1553. #if DBG
  1554. CheckThreadToken () ;
  1555. #endif
  1556. BOOL t_Impersonating = FALSE ;
  1557. IUnknown *t_OldContext = NULL ;
  1558. IServerSecurity *t_OldSecurity = NULL ;
  1559. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1560. a_InternalContext ,
  1561. t_Impersonating ,
  1562. t_OldContext ,
  1563. t_OldSecurity
  1564. ) ;
  1565. if ( SUCCEEDED ( t_Result ) )
  1566. {
  1567. t_Result = CreateClassEnumAsync (
  1568. a_SuperClass ,
  1569. a_Flags,
  1570. a_Context ,
  1571. a_Sink
  1572. ) ;
  1573. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1574. }
  1575. return t_Result ;
  1576. }
  1577. /******************************************************************************
  1578. *
  1579. * Name:
  1580. *
  1581. *
  1582. * Description:
  1583. *
  1584. *
  1585. *****************************************************************************/
  1586. HRESULT CInterceptor_IWbemSyncProvider :: Internal_PutInstance (
  1587. WmiInternalContext a_InternalContext ,
  1588. IWbemClassObject *a_Instance ,
  1589. long a_Flags ,
  1590. IWbemContext *a_Context ,
  1591. IWbemCallResult **a_CallResult
  1592. )
  1593. {
  1594. #if DBG
  1595. CheckThreadToken () ;
  1596. #endif
  1597. BOOL t_Impersonating = FALSE ;
  1598. IUnknown *t_OldContext = NULL ;
  1599. IServerSecurity *t_OldSecurity = NULL ;
  1600. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1601. a_InternalContext ,
  1602. t_Impersonating ,
  1603. t_OldContext ,
  1604. t_OldSecurity
  1605. ) ;
  1606. if ( SUCCEEDED ( t_Result ) )
  1607. {
  1608. t_Result = PutInstance (
  1609. a_Instance ,
  1610. a_Flags ,
  1611. a_Context ,
  1612. a_CallResult
  1613. ) ;
  1614. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1615. }
  1616. return t_Result ;
  1617. }
  1618. /******************************************************************************
  1619. *
  1620. * Name:
  1621. *
  1622. *
  1623. * Description:
  1624. *
  1625. *
  1626. *****************************************************************************/
  1627. HRESULT CInterceptor_IWbemSyncProvider :: Internal_PutInstanceAsync (
  1628. WmiInternalContext a_InternalContext ,
  1629. IWbemClassObject *a_Instance ,
  1630. long a_Flags ,
  1631. IWbemContext *a_Context ,
  1632. IWbemObjectSink *a_Sink
  1633. )
  1634. {
  1635. #if DBG
  1636. CheckThreadToken () ;
  1637. #endif
  1638. BOOL t_Impersonating = FALSE ;
  1639. IUnknown *t_OldContext = NULL ;
  1640. IServerSecurity *t_OldSecurity = NULL ;
  1641. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1642. a_InternalContext ,
  1643. t_Impersonating ,
  1644. t_OldContext ,
  1645. t_OldSecurity
  1646. ) ;
  1647. if ( SUCCEEDED ( t_Result ) )
  1648. {
  1649. t_Result = PutInstanceAsync (
  1650. a_Instance ,
  1651. a_Flags ,
  1652. a_Context ,
  1653. a_Sink
  1654. ) ;
  1655. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1656. }
  1657. return t_Result ;
  1658. }
  1659. /******************************************************************************
  1660. *
  1661. * Name:
  1662. *
  1663. *
  1664. * Description:
  1665. *
  1666. *
  1667. *****************************************************************************/
  1668. HRESULT CInterceptor_IWbemSyncProvider :: Internal_DeleteInstance (
  1669. WmiInternalContext a_InternalContext ,
  1670. const BSTR a_ObjectPath ,
  1671. long a_Flags ,
  1672. IWbemContext *a_Context ,
  1673. IWbemCallResult **a_CallResult
  1674. )
  1675. {
  1676. #if DBG
  1677. CheckThreadToken () ;
  1678. #endif
  1679. BOOL t_Impersonating = FALSE ;
  1680. IUnknown *t_OldContext = NULL ;
  1681. IServerSecurity *t_OldSecurity = NULL ;
  1682. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1683. a_InternalContext ,
  1684. t_Impersonating ,
  1685. t_OldContext ,
  1686. t_OldSecurity
  1687. ) ;
  1688. if ( SUCCEEDED ( t_Result ) )
  1689. {
  1690. t_Result = DeleteInstance (
  1691. a_ObjectPath ,
  1692. a_Flags ,
  1693. a_Context ,
  1694. a_CallResult
  1695. ) ;
  1696. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1697. }
  1698. return t_Result ;
  1699. }
  1700. /******************************************************************************
  1701. *
  1702. * Name:
  1703. *
  1704. *
  1705. * Description:
  1706. *
  1707. *
  1708. *****************************************************************************/
  1709. HRESULT CInterceptor_IWbemSyncProvider :: Internal_DeleteInstanceAsync (
  1710. WmiInternalContext a_InternalContext ,
  1711. const BSTR a_ObjectPath ,
  1712. long a_Flags ,
  1713. IWbemContext *a_Context ,
  1714. IWbemObjectSink *a_Sink
  1715. )
  1716. {
  1717. #if DBG
  1718. CheckThreadToken () ;
  1719. #endif
  1720. BOOL t_Impersonating = FALSE ;
  1721. IUnknown *t_OldContext = NULL ;
  1722. IServerSecurity *t_OldSecurity = NULL ;
  1723. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1724. a_InternalContext ,
  1725. t_Impersonating ,
  1726. t_OldContext ,
  1727. t_OldSecurity
  1728. ) ;
  1729. if ( SUCCEEDED ( t_Result ) )
  1730. {
  1731. t_Result = DeleteInstanceAsync (
  1732. a_ObjectPath ,
  1733. a_Flags ,
  1734. a_Context ,
  1735. a_Sink
  1736. ) ;
  1737. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1738. }
  1739. return t_Result ;
  1740. }
  1741. /******************************************************************************
  1742. *
  1743. * Name:
  1744. *
  1745. *
  1746. * Description:
  1747. *
  1748. *
  1749. *****************************************************************************/
  1750. HRESULT CInterceptor_IWbemSyncProvider :: Internal_CreateInstanceEnum (
  1751. WmiInternalContext a_InternalContext ,
  1752. const BSTR a_Class ,
  1753. long a_Flags ,
  1754. IWbemContext *a_Context ,
  1755. IEnumWbemClassObject **a_Enum
  1756. )
  1757. {
  1758. #if DBG
  1759. CheckThreadToken () ;
  1760. #endif
  1761. BOOL t_Impersonating = FALSE ;
  1762. IUnknown *t_OldContext = NULL ;
  1763. IServerSecurity *t_OldSecurity = NULL ;
  1764. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1765. a_InternalContext ,
  1766. t_Impersonating ,
  1767. t_OldContext ,
  1768. t_OldSecurity
  1769. ) ;
  1770. if ( SUCCEEDED ( t_Result ) )
  1771. {
  1772. t_Result = CreateInstanceEnum (
  1773. a_Class ,
  1774. a_Flags ,
  1775. a_Context ,
  1776. a_Enum
  1777. ) ;
  1778. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1779. }
  1780. return t_Result ;
  1781. }
  1782. /******************************************************************************
  1783. *
  1784. * Name:
  1785. *
  1786. *
  1787. * Description:
  1788. *
  1789. *
  1790. *****************************************************************************/
  1791. HRESULT CInterceptor_IWbemSyncProvider :: Internal_CreateInstanceEnumAsync (
  1792. WmiInternalContext a_InternalContext ,
  1793. const BSTR a_Class ,
  1794. long a_Flags ,
  1795. IWbemContext *a_Context ,
  1796. IWbemObjectSink *a_Sink
  1797. )
  1798. {
  1799. #if DBG
  1800. CheckThreadToken () ;
  1801. #endif
  1802. BOOL t_Impersonating = FALSE ;
  1803. IUnknown *t_OldContext = NULL ;
  1804. IServerSecurity *t_OldSecurity = NULL ;
  1805. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1806. a_InternalContext ,
  1807. t_Impersonating ,
  1808. t_OldContext ,
  1809. t_OldSecurity
  1810. ) ;
  1811. if ( SUCCEEDED ( t_Result ) )
  1812. {
  1813. t_Result = CreateInstanceEnumAsync (
  1814. a_Class ,
  1815. a_Flags ,
  1816. a_Context ,
  1817. a_Sink
  1818. ) ;
  1819. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1820. }
  1821. return t_Result ;
  1822. }
  1823. /******************************************************************************
  1824. *
  1825. * Name:
  1826. *
  1827. *
  1828. * Description:
  1829. *
  1830. *
  1831. *****************************************************************************/
  1832. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ExecQuery (
  1833. WmiInternalContext a_InternalContext ,
  1834. const BSTR a_QueryLanguage ,
  1835. const BSTR a_Query ,
  1836. long a_Flags ,
  1837. IWbemContext *a_Context ,
  1838. IEnumWbemClassObject **a_Enum
  1839. )
  1840. {
  1841. #if DBG
  1842. CheckThreadToken () ;
  1843. #endif
  1844. BOOL t_Impersonating = FALSE ;
  1845. IUnknown *t_OldContext = NULL ;
  1846. IServerSecurity *t_OldSecurity = NULL ;
  1847. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1848. a_InternalContext ,
  1849. t_Impersonating ,
  1850. t_OldContext ,
  1851. t_OldSecurity
  1852. ) ;
  1853. if ( SUCCEEDED ( t_Result ) )
  1854. {
  1855. t_Result = ExecQuery (
  1856. a_QueryLanguage ,
  1857. a_Query ,
  1858. a_Flags ,
  1859. a_Context ,
  1860. a_Enum
  1861. ) ;
  1862. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1863. }
  1864. return t_Result ;
  1865. }
  1866. /******************************************************************************
  1867. *
  1868. * Name:
  1869. *
  1870. *
  1871. * Description:
  1872. *
  1873. *
  1874. *****************************************************************************/
  1875. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ExecQueryAsync (
  1876. WmiInternalContext a_InternalContext ,
  1877. const BSTR a_QueryLanguage ,
  1878. const BSTR a_Query,
  1879. long a_Flags ,
  1880. IWbemContext *a_Context ,
  1881. IWbemObjectSink *a_Sink
  1882. )
  1883. {
  1884. #if DBG
  1885. CheckThreadToken () ;
  1886. #endif
  1887. BOOL t_Impersonating = FALSE ;
  1888. IUnknown *t_OldContext = NULL ;
  1889. IServerSecurity *t_OldSecurity = NULL ;
  1890. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1891. a_InternalContext ,
  1892. t_Impersonating ,
  1893. t_OldContext ,
  1894. t_OldSecurity
  1895. ) ;
  1896. if ( SUCCEEDED ( t_Result ) )
  1897. {
  1898. t_Result = ExecQueryAsync (
  1899. a_QueryLanguage ,
  1900. a_Query,
  1901. a_Flags ,
  1902. a_Context ,
  1903. a_Sink
  1904. ) ;
  1905. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1906. }
  1907. return t_Result ;
  1908. }
  1909. /******************************************************************************
  1910. *
  1911. * Name:
  1912. *
  1913. *
  1914. * Description:
  1915. *
  1916. *
  1917. *****************************************************************************/
  1918. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ExecNotificationQuery (
  1919. WmiInternalContext a_InternalContext ,
  1920. const BSTR a_QueryLanguage ,
  1921. const BSTR a_Query ,
  1922. long a_Flags ,
  1923. IWbemContext *a_Context ,
  1924. IEnumWbemClassObject **a_Enum
  1925. )
  1926. {
  1927. #if DBG
  1928. CheckThreadToken () ;
  1929. #endif
  1930. BOOL t_Impersonating = FALSE ;
  1931. IUnknown *t_OldContext = NULL ;
  1932. IServerSecurity *t_OldSecurity = NULL ;
  1933. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1934. a_InternalContext ,
  1935. t_Impersonating ,
  1936. t_OldContext ,
  1937. t_OldSecurity
  1938. ) ;
  1939. if ( SUCCEEDED ( t_Result ) )
  1940. {
  1941. t_Result = ExecNotificationQuery (
  1942. a_QueryLanguage ,
  1943. a_Query ,
  1944. a_Flags ,
  1945. a_Context ,
  1946. a_Enum
  1947. ) ;
  1948. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1949. }
  1950. return t_Result ;
  1951. }
  1952. /******************************************************************************
  1953. *
  1954. * Name:
  1955. *
  1956. *
  1957. * Description:
  1958. *
  1959. *
  1960. *****************************************************************************/
  1961. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ExecNotificationQueryAsync (
  1962. WmiInternalContext a_InternalContext ,
  1963. const BSTR a_QueryLanguage ,
  1964. const BSTR a_Query ,
  1965. long a_Flags ,
  1966. IWbemContext *a_Context ,
  1967. IWbemObjectSink *a_Sink
  1968. )
  1969. {
  1970. #if DBG
  1971. CheckThreadToken () ;
  1972. #endif
  1973. BOOL t_Impersonating = FALSE ;
  1974. IUnknown *t_OldContext = NULL ;
  1975. IServerSecurity *t_OldSecurity = NULL ;
  1976. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  1977. a_InternalContext ,
  1978. t_Impersonating ,
  1979. t_OldContext ,
  1980. t_OldSecurity
  1981. ) ;
  1982. if ( SUCCEEDED ( t_Result ) )
  1983. {
  1984. t_Result = ExecNotificationQueryAsync (
  1985. a_QueryLanguage ,
  1986. a_Query ,
  1987. a_Flags ,
  1988. a_Context ,
  1989. a_Sink
  1990. ) ;
  1991. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  1992. }
  1993. return t_Result ;
  1994. }
  1995. /******************************************************************************
  1996. *
  1997. * Name:
  1998. *
  1999. *
  2000. * Description:
  2001. *
  2002. *
  2003. *****************************************************************************/
  2004. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ExecMethod (
  2005. WmiInternalContext a_InternalContext ,
  2006. const BSTR a_ObjectPath ,
  2007. const BSTR a_MethodName ,
  2008. long a_Flags ,
  2009. IWbemContext *a_Context ,
  2010. IWbemClassObject *a_InParams ,
  2011. IWbemClassObject **a_OutParams ,
  2012. IWbemCallResult **a_CallResult
  2013. )
  2014. {
  2015. #if DBG
  2016. CheckThreadToken () ;
  2017. #endif
  2018. BOOL t_Impersonating = FALSE ;
  2019. IUnknown *t_OldContext = NULL ;
  2020. IServerSecurity *t_OldSecurity = NULL ;
  2021. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2022. a_InternalContext ,
  2023. t_Impersonating ,
  2024. t_OldContext ,
  2025. t_OldSecurity
  2026. ) ;
  2027. if ( SUCCEEDED ( t_Result ) )
  2028. {
  2029. t_Result = ExecMethod (
  2030. a_ObjectPath ,
  2031. a_MethodName ,
  2032. a_Flags ,
  2033. a_Context ,
  2034. a_InParams ,
  2035. a_OutParams ,
  2036. a_CallResult
  2037. ) ;
  2038. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2039. }
  2040. return t_Result ;
  2041. }
  2042. /******************************************************************************
  2043. *
  2044. * Name:
  2045. *
  2046. *
  2047. * Description:
  2048. *
  2049. *
  2050. *****************************************************************************/
  2051. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ExecMethodAsync (
  2052. WmiInternalContext a_InternalContext ,
  2053. const BSTR a_ObjectPath ,
  2054. const BSTR a_MethodName ,
  2055. long a_Flags ,
  2056. IWbemContext *a_Context ,
  2057. IWbemClassObject *a_InParams ,
  2058. IWbemObjectSink *a_Sink
  2059. )
  2060. {
  2061. #if DBG
  2062. CheckThreadToken () ;
  2063. #endif
  2064. BOOL t_Impersonating = FALSE ;
  2065. IUnknown *t_OldContext = NULL ;
  2066. IServerSecurity *t_OldSecurity = NULL ;
  2067. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2068. a_InternalContext ,
  2069. t_Impersonating ,
  2070. t_OldContext ,
  2071. t_OldSecurity
  2072. ) ;
  2073. if ( SUCCEEDED ( t_Result ) )
  2074. {
  2075. t_Result = ExecMethodAsync (
  2076. a_ObjectPath ,
  2077. a_MethodName ,
  2078. a_Flags ,
  2079. a_Context ,
  2080. a_InParams ,
  2081. a_Sink
  2082. ) ;
  2083. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2084. }
  2085. return t_Result ;
  2086. }
  2087. /******************************************************************************
  2088. *
  2089. * Name:
  2090. *
  2091. *
  2092. * Description:
  2093. *
  2094. *
  2095. *****************************************************************************/
  2096. HRESULT CInterceptor_IWbemSyncProvider :: Internal_GetProperty (
  2097. WmiInternalContext a_InternalContext ,
  2098. long a_Flags ,
  2099. const BSTR a_Locale ,
  2100. const BSTR a_ClassMapping ,
  2101. const BSTR a_InstanceMapping ,
  2102. const BSTR a_PropertyMapping ,
  2103. VARIANT *a_Value
  2104. )
  2105. {
  2106. #if DBG
  2107. CheckThreadToken () ;
  2108. #endif
  2109. BOOL t_Impersonating = FALSE ;
  2110. IUnknown *t_OldContext = NULL ;
  2111. IServerSecurity *t_OldSecurity = NULL ;
  2112. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2113. a_InternalContext ,
  2114. t_Impersonating ,
  2115. t_OldContext ,
  2116. t_OldSecurity
  2117. ) ;
  2118. if ( SUCCEEDED ( t_Result ) )
  2119. {
  2120. t_Result = GetProperty (
  2121. a_Flags ,
  2122. a_Locale ,
  2123. a_ClassMapping ,
  2124. a_InstanceMapping ,
  2125. a_PropertyMapping ,
  2126. a_Value
  2127. ) ;
  2128. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2129. }
  2130. return t_Result ;
  2131. }
  2132. /******************************************************************************
  2133. *
  2134. * Name:
  2135. *
  2136. *
  2137. * Description:
  2138. *
  2139. *
  2140. *****************************************************************************/
  2141. HRESULT CInterceptor_IWbemSyncProvider :: Internal_PutProperty (
  2142. WmiInternalContext a_InternalContext ,
  2143. long a_Flags ,
  2144. const BSTR a_Locale ,
  2145. const BSTR a_ClassMapping ,
  2146. const BSTR a_InstanceMapping ,
  2147. const BSTR a_PropertyMapping ,
  2148. const VARIANT *a_Value
  2149. )
  2150. {
  2151. #if DBG
  2152. CheckThreadToken () ;
  2153. #endif
  2154. BOOL t_Impersonating = FALSE ;
  2155. IUnknown *t_OldContext = NULL ;
  2156. IServerSecurity *t_OldSecurity = NULL ;
  2157. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2158. a_InternalContext ,
  2159. t_Impersonating ,
  2160. t_OldContext ,
  2161. t_OldSecurity
  2162. ) ;
  2163. if ( SUCCEEDED ( t_Result ) )
  2164. {
  2165. t_Result = PutProperty (
  2166. a_Flags ,
  2167. a_Locale ,
  2168. a_ClassMapping ,
  2169. a_InstanceMapping ,
  2170. a_PropertyMapping ,
  2171. a_Value
  2172. ) ;
  2173. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2174. }
  2175. return t_Result ;
  2176. }
  2177. /******************************************************************************
  2178. *
  2179. * Name:
  2180. *
  2181. *
  2182. * Description:
  2183. *
  2184. *
  2185. *****************************************************************************/
  2186. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ProvideEvents (
  2187. WmiInternalContext a_InternalContext ,
  2188. IWbemObjectSink *a_Sink ,
  2189. long a_Flags
  2190. )
  2191. {
  2192. #if DBG
  2193. CheckThreadToken () ;
  2194. #endif
  2195. BOOL t_Impersonating = FALSE ;
  2196. IUnknown *t_OldContext = NULL ;
  2197. IServerSecurity *t_OldSecurity = NULL ;
  2198. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2199. a_InternalContext ,
  2200. t_Impersonating ,
  2201. t_OldContext ,
  2202. t_OldSecurity
  2203. ) ;
  2204. if ( SUCCEEDED ( t_Result ) )
  2205. {
  2206. t_Result = InternalEx_ProvideEvents (
  2207. true ,
  2208. a_Sink ,
  2209. a_Flags
  2210. ) ;
  2211. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2212. }
  2213. return t_Result ;
  2214. }
  2215. /******************************************************************************
  2216. *
  2217. * Name:
  2218. *
  2219. *
  2220. * Description:
  2221. *
  2222. *
  2223. *****************************************************************************/
  2224. HRESULT CInterceptor_IWbemSyncProvider :: Internal_NewQuery (
  2225. WmiInternalContext a_InternalContext ,
  2226. unsigned long a_Id ,
  2227. WBEM_WSTR a_QueryLanguage ,
  2228. WBEM_WSTR a_Query
  2229. )
  2230. {
  2231. #if DBG
  2232. CheckThreadToken () ;
  2233. #endif
  2234. BOOL t_Impersonating = FALSE ;
  2235. IUnknown *t_OldContext = NULL ;
  2236. IServerSecurity *t_OldSecurity = NULL ;
  2237. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2238. a_InternalContext ,
  2239. t_Impersonating ,
  2240. t_OldContext ,
  2241. t_OldSecurity
  2242. ) ;
  2243. if ( SUCCEEDED ( t_Result ) )
  2244. {
  2245. t_Result = InternalEx_NewQuery (
  2246. true ,
  2247. a_Id ,
  2248. a_QueryLanguage ,
  2249. a_Query
  2250. ) ;
  2251. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2252. }
  2253. return t_Result ;
  2254. }
  2255. /******************************************************************************
  2256. *
  2257. * Name:
  2258. *
  2259. *
  2260. * Description:
  2261. *
  2262. *
  2263. *****************************************************************************/
  2264. HRESULT CInterceptor_IWbemSyncProvider :: Internal_CancelQuery (
  2265. WmiInternalContext a_InternalContext ,
  2266. unsigned long a_Id
  2267. )
  2268. {
  2269. #if DBG
  2270. CheckThreadToken () ;
  2271. #endif
  2272. BOOL t_Impersonating = FALSE ;
  2273. IUnknown *t_OldContext = NULL ;
  2274. IServerSecurity *t_OldSecurity = NULL ;
  2275. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2276. a_InternalContext ,
  2277. t_Impersonating ,
  2278. t_OldContext ,
  2279. t_OldSecurity
  2280. ) ;
  2281. if ( SUCCEEDED ( t_Result ) )
  2282. {
  2283. t_Result = InternalEx_CancelQuery (
  2284. true ,
  2285. a_Id
  2286. ) ;
  2287. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2288. }
  2289. return t_Result ;
  2290. }
  2291. /******************************************************************************
  2292. *
  2293. * Name:
  2294. *
  2295. *
  2296. * Description:
  2297. *
  2298. *
  2299. *****************************************************************************/
  2300. HRESULT CInterceptor_IWbemSyncProvider :: Internal_AccessCheck (
  2301. WmiInternalContext a_InternalContext ,
  2302. WBEM_CWSTR a_QueryLanguage ,
  2303. WBEM_CWSTR a_Query ,
  2304. long a_SidLength ,
  2305. const BYTE *a_Sid
  2306. )
  2307. {
  2308. #if DBG
  2309. CheckThreadToken () ;
  2310. #endif
  2311. BOOL t_Impersonating = FALSE ;
  2312. IUnknown *t_OldContext = NULL ;
  2313. IServerSecurity *t_OldSecurity = NULL ;
  2314. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2315. a_InternalContext ,
  2316. t_Impersonating ,
  2317. t_OldContext ,
  2318. t_OldSecurity
  2319. ) ;
  2320. if ( SUCCEEDED ( t_Result ) )
  2321. {
  2322. t_Result = InternalEx_AccessCheck (
  2323. true ,
  2324. a_QueryLanguage ,
  2325. a_Query ,
  2326. a_SidLength ,
  2327. a_Sid
  2328. ) ;
  2329. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2330. }
  2331. return t_Result ;
  2332. }
  2333. /******************************************************************************
  2334. *
  2335. * Name:
  2336. *
  2337. *
  2338. * Description:
  2339. *
  2340. *
  2341. *****************************************************************************/
  2342. HRESULT CInterceptor_IWbemSyncProvider :: Internal_FindConsumer (
  2343. WmiInternalContext a_InternalContext ,
  2344. IWbemClassObject *a_LogicalConsumer ,
  2345. IWbemUnboundObjectSink **a_Consumer
  2346. )
  2347. {
  2348. #if DBG
  2349. CheckThreadToken () ;
  2350. #endif
  2351. BOOL t_Impersonating = FALSE ;
  2352. IUnknown *t_OldContext = NULL ;
  2353. IServerSecurity *t_OldSecurity = NULL ;
  2354. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2355. a_InternalContext ,
  2356. t_Impersonating ,
  2357. t_OldContext ,
  2358. t_OldSecurity
  2359. ) ;
  2360. if ( SUCCEEDED ( t_Result ) )
  2361. {
  2362. t_Result = InternalEx_FindConsumer (
  2363. true ,
  2364. a_LogicalConsumer ,
  2365. a_Consumer
  2366. ) ;
  2367. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2368. }
  2369. return t_Result ;
  2370. }
  2371. /******************************************************************************
  2372. *
  2373. * Name:
  2374. *
  2375. *
  2376. * Description:
  2377. *
  2378. *
  2379. *****************************************************************************/
  2380. HRESULT CInterceptor_IWbemSyncProvider :: Internal_ValidateSubscription (
  2381. WmiInternalContext a_InternalContext ,
  2382. IWbemClassObject *a_LogicalConsumer
  2383. )
  2384. {
  2385. #if DBG
  2386. CheckThreadToken () ;
  2387. #endif
  2388. BOOL t_Impersonating = FALSE ;
  2389. IUnknown *t_OldContext = NULL ;
  2390. IServerSecurity *t_OldSecurity = NULL ;
  2391. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2392. a_InternalContext ,
  2393. t_Impersonating ,
  2394. t_OldContext ,
  2395. t_OldSecurity
  2396. ) ;
  2397. if ( SUCCEEDED ( t_Result ) )
  2398. {
  2399. t_Result = InternalEx_ValidateSubscription (
  2400. true ,
  2401. a_LogicalConsumer
  2402. ) ;
  2403. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2404. }
  2405. return t_Result ;
  2406. }
  2407. /******************************************************************************
  2408. *
  2409. * Name:
  2410. *
  2411. *
  2412. * Description:
  2413. *
  2414. *
  2415. *****************************************************************************/
  2416. HRESULT CInterceptor_IWbemSyncProvider :: Internal_IndicateToConsumer (
  2417. WmiInternalContext a_InternalContext ,
  2418. IWbemClassObject *a_LogicalConsumer ,
  2419. long a_ObjectCount ,
  2420. IWbemClassObject **a_Objects
  2421. )
  2422. {
  2423. #if DBG
  2424. CheckThreadToken () ;
  2425. #endif
  2426. BOOL t_Impersonating = FALSE ;
  2427. IUnknown *t_OldContext = NULL ;
  2428. IServerSecurity *t_OldSecurity = NULL ;
  2429. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2430. a_InternalContext ,
  2431. t_Impersonating ,
  2432. t_OldContext ,
  2433. t_OldSecurity
  2434. ) ;
  2435. if ( SUCCEEDED ( t_Result ) )
  2436. {
  2437. t_Result = InternalEx_IndicateToConsumer (
  2438. true ,
  2439. a_LogicalConsumer ,
  2440. a_ObjectCount ,
  2441. a_Objects
  2442. ) ;
  2443. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2444. }
  2445. return t_Result ;
  2446. }
  2447. /******************************************************************************
  2448. *
  2449. * Name:
  2450. *
  2451. *
  2452. * Description:
  2453. *
  2454. *
  2455. *****************************************************************************/
  2456. HRESULT CInterceptor_IWbemSyncProvider :: Internal_Get (
  2457. WmiInternalContext a_InternalContext ,
  2458. IWbemServices *a_Service ,
  2459. long a_Flags ,
  2460. IWbemContext *a_Context ,
  2461. LPCWSTR a_Class ,
  2462. LPCWSTR a_Path ,
  2463. IWbemObjectSink *a_Sink
  2464. )
  2465. {
  2466. #if DBG
  2467. CheckThreadToken () ;
  2468. #endif
  2469. BOOL t_Impersonating = FALSE ;
  2470. IUnknown *t_OldContext = NULL ;
  2471. IServerSecurity *t_OldSecurity = NULL ;
  2472. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2473. a_InternalContext ,
  2474. t_Impersonating ,
  2475. t_OldContext ,
  2476. t_OldSecurity
  2477. ) ;
  2478. if ( SUCCEEDED ( t_Result ) )
  2479. {
  2480. t_Result = Get (
  2481. a_Service ,
  2482. a_Flags ,
  2483. a_Context ,
  2484. a_Class ,
  2485. a_Path ,
  2486. a_Sink
  2487. ) ;
  2488. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2489. }
  2490. return t_Result ;
  2491. }
  2492. /******************************************************************************
  2493. *
  2494. * Name:
  2495. *
  2496. *
  2497. * Description:
  2498. *
  2499. *
  2500. *****************************************************************************/
  2501. HRESULT CInterceptor_IWbemSyncProvider :: Internal_Set (
  2502. WmiInternalContext a_InternalContext ,
  2503. IWbemServices *a_Service ,
  2504. long a_Flags ,
  2505. IWbemContext *a_Context ,
  2506. LPCWSTR a_Provider ,
  2507. LPCWSTR a_Class ,
  2508. LPCWSTR a_Path ,
  2509. IWbemClassObject *a_OldObject ,
  2510. IWbemClassObject *a_NewObject
  2511. )
  2512. {
  2513. #if DBG
  2514. CheckThreadToken () ;
  2515. #endif
  2516. BOOL t_Impersonating = FALSE ;
  2517. IUnknown *t_OldContext = NULL ;
  2518. IServerSecurity *t_OldSecurity = NULL ;
  2519. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2520. a_InternalContext ,
  2521. t_Impersonating ,
  2522. t_OldContext ,
  2523. t_OldSecurity
  2524. ) ;
  2525. if ( SUCCEEDED ( t_Result ) )
  2526. {
  2527. t_Result = Set (
  2528. a_Service ,
  2529. a_Flags ,
  2530. a_Context ,
  2531. a_Provider ,
  2532. a_Class ,
  2533. a_Path ,
  2534. a_OldObject ,
  2535. a_NewObject
  2536. ) ;
  2537. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2538. }
  2539. return t_Result ;
  2540. }
  2541. /******************************************************************************
  2542. *
  2543. * Name:
  2544. *
  2545. *
  2546. * Description:
  2547. *
  2548. *
  2549. *****************************************************************************/
  2550. HRESULT CInterceptor_IWbemSyncProvider :: Internal_Deleted (
  2551. WmiInternalContext a_InternalContext ,
  2552. IWbemServices *a_Service ,
  2553. long a_Flags ,
  2554. IWbemContext *a_Context ,
  2555. LPCWSTR a_Provider ,
  2556. LPCWSTR a_Class ,
  2557. LPCWSTR a_Path ,
  2558. IWbemClassObject *a_Object
  2559. )
  2560. {
  2561. #if DBG
  2562. CheckThreadToken () ;
  2563. #endif
  2564. BOOL t_Impersonating = FALSE ;
  2565. IUnknown *t_OldContext = NULL ;
  2566. IServerSecurity *t_OldSecurity = NULL ;
  2567. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2568. a_InternalContext ,
  2569. t_Impersonating ,
  2570. t_OldContext ,
  2571. t_OldSecurity
  2572. ) ;
  2573. if ( SUCCEEDED ( t_Result ) )
  2574. {
  2575. t_Result = Deleted (
  2576. a_Service ,
  2577. a_Flags ,
  2578. a_Context ,
  2579. a_Provider ,
  2580. a_Class ,
  2581. a_Path ,
  2582. a_Object
  2583. ) ;
  2584. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2585. }
  2586. return t_Result ;
  2587. }
  2588. /******************************************************************************
  2589. *
  2590. * Name:
  2591. *
  2592. *
  2593. * Description:
  2594. *
  2595. *
  2596. *****************************************************************************/
  2597. HRESULT CInterceptor_IWbemSyncProvider :: Internal_Enumerate (
  2598. WmiInternalContext a_InternalContext ,
  2599. IWbemServices *a_Service ,
  2600. long a_Flags ,
  2601. IWbemContext *a_Context ,
  2602. LPCWSTR a_Class ,
  2603. IWbemObjectSink *a_Sink
  2604. )
  2605. {
  2606. #if DBG
  2607. CheckThreadToken () ;
  2608. #endif
  2609. BOOL t_Impersonating = FALSE ;
  2610. IUnknown *t_OldContext = NULL ;
  2611. IServerSecurity *t_OldSecurity = NULL ;
  2612. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2613. a_InternalContext ,
  2614. t_Impersonating ,
  2615. t_OldContext ,
  2616. t_OldSecurity
  2617. ) ;
  2618. if ( SUCCEEDED ( t_Result ) )
  2619. {
  2620. t_Result = Enumerate (
  2621. a_Service ,
  2622. a_Flags ,
  2623. a_Context ,
  2624. a_Class ,
  2625. a_Sink
  2626. ) ;
  2627. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2628. }
  2629. return t_Result ;
  2630. }
  2631. /******************************************************************************
  2632. *
  2633. * Name:
  2634. *
  2635. *
  2636. * Description:
  2637. *
  2638. *
  2639. *****************************************************************************/
  2640. HRESULT CInterceptor_IWbemSyncProvider :: Internal_Call (
  2641. WmiInternalContext a_InternalContext ,
  2642. IWbemServices *a_Service ,
  2643. long a_Flags ,
  2644. IWbemContext *a_Context ,
  2645. LPCWSTR a_Class ,
  2646. LPCWSTR a_Path ,
  2647. LPCWSTR a_Method,
  2648. IWbemClassObject *a_InParams,
  2649. IWbemObjectSink *a_Sink
  2650. )
  2651. {
  2652. #if DBG
  2653. CheckThreadToken () ;
  2654. #endif
  2655. BOOL t_Impersonating = FALSE ;
  2656. IUnknown *t_OldContext = NULL ;
  2657. IServerSecurity *t_OldSecurity = NULL ;
  2658. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2659. a_InternalContext ,
  2660. t_Impersonating ,
  2661. t_OldContext ,
  2662. t_OldSecurity
  2663. ) ;
  2664. if ( SUCCEEDED ( t_Result ) )
  2665. {
  2666. t_Result = Call (
  2667. a_Service ,
  2668. a_Flags ,
  2669. a_Context ,
  2670. a_Class ,
  2671. a_Path ,
  2672. a_Method,
  2673. a_InParams,
  2674. a_Sink
  2675. ) ;
  2676. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2677. }
  2678. return t_Result ;
  2679. }
  2680. /******************************************************************************
  2681. *
  2682. * Name:
  2683. *
  2684. *
  2685. * Description:
  2686. *
  2687. *
  2688. *****************************************************************************/
  2689. HRESULT CInterceptor_IWbemSyncProvider :: Internal_Query (
  2690. WmiInternalContext a_InternalContext ,
  2691. IWbemServices *a_Service ,
  2692. long a_Flags ,
  2693. IWbemContext *a_Context ,
  2694. WBEM_PROVIDER_CONFIGURATION_CLASS_ID a_ClassIdentifier ,
  2695. WBEM_PROVIDER_CONFIGURATION_PROPERTY_ID a_PropertyIdentifier ,
  2696. VARIANT *a_Value
  2697. )
  2698. {
  2699. #if DBG
  2700. CheckThreadToken () ;
  2701. #endif
  2702. BOOL t_Impersonating = FALSE ;
  2703. IUnknown *t_OldContext = NULL ;
  2704. IServerSecurity *t_OldSecurity = NULL ;
  2705. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2706. a_InternalContext ,
  2707. t_Impersonating ,
  2708. t_OldContext ,
  2709. t_OldSecurity
  2710. ) ;
  2711. if ( SUCCEEDED ( t_Result ) )
  2712. {
  2713. t_Result = Query (
  2714. a_Service ,
  2715. a_Flags ,
  2716. a_Context ,
  2717. a_ClassIdentifier ,
  2718. a_PropertyIdentifier ,
  2719. a_Value
  2720. ) ;
  2721. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2722. }
  2723. return t_Result ;
  2724. }
  2725. /******************************************************************************
  2726. *
  2727. * Name:
  2728. *
  2729. *
  2730. * Description:
  2731. *
  2732. *
  2733. *****************************************************************************/
  2734. HRESULT CInterceptor_IWbemSyncProvider :: Internal_Shutdown (
  2735. WmiInternalContext a_InternalContext ,
  2736. IWbemServices *a_Service ,
  2737. long a_Flags ,
  2738. IWbemContext *a_Context ,
  2739. LPCWSTR a_Provider ,
  2740. ULONG a_MilliSeconds
  2741. )
  2742. {
  2743. #if DBG
  2744. CheckThreadToken () ;
  2745. #endif
  2746. BOOL t_Impersonating = FALSE ;
  2747. IUnknown *t_OldContext = NULL ;
  2748. IServerSecurity *t_OldSecurity = NULL ;
  2749. HRESULT t_Result = ProviderSubSystem_Globals :: Begin_IdentifyCall_PrvHost (
  2750. a_InternalContext ,
  2751. t_Impersonating ,
  2752. t_OldContext ,
  2753. t_OldSecurity
  2754. ) ;
  2755. if ( SUCCEEDED ( t_Result ) )
  2756. {
  2757. t_Result = Shutdown (
  2758. a_Service ,
  2759. a_Flags ,
  2760. a_Context ,
  2761. a_Provider ,
  2762. a_MilliSeconds
  2763. ) ;
  2764. ProviderSubSystem_Globals :: End_IdentifyCall_PrvHost ( a_InternalContext , t_OldContext , t_OldSecurity , t_Impersonating ) ;
  2765. }
  2766. return t_Result ;
  2767. }
  2768. /******************************************************************************
  2769. *
  2770. * Name:
  2771. *
  2772. *
  2773. * Description:
  2774. *
  2775. *
  2776. *****************************************************************************/
  2777. HRESULT CInterceptor_IWbemSyncProvider :: AdjustGetContext (
  2778. IWbemContext *a_Context
  2779. )
  2780. {
  2781. // See if per-property get are being used.
  2782. // ========================================
  2783. HRESULT t_Result = S_OK ;
  2784. if ( a_Context )
  2785. {
  2786. VARIANT t_Variant ;
  2787. VariantInit ( & t_Variant ) ;
  2788. t_Result = a_Context->GetValue ( L"__GET_EXTENSIONS" , 0, & t_Variant ) ;
  2789. if ( SUCCEEDED ( t_Result ) )
  2790. {
  2791. // If here, they are being used. Next we have to check and see
  2792. // if the reentrancy flag is set or not.
  2793. // =============================================================
  2794. VariantClear ( & t_Variant ) ;
  2795. t_Result = a_Context->GetValue ( L"__GET_EXT_CLIENT_REQUEST" , 0 , & t_Variant ) ;
  2796. if ( SUCCEEDED ( t_Result ) )
  2797. {
  2798. VariantClear ( & t_Variant ) ;
  2799. a_Context->DeleteValue ( L"__GET_EXT_CLIENT_REQUEST" , 0 ) ;
  2800. }
  2801. else
  2802. {
  2803. // If here, we have to clear out the get extensions.
  2804. // =================================================
  2805. a_Context->DeleteValue ( L"__GET_EXTENSIONS" , 0 ) ;
  2806. a_Context->DeleteValue ( L"__GET_EXT_CLIENT_REQUEST" , 0 ) ;
  2807. a_Context->DeleteValue ( L"__GET_EXT_KEYS_ONLY" , 0 ) ;
  2808. a_Context->DeleteValue ( L"__GET_EXT_PROPERTIES" , 0 ) ;
  2809. }
  2810. }
  2811. }
  2812. return S_OK ;
  2813. }
  2814. /******************************************************************************
  2815. *
  2816. * Name:
  2817. *
  2818. *
  2819. * Description:
  2820. *
  2821. *
  2822. *****************************************************************************/
  2823. HRESULT CInterceptor_IWbemSyncProvider :: SetStatus (
  2824. LPWSTR a_Operation ,
  2825. LPWSTR a_Parameters ,
  2826. LPWSTR a_Description ,
  2827. HRESULT a_Result ,
  2828. IWbemObjectSink *a_Sink
  2829. )
  2830. {
  2831. HRESULT t_Result = S_OK ;
  2832. if ( m_ExtendedStatusObject )
  2833. {
  2834. IWbemClassObject *t_StatusObject ;
  2835. t_Result = m_ExtendedStatusObject ->SpawnInstance (
  2836. 0 ,
  2837. & t_StatusObject
  2838. ) ;
  2839. if ( SUCCEEDED ( t_Result ) )
  2840. {
  2841. ProviderSubSystem_Common_Globals :: Set_String ( t_StatusObject , L"Provider" , m_Registration->GetProviderName () ) ;
  2842. if ( a_Operation )
  2843. {
  2844. ProviderSubSystem_Common_Globals :: Set_String ( t_StatusObject , L"Operation" , a_Operation ) ;
  2845. }
  2846. if ( a_Parameters )
  2847. {
  2848. ProviderSubSystem_Common_Globals :: Set_String ( t_StatusObject , L"ParameterInfo" , a_Parameters ) ;
  2849. }
  2850. if ( a_Description )
  2851. {
  2852. ProviderSubSystem_Common_Globals :: Set_String ( t_StatusObject , L"Description" , a_Description ) ;
  2853. }
  2854. _IWmiObject *t_FastStatusObject ;
  2855. t_Result = t_StatusObject->QueryInterface ( IID__IWmiObject , ( void ** ) & t_FastStatusObject ) ;
  2856. if ( SUCCEEDED ( t_Result ) )
  2857. {
  2858. ProviderSubSystem_Common_Globals :: Set_Uint32 ( t_FastStatusObject , L"StatusCode" , a_Result ) ;
  2859. t_FastStatusObject->Release () ;
  2860. }
  2861. t_Result = a_Sink->SetStatus ( 0 , a_Result , L"Provider Subsystem Error Report" , t_StatusObject ) ;
  2862. t_StatusObject->Release () ;
  2863. }
  2864. else
  2865. {
  2866. t_Result = a_Sink->SetStatus ( 0 , a_Result , NULL , NULL ) ;
  2867. }
  2868. }
  2869. else
  2870. {
  2871. t_Result = a_Sink->SetStatus ( 0 , a_Result , NULL , NULL ) ;
  2872. }
  2873. return t_Result ;
  2874. }
  2875. /******************************************************************************
  2876. *
  2877. * Name:
  2878. *
  2879. *
  2880. * Description:
  2881. *
  2882. *
  2883. *****************************************************************************/
  2884. HRESULT CInterceptor_IWbemSyncProvider :: Begin_IWbemServices (
  2885. BOOL &a_Impersonating ,
  2886. IUnknown *&a_OldContext ,
  2887. IServerSecurity *&a_OldSecurity ,
  2888. BOOL &a_IsProxy ,
  2889. IWbemServices *&a_Interface ,
  2890. BOOL &a_Revert ,
  2891. IUnknown *&a_Proxy
  2892. )
  2893. {
  2894. HRESULT t_Result = S_OK ;
  2895. a_Revert = FALSE ;
  2896. a_Proxy = NULL ;
  2897. a_Impersonating = FALSE ;
  2898. a_OldContext = NULL ;
  2899. a_OldSecurity = NULL ;
  2900. switch ( m_Registration->GetHosting () )
  2901. {
  2902. case e_Hosting_WmiCore:
  2903. case e_Hosting_SharedLocalSystemHost:
  2904. case e_Hosting_SharedLocalServiceHost:
  2905. case e_Hosting_SharedNetworkServiceHost:
  2906. {
  2907. a_Interface = m_Provider_IWbemServices ;
  2908. a_IsProxy = FALSE ;
  2909. }
  2910. break ;
  2911. default:
  2912. {
  2913. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2914. if ( SUCCEEDED ( t_Result ) )
  2915. {
  2916. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemServices , IID_IWbemServices , m_Provider_IWbemServices , a_Proxy , a_Revert ) ;
  2917. if ( t_Result == WBEM_E_NOT_FOUND )
  2918. {
  2919. a_Interface = m_Provider_IWbemServices ;
  2920. a_IsProxy = FALSE ;
  2921. t_Result = S_OK ;
  2922. }
  2923. else
  2924. {
  2925. if ( SUCCEEDED ( t_Result ) )
  2926. {
  2927. a_IsProxy = TRUE ;
  2928. a_Interface = ( IWbemServices * ) a_Proxy ;
  2929. // Set cloaking on the proxy
  2930. // =========================
  2931. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  2932. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  2933. a_Interface ,
  2934. RPC_C_AUTHN_LEVEL_DEFAULT ,
  2935. t_ImpersonationLevel
  2936. ) ;
  2937. if ( SUCCEEDED ( t_Result ) )
  2938. {
  2939. t_Result = CoImpersonateClient () ;
  2940. if ( SUCCEEDED ( t_Result ) )
  2941. {
  2942. }
  2943. else
  2944. {
  2945. t_Result = WBEM_E_ACCESS_DENIED ;
  2946. }
  2947. }
  2948. if ( FAILED ( t_Result ) )
  2949. {
  2950. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  2951. m_ProxyContainer ,
  2952. ProxyIndex_IWbemServices ,
  2953. a_Proxy ,
  2954. a_Revert
  2955. ) ;
  2956. }
  2957. }
  2958. }
  2959. if ( FAILED ( t_Result ) && t_Result != WBEM_E_NOT_FOUND )
  2960. {
  2961. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  2962. }
  2963. }
  2964. }
  2965. break ;
  2966. }
  2967. return t_Result ;
  2968. }
  2969. /******************************************************************************
  2970. *
  2971. * Name:
  2972. *
  2973. *
  2974. * Description:
  2975. *
  2976. *
  2977. *****************************************************************************/
  2978. HRESULT CInterceptor_IWbemSyncProvider :: End_IWbemServices (
  2979. BOOL a_Impersonating ,
  2980. IUnknown *a_OldContext ,
  2981. IServerSecurity *a_OldSecurity ,
  2982. BOOL a_IsProxy ,
  2983. IWbemServices *a_Interface ,
  2984. BOOL a_Revert ,
  2985. IUnknown *a_Proxy
  2986. )
  2987. {
  2988. CoRevertToSelf () ;
  2989. if ( a_Proxy )
  2990. {
  2991. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  2992. m_ProxyContainer ,
  2993. ProxyIndex_IWbemServices ,
  2994. a_Proxy ,
  2995. a_Revert
  2996. ) ;
  2997. }
  2998. switch ( m_Registration->GetHosting () )
  2999. {
  3000. case e_Hosting_WmiCore:
  3001. case e_Hosting_SharedLocalSystemHost:
  3002. case e_Hosting_SharedLocalServiceHost:
  3003. case e_Hosting_SharedNetworkServiceHost:
  3004. {
  3005. }
  3006. break ;
  3007. default:
  3008. {
  3009. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  3010. }
  3011. break ;
  3012. }
  3013. return S_OK ;
  3014. }
  3015. /******************************************************************************
  3016. *
  3017. * Name:
  3018. *
  3019. *
  3020. * Description:
  3021. *
  3022. *
  3023. *****************************************************************************/
  3024. HRESULT CInterceptor_IWbemSyncProvider :: Begin_Interface (
  3025. IUnknown *a_ServerInterface ,
  3026. REFIID a_InterfaceIdentifier ,
  3027. DWORD a_ProxyIndex ,
  3028. BOOL &a_Impersonating ,
  3029. IUnknown *&a_OldContext ,
  3030. IServerSecurity *&a_OldSecurity ,
  3031. BOOL &a_IsProxy ,
  3032. IUnknown *&a_Interface ,
  3033. BOOL &a_Revert ,
  3034. IUnknown *&a_Proxy
  3035. )
  3036. {
  3037. HRESULT t_Result = S_OK ;
  3038. a_Revert = FALSE ;
  3039. a_Proxy = NULL ;
  3040. a_Impersonating = FALSE ;
  3041. a_OldContext = NULL ;
  3042. a_OldSecurity = NULL ;
  3043. switch ( m_Registration->GetHosting () )
  3044. {
  3045. case e_Hosting_WmiCore:
  3046. case e_Hosting_SharedLocalSystemHost:
  3047. case e_Hosting_SharedLocalServiceHost:
  3048. case e_Hosting_SharedNetworkServiceHost:
  3049. {
  3050. a_Interface = a_ServerInterface ;
  3051. a_IsProxy = FALSE ;
  3052. }
  3053. break ;
  3054. default:
  3055. {
  3056. DWORD t_AuthenticationLevel = RPC_C_AUTHN_LEVEL_DEFAULT ;
  3057. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating , & t_AuthenticationLevel ) ;
  3058. if ( SUCCEEDED ( t_Result ) )
  3059. {
  3060. DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
  3061. IServerSecurity *t_ServerSecurity = NULL ;
  3062. HRESULT t_TempResult = CoGetCallContext ( IID_IUnknown , ( void ** ) & t_ServerSecurity ) ;
  3063. if ( SUCCEEDED ( t_TempResult ) )
  3064. {
  3065. t_Result = CoImpersonateClient () ;
  3066. if ( SUCCEEDED ( t_Result ) )
  3067. {
  3068. t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  3069. CoRevertToSelf () ;
  3070. }
  3071. t_ServerSecurity->Release () ;
  3072. }
  3073. if ( SUCCEEDED ( t_Result ) )
  3074. {
  3075. if ( t_ImpersonationLevel == RPC_C_IMP_LEVEL_IDENTIFY )
  3076. {
  3077. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState_NoImpersonation (
  3078. m_ProxyContainer ,
  3079. a_ProxyIndex ,
  3080. a_InterfaceIdentifier ,
  3081. a_ServerInterface ,
  3082. a_Proxy ,
  3083. a_Revert
  3084. ) ;
  3085. }
  3086. else
  3087. {
  3088. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState (
  3089. m_ProxyContainer ,
  3090. a_ProxyIndex ,
  3091. a_InterfaceIdentifier ,
  3092. a_ServerInterface ,
  3093. a_Proxy ,
  3094. a_Revert
  3095. ) ;
  3096. }
  3097. }
  3098. if ( t_Result == WBEM_E_NOT_FOUND )
  3099. {
  3100. a_Interface = a_ServerInterface ;
  3101. a_IsProxy = FALSE ;
  3102. t_Result = S_OK ;
  3103. }
  3104. else
  3105. {
  3106. if ( SUCCEEDED ( t_Result ) )
  3107. {
  3108. a_IsProxy = TRUE ;
  3109. a_Interface = ( IUnknown * ) a_Proxy ;
  3110. // Set cloaking on the proxy
  3111. // =========================
  3112. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  3113. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  3114. a_Interface ,
  3115. RPC_C_AUTHN_LEVEL_DEFAULT ,
  3116. t_ImpersonationLevel
  3117. ) ;
  3118. if ( FAILED ( t_Result ) )
  3119. {
  3120. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  3121. m_ProxyContainer ,
  3122. a_ProxyIndex ,
  3123. a_Proxy ,
  3124. a_Revert
  3125. ) ;
  3126. }
  3127. }
  3128. }
  3129. if ( FAILED ( t_Result ) && t_Result != WBEM_E_NOT_FOUND )
  3130. {
  3131. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  3132. }
  3133. }
  3134. }
  3135. break ;
  3136. }
  3137. return t_Result ;
  3138. }
  3139. /******************************************************************************
  3140. *
  3141. * Name:
  3142. *
  3143. *
  3144. * Description:
  3145. *
  3146. *
  3147. *****************************************************************************/
  3148. HRESULT CInterceptor_IWbemSyncProvider :: End_Interface (
  3149. IUnknown *a_ServerInterface ,
  3150. REFIID a_InterfaceIdentifier ,
  3151. DWORD a_ProxyIndex ,
  3152. BOOL a_Impersonating ,
  3153. IUnknown *a_OldContext ,
  3154. IServerSecurity *a_OldSecurity ,
  3155. BOOL a_IsProxy ,
  3156. IUnknown *a_Interface ,
  3157. BOOL a_Revert ,
  3158. IUnknown *a_Proxy
  3159. )
  3160. {
  3161. CoRevertToSelf () ;
  3162. if ( a_Proxy )
  3163. {
  3164. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  3165. m_ProxyContainer ,
  3166. a_ProxyIndex ,
  3167. a_Proxy ,
  3168. a_Revert
  3169. ) ;
  3170. }
  3171. switch ( m_Registration->GetHosting () )
  3172. {
  3173. case e_Hosting_WmiCore:
  3174. case e_Hosting_SharedLocalSystemHost:
  3175. case e_Hosting_SharedLocalServiceHost:
  3176. case e_Hosting_SharedNetworkServiceHost:
  3177. {
  3178. }
  3179. break ;
  3180. default:
  3181. {
  3182. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  3183. }
  3184. break ;
  3185. }
  3186. return S_OK ;
  3187. }
  3188. /******************************************************************************
  3189. *
  3190. * Name:
  3191. *
  3192. *
  3193. * Description:
  3194. *
  3195. *
  3196. *****************************************************************************/
  3197. HRESULT CInterceptor_IWbemSyncProvider :: Begin_Interface_Events (
  3198. bool a_Identify ,
  3199. IUnknown *a_ServerInterface ,
  3200. REFIID a_InterfaceIdentifier ,
  3201. DWORD a_ProxyIndex ,
  3202. BOOL &a_Impersonating ,
  3203. IUnknown *&a_OldContext ,
  3204. IServerSecurity *&a_OldSecurity ,
  3205. BOOL &a_IsProxy ,
  3206. IUnknown *&a_Interface ,
  3207. BOOL &a_Revert ,
  3208. IUnknown *&a_Proxy
  3209. )
  3210. {
  3211. HRESULT t_Result = S_OK ;
  3212. a_Revert = FALSE ;
  3213. a_Proxy = NULL ;
  3214. a_Impersonating = FALSE ;
  3215. a_OldContext = NULL ;
  3216. a_OldSecurity = NULL ;
  3217. if ( a_Identify )
  3218. {
  3219. DWORD t_AuthenticationLevel = 0 ;
  3220. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation (
  3221. a_OldContext ,
  3222. a_OldSecurity ,
  3223. a_Impersonating ,
  3224. & t_AuthenticationLevel
  3225. ) ;
  3226. if ( SUCCEEDED ( t_Result ) )
  3227. {
  3228. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState (
  3229. m_ProxyContainer ,
  3230. a_ProxyIndex ,
  3231. a_InterfaceIdentifier ,
  3232. a_ServerInterface ,
  3233. a_Proxy ,
  3234. a_Revert
  3235. ) ;
  3236. if ( t_Result == WBEM_E_NOT_FOUND )
  3237. {
  3238. a_Interface = a_ServerInterface ;
  3239. a_IsProxy = FALSE ;
  3240. }
  3241. else
  3242. {
  3243. if ( SUCCEEDED ( t_Result ) )
  3244. {
  3245. a_IsProxy = TRUE ;
  3246. a_Interface = ( IUnknown * ) a_Proxy ;
  3247. // Set cloaking on the proxy
  3248. // =========================
  3249. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  3250. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  3251. a_Interface ,
  3252. RPC_C_AUTHN_LEVEL_DEFAULT ,
  3253. t_ImpersonationLevel
  3254. ) ;
  3255. if ( FAILED ( t_Result ) )
  3256. {
  3257. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  3258. m_ProxyContainer ,
  3259. a_ProxyIndex ,
  3260. a_Proxy ,
  3261. a_Revert
  3262. ) ;
  3263. }
  3264. }
  3265. }
  3266. if ( FAILED ( t_Result ) && t_Result != WBEM_E_NOT_FOUND )
  3267. {
  3268. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  3269. }
  3270. }
  3271. }
  3272. else
  3273. {
  3274. DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
  3275. IServerSecurity *t_ServerSecurity = NULL ;
  3276. HRESULT t_TempResult = CoGetCallContext ( IID_IUnknown , ( void ** ) & t_ServerSecurity ) ;
  3277. if ( SUCCEEDED ( t_TempResult ) )
  3278. {
  3279. t_Result = CoImpersonateClient () ;
  3280. if ( SUCCEEDED ( t_Result ) )
  3281. {
  3282. t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  3283. CoRevertToSelf () ;
  3284. }
  3285. t_ServerSecurity->Release () ;
  3286. }
  3287. if ( SUCCEEDED ( t_Result ) )
  3288. {
  3289. if ( t_ImpersonationLevel == RPC_C_IMP_LEVEL_IDENTIFY )
  3290. {
  3291. t_Result = CoSwitchCallContext ( NULL , &a_OldContext ) ;
  3292. if ( SUCCEEDED ( t_Result ) )
  3293. {
  3294. t_Result = a_OldContext->QueryInterface ( IID_IServerSecurity , ( void ** ) & a_OldSecurity ) ;
  3295. if ( SUCCEEDED ( t_Result ) )
  3296. {
  3297. a_Impersonating = a_OldSecurity->IsImpersonating () ;
  3298. }
  3299. }
  3300. a_Interface = a_ServerInterface ;
  3301. a_IsProxy = FALSE ;
  3302. }
  3303. else
  3304. {
  3305. DWORD t_AuthenticationLevel = 0 ;
  3306. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation (
  3307. a_OldContext ,
  3308. a_OldSecurity ,
  3309. a_Impersonating ,
  3310. & t_AuthenticationLevel
  3311. ) ;
  3312. if ( SUCCEEDED ( t_Result ) )
  3313. {
  3314. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState (
  3315. m_ProxyContainer ,
  3316. a_ProxyIndex ,
  3317. a_InterfaceIdentifier ,
  3318. a_ServerInterface ,
  3319. a_Proxy ,
  3320. a_Revert
  3321. ) ;
  3322. if ( t_Result == WBEM_E_NOT_FOUND )
  3323. {
  3324. t_Result = S_OK ;
  3325. a_Interface = a_ServerInterface ;
  3326. a_IsProxy = FALSE ;
  3327. }
  3328. else
  3329. {
  3330. if ( SUCCEEDED ( t_Result ) )
  3331. {
  3332. a_IsProxy = TRUE ;
  3333. a_Interface = ( IUnknown * ) a_Proxy ;
  3334. // Set cloaking on the proxy
  3335. // =========================
  3336. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  3337. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  3338. a_Interface ,
  3339. RPC_C_AUTHN_LEVEL_DEFAULT ,
  3340. t_ImpersonationLevel
  3341. ) ;
  3342. if ( FAILED ( t_Result ) )
  3343. {
  3344. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  3345. m_ProxyContainer ,
  3346. a_ProxyIndex ,
  3347. a_Proxy ,
  3348. a_Revert
  3349. ) ;
  3350. }
  3351. }
  3352. }
  3353. if ( FAILED ( t_Result ) && t_Result != WBEM_E_NOT_FOUND )
  3354. {
  3355. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  3356. }
  3357. }
  3358. }
  3359. }
  3360. }
  3361. return t_Result ;
  3362. }
  3363. /******************************************************************************
  3364. *
  3365. * Name:
  3366. *
  3367. *
  3368. * Description:
  3369. *
  3370. *
  3371. *****************************************************************************/
  3372. HRESULT CInterceptor_IWbemSyncProvider :: End_Interface_Events (
  3373. IUnknown *a_ServerInterface ,
  3374. REFIID a_InterfaceIdentifier ,
  3375. DWORD a_ProxyIndex ,
  3376. BOOL a_Impersonating ,
  3377. IUnknown *a_OldContext ,
  3378. IServerSecurity *a_OldSecurity ,
  3379. BOOL a_IsProxy ,
  3380. IUnknown *a_Interface ,
  3381. BOOL a_Revert ,
  3382. IUnknown *a_Proxy
  3383. )
  3384. {
  3385. CoRevertToSelf () ;
  3386. if ( a_Proxy )
  3387. {
  3388. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState (
  3389. m_ProxyContainer ,
  3390. a_ProxyIndex ,
  3391. a_Proxy ,
  3392. a_Revert
  3393. ) ;
  3394. }
  3395. ProviderSubSystem_Common_Globals :: EndImpersonation ( a_OldContext , a_OldSecurity , a_Impersonating ) ;
  3396. return S_OK ;
  3397. }
  3398. /******************************************************************************
  3399. *
  3400. * Name:
  3401. *
  3402. *
  3403. * Description:
  3404. *
  3405. *
  3406. *****************************************************************************/
  3407. HRESULT CInterceptor_IWbemSyncProvider::OpenNamespace (
  3408. const BSTR a_ObjectPath ,
  3409. long a_Flags ,
  3410. IWbemContext *a_Context ,
  3411. IWbemServices **a_NamespaceService ,
  3412. IWbemCallResult **a_CallResult
  3413. )
  3414. {
  3415. return WBEM_E_NOT_AVAILABLE ;
  3416. }
  3417. /******************************************************************************
  3418. *
  3419. * Name:
  3420. *
  3421. *
  3422. * Description:
  3423. *
  3424. *
  3425. *****************************************************************************/
  3426. HRESULT CInterceptor_IWbemSyncProvider :: CancelAsyncCall (
  3427. IWbemObjectSink *a_Sink
  3428. )
  3429. {
  3430. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3431. if ( m_Provider_IWbemServices )
  3432. {
  3433. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3434. Lock () ;
  3435. WmiStatusCode t_StatusCode = Find (
  3436. a_Sink ,
  3437. t_Iterator
  3438. ) ;
  3439. if ( t_StatusCode == e_StatusCode_Success )
  3440. {
  3441. ObjectSinkContainerElement *t_Element = t_Iterator.GetElement () ;
  3442. UnLock () ;
  3443. IWbemObjectSink *t_ObjectSink = NULL ;
  3444. t_Result = t_Element->QueryInterface ( IID_IWbemObjectSink , ( void ** ) & t_ObjectSink ) ;
  3445. if ( SUCCEEDED ( t_Result ) )
  3446. {
  3447. BOOL t_Impersonating ;
  3448. IUnknown *t_OldContext ;
  3449. IServerSecurity *t_OldSecurity ;
  3450. BOOL t_IsProxy ;
  3451. IWbemServices *t_Interface ;
  3452. BOOL t_Revert ;
  3453. IUnknown *t_Proxy ;
  3454. t_Result = Begin_IWbemServices (
  3455. t_Impersonating ,
  3456. t_OldContext ,
  3457. t_OldSecurity ,
  3458. t_IsProxy ,
  3459. t_Interface ,
  3460. t_Revert ,
  3461. t_Proxy
  3462. ) ;
  3463. if ( SUCCEEDED ( t_Result ) )
  3464. {
  3465. t_Result = t_Interface->CancelAsyncCall (
  3466. t_ObjectSink
  3467. ) ;
  3468. End_IWbemServices (
  3469. t_Impersonating ,
  3470. t_OldContext ,
  3471. t_OldSecurity ,
  3472. t_IsProxy ,
  3473. t_Interface ,
  3474. t_Revert ,
  3475. t_Proxy
  3476. ) ;
  3477. }
  3478. t_ObjectSink->Release () ;
  3479. }
  3480. IWbemShutdown *t_Shutdown = NULL ;
  3481. HRESULT t_TempResult = t_Element->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  3482. if ( SUCCEEDED ( t_TempResult ) )
  3483. {
  3484. t_TempResult = t_Shutdown->Shutdown (
  3485. 0 ,
  3486. 0 ,
  3487. NULL
  3488. ) ;
  3489. t_Shutdown->Release () ;
  3490. }
  3491. t_Element->Release () ;
  3492. }
  3493. else
  3494. {
  3495. UnLock () ;
  3496. t_Result = WBEM_E_NOT_FOUND ;
  3497. }
  3498. }
  3499. return t_Result ;
  3500. }
  3501. /******************************************************************************
  3502. *
  3503. * Name:
  3504. *
  3505. *
  3506. * Description:
  3507. *
  3508. *
  3509. *****************************************************************************/
  3510. HRESULT CInterceptor_IWbemSyncProvider :: QueryObjectSink (
  3511. long a_Flags ,
  3512. IWbemObjectSink **a_Sink
  3513. )
  3514. {
  3515. return WBEM_E_NOT_AVAILABLE ;
  3516. }
  3517. /******************************************************************************
  3518. *
  3519. * Name:
  3520. *
  3521. *
  3522. * Description:
  3523. *
  3524. *
  3525. *****************************************************************************/
  3526. HRESULT CInterceptor_IWbemSyncProvider :: GetObject (
  3527. const BSTR a_ObjectPath ,
  3528. long a_Flags ,
  3529. IWbemContext *a_Context ,
  3530. IWbemClassObject **a_Object ,
  3531. IWbemCallResult **a_CallResult
  3532. )
  3533. {
  3534. return WBEM_E_NOT_AVAILABLE ;
  3535. }
  3536. /******************************************************************************
  3537. *
  3538. * Name:
  3539. *
  3540. *
  3541. * Description:
  3542. *
  3543. *
  3544. *****************************************************************************/
  3545. HRESULT CInterceptor_IWbemSyncProvider :: Helper_GetObjectAsync (
  3546. BOOL a_IsProxy ,
  3547. const BSTR a_ObjectPath ,
  3548. long a_Flags ,
  3549. IWbemContext *a_Context ,
  3550. IWbemObjectSink *a_Sink ,
  3551. IWbemServices *a_Service
  3552. )
  3553. {
  3554. HRESULT t_Result = S_OK ;
  3555. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3556. IWbemContext *t_ContextCopy = NULL ;
  3557. if ( a_Context )
  3558. {
  3559. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  3560. AdjustGetContext ( t_ContextCopy ) ;
  3561. }
  3562. else
  3563. {
  3564. t_Result = S_OK ;
  3565. }
  3566. if ( SUCCEEDED ( t_Result ) )
  3567. {
  3568. ULONG t_Dependant = 1 ;
  3569. BSTR t_ObjectPath = SysAllocString ( a_ObjectPath ) ;
  3570. if ( t_ObjectPath )
  3571. {
  3572. CInterceptor_IWbemSyncObjectSink_GetObjectAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_GetObjectAsync (
  3573. m_Allocator ,
  3574. a_Flags ,
  3575. t_ObjectPath ,
  3576. this ,
  3577. a_Sink ,
  3578. ( IWbemServices * ) this ,
  3579. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3580. t_Dependant
  3581. ) ;
  3582. if ( t_Sink )
  3583. {
  3584. t_Sink->AddRef () ;
  3585. t_Result = t_Sink->SinkInitialize () ;
  3586. if ( SUCCEEDED ( t_Result ) )
  3587. {
  3588. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3589. Lock () ;
  3590. WmiStatusCode t_StatusCode = Insert (
  3591. *t_Sink ,
  3592. t_Iterator
  3593. ) ;
  3594. if ( t_StatusCode == e_StatusCode_Success )
  3595. {
  3596. UnLock () ;
  3597. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  3598. {
  3599. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  3600. }
  3601. if ( a_IsProxy )
  3602. {
  3603. t_Result = CoImpersonateClient () ;
  3604. }
  3605. else
  3606. {
  3607. t_Result = S_OK ;
  3608. }
  3609. if ( SUCCEEDED ( t_Result ) )
  3610. {
  3611. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  3612. {
  3613. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_GetObjectAsync () ;
  3614. }
  3615. Increment_ProviderOperation_GetObjectAsync () ;
  3616. try
  3617. {
  3618. t_Result = a_Service->GetObjectAsync (
  3619. t_ObjectPath ,
  3620. a_Flags ,
  3621. t_ContextCopy ,
  3622. t_Sink
  3623. ) ;
  3624. }
  3625. catch ( ... )
  3626. {
  3627. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3628. }
  3629. CoRevertToSelf () ;
  3630. }
  3631. else
  3632. {
  3633. t_Result = WBEM_E_ACCESS_DENIED ;
  3634. }
  3635. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  3636. {
  3637. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  3638. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  3639. {
  3640. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_GetObjectAsync () ;
  3641. }
  3642. Increment_ProviderOperation_GetObjectAsync () ;
  3643. if ( a_IsProxy )
  3644. {
  3645. t_Result = CoImpersonateClient () ;
  3646. }
  3647. else
  3648. {
  3649. t_Result = S_OK ;
  3650. }
  3651. if ( SUCCEEDED ( t_Result ) )
  3652. {
  3653. try
  3654. {
  3655. t_Result = a_Service->GetObjectAsync (
  3656. t_ObjectPath ,
  3657. a_Flags ,
  3658. t_ContextCopy ,
  3659. t_Sink
  3660. ) ;
  3661. }
  3662. catch ( ... )
  3663. {
  3664. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3665. }
  3666. CoRevertToSelf () ;
  3667. }
  3668. }
  3669. }
  3670. else
  3671. {
  3672. UnLock () ;
  3673. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3674. }
  3675. if ( FAILED ( t_Result ) )
  3676. {
  3677. HRESULT t_TempResult = SetStatus ( L"GetObjectAsync" , NULL , NULL , t_Result , t_Sink ) ;
  3678. }
  3679. }
  3680. t_Sink->Release () ;
  3681. }
  3682. else
  3683. {
  3684. SysFreeString ( t_ObjectPath ) ;
  3685. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3686. }
  3687. }
  3688. else
  3689. {
  3690. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3691. }
  3692. }
  3693. else
  3694. {
  3695. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3696. }
  3697. if ( t_ContextCopy )
  3698. {
  3699. t_ContextCopy->Release () ;
  3700. }
  3701. return t_Result ;
  3702. }
  3703. /******************************************************************************
  3704. *
  3705. * Name:
  3706. *
  3707. *
  3708. * Description:
  3709. *
  3710. *
  3711. *****************************************************************************/
  3712. HRESULT CInterceptor_IWbemSyncProvider :: Helper_HiPerfGetObjectAsync (
  3713. IWbemHiPerfProvider *a_HighPerformanceProvider ,
  3714. const BSTR a_ObjectPath ,
  3715. long a_Flags ,
  3716. IWbemContext *a_Context ,
  3717. IWbemObjectSink *a_Sink
  3718. )
  3719. {
  3720. IWbemClassObject *t_Instance = NULL ;
  3721. // Parse the path
  3722. // ==============
  3723. IWbemPath* pPathParser = NULL;
  3724. WCHAR* pwszClassName = NULL;
  3725. HRESULT t_Result = CoCreateInstance( CLSID_WbemDefPath, NULL, CLSCTX_INPROC_SERVER, IID_IWbemPath, (void**) &pPathParser );
  3726. if ( SUCCEEDED( t_Result ) )
  3727. {
  3728. t_Result = pPathParser->SetText( WBEMPATH_CREATE_ACCEPT_ALL, a_ObjectPath );
  3729. if ( SUCCEEDED( t_Result ) )
  3730. {
  3731. ULONG uLength = 0;
  3732. // Get the length of the name
  3733. t_Result = pPathParser->GetClassName( &uLength, NULL );
  3734. if ( SUCCEEDED( t_Result ) )
  3735. {
  3736. // Allocate memory and get it for real
  3737. uLength++;
  3738. pwszClassName = new WCHAR[uLength];
  3739. if ( NULL != pwszClassName )
  3740. {
  3741. t_Result = pPathParser->GetClassName( &uLength, pwszClassName );
  3742. }
  3743. else
  3744. {
  3745. t_Result = WBEM_E_OUT_OF_MEMORY;
  3746. }
  3747. } // IF Buffer too small
  3748. } // IF SetText
  3749. } // IF CoCreateInstance
  3750. // Cleanup the parser and any allocated memory
  3751. CReleaseMe rmPP( pPathParser );
  3752. CVectorDeleteMe<WCHAR> vdm( pwszClassName );
  3753. if ( FAILED( t_Result ) )
  3754. {
  3755. return t_Result;
  3756. }
  3757. // Get the class
  3758. // =============
  3759. IWbemClassObject* pClass = NULL;
  3760. // Must use a BSTR in case the call gets marshaled
  3761. BSTR bstrClass = SysAllocString( pwszClassName );
  3762. if ( NULL == bstrClass )
  3763. {
  3764. return WBEM_E_OUT_OF_MEMORY;
  3765. }
  3766. CSysFreeMe sfm( bstrClass );
  3767. // Note that WBEM_FLAG_USE_AMENDED_QUALIFIERS is a valid flag
  3768. t_Result = m_CoreStub->GetObject( bstrClass, 0L, NULL, &pClass, NULL);
  3769. CReleaseMe rmClass( pClass );
  3770. if(FAILED(t_Result))
  3771. {
  3772. return WBEM_E_INVALID_CLASS;
  3773. }
  3774. _IWmiObject* pWmiClass = NULL;
  3775. t_Result = pClass->QueryInterface( IID__IWmiObject, (void**) &pWmiClass );
  3776. CReleaseMe rmObj( pWmiClass );
  3777. // Get a Keyed instance and continue
  3778. if ( SUCCEEDED( t_Result ) )
  3779. {
  3780. _IWmiObject* pTempInst = NULL;
  3781. t_Result = pWmiClass->SpawnKeyedInstance( 0L, a_ObjectPath, &pTempInst );
  3782. CReleaseMe rmTempInst( pTempInst );
  3783. if ( SUCCEEDED( t_Result ) )
  3784. {
  3785. t_Result = pTempInst->QueryInterface( IID_IWbemClassObject, (void**) &t_Instance );
  3786. }
  3787. }
  3788. CReleaseMe rmInst( t_Instance );
  3789. if ( SUCCEEDED ( t_Result ) )
  3790. {
  3791. try
  3792. {
  3793. t_Result = a_HighPerformanceProvider->GetObjects (
  3794. m_CoreStub ,
  3795. 1 ,
  3796. ( IWbemObjectAccess ** ) & t_Instance ,
  3797. 0 ,
  3798. a_Context
  3799. ) ;
  3800. }
  3801. catch ( ... )
  3802. {
  3803. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3804. }
  3805. CoRevertToSelf () ;
  3806. if ( SUCCEEDED ( t_Result ) && t_Instance )
  3807. {
  3808. a_Sink->Indicate ( 1 , & t_Instance ) ;
  3809. }
  3810. else
  3811. {
  3812. if (
  3813. SUCCEEDED ( t_Result ) ||
  3814. t_Result == WBEM_E_PROVIDER_NOT_CAPABLE ||
  3815. t_Result == WBEM_E_METHOD_NOT_IMPLEMENTED ||
  3816. t_Result == E_NOTIMPL ||
  3817. t_Result == WBEM_E_NOT_SUPPORTED
  3818. )
  3819. {
  3820. IWbemRefresher *t_Refresher = NULL ;
  3821. try
  3822. {
  3823. t_Result = a_HighPerformanceProvider->CreateRefresher (
  3824. m_CoreStub ,
  3825. 0 ,
  3826. & t_Refresher
  3827. ) ;
  3828. }
  3829. catch ( ... )
  3830. {
  3831. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3832. }
  3833. CoRevertToSelf () ;
  3834. if ( SUCCEEDED ( t_Result ) )
  3835. {
  3836. IWbemObjectAccess *t_Object = NULL ;
  3837. long t_Id = 0 ;
  3838. try
  3839. {
  3840. t_Result = a_HighPerformanceProvider->CreateRefreshableObject (
  3841. m_CoreStub ,
  3842. ( IWbemObjectAccess * ) t_Instance ,
  3843. t_Refresher ,
  3844. 0,
  3845. a_Context ,
  3846. & t_Object,
  3847. & t_Id
  3848. ) ;
  3849. }
  3850. catch ( ... )
  3851. {
  3852. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3853. }
  3854. CoRevertToSelf () ;
  3855. if ( SUCCEEDED ( t_Result ) )
  3856. {
  3857. try
  3858. {
  3859. t_Result = t_Refresher->Refresh ( 0 ) ;
  3860. }
  3861. catch ( ... )
  3862. {
  3863. t_Result = WBEM_E_PROVIDER_FAILURE ;
  3864. }
  3865. CoRevertToSelf () ;
  3866. if ( SUCCEEDED( t_Result ) )
  3867. {
  3868. a_Sink->Indicate ( 1, ( IWbemClassObject ** ) & t_Object );
  3869. }
  3870. t_Object->Release () ;
  3871. }
  3872. t_Refresher->Release () ;
  3873. }
  3874. }
  3875. }
  3876. }
  3877. return t_Result ;
  3878. }
  3879. /******************************************************************************
  3880. *
  3881. * Name:
  3882. *
  3883. *
  3884. * Description:
  3885. *
  3886. *
  3887. *****************************************************************************/
  3888. HRESULT CInterceptor_IWbemSyncProvider :: GetObjectAsync (
  3889. const BSTR a_ObjectPath ,
  3890. long a_Flags ,
  3891. IWbemContext *a_Context ,
  3892. IWbemObjectSink *a_Sink
  3893. )
  3894. {
  3895. #if DBG
  3896. CheckThreadToken () ;
  3897. #endif
  3898. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  3899. if ( m_Provider_IWbemServices )
  3900. {
  3901. if ( m_Registration->GetInstanceProviderRegistration ().SupportsGet () || m_Registration->GetClassProviderRegistration ().SupportsGet () )
  3902. {
  3903. BOOL t_Impersonating ;
  3904. IUnknown *t_OldContext ;
  3905. IServerSecurity *t_OldSecurity ;
  3906. BOOL t_IsProxy ;
  3907. IWbemServices *t_Interface ;
  3908. BOOL t_Revert ;
  3909. IUnknown *t_Proxy ;
  3910. t_Result = Begin_IWbemServices (
  3911. t_Impersonating ,
  3912. t_OldContext ,
  3913. t_OldSecurity ,
  3914. t_IsProxy ,
  3915. t_Interface ,
  3916. t_Revert ,
  3917. t_Proxy
  3918. ) ;
  3919. if ( SUCCEEDED ( t_Result ) )
  3920. {
  3921. t_Result = Helper_GetObjectAsync (
  3922. t_IsProxy ,
  3923. a_ObjectPath ,
  3924. a_Flags ,
  3925. a_Context ,
  3926. a_Sink ,
  3927. t_Interface
  3928. ) ;
  3929. End_IWbemServices (
  3930. t_Impersonating ,
  3931. t_OldContext ,
  3932. t_OldSecurity ,
  3933. t_IsProxy ,
  3934. t_Interface ,
  3935. t_Revert ,
  3936. t_Proxy
  3937. ) ;
  3938. }
  3939. }
  3940. }
  3941. else
  3942. {
  3943. if ( m_Provider_IWbemHiPerfProvider )
  3944. {
  3945. t_Result = Helper_HiPerfGetObjectAsync (
  3946. m_Provider_IWbemHiPerfProvider ,
  3947. a_ObjectPath ,
  3948. a_Flags ,
  3949. a_Context ,
  3950. a_Sink
  3951. ) ;
  3952. // Send back the final status
  3953. a_Sink->SetStatus( WBEM_STATUS_COMPLETE, t_Result, NULL, NULL );
  3954. }
  3955. }
  3956. return t_Result ;
  3957. }
  3958. /******************************************************************************
  3959. *
  3960. * Name:
  3961. *
  3962. *
  3963. * Description:
  3964. *
  3965. *
  3966. *****************************************************************************/
  3967. HRESULT CInterceptor_IWbemSyncProvider :: PutClass (
  3968. IWbemClassObject *a_Object ,
  3969. long a_Flags ,
  3970. IWbemContext *a_Context ,
  3971. IWbemCallResult **a_CallResult
  3972. )
  3973. {
  3974. return WBEM_E_NOT_AVAILABLE ;
  3975. }
  3976. /******************************************************************************
  3977. *
  3978. * Name:
  3979. *
  3980. *
  3981. * Description:
  3982. *
  3983. *
  3984. *****************************************************************************/
  3985. HRESULT CInterceptor_IWbemSyncProvider :: Helper_PutClassAsync (
  3986. BOOL a_IsProxy ,
  3987. IWbemClassObject *a_Object ,
  3988. long a_Flags ,
  3989. IWbemContext FAR *a_Context ,
  3990. IWbemObjectSink *a_Sink ,
  3991. IWbemServices *a_Service
  3992. )
  3993. {
  3994. HRESULT t_Result = S_OK ;
  3995. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  3996. IWbemContext *t_ContextCopy = NULL ;
  3997. if ( a_Context )
  3998. {
  3999. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  4000. }
  4001. else
  4002. {
  4003. t_Result = S_OK ;
  4004. }
  4005. if ( SUCCEEDED ( t_Result ) )
  4006. {
  4007. ULONG t_Dependant = 1 ;
  4008. CInterceptor_IWbemSyncObjectSink_PutClassAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_PutClassAsync (
  4009. m_Allocator ,
  4010. a_Flags ,
  4011. a_Object ,
  4012. this ,
  4013. a_Sink ,
  4014. ( IWbemServices * ) this ,
  4015. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4016. t_Dependant
  4017. ) ;
  4018. if ( t_Sink )
  4019. {
  4020. t_Sink->AddRef () ;
  4021. t_Result = t_Sink->SinkInitialize () ;
  4022. if ( SUCCEEDED ( t_Result ) )
  4023. {
  4024. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4025. Lock () ;
  4026. WmiStatusCode t_StatusCode = Insert (
  4027. *t_Sink ,
  4028. t_Iterator
  4029. ) ;
  4030. if ( t_StatusCode == e_StatusCode_Success )
  4031. {
  4032. UnLock () ;
  4033. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4034. {
  4035. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4036. }
  4037. if ( a_IsProxy )
  4038. {
  4039. t_Result = CoImpersonateClient () ;
  4040. }
  4041. else
  4042. {
  4043. t_Result = S_OK ;
  4044. }
  4045. if ( SUCCEEDED ( t_Result ) )
  4046. {
  4047. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4048. {
  4049. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_PutClassAsync () ;
  4050. }
  4051. Increment_ProviderOperation_PutClassAsync () ;
  4052. try
  4053. {
  4054. t_Result = a_Service->PutClassAsync (
  4055. a_Object ,
  4056. a_Flags ,
  4057. t_ContextCopy ,
  4058. t_Sink
  4059. ) ;
  4060. }
  4061. catch ( ... )
  4062. {
  4063. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4064. }
  4065. CoRevertToSelf () ;
  4066. }
  4067. else
  4068. {
  4069. t_Result = WBEM_E_ACCESS_DENIED ;
  4070. }
  4071. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4072. {
  4073. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4074. if ( a_IsProxy )
  4075. {
  4076. t_Result = CoImpersonateClient () ;
  4077. }
  4078. else
  4079. {
  4080. t_Result = S_OK ;
  4081. }
  4082. if ( SUCCEEDED ( t_Result ) )
  4083. {
  4084. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4085. {
  4086. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_PutClassAsync () ;
  4087. }
  4088. Increment_ProviderOperation_PutClassAsync () ;
  4089. try
  4090. {
  4091. t_Result = a_Service->PutClassAsync (
  4092. a_Object ,
  4093. a_Flags ,
  4094. t_ContextCopy ,
  4095. t_Sink
  4096. ) ;
  4097. }
  4098. catch ( ... )
  4099. {
  4100. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4101. }
  4102. CoRevertToSelf () ;
  4103. }
  4104. else
  4105. {
  4106. t_Result = WBEM_E_ACCESS_DENIED ;
  4107. }
  4108. }
  4109. }
  4110. else
  4111. {
  4112. UnLock () ;
  4113. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4114. }
  4115. if ( FAILED ( t_Result ) )
  4116. {
  4117. HRESULT t_TempResult = SetStatus ( L"PutClassAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4118. }
  4119. }
  4120. t_Sink->Release () ;
  4121. }
  4122. else
  4123. {
  4124. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4125. }
  4126. }
  4127. else
  4128. {
  4129. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4130. }
  4131. if ( t_ContextCopy )
  4132. {
  4133. t_ContextCopy->Release () ;
  4134. }
  4135. return t_Result ;
  4136. }
  4137. /******************************************************************************
  4138. *
  4139. * Name:
  4140. *
  4141. *
  4142. * Description:
  4143. *
  4144. *
  4145. *****************************************************************************/
  4146. HRESULT CInterceptor_IWbemSyncProvider :: PutClassAsync (
  4147. IWbemClassObject *a_Object ,
  4148. long a_Flags ,
  4149. IWbemContext *a_Context ,
  4150. IWbemObjectSink *a_Sink
  4151. )
  4152. {
  4153. #if DBG
  4154. CheckThreadToken () ;
  4155. #endif
  4156. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4157. if ( m_Provider_IWbemServices )
  4158. {
  4159. if ( m_Registration->GetClassProviderRegistration ().SupportsPut () )
  4160. {
  4161. BOOL t_Impersonating ;
  4162. IUnknown *t_OldContext ;
  4163. IServerSecurity *t_OldSecurity ;
  4164. BOOL t_IsProxy ;
  4165. IWbemServices *t_Interface ;
  4166. BOOL t_Revert ;
  4167. IUnknown *t_Proxy ;
  4168. t_Result = Begin_IWbemServices (
  4169. t_Impersonating ,
  4170. t_OldContext ,
  4171. t_OldSecurity ,
  4172. t_IsProxy ,
  4173. t_Interface ,
  4174. t_Revert ,
  4175. t_Proxy
  4176. ) ;
  4177. if ( SUCCEEDED ( t_Result ) )
  4178. {
  4179. t_Result = Helper_PutClassAsync (
  4180. t_IsProxy ,
  4181. a_Object ,
  4182. a_Flags ,
  4183. a_Context ,
  4184. a_Sink ,
  4185. t_Interface
  4186. ) ;
  4187. End_IWbemServices (
  4188. t_Impersonating ,
  4189. t_OldContext ,
  4190. t_OldSecurity ,
  4191. t_IsProxy ,
  4192. t_Interface ,
  4193. t_Revert ,
  4194. t_Proxy
  4195. ) ;
  4196. }
  4197. }
  4198. }
  4199. return t_Result ;
  4200. }
  4201. /******************************************************************************
  4202. *
  4203. * Name:
  4204. *
  4205. *
  4206. * Description:
  4207. *
  4208. *
  4209. *****************************************************************************/
  4210. HRESULT CInterceptor_IWbemSyncProvider :: DeleteClass (
  4211. const BSTR a_Class ,
  4212. long a_Flags ,
  4213. IWbemContext *a_Context ,
  4214. IWbemCallResult **a_CallResult
  4215. )
  4216. {
  4217. return WBEM_E_NOT_AVAILABLE ;
  4218. }
  4219. /******************************************************************************
  4220. *
  4221. * Name:
  4222. *
  4223. *
  4224. * Description:
  4225. *
  4226. *
  4227. *****************************************************************************/
  4228. HRESULT CInterceptor_IWbemSyncProvider :: Helper_DeleteClassAsync (
  4229. BOOL a_IsProxy ,
  4230. const BSTR a_Class ,
  4231. long a_Flags ,
  4232. IWbemContext FAR *a_Context ,
  4233. IWbemObjectSink *a_Sink ,
  4234. IWbemServices *a_Service
  4235. )
  4236. {
  4237. HRESULT t_Result = S_OK ;
  4238. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  4239. IWbemContext *t_ContextCopy = NULL ;
  4240. if ( a_Context )
  4241. {
  4242. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  4243. }
  4244. else
  4245. {
  4246. t_Result = S_OK ;
  4247. }
  4248. if ( SUCCEEDED ( t_Result ) )
  4249. {
  4250. ULONG t_Dependant = 1 ;
  4251. BSTR t_Class = SysAllocString ( a_Class ) ;
  4252. if ( t_Class )
  4253. {
  4254. CInterceptor_IWbemSyncObjectSink_DeleteClassAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_DeleteClassAsync (
  4255. m_Allocator ,
  4256. a_Flags ,
  4257. t_Class ,
  4258. this ,
  4259. a_Sink ,
  4260. ( IWbemServices * ) this ,
  4261. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4262. t_Dependant
  4263. ) ;
  4264. if ( t_Sink )
  4265. {
  4266. t_Sink->AddRef () ;
  4267. t_Result = t_Sink->SinkInitialize () ;
  4268. if ( SUCCEEDED ( t_Result ) )
  4269. {
  4270. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4271. Lock () ;
  4272. WmiStatusCode t_StatusCode = Insert (
  4273. *t_Sink ,
  4274. t_Iterator
  4275. ) ;
  4276. if ( t_StatusCode == e_StatusCode_Success )
  4277. {
  4278. UnLock () ;
  4279. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4280. {
  4281. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4282. }
  4283. if ( a_IsProxy )
  4284. {
  4285. t_Result = CoImpersonateClient () ;
  4286. }
  4287. else
  4288. {
  4289. t_Result = S_OK ;
  4290. }
  4291. if ( SUCCEEDED ( t_Result ) )
  4292. {
  4293. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4294. {
  4295. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_DeleteClassAsync () ;
  4296. }
  4297. Increment_ProviderOperation_DeleteClassAsync () ;
  4298. try
  4299. {
  4300. t_Result = a_Service->DeleteClassAsync (
  4301. t_Class ,
  4302. a_Flags ,
  4303. t_ContextCopy ,
  4304. t_Sink
  4305. ) ;
  4306. }
  4307. catch ( ... )
  4308. {
  4309. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4310. }
  4311. CoRevertToSelf () ;
  4312. }
  4313. else
  4314. {
  4315. t_Result = WBEM_E_ACCESS_DENIED ;
  4316. }
  4317. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4318. {
  4319. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4320. if ( a_IsProxy )
  4321. {
  4322. t_Result = CoImpersonateClient () ;
  4323. }
  4324. else
  4325. {
  4326. t_Result = S_OK ;
  4327. }
  4328. if ( SUCCEEDED ( t_Result ) )
  4329. {
  4330. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4331. {
  4332. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_DeleteClassAsync () ;
  4333. }
  4334. Increment_ProviderOperation_DeleteClassAsync () ;
  4335. try
  4336. {
  4337. t_Result = a_Service->DeleteClassAsync (
  4338. t_Class ,
  4339. a_Flags ,
  4340. t_ContextCopy ,
  4341. t_Sink
  4342. ) ;
  4343. }
  4344. catch ( ... )
  4345. {
  4346. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4347. }
  4348. CoRevertToSelf () ;
  4349. }
  4350. else
  4351. {
  4352. t_Result = WBEM_E_ACCESS_DENIED ;
  4353. }
  4354. }
  4355. }
  4356. else
  4357. {
  4358. UnLock () ;
  4359. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4360. }
  4361. if ( FAILED ( t_Result ) )
  4362. {
  4363. HRESULT t_TempResult = SetStatus ( L"DeleteClassAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4364. }
  4365. }
  4366. t_Sink->Release () ;
  4367. }
  4368. else
  4369. {
  4370. SysFreeString ( t_Class ) ;
  4371. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4372. }
  4373. }
  4374. else
  4375. {
  4376. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4377. }
  4378. }
  4379. else
  4380. {
  4381. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4382. }
  4383. if ( t_ContextCopy )
  4384. {
  4385. t_ContextCopy->Release () ;
  4386. }
  4387. return t_Result ;
  4388. }
  4389. /******************************************************************************
  4390. *
  4391. * Name:
  4392. *
  4393. *
  4394. * Description:
  4395. *
  4396. *
  4397. *****************************************************************************/
  4398. HRESULT CInterceptor_IWbemSyncProvider :: DeleteClassAsync (
  4399. const BSTR a_Class ,
  4400. long a_Flags ,
  4401. IWbemContext *a_Context ,
  4402. IWbemObjectSink *a_Sink
  4403. )
  4404. {
  4405. #if DBG
  4406. CheckThreadToken () ;
  4407. #endif
  4408. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4409. if ( m_Provider_IWbemServices )
  4410. {
  4411. if ( m_Registration->GetClassProviderRegistration ().SupportsDelete () )
  4412. {
  4413. BOOL t_Impersonating ;
  4414. IUnknown *t_OldContext ;
  4415. IServerSecurity *t_OldSecurity ;
  4416. BOOL t_IsProxy ;
  4417. IWbemServices *t_Interface ;
  4418. BOOL t_Revert ;
  4419. IUnknown *t_Proxy ;
  4420. t_Result = Begin_IWbemServices (
  4421. t_Impersonating ,
  4422. t_OldContext ,
  4423. t_OldSecurity ,
  4424. t_IsProxy ,
  4425. t_Interface ,
  4426. t_Revert ,
  4427. t_Proxy
  4428. ) ;
  4429. if ( SUCCEEDED ( t_Result ) )
  4430. {
  4431. t_Result = Helper_DeleteClassAsync (
  4432. t_IsProxy ,
  4433. a_Class ,
  4434. a_Flags ,
  4435. a_Context ,
  4436. a_Sink ,
  4437. t_Interface
  4438. ) ;
  4439. End_IWbemServices (
  4440. t_Impersonating ,
  4441. t_OldContext ,
  4442. t_OldSecurity ,
  4443. t_IsProxy ,
  4444. t_Interface ,
  4445. t_Revert ,
  4446. t_Proxy
  4447. ) ;
  4448. }
  4449. }
  4450. }
  4451. return t_Result ;
  4452. }
  4453. /******************************************************************************
  4454. *
  4455. * Name:
  4456. *
  4457. *
  4458. * Description:
  4459. *
  4460. *
  4461. *****************************************************************************/
  4462. HRESULT CInterceptor_IWbemSyncProvider :: CreateClassEnum (
  4463. const BSTR a_Superclass ,
  4464. long a_Flags,
  4465. IWbemContext *a_Context ,
  4466. IEnumWbemClassObject **a_Enum
  4467. )
  4468. {
  4469. return WBEM_E_NOT_AVAILABLE ;
  4470. }
  4471. /******************************************************************************
  4472. *
  4473. * Name:
  4474. *
  4475. *
  4476. * Description:
  4477. *
  4478. *
  4479. *****************************************************************************/
  4480. HRESULT CInterceptor_IWbemSyncProvider :: Helper_CreateClassEnumAsync (
  4481. BOOL a_IsProxy ,
  4482. const BSTR a_SuperClass ,
  4483. long a_Flags ,
  4484. IWbemContext FAR *a_Context ,
  4485. IWbemObjectSink *a_Sink ,
  4486. IWbemServices *a_Service
  4487. )
  4488. {
  4489. HRESULT t_Result = S_OK ;
  4490. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  4491. IWbemContext *t_ContextCopy = NULL ;
  4492. if ( a_Context )
  4493. {
  4494. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  4495. }
  4496. else
  4497. {
  4498. t_Result = S_OK ;
  4499. }
  4500. if ( SUCCEEDED ( t_Result ) )
  4501. {
  4502. ULONG t_Dependant = 1 ;
  4503. BSTR t_SuperClass = SysAllocString ( a_SuperClass ) ;
  4504. if ( t_SuperClass )
  4505. {
  4506. CInterceptor_IWbemSyncObjectSink_CreateClassEnumAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_CreateClassEnumAsync (
  4507. m_Allocator ,
  4508. a_Flags ,
  4509. t_SuperClass ,
  4510. this ,
  4511. a_Sink ,
  4512. ( IWbemServices * ) this ,
  4513. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4514. t_Dependant
  4515. ) ;
  4516. if ( t_Sink )
  4517. {
  4518. t_Sink->AddRef () ;
  4519. t_Result = t_Sink->SinkInitialize () ;
  4520. if ( SUCCEEDED ( t_Result ) )
  4521. {
  4522. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4523. Lock () ;
  4524. WmiStatusCode t_StatusCode = Insert (
  4525. *t_Sink ,
  4526. t_Iterator
  4527. ) ;
  4528. if ( t_StatusCode == e_StatusCode_Success )
  4529. {
  4530. UnLock () ;
  4531. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4532. {
  4533. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4534. }
  4535. if ( a_IsProxy )
  4536. {
  4537. t_Result = CoImpersonateClient () ;
  4538. }
  4539. else
  4540. {
  4541. t_Result = S_OK ;
  4542. }
  4543. if ( SUCCEEDED ( t_Result ) )
  4544. {
  4545. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4546. {
  4547. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateClassEnumAsync () ;
  4548. }
  4549. Increment_ProviderOperation_CreateClassEnumAsync () ;
  4550. try
  4551. {
  4552. t_Result = a_Service->CreateClassEnumAsync (
  4553. t_SuperClass ,
  4554. a_Flags ,
  4555. t_ContextCopy ,
  4556. t_Sink
  4557. ) ;
  4558. }
  4559. catch ( ... )
  4560. {
  4561. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4562. }
  4563. CoRevertToSelf () ;
  4564. }
  4565. else
  4566. {
  4567. t_Result = WBEM_E_ACCESS_DENIED ;
  4568. }
  4569. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4570. {
  4571. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4572. if ( a_IsProxy )
  4573. {
  4574. t_Result = CoImpersonateClient () ;
  4575. }
  4576. else
  4577. {
  4578. t_Result = S_OK ;
  4579. }
  4580. if ( SUCCEEDED ( t_Result ) )
  4581. {
  4582. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4583. {
  4584. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateClassEnumAsync () ;
  4585. }
  4586. Increment_ProviderOperation_CreateClassEnumAsync () ;
  4587. try
  4588. {
  4589. t_Result = a_Service->CreateClassEnumAsync (
  4590. t_SuperClass ,
  4591. a_Flags ,
  4592. t_ContextCopy ,
  4593. t_Sink
  4594. ) ;
  4595. }
  4596. catch ( ... )
  4597. {
  4598. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4599. }
  4600. CoRevertToSelf () ;
  4601. }
  4602. else
  4603. {
  4604. t_Result = WBEM_E_ACCESS_DENIED ;
  4605. }
  4606. }
  4607. }
  4608. else
  4609. {
  4610. UnLock () ;
  4611. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4612. }
  4613. if ( FAILED ( t_Result ) )
  4614. {
  4615. HRESULT t_TempResult = SetStatus ( L"CreateClassEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4616. }
  4617. }
  4618. t_Sink->Release () ;
  4619. }
  4620. else
  4621. {
  4622. SysFreeString ( t_SuperClass ) ;
  4623. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4624. }
  4625. }
  4626. else
  4627. {
  4628. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4629. }
  4630. }
  4631. else
  4632. {
  4633. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4634. }
  4635. if ( t_ContextCopy )
  4636. {
  4637. t_ContextCopy->Release () ;
  4638. }
  4639. return t_Result ;
  4640. }
  4641. /******************************************************************************
  4642. *
  4643. * Name:
  4644. *
  4645. *
  4646. * Description:
  4647. *
  4648. *
  4649. *****************************************************************************/
  4650. HRESULT CInterceptor_IWbemSyncProvider :: CreateClassEnumAsync (
  4651. const BSTR a_SuperClass ,
  4652. long a_Flags ,
  4653. IWbemContext *a_Context ,
  4654. IWbemObjectSink *a_Sink
  4655. )
  4656. {
  4657. #if DBG
  4658. CheckThreadToken () ;
  4659. #endif
  4660. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4661. if ( m_Provider_IWbemServices )
  4662. {
  4663. if ( m_Registration->GetClassProviderRegistration ().SupportsEnumeration () )
  4664. {
  4665. BOOL t_Impersonating ;
  4666. IUnknown *t_OldContext ;
  4667. IServerSecurity *t_OldSecurity ;
  4668. BOOL t_IsProxy ;
  4669. IWbemServices *t_Interface ;
  4670. BOOL t_Revert ;
  4671. IUnknown *t_Proxy ;
  4672. t_Result = Begin_IWbemServices (
  4673. t_Impersonating ,
  4674. t_OldContext ,
  4675. t_OldSecurity ,
  4676. t_IsProxy ,
  4677. t_Interface ,
  4678. t_Revert ,
  4679. t_Proxy
  4680. ) ;
  4681. if ( SUCCEEDED ( t_Result ) )
  4682. {
  4683. t_Result = Helper_CreateClassEnumAsync (
  4684. t_IsProxy ,
  4685. a_SuperClass ,
  4686. a_Flags ,
  4687. a_Context ,
  4688. a_Sink ,
  4689. t_Interface
  4690. ) ;
  4691. End_IWbemServices (
  4692. t_Impersonating ,
  4693. t_OldContext ,
  4694. t_OldSecurity ,
  4695. t_IsProxy ,
  4696. t_Interface ,
  4697. t_Revert ,
  4698. t_Proxy
  4699. ) ;
  4700. }
  4701. }
  4702. }
  4703. return t_Result ;
  4704. }
  4705. /******************************************************************************
  4706. *
  4707. * Name:
  4708. *
  4709. *
  4710. * Description:
  4711. *
  4712. *
  4713. *****************************************************************************/
  4714. HRESULT CInterceptor_IWbemSyncProvider :: PutInstance (
  4715. IWbemClassObject *a_Instance ,
  4716. long a_Flags ,
  4717. IWbemContext *a_Context ,
  4718. IWbemCallResult **a_CallResult
  4719. )
  4720. {
  4721. return WBEM_E_NOT_AVAILABLE ;
  4722. }
  4723. /******************************************************************************
  4724. *
  4725. * Name:
  4726. *
  4727. *
  4728. * Description:
  4729. *
  4730. *
  4731. *****************************************************************************/
  4732. HRESULT CInterceptor_IWbemSyncProvider :: Helper_PutInstanceAsync (
  4733. BOOL a_IsProxy ,
  4734. IWbemClassObject *a_Instance ,
  4735. long a_Flags ,
  4736. IWbemContext FAR *a_Context ,
  4737. IWbemObjectSink *a_Sink ,
  4738. IWbemServices *a_Service
  4739. )
  4740. {
  4741. HRESULT t_Result = S_OK ;
  4742. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  4743. IWbemContext *t_ContextCopy = NULL ;
  4744. if ( a_Context )
  4745. {
  4746. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  4747. }
  4748. else
  4749. {
  4750. t_Result = S_OK ;
  4751. }
  4752. if ( SUCCEEDED ( t_Result ) )
  4753. {
  4754. ULONG t_Dependant = 1 ;
  4755. CInterceptor_IWbemSyncObjectSink_PutInstanceAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_PutInstanceAsync (
  4756. m_Allocator ,
  4757. a_Flags ,
  4758. a_Instance ,
  4759. this ,
  4760. a_Sink ,
  4761. ( IWbemServices * ) this ,
  4762. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4763. t_Dependant
  4764. ) ;
  4765. if ( t_Sink )
  4766. {
  4767. t_Sink->AddRef () ;
  4768. t_Result = t_Sink->SinkInitialize () ;
  4769. if ( SUCCEEDED ( t_Result ) )
  4770. {
  4771. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4772. Lock () ;
  4773. WmiStatusCode t_StatusCode = Insert (
  4774. *t_Sink ,
  4775. t_Iterator
  4776. ) ;
  4777. if ( t_StatusCode == e_StatusCode_Success )
  4778. {
  4779. UnLock () ;
  4780. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  4781. {
  4782. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  4783. }
  4784. if ( a_IsProxy )
  4785. {
  4786. t_Result = CoImpersonateClient () ;
  4787. }
  4788. else
  4789. {
  4790. t_Result = S_OK ;
  4791. }
  4792. if ( SUCCEEDED ( t_Result ) )
  4793. {
  4794. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4795. {
  4796. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_PutInstanceAsync () ;
  4797. }
  4798. Increment_ProviderOperation_PutInstanceAsync () ;
  4799. try
  4800. {
  4801. t_Result = a_Service->PutInstanceAsync (
  4802. a_Instance ,
  4803. a_Flags ,
  4804. t_ContextCopy ,
  4805. t_Sink
  4806. ) ;
  4807. }
  4808. catch ( ... )
  4809. {
  4810. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4811. }
  4812. CoRevertToSelf () ;
  4813. }
  4814. else
  4815. {
  4816. t_Result = WBEM_E_ACCESS_DENIED ;
  4817. }
  4818. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  4819. {
  4820. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  4821. if ( a_IsProxy )
  4822. {
  4823. t_Result = CoImpersonateClient () ;
  4824. }
  4825. else
  4826. {
  4827. t_Result = S_OK ;
  4828. }
  4829. if ( SUCCEEDED ( t_Result ) )
  4830. {
  4831. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  4832. {
  4833. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_PutInstanceAsync () ;
  4834. }
  4835. Increment_ProviderOperation_PutInstanceAsync () ;
  4836. try
  4837. {
  4838. t_Result = a_Service->PutInstanceAsync (
  4839. a_Instance ,
  4840. a_Flags ,
  4841. t_ContextCopy ,
  4842. t_Sink
  4843. ) ;
  4844. }
  4845. catch ( ... )
  4846. {
  4847. t_Result = WBEM_E_PROVIDER_FAILURE ;
  4848. }
  4849. CoRevertToSelf () ;
  4850. }
  4851. else
  4852. {
  4853. t_Result = WBEM_E_ACCESS_DENIED ;
  4854. }
  4855. }
  4856. }
  4857. else
  4858. {
  4859. UnLock () ;
  4860. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4861. }
  4862. if ( FAILED ( t_Result ) )
  4863. {
  4864. HRESULT t_TempResult = SetStatus ( L"PutInstanceAsync" , NULL , NULL , t_Result , t_Sink ) ;
  4865. }
  4866. }
  4867. t_Sink->Release () ;
  4868. }
  4869. else
  4870. {
  4871. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4872. }
  4873. }
  4874. else
  4875. {
  4876. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4877. }
  4878. if ( t_ContextCopy )
  4879. {
  4880. t_ContextCopy->Release () ;
  4881. }
  4882. return t_Result ;
  4883. }
  4884. /******************************************************************************
  4885. *
  4886. * Name:
  4887. *
  4888. *
  4889. * Description:
  4890. *
  4891. *
  4892. *****************************************************************************/
  4893. HRESULT CInterceptor_IWbemSyncProvider :: PutInstanceAsync (
  4894. IWbemClassObject *a_Instance ,
  4895. long a_Flags ,
  4896. IWbemContext *a_Context ,
  4897. IWbemObjectSink *a_Sink
  4898. )
  4899. {
  4900. #if DBG
  4901. CheckThreadToken () ;
  4902. #endif
  4903. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  4904. if ( m_Provider_IWbemServices )
  4905. {
  4906. if ( m_Registration->GetInstanceProviderRegistration ().SupportsPut () )
  4907. {
  4908. BOOL t_Impersonating ;
  4909. IUnknown *t_OldContext ;
  4910. IServerSecurity *t_OldSecurity ;
  4911. BOOL t_IsProxy ;
  4912. IWbemServices *t_Interface ;
  4913. BOOL t_Revert ;
  4914. IUnknown *t_Proxy ;
  4915. t_Result = Begin_IWbemServices (
  4916. t_Impersonating ,
  4917. t_OldContext ,
  4918. t_OldSecurity ,
  4919. t_IsProxy ,
  4920. t_Interface ,
  4921. t_Revert ,
  4922. t_Proxy
  4923. ) ;
  4924. if ( SUCCEEDED ( t_Result ) )
  4925. {
  4926. t_Result = Helper_PutInstanceAsync (
  4927. t_IsProxy ,
  4928. a_Instance ,
  4929. a_Flags ,
  4930. a_Context ,
  4931. a_Sink ,
  4932. t_Interface
  4933. ) ;
  4934. End_IWbemServices (
  4935. t_Impersonating ,
  4936. t_OldContext ,
  4937. t_OldSecurity ,
  4938. t_IsProxy ,
  4939. t_Interface ,
  4940. t_Revert ,
  4941. t_Proxy
  4942. ) ;
  4943. }
  4944. }
  4945. }
  4946. return t_Result ;
  4947. }
  4948. /******************************************************************************
  4949. *
  4950. * Name:
  4951. *
  4952. *
  4953. * Description:
  4954. *
  4955. *
  4956. *****************************************************************************/
  4957. HRESULT CInterceptor_IWbemSyncProvider :: DeleteInstance (
  4958. const BSTR a_ObjectPath ,
  4959. long a_Flags ,
  4960. IWbemContext *a_Context ,
  4961. IWbemCallResult **a_CallResult
  4962. )
  4963. {
  4964. return WBEM_E_NOT_AVAILABLE ;
  4965. }
  4966. /******************************************************************************
  4967. *
  4968. * Name:
  4969. *
  4970. *
  4971. * Description:
  4972. *
  4973. *
  4974. *****************************************************************************/
  4975. HRESULT CInterceptor_IWbemSyncProvider :: Helper_DeleteInstanceAsync (
  4976. BOOL a_IsProxy ,
  4977. const BSTR a_ObjectPath ,
  4978. long a_Flags ,
  4979. IWbemContext FAR *a_Context ,
  4980. IWbemObjectSink *a_Sink ,
  4981. IWbemServices *a_Service
  4982. )
  4983. {
  4984. HRESULT t_Result = S_OK ;
  4985. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  4986. IWbemContext *t_ContextCopy = NULL ;
  4987. if ( a_Context )
  4988. {
  4989. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  4990. }
  4991. else
  4992. {
  4993. t_Result = S_OK ;
  4994. }
  4995. if ( SUCCEEDED ( t_Result ) )
  4996. {
  4997. ULONG t_Dependant = 1 ;
  4998. BSTR t_ObjectPath = SysAllocString ( a_ObjectPath ) ;
  4999. if ( t_ObjectPath )
  5000. {
  5001. CInterceptor_IWbemSyncObjectSink_DeleteInstanceAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_DeleteInstanceAsync (
  5002. m_Allocator ,
  5003. a_Flags ,
  5004. t_ObjectPath ,
  5005. this ,
  5006. a_Sink ,
  5007. ( IWbemServices * ) this ,
  5008. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  5009. t_Dependant
  5010. ) ;
  5011. if ( t_Sink )
  5012. {
  5013. t_Sink->AddRef () ;
  5014. t_Result = t_Sink->SinkInitialize () ;
  5015. if ( SUCCEEDED ( t_Result ) )
  5016. {
  5017. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  5018. Lock () ;
  5019. WmiStatusCode t_StatusCode = Insert (
  5020. *t_Sink ,
  5021. t_Iterator
  5022. ) ;
  5023. if ( t_StatusCode == e_StatusCode_Success )
  5024. {
  5025. UnLock () ;
  5026. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  5027. {
  5028. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  5029. }
  5030. if ( a_IsProxy )
  5031. {
  5032. t_Result = CoImpersonateClient () ;
  5033. }
  5034. else
  5035. {
  5036. t_Result = S_OK ;
  5037. }
  5038. if ( SUCCEEDED ( t_Result ) )
  5039. {
  5040. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5041. {
  5042. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_DeleteInstanceAsync () ;
  5043. }
  5044. Increment_ProviderOperation_DeleteInstanceAsync () ;
  5045. try
  5046. {
  5047. t_Result = a_Service->DeleteInstanceAsync (
  5048. t_ObjectPath ,
  5049. a_Flags ,
  5050. t_ContextCopy ,
  5051. t_Sink
  5052. ) ;
  5053. }
  5054. catch ( ... )
  5055. {
  5056. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5057. }
  5058. CoRevertToSelf () ;
  5059. }
  5060. else
  5061. {
  5062. t_Result = WBEM_E_ACCESS_DENIED ;
  5063. }
  5064. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  5065. {
  5066. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  5067. if ( a_IsProxy )
  5068. {
  5069. t_Result = CoImpersonateClient () ;
  5070. }
  5071. else
  5072. {
  5073. t_Result = S_OK ;
  5074. }
  5075. if ( SUCCEEDED ( t_Result ) )
  5076. {
  5077. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5078. {
  5079. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_DeleteInstanceAsync () ;
  5080. }
  5081. Increment_ProviderOperation_DeleteInstanceAsync () ;
  5082. try
  5083. {
  5084. t_Result = a_Service->DeleteInstanceAsync (
  5085. t_ObjectPath ,
  5086. a_Flags ,
  5087. t_ContextCopy ,
  5088. t_Sink
  5089. ) ;
  5090. }
  5091. catch ( ... )
  5092. {
  5093. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5094. }
  5095. CoRevertToSelf () ;
  5096. }
  5097. else
  5098. {
  5099. t_Result = WBEM_E_ACCESS_DENIED ;
  5100. }
  5101. }
  5102. }
  5103. else
  5104. {
  5105. UnLock () ;
  5106. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5107. }
  5108. if ( FAILED ( t_Result ) )
  5109. {
  5110. HRESULT t_TempResult = SetStatus ( L"DeleteInstanceAsync" , NULL , NULL , t_Result , t_Sink ) ;
  5111. }
  5112. }
  5113. t_Sink->Release () ;
  5114. }
  5115. else
  5116. {
  5117. SysFreeString ( t_ObjectPath ) ;
  5118. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5119. }
  5120. }
  5121. else
  5122. {
  5123. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5124. }
  5125. }
  5126. else
  5127. {
  5128. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5129. }
  5130. if ( t_ContextCopy )
  5131. {
  5132. t_ContextCopy->Release () ;
  5133. }
  5134. return t_Result ;
  5135. }
  5136. /******************************************************************************
  5137. *
  5138. * Name:
  5139. *
  5140. *
  5141. * Description:
  5142. *
  5143. *
  5144. *****************************************************************************/
  5145. HRESULT CInterceptor_IWbemSyncProvider :: DeleteInstanceAsync (
  5146. const BSTR a_ObjectPath ,
  5147. long a_Flags ,
  5148. IWbemContext *a_Context ,
  5149. IWbemObjectSink *a_Sink
  5150. )
  5151. {
  5152. #if DBG
  5153. CheckThreadToken () ;
  5154. #endif
  5155. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  5156. if ( m_Provider_IWbemServices )
  5157. {
  5158. if ( m_Registration->GetInstanceProviderRegistration ().SupportsDelete () )
  5159. {
  5160. BOOL t_Impersonating ;
  5161. IUnknown *t_OldContext ;
  5162. IServerSecurity *t_OldSecurity ;
  5163. BOOL t_IsProxy ;
  5164. IWbemServices *t_Interface ;
  5165. BOOL t_Revert ;
  5166. IUnknown *t_Proxy ;
  5167. t_Result = Begin_IWbemServices (
  5168. t_Impersonating ,
  5169. t_OldContext ,
  5170. t_OldSecurity ,
  5171. t_IsProxy ,
  5172. t_Interface ,
  5173. t_Revert ,
  5174. t_Proxy
  5175. ) ;
  5176. if ( SUCCEEDED ( t_Result ) )
  5177. {
  5178. t_Result = Helper_DeleteInstanceAsync (
  5179. t_IsProxy ,
  5180. a_ObjectPath ,
  5181. a_Flags ,
  5182. a_Context ,
  5183. a_Sink ,
  5184. t_Interface
  5185. ) ;
  5186. End_IWbemServices (
  5187. t_Impersonating ,
  5188. t_OldContext ,
  5189. t_OldSecurity ,
  5190. t_IsProxy ,
  5191. t_Interface ,
  5192. t_Revert ,
  5193. t_Proxy
  5194. ) ;
  5195. }
  5196. }
  5197. }
  5198. return t_Result ;
  5199. }
  5200. /******************************************************************************
  5201. *
  5202. * Name:
  5203. *
  5204. *
  5205. * Description:
  5206. *
  5207. *
  5208. *****************************************************************************/
  5209. HRESULT CInterceptor_IWbemSyncProvider :: CreateInstanceEnum (
  5210. const BSTR a_Class ,
  5211. long a_Flags ,
  5212. IWbemContext *a_Context ,
  5213. IEnumWbemClassObject **a_Enum
  5214. )
  5215. {
  5216. return WBEM_E_NOT_AVAILABLE ;
  5217. }
  5218. /******************************************************************************
  5219. *
  5220. * Name:
  5221. *
  5222. *
  5223. * Description:
  5224. *
  5225. *
  5226. *****************************************************************************/
  5227. HRESULT CInterceptor_IWbemSyncProvider :: Helper_CreateInstanceEnumAsync (
  5228. BOOL a_IsProxy ,
  5229. const BSTR a_Class ,
  5230. long a_Flags ,
  5231. IWbemContext *a_Context ,
  5232. IWbemObjectSink *a_Sink ,
  5233. IWbemServices *a_Service
  5234. )
  5235. {
  5236. HRESULT t_Result = S_OK ;
  5237. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  5238. IWbemContext *t_ContextCopy = NULL ;
  5239. if ( a_Context )
  5240. {
  5241. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  5242. AdjustGetContext ( t_ContextCopy ) ;
  5243. }
  5244. else
  5245. {
  5246. t_Result = S_OK ;
  5247. }
  5248. if ( SUCCEEDED ( t_Result ) )
  5249. {
  5250. ULONG t_Dependant = 1 ;
  5251. BSTR t_Class = SysAllocString ( a_Class ) ;
  5252. if ( t_Class )
  5253. {
  5254. CInterceptor_IWbemSyncObjectSink_CreateInstanceEnumAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_CreateInstanceEnumAsync (
  5255. m_Allocator ,
  5256. a_Flags ,
  5257. t_Class ,
  5258. this ,
  5259. a_Sink ,
  5260. ( IWbemServices * ) this ,
  5261. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  5262. t_Dependant
  5263. ) ;
  5264. if ( t_Sink )
  5265. {
  5266. t_Sink->AddRef () ;
  5267. t_Result = t_Sink->SinkInitialize () ;
  5268. if ( SUCCEEDED ( t_Result ) )
  5269. {
  5270. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  5271. Lock () ;
  5272. WmiStatusCode t_StatusCode = Insert (
  5273. *t_Sink ,
  5274. t_Iterator
  5275. ) ;
  5276. if ( t_StatusCode == e_StatusCode_Success )
  5277. {
  5278. UnLock () ;
  5279. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  5280. {
  5281. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  5282. }
  5283. if ( a_IsProxy )
  5284. {
  5285. t_Result = CoImpersonateClient () ;
  5286. }
  5287. else
  5288. {
  5289. t_Result = S_OK ;
  5290. }
  5291. if ( SUCCEEDED ( t_Result ) )
  5292. {
  5293. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5294. {
  5295. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5296. }
  5297. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5298. try
  5299. {
  5300. t_Result = a_Service->CreateInstanceEnumAsync (
  5301. t_Class ,
  5302. a_Flags ,
  5303. t_ContextCopy ,
  5304. t_Sink
  5305. ) ;
  5306. #if DBG
  5307. CheckThreadToken () ;
  5308. #endif
  5309. }
  5310. catch ( ... )
  5311. {
  5312. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5313. }
  5314. CoRevertToSelf () ;
  5315. }
  5316. else
  5317. {
  5318. t_Result = WBEM_E_ACCESS_DENIED ;
  5319. }
  5320. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  5321. {
  5322. if ( a_IsProxy )
  5323. {
  5324. t_Result = CoImpersonateClient () ;
  5325. }
  5326. else
  5327. {
  5328. t_Result = S_OK ;
  5329. }
  5330. if ( SUCCEEDED ( t_Result ) )
  5331. {
  5332. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  5333. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5334. {
  5335. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5336. }
  5337. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5338. try
  5339. {
  5340. t_Result = a_Service->CreateInstanceEnumAsync (
  5341. t_Class ,
  5342. a_Flags ,
  5343. t_ContextCopy ,
  5344. t_Sink
  5345. ) ;
  5346. }
  5347. catch ( ... )
  5348. {
  5349. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5350. }
  5351. CoRevertToSelf () ;
  5352. }
  5353. }
  5354. }
  5355. else
  5356. {
  5357. UnLock () ;
  5358. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5359. }
  5360. }
  5361. if ( FAILED ( t_Result ) )
  5362. {
  5363. HRESULT t_TempResult = SetStatus ( L"CreateInstanceEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  5364. }
  5365. t_Sink->Release () ;
  5366. }
  5367. else
  5368. {
  5369. SysFreeString ( t_Class ) ;
  5370. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5371. }
  5372. }
  5373. else
  5374. {
  5375. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5376. }
  5377. }
  5378. else
  5379. {
  5380. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5381. }
  5382. if ( t_ContextCopy )
  5383. {
  5384. t_ContextCopy->Release () ;
  5385. }
  5386. return t_Result ;
  5387. }
  5388. /******************************************************************************
  5389. *
  5390. * Name:
  5391. *
  5392. *
  5393. * Description:
  5394. *
  5395. *
  5396. *****************************************************************************/
  5397. HRESULT CInterceptor_IWbemSyncProvider :: Helper_QueryInstancesAsync (
  5398. IWbemHiPerfProvider *a_PerformanceProvider ,
  5399. const BSTR a_Class ,
  5400. long a_Flags ,
  5401. IWbemContext *a_Context ,
  5402. IWbemObjectSink *a_Sink
  5403. )
  5404. {
  5405. HRESULT t_Result = S_OK ;
  5406. IWbemContext *t_ContextCopy = NULL ;
  5407. if ( a_Context )
  5408. {
  5409. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  5410. AdjustGetContext ( t_ContextCopy ) ;
  5411. }
  5412. else
  5413. {
  5414. t_Result = S_OK ;
  5415. }
  5416. if ( SUCCEEDED ( t_Result ) )
  5417. {
  5418. ULONG t_Dependant = 1 ;
  5419. CInterceptor_IWbemSyncObjectSink *t_Sink = new CInterceptor_IWbemSyncObjectSink (
  5420. m_Allocator ,
  5421. a_Sink ,
  5422. ( IWbemServices * ) this ,
  5423. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  5424. t_Dependant
  5425. ) ;
  5426. if ( t_Sink )
  5427. {
  5428. t_Sink->AddRef () ;
  5429. t_Result = t_Sink->SinkInitialize () ;
  5430. if ( SUCCEEDED ( t_Result ) )
  5431. {
  5432. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  5433. Lock () ;
  5434. WmiStatusCode t_StatusCode = Insert (
  5435. *t_Sink ,
  5436. t_Iterator
  5437. ) ;
  5438. if ( t_StatusCode == e_StatusCode_Success )
  5439. {
  5440. UnLock () ;
  5441. BSTR t_Class = SysAllocString ( a_Class ) ;
  5442. if ( t_Class )
  5443. {
  5444. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  5445. {
  5446. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  5447. }
  5448. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5449. {
  5450. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_QueryInstances () ;
  5451. }
  5452. Increment_ProviderOperation_QueryInstances () ;
  5453. try
  5454. {
  5455. t_Result = a_PerformanceProvider->QueryInstances (
  5456. m_CoreStub ,
  5457. a_Class,
  5458. a_Flags,
  5459. a_Context,
  5460. t_Sink
  5461. ) ;
  5462. }
  5463. catch ( ... )
  5464. {
  5465. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5466. }
  5467. CoRevertToSelf () ;
  5468. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  5469. {
  5470. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  5471. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5472. {
  5473. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_QueryInstances () ;
  5474. }
  5475. Increment_ProviderOperation_QueryInstances () ;
  5476. try
  5477. {
  5478. a_PerformanceProvider->QueryInstances (
  5479. m_CoreStub,
  5480. a_Class,
  5481. a_Flags,
  5482. a_Context,
  5483. t_Sink
  5484. ) ;
  5485. }
  5486. catch ( ... )
  5487. {
  5488. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5489. }
  5490. CoRevertToSelf () ;
  5491. }
  5492. SysFreeString ( t_Class ) ;
  5493. }
  5494. else
  5495. {
  5496. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5497. }
  5498. }
  5499. else
  5500. {
  5501. UnLock () ;
  5502. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5503. }
  5504. if ( FAILED ( t_Result ) )
  5505. {
  5506. t_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  5507. }
  5508. }
  5509. t_Sink->Release () ;
  5510. }
  5511. else
  5512. {
  5513. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5514. }
  5515. }
  5516. else
  5517. {
  5518. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5519. }
  5520. if ( t_ContextCopy )
  5521. {
  5522. t_ContextCopy->Release () ;
  5523. }
  5524. return t_Result ;
  5525. }
  5526. /******************************************************************************
  5527. *
  5528. * Name:
  5529. *
  5530. *
  5531. * Description:
  5532. *
  5533. *
  5534. *****************************************************************************/
  5535. HRESULT CInterceptor_IWbemSyncProvider :: CreateInstanceEnumAsync (
  5536. const BSTR a_Class ,
  5537. long a_Flags ,
  5538. IWbemContext *a_Context ,
  5539. IWbemObjectSink *a_Sink
  5540. )
  5541. {
  5542. #if DBG
  5543. CheckThreadToken () ;
  5544. #endif
  5545. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  5546. if ( m_Provider_IWbemServices )
  5547. {
  5548. if ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () )
  5549. {
  5550. BOOL t_Impersonating ;
  5551. IUnknown *t_OldContext ;
  5552. IServerSecurity *t_OldSecurity ;
  5553. BOOL t_IsProxy ;
  5554. IWbemServices *t_Interface ;
  5555. BOOL t_Revert ;
  5556. IUnknown *t_Proxy ;
  5557. t_Result = Begin_IWbemServices (
  5558. t_Impersonating ,
  5559. t_OldContext ,
  5560. t_OldSecurity ,
  5561. t_IsProxy ,
  5562. t_Interface ,
  5563. t_Revert ,
  5564. t_Proxy
  5565. ) ;
  5566. if ( SUCCEEDED ( t_Result ) )
  5567. {
  5568. t_Result = Helper_CreateInstanceEnumAsync (
  5569. t_IsProxy ,
  5570. a_Class ,
  5571. a_Flags ,
  5572. a_Context ,
  5573. a_Sink ,
  5574. t_Interface
  5575. ) ;
  5576. End_IWbemServices (
  5577. t_Impersonating ,
  5578. t_OldContext ,
  5579. t_OldSecurity ,
  5580. t_IsProxy ,
  5581. t_Interface ,
  5582. t_Revert ,
  5583. t_Proxy
  5584. ) ;
  5585. }
  5586. }
  5587. }
  5588. else
  5589. {
  5590. if ( m_Provider_IWbemHiPerfProvider )
  5591. {
  5592. t_Result = Helper_QueryInstancesAsync (
  5593. m_Provider_IWbemHiPerfProvider ,
  5594. a_Class ,
  5595. a_Flags ,
  5596. a_Context ,
  5597. a_Sink
  5598. ) ;
  5599. }
  5600. }
  5601. return t_Result ;
  5602. }
  5603. /******************************************************************************
  5604. *
  5605. * Name:
  5606. *
  5607. *
  5608. * Description:
  5609. *
  5610. *
  5611. *****************************************************************************/
  5612. HRESULT CInterceptor_IWbemSyncProvider :: ExecQuery (
  5613. const BSTR a_QueryLanguage ,
  5614. const BSTR a_Query ,
  5615. long a_Flags ,
  5616. IWbemContext *a_Context ,
  5617. IEnumWbemClassObject **a_Enum
  5618. )
  5619. {
  5620. return WBEM_E_NOT_AVAILABLE ;
  5621. }
  5622. /******************************************************************************
  5623. *
  5624. * Name:
  5625. *
  5626. *
  5627. * Description:
  5628. *
  5629. *
  5630. *****************************************************************************/
  5631. HRESULT CInterceptor_IWbemSyncProvider :: Helper_ExecQueryAsync (
  5632. BOOL a_IsProxy ,
  5633. const BSTR a_QueryLanguage ,
  5634. const BSTR a_Query,
  5635. long a_Flags ,
  5636. IWbemContext FAR *a_Context ,
  5637. IWbemObjectSink *a_Sink ,
  5638. IWbemServices *a_Service
  5639. )
  5640. {
  5641. HRESULT t_Result = S_OK ;
  5642. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  5643. IWbemContext *t_ContextCopy = NULL ;
  5644. if ( SUCCEEDED ( t_Result ) )
  5645. {
  5646. if ( a_Context )
  5647. {
  5648. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  5649. if ( SUCCEEDED ( t_Result ) )
  5650. {
  5651. }
  5652. else
  5653. {
  5654. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5655. }
  5656. }
  5657. else
  5658. {
  5659. t_Result = S_OK ;
  5660. }
  5661. }
  5662. if ( SUCCEEDED ( t_Result ) )
  5663. {
  5664. ULONG t_Dependant = 1 ;
  5665. if ( ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_UnarySelect ) || ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_V1ProviderDefined ) )
  5666. {
  5667. BSTR t_QueryLanguage = SysAllocString ( a_QueryLanguage ) ;
  5668. BSTR t_Query = SysAllocString ( a_Query ) ;
  5669. if ( t_QueryLanguage && t_Query )
  5670. {
  5671. CInterceptor_IWbemSyncObjectSink_ExecQueryAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_ExecQueryAsync (
  5672. m_Allocator ,
  5673. a_Flags ,
  5674. t_QueryLanguage ,
  5675. t_Query ,
  5676. this ,
  5677. a_Sink ,
  5678. ( IWbemServices * ) this ,
  5679. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  5680. t_Dependant
  5681. ) ;
  5682. if ( t_Sink )
  5683. {
  5684. t_Sink->AddRef () ;
  5685. t_Result = t_Sink->SinkInitialize () ;
  5686. if ( SUCCEEDED ( t_Result ) )
  5687. {
  5688. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  5689. Lock () ;
  5690. WmiStatusCode t_StatusCode = Insert (
  5691. *t_Sink ,
  5692. t_Iterator
  5693. ) ;
  5694. if ( t_StatusCode == e_StatusCode_Success )
  5695. {
  5696. UnLock () ;
  5697. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  5698. {
  5699. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  5700. }
  5701. if ( a_IsProxy )
  5702. {
  5703. t_Result = CoImpersonateClient () ;
  5704. }
  5705. else
  5706. {
  5707. t_Result = S_OK ;
  5708. }
  5709. if ( SUCCEEDED ( t_Result ) )
  5710. {
  5711. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5712. {
  5713. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_ExecQueryAsync () ;
  5714. }
  5715. Increment_ProviderOperation_ExecQueryAsync () ;
  5716. try
  5717. {
  5718. t_Result = a_Service->ExecQueryAsync (
  5719. t_QueryLanguage ,
  5720. t_Query,
  5721. a_Flags ,
  5722. t_ContextCopy ,
  5723. t_Sink
  5724. ) ;
  5725. }
  5726. catch ( ... )
  5727. {
  5728. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5729. }
  5730. CoRevertToSelf () ;
  5731. }
  5732. else
  5733. {
  5734. t_Result = WBEM_E_ACCESS_DENIED ;
  5735. }
  5736. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  5737. {
  5738. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  5739. if ( a_IsProxy )
  5740. {
  5741. t_Result = CoImpersonateClient () ;
  5742. }
  5743. else
  5744. {
  5745. t_Result = S_OK ;
  5746. }
  5747. if ( SUCCEEDED ( t_Result ) )
  5748. {
  5749. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5750. {
  5751. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_ExecQueryAsync () ;
  5752. }
  5753. Increment_ProviderOperation_ExecQueryAsync () ;
  5754. try
  5755. {
  5756. t_Result = a_Service->ExecQueryAsync (
  5757. t_QueryLanguage ,
  5758. t_Query,
  5759. a_Flags ,
  5760. t_ContextCopy ,
  5761. t_Sink
  5762. ) ;
  5763. }
  5764. catch ( ... )
  5765. {
  5766. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5767. }
  5768. CoRevertToSelf () ;
  5769. }
  5770. else
  5771. {
  5772. t_Result = WBEM_E_ACCESS_DENIED ;
  5773. }
  5774. }
  5775. }
  5776. else
  5777. {
  5778. UnLock () ;
  5779. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5780. }
  5781. if ( FAILED ( t_Result ) )
  5782. {
  5783. HRESULT t_TempResult = SetStatus ( L"ExecQueryAsync" , NULL , NULL , t_Result , t_Sink ) ;
  5784. }
  5785. }
  5786. t_Sink->Release () ;
  5787. }
  5788. else
  5789. {
  5790. SysFreeString ( t_Query ) ;
  5791. SysFreeString ( t_QueryLanguage ) ;
  5792. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5793. }
  5794. }
  5795. else
  5796. {
  5797. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5798. }
  5799. }
  5800. else if ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () )
  5801. {
  5802. IWbemQuery *t_QueryFilter = NULL ;
  5803. t_Result = ProviderSubSystem_Common_Globals :: CreateInstance (
  5804. CLSID_WbemQuery ,
  5805. NULL ,
  5806. CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER ,
  5807. IID_IWbemQuery ,
  5808. ( void ** ) & t_QueryFilter
  5809. ) ;
  5810. if ( SUCCEEDED ( t_Result ) )
  5811. {
  5812. t_Result = t_QueryFilter->Parse (
  5813. a_QueryLanguage ,
  5814. a_Query ,
  5815. 0
  5816. ) ;
  5817. if ( SUCCEEDED ( t_Result ) )
  5818. {
  5819. SWbemRpnEncodedQuery *t_Expression = NULL ;
  5820. t_Result = t_QueryFilter->GetAnalysis (
  5821. WMIQ_ANALYSIS_RPN_SEQUENCE ,
  5822. 0 ,
  5823. ( void ** ) & t_Expression
  5824. ) ;
  5825. if ( SUCCEEDED ( t_Result ) )
  5826. {
  5827. if ( t_Expression->m_uFromTargetType == WMIQ_RPN_FROM_UNARY )
  5828. {
  5829. BSTR t_Class = SysAllocString ( t_Expression->m_ppszFromList [ 0 ] ) ;
  5830. if ( t_Class )
  5831. {
  5832. CInterceptor_IWbemSyncObjectSink_CreateInstanceEnumAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_CreateInstanceEnumAsync (
  5833. m_Allocator ,
  5834. a_Flags ,
  5835. t_Class ,
  5836. this ,
  5837. a_Sink ,
  5838. ( IWbemServices * ) this ,
  5839. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  5840. t_Dependant
  5841. ) ;
  5842. if ( t_Sink )
  5843. {
  5844. t_Sink->AddRef () ;
  5845. t_Result = t_Sink->SinkInitialize () ;
  5846. if ( SUCCEEDED ( t_Result ) )
  5847. {
  5848. a_Sink->SetStatus ( WBEM_STATUS_REQUIREMENTS , 0 , NULL , NULL ) ;
  5849. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  5850. Lock () ;
  5851. WmiStatusCode t_StatusCode = Insert (
  5852. *t_Sink ,
  5853. t_Iterator
  5854. ) ;
  5855. if ( t_StatusCode == e_StatusCode_Success )
  5856. {
  5857. UnLock () ;
  5858. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  5859. {
  5860. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  5861. }
  5862. if ( a_IsProxy )
  5863. {
  5864. t_Result = CoImpersonateClient () ;
  5865. }
  5866. else
  5867. {
  5868. t_Result = S_OK ;
  5869. }
  5870. if ( SUCCEEDED ( t_Result ) )
  5871. {
  5872. a_Sink->SetStatus ( WBEM_STATUS_REQUIREMENTS , 0 , NULL , NULL ) ;
  5873. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5874. {
  5875. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5876. }
  5877. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5878. try
  5879. {
  5880. t_Result = a_Service->CreateInstanceEnumAsync (
  5881. t_Class ,
  5882. a_Flags ,
  5883. t_ContextCopy ,
  5884. t_Sink
  5885. ) ;
  5886. }
  5887. catch ( ... )
  5888. {
  5889. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5890. }
  5891. CoRevertToSelf () ;
  5892. }
  5893. else
  5894. {
  5895. t_Result = WBEM_E_ACCESS_DENIED ;
  5896. }
  5897. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  5898. {
  5899. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  5900. if ( a_IsProxy )
  5901. {
  5902. t_Result = CoImpersonateClient () ;
  5903. }
  5904. else
  5905. {
  5906. t_Result = S_OK ;
  5907. }
  5908. if ( SUCCEEDED ( t_Result ) )
  5909. {
  5910. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  5911. {
  5912. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5913. }
  5914. Increment_ProviderOperation_CreateInstanceEnumAsync () ;
  5915. try
  5916. {
  5917. t_Result = a_Service->CreateInstanceEnumAsync (
  5918. t_Class ,
  5919. a_Flags ,
  5920. t_ContextCopy ,
  5921. t_Sink
  5922. ) ;
  5923. }
  5924. catch ( ... )
  5925. {
  5926. t_Result = WBEM_E_PROVIDER_FAILURE ;
  5927. }
  5928. CoRevertToSelf () ;
  5929. }
  5930. else
  5931. {
  5932. t_Result = WBEM_E_ACCESS_DENIED ;
  5933. }
  5934. }
  5935. }
  5936. else
  5937. {
  5938. UnLock () ;
  5939. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5940. }
  5941. }
  5942. if ( FAILED ( t_Result ) )
  5943. {
  5944. HRESULT t_TempResult = SetStatus ( L"CreateInstanceEnumAsync" , NULL , NULL , t_Result , t_Sink ) ;
  5945. }
  5946. t_Sink->Release () ;
  5947. }
  5948. else
  5949. {
  5950. SysFreeString ( t_Class ) ;
  5951. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5952. }
  5953. }
  5954. else
  5955. {
  5956. t_Result = WBEM_E_OUT_OF_MEMORY ;
  5957. }
  5958. }
  5959. else
  5960. {
  5961. t_Result = WBEM_E_NOT_SUPPORTED ;
  5962. }
  5963. t_QueryFilter->FreeMemory ( t_Expression ) ;
  5964. }
  5965. else
  5966. {
  5967. t_Result = WBEM_E_UNEXPECTED ;
  5968. }
  5969. }
  5970. else
  5971. {
  5972. t_Result = WBEM_E_NOT_SUPPORTED ;
  5973. }
  5974. t_QueryFilter->Release () ;
  5975. }
  5976. else
  5977. {
  5978. t_Result = WBEM_E_CRITICAL_ERROR ;
  5979. }
  5980. }
  5981. else
  5982. {
  5983. t_Result = WBEM_E_NOT_SUPPORTED ;
  5984. }
  5985. }
  5986. if ( t_ContextCopy )
  5987. {
  5988. t_ContextCopy->Release () ;
  5989. }
  5990. return t_Result ;
  5991. }
  5992. /******************************************************************************
  5993. *
  5994. * Name:
  5995. *
  5996. *
  5997. * Description:
  5998. *
  5999. *
  6000. *****************************************************************************/
  6001. HRESULT CInterceptor_IWbemSyncProvider :: ExecQueryAsync (
  6002. const BSTR a_QueryLanguage ,
  6003. const BSTR a_Query,
  6004. long a_Flags ,
  6005. IWbemContext *a_Context ,
  6006. IWbemObjectSink *a_Sink
  6007. )
  6008. {
  6009. #if DBG
  6010. CheckThreadToken () ;
  6011. #endif
  6012. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  6013. if ( m_Provider_IWbemServices )
  6014. {
  6015. if ( ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_UnarySelect ) || ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_V1ProviderDefined ) || ( m_Registration->GetInstanceProviderRegistration ().SupportsEnumeration () ) )
  6016. {
  6017. BOOL t_Impersonating ;
  6018. IUnknown *t_OldContext ;
  6019. IServerSecurity *t_OldSecurity ;
  6020. BOOL t_IsProxy ;
  6021. IWbemServices *t_Interface ;
  6022. BOOL t_Revert ;
  6023. IUnknown *t_Proxy ;
  6024. t_Result = Begin_IWbemServices (
  6025. t_Impersonating ,
  6026. t_OldContext ,
  6027. t_OldSecurity ,
  6028. t_IsProxy ,
  6029. t_Interface ,
  6030. t_Revert ,
  6031. t_Proxy
  6032. ) ;
  6033. if ( SUCCEEDED ( t_Result ) )
  6034. {
  6035. t_Result = Helper_ExecQueryAsync (
  6036. t_IsProxy ,
  6037. a_QueryLanguage ,
  6038. a_Query,
  6039. a_Flags ,
  6040. a_Context ,
  6041. a_Sink ,
  6042. t_Interface
  6043. ) ;
  6044. End_IWbemServices (
  6045. t_Impersonating ,
  6046. t_OldContext ,
  6047. t_OldSecurity ,
  6048. t_IsProxy ,
  6049. t_Interface ,
  6050. t_Revert ,
  6051. t_Proxy
  6052. ) ;
  6053. }
  6054. }
  6055. }
  6056. else
  6057. {
  6058. if ( m_Provider_IWbemHiPerfProvider )
  6059. {
  6060. IWbemQuery *t_QueryFilter = NULL ;
  6061. t_Result = ProviderSubSystem_Common_Globals :: CreateInstance (
  6062. CLSID_WbemQuery ,
  6063. NULL ,
  6064. CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER ,
  6065. IID_IWbemQuery ,
  6066. ( void ** ) & t_QueryFilter
  6067. ) ;
  6068. if ( SUCCEEDED ( t_Result ) )
  6069. {
  6070. t_Result = t_QueryFilter->Parse (
  6071. a_QueryLanguage ,
  6072. a_Query ,
  6073. 0
  6074. ) ;
  6075. if ( SUCCEEDED ( t_Result ) )
  6076. {
  6077. SWbemRpnEncodedQuery *t_Expression = NULL ;
  6078. t_Result = t_QueryFilter->GetAnalysis (
  6079. WMIQ_ANALYSIS_RPN_SEQUENCE ,
  6080. 0 ,
  6081. ( void ** ) & t_Expression
  6082. ) ;
  6083. if ( SUCCEEDED ( t_Result ) )
  6084. {
  6085. if ( t_Expression->m_uFromTargetType == WMIQ_RPN_FROM_UNARY )
  6086. {
  6087. BSTR t_Class = SysAllocString ( t_Expression->m_ppszFromList [ 0 ] ) ;
  6088. if ( t_Class )
  6089. {
  6090. a_Sink->SetStatus ( WBEM_STATUS_REQUIREMENTS , 0 , NULL , NULL ) ;
  6091. t_Result = Helper_QueryInstancesAsync (
  6092. m_Provider_IWbemHiPerfProvider ,
  6093. t_Class ,
  6094. a_Flags ,
  6095. a_Context ,
  6096. a_Sink
  6097. ) ;
  6098. SysFreeString ( t_Class ) ;
  6099. }
  6100. else
  6101. {
  6102. t_Result = WBEM_E_OUT_OF_MEMORY ;
  6103. }
  6104. }
  6105. else
  6106. {
  6107. t_Result = WBEM_E_NOT_SUPPORTED ;
  6108. }
  6109. t_QueryFilter->FreeMemory ( t_Expression ) ;
  6110. }
  6111. else
  6112. {
  6113. t_Result = WBEM_E_UNEXPECTED ;
  6114. }
  6115. }
  6116. else
  6117. {
  6118. t_Result = WBEM_E_NOT_SUPPORTED ;
  6119. }
  6120. t_QueryFilter->Release () ;
  6121. }
  6122. }
  6123. else
  6124. {
  6125. t_Result = WBEM_E_CRITICAL_ERROR ;
  6126. }
  6127. }
  6128. return t_Result ;
  6129. }
  6130. /******************************************************************************
  6131. *
  6132. * Name:
  6133. *
  6134. *
  6135. * Description:
  6136. *
  6137. *
  6138. *****************************************************************************/
  6139. HRESULT CInterceptor_IWbemSyncProvider :: ExecNotificationQuery (
  6140. const BSTR a_QueryLanguage ,
  6141. const BSTR a_Query ,
  6142. long a_Flags ,
  6143. IWbemContext *a_Context ,
  6144. IEnumWbemClassObject **a_Enum
  6145. )
  6146. {
  6147. return WBEM_E_NOT_AVAILABLE ;
  6148. }
  6149. /******************************************************************************
  6150. *
  6151. * Name:
  6152. *
  6153. *
  6154. * Description:
  6155. *
  6156. *
  6157. *****************************************************************************/
  6158. HRESULT CInterceptor_IWbemSyncProvider :: ExecNotificationQueryAsync (
  6159. const BSTR a_QueryLanguage ,
  6160. const BSTR a_Query ,
  6161. long a_Flags ,
  6162. IWbemContext *a_Context ,
  6163. IWbemObjectSink *a_Sink
  6164. )
  6165. {
  6166. return WBEM_E_NOT_AVAILABLE ;
  6167. }
  6168. /******************************************************************************
  6169. *
  6170. * Name:
  6171. *
  6172. *
  6173. * Description:
  6174. *
  6175. *
  6176. *****************************************************************************/
  6177. HRESULT CInterceptor_IWbemSyncProvider :: ExecMethod (
  6178. const BSTR a_ObjectPath ,
  6179. const BSTR a_MethodName ,
  6180. long a_Flags ,
  6181. IWbemContext *a_Context ,
  6182. IWbemClassObject *a_InParams ,
  6183. IWbemClassObject **a_OutParams ,
  6184. IWbemCallResult **a_CallResult
  6185. )
  6186. {
  6187. return WBEM_E_NOT_AVAILABLE ;
  6188. }
  6189. /******************************************************************************
  6190. *
  6191. * Name:
  6192. *
  6193. *
  6194. * Description:
  6195. *
  6196. *
  6197. *****************************************************************************/
  6198. HRESULT CInterceptor_IWbemSyncProvider :: Helper_ExecMethodAsync (
  6199. BOOL a_IsProxy ,
  6200. const BSTR a_ObjectPath ,
  6201. const BSTR a_MethodName ,
  6202. long a_Flags ,
  6203. IWbemContext *a_Context ,
  6204. IWbemClassObject *a_InParams ,
  6205. IWbemObjectSink *a_Sink ,
  6206. IWbemServices *a_Service
  6207. )
  6208. {
  6209. HRESULT t_Result = S_OK ;
  6210. a_Flags = ( a_Flags & ~WBEM_FLAG_DIRECT_READ ) ;
  6211. IWbemContext *t_ContextCopy = NULL ;
  6212. if ( a_Context )
  6213. {
  6214. t_Result = a_Context->Clone ( & t_ContextCopy ) ;
  6215. AdjustGetContext ( t_ContextCopy ) ;
  6216. }
  6217. else
  6218. {
  6219. t_Result = S_OK ;
  6220. }
  6221. if ( SUCCEEDED ( t_Result ) )
  6222. {
  6223. ULONG t_Dependant = 1 ;
  6224. BSTR t_ObjectPath = SysAllocString ( a_ObjectPath ) ;
  6225. BSTR t_MethodName = SysAllocString ( a_MethodName ) ;
  6226. if ( t_ObjectPath && t_MethodName )
  6227. {
  6228. CInterceptor_IWbemSyncObjectSink_ExecMethodAsync *t_Sink = new CInterceptor_IWbemSyncObjectSink_ExecMethodAsync (
  6229. m_Allocator ,
  6230. a_Flags ,
  6231. t_ObjectPath ,
  6232. t_MethodName ,
  6233. a_InParams ,
  6234. this ,
  6235. a_Sink ,
  6236. ( IWbemServices * ) this ,
  6237. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  6238. t_Dependant
  6239. ) ;
  6240. if ( t_Sink )
  6241. {
  6242. t_Sink->AddRef () ;
  6243. t_Result = t_Sink->SinkInitialize () ;
  6244. if ( SUCCEEDED ( t_Result ) )
  6245. {
  6246. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  6247. Lock () ;
  6248. WmiStatusCode t_StatusCode = Insert (
  6249. *t_Sink ,
  6250. t_Iterator
  6251. ) ;
  6252. if ( t_StatusCode == e_StatusCode_Success )
  6253. {
  6254. UnLock () ;
  6255. if ( m_Registration->GetComRegistration ().GetSupportsSendStatus () == FALSE )
  6256. {
  6257. a_Flags = ( a_Flags & ( ~WBEM_FLAG_SEND_STATUS ) ) ;
  6258. }
  6259. if ( a_IsProxy )
  6260. {
  6261. t_Result = CoImpersonateClient () ;
  6262. }
  6263. else
  6264. {
  6265. t_Result = S_OK ;
  6266. }
  6267. if ( SUCCEEDED ( t_Result ) )
  6268. {
  6269. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  6270. {
  6271. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_ExecMethodAsync () ;
  6272. }
  6273. Increment_ProviderOperation_ExecMethodAsync () ;
  6274. try
  6275. {
  6276. t_Result = a_Service->ExecMethodAsync (
  6277. t_ObjectPath ,
  6278. t_MethodName ,
  6279. a_Flags ,
  6280. t_ContextCopy ,
  6281. a_InParams ,
  6282. t_Sink
  6283. ) ;
  6284. }
  6285. catch ( ... )
  6286. {
  6287. t_Result = WBEM_E_PROVIDER_FAILURE ;
  6288. }
  6289. CoRevertToSelf () ;
  6290. }
  6291. else
  6292. {
  6293. t_Result = WBEM_E_ACCESS_DENIED ;
  6294. }
  6295. if ( t_Result == WBEM_E_UNSUPPORTED_PARAMETER || t_Result == WBEM_E_INVALID_PARAMETER )
  6296. {
  6297. a_Flags = ( a_Flags & ~WBEM_FLAG_SEND_STATUS ) ;
  6298. if ( a_IsProxy )
  6299. {
  6300. t_Result = CoImpersonateClient () ;
  6301. }
  6302. else
  6303. {
  6304. t_Result = S_OK ;
  6305. }
  6306. if ( SUCCEEDED ( t_Result ) )
  6307. {
  6308. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  6309. {
  6310. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_ExecMethodAsync () ;
  6311. }
  6312. Increment_ProviderOperation_ExecMethodAsync () ;
  6313. try
  6314. {
  6315. t_Result = a_Service->ExecMethodAsync (
  6316. t_ObjectPath ,
  6317. t_MethodName ,
  6318. a_Flags ,
  6319. t_ContextCopy ,
  6320. a_InParams ,
  6321. t_Sink
  6322. ) ;
  6323. }
  6324. catch ( ... )
  6325. {
  6326. t_Result = WBEM_E_PROVIDER_FAILURE ;
  6327. }
  6328. CoRevertToSelf () ;
  6329. }
  6330. else
  6331. {
  6332. t_Result = WBEM_E_ACCESS_DENIED ;
  6333. }
  6334. }
  6335. }
  6336. else
  6337. {
  6338. UnLock () ;
  6339. t_Result = WBEM_E_OUT_OF_MEMORY ;
  6340. }
  6341. if ( FAILED ( t_Result ) )
  6342. {
  6343. HRESULT t_TempResult = SetStatus ( L"ExecMethodAsync" , NULL , NULL , t_Result , t_Sink ) ;
  6344. }
  6345. }
  6346. t_Sink->Release () ;
  6347. }
  6348. else
  6349. {
  6350. SysFreeString ( t_ObjectPath ) ;
  6351. SysFreeString ( t_MethodName ) ;
  6352. t_Result = WBEM_E_OUT_OF_MEMORY ;
  6353. }
  6354. }
  6355. else
  6356. {
  6357. t_Result = WBEM_E_OUT_OF_MEMORY ;
  6358. }
  6359. }
  6360. else
  6361. {
  6362. t_Result = WBEM_E_OUT_OF_MEMORY ;
  6363. }
  6364. if ( t_ContextCopy )
  6365. {
  6366. t_ContextCopy->Release () ;
  6367. }
  6368. return t_Result ;
  6369. }
  6370. /******************************************************************************
  6371. *
  6372. * Name:
  6373. *
  6374. *
  6375. * Description:
  6376. *
  6377. *
  6378. *****************************************************************************/
  6379. HRESULT CInterceptor_IWbemSyncProvider :: ExecMethodAsync (
  6380. const BSTR a_ObjectPath ,
  6381. const BSTR a_MethodName ,
  6382. long a_Flags ,
  6383. IWbemContext *a_Context ,
  6384. IWbemClassObject *a_InParams ,
  6385. IWbemObjectSink *a_Sink
  6386. )
  6387. {
  6388. #if DBG
  6389. CheckThreadToken () ;
  6390. #endif
  6391. HRESULT t_Result = WBEM_E_PROVIDER_NOT_CAPABLE ;
  6392. if ( m_Provider_IWbemServices )
  6393. {
  6394. if ( m_Registration->GetMethodProviderRegistration ().SupportsMethods () )
  6395. {
  6396. BOOL t_Impersonating ;
  6397. IUnknown *t_OldContext ;
  6398. IServerSecurity *t_OldSecurity ;
  6399. BOOL t_IsProxy ;
  6400. IWbemServices *t_Interface ;
  6401. BOOL t_Revert ;
  6402. IUnknown *t_Proxy ;
  6403. t_Result = Begin_IWbemServices (
  6404. t_Impersonating ,
  6405. t_OldContext ,
  6406. t_OldSecurity ,
  6407. t_IsProxy ,
  6408. t_Interface ,
  6409. t_Revert ,
  6410. t_Proxy
  6411. ) ;
  6412. if ( SUCCEEDED ( t_Result ) )
  6413. {
  6414. t_Result = Helper_ExecMethodAsync (
  6415. t_IsProxy ,
  6416. a_ObjectPath ,
  6417. a_MethodName ,
  6418. a_Flags ,
  6419. a_Context ,
  6420. a_InParams ,
  6421. a_Sink ,
  6422. t_Interface
  6423. ) ;
  6424. End_IWbemServices (
  6425. t_Impersonating ,
  6426. t_OldContext ,
  6427. t_OldSecurity ,
  6428. t_IsProxy ,
  6429. t_Interface ,
  6430. t_Revert ,
  6431. t_Proxy
  6432. ) ;
  6433. }
  6434. }
  6435. }
  6436. return t_Result ;
  6437. }
  6438. /******************************************************************************
  6439. *
  6440. * Name:
  6441. *
  6442. *
  6443. * Description:
  6444. *
  6445. *
  6446. *****************************************************************************/
  6447. HRESULT CInterceptor_IWbemSyncProvider :: GetProperty (
  6448. long a_Flags ,
  6449. const BSTR a_Locale ,
  6450. const BSTR a_ClassMapping ,
  6451. const BSTR a_InstanceMapping ,
  6452. const BSTR a_PropertyMapping ,
  6453. VARIANT *a_Value
  6454. )
  6455. {
  6456. if ( m_Provider_IWbemPropertyProvider )
  6457. {
  6458. if ( m_Registration->GetPropertyProviderRegistration ().SupportsGet () )
  6459. {
  6460. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  6461. {
  6462. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_GetProperty () ;
  6463. }
  6464. Increment_ProviderOperation_GetProperty () ;
  6465. HRESULT t_Result = S_OK ;
  6466. try
  6467. {
  6468. t_Result = m_Provider_IWbemPropertyProvider->GetProperty (
  6469. a_Flags ,
  6470. a_Locale ,
  6471. a_ClassMapping ,
  6472. a_InstanceMapping ,
  6473. a_PropertyMapping ,
  6474. a_Value
  6475. ) ;
  6476. CoRevertToSelf () ;
  6477. }
  6478. catch ( ... )
  6479. {
  6480. t_Result = WBEM_E_PROVIDER_FAILURE ;
  6481. CoRevertToSelf () ;
  6482. }
  6483. return t_Result ;
  6484. }
  6485. }
  6486. return WBEM_E_PROVIDER_NOT_CAPABLE;
  6487. }
  6488. /******************************************************************************
  6489. *
  6490. * Name:
  6491. *
  6492. *
  6493. * Description:
  6494. *
  6495. *
  6496. *****************************************************************************/
  6497. HRESULT CInterceptor_IWbemSyncProvider :: PutProperty (
  6498. long a_Flags ,
  6499. const BSTR a_Locale ,
  6500. const BSTR a_ClassMapping ,
  6501. const BSTR a_InstanceMapping ,
  6502. const BSTR a_PropertyMapping ,
  6503. const VARIANT *a_Value
  6504. )
  6505. {
  6506. if ( m_Provider_IWbemPropertyProvider )
  6507. {
  6508. if ( m_Registration->GetPropertyProviderRegistration ().SupportsPut () )
  6509. {
  6510. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  6511. {
  6512. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_PutProperty () ;
  6513. }
  6514. Increment_ProviderOperation_PutProperty () ;
  6515. HRESULT t_Result = S_OK ;
  6516. try
  6517. {
  6518. t_Result = m_Provider_IWbemPropertyProvider->PutProperty (
  6519. a_Flags ,
  6520. a_Locale ,
  6521. a_ClassMapping ,
  6522. a_InstanceMapping ,
  6523. a_PropertyMapping ,
  6524. a_Value
  6525. ) ;
  6526. CoRevertToSelf () ;
  6527. return t_Result ;
  6528. }
  6529. catch ( ... )
  6530. {
  6531. t_Result = WBEM_E_PROVIDER_FAILURE ;
  6532. CoRevertToSelf () ;
  6533. }
  6534. return t_Result ;
  6535. }
  6536. }
  6537. return WBEM_E_PROVIDER_NOT_CAPABLE;
  6538. }
  6539. /******************************************************************************
  6540. *
  6541. * Name:
  6542. *
  6543. *
  6544. * Description:
  6545. *
  6546. *
  6547. *****************************************************************************/
  6548. HRESULT CInterceptor_IWbemSyncProvider :: ProvideEvents (
  6549. IWbemObjectSink *a_Sink ,
  6550. long a_Flags
  6551. )
  6552. {
  6553. return InternalEx_ProvideEvents (
  6554. false ,
  6555. a_Sink ,
  6556. a_Flags
  6557. ) ;
  6558. }
  6559. /******************************************************************************
  6560. *
  6561. * Name:
  6562. *
  6563. *
  6564. * Description:
  6565. *
  6566. *
  6567. *****************************************************************************/
  6568. HRESULT CInterceptor_IWbemSyncProvider :: NewQuery (
  6569. unsigned long a_Id ,
  6570. WBEM_WSTR a_QueryLanguage ,
  6571. WBEM_WSTR a_Query
  6572. )
  6573. {
  6574. return InternalEx_NewQuery (
  6575. false ,
  6576. a_Id ,
  6577. a_QueryLanguage ,
  6578. a_Query
  6579. ) ;
  6580. }
  6581. /******************************************************************************
  6582. *
  6583. * Name:
  6584. *
  6585. *
  6586. * Description:
  6587. *
  6588. *
  6589. *****************************************************************************/
  6590. HRESULT CInterceptor_IWbemSyncProvider :: CancelQuery (
  6591. unsigned long a_Id
  6592. )
  6593. {
  6594. return InternalEx_CancelQuery (
  6595. false ,
  6596. a_Id
  6597. ) ;
  6598. }
  6599. /******************************************************************************
  6600. *
  6601. * Name:
  6602. *
  6603. *
  6604. * Description:
  6605. *
  6606. *
  6607. *****************************************************************************/
  6608. HRESULT CInterceptor_IWbemSyncProvider :: AccessCheck (
  6609. WBEM_CWSTR a_QueryLanguage ,
  6610. WBEM_CWSTR a_Query ,
  6611. long a_SidLength ,
  6612. const BYTE *a_Sid
  6613. )
  6614. {
  6615. return InternalEx_AccessCheck (
  6616. false ,
  6617. a_QueryLanguage ,
  6618. a_Query ,
  6619. a_SidLength ,
  6620. a_Sid
  6621. ) ;
  6622. }
  6623. /******************************************************************************
  6624. *
  6625. * Name:
  6626. *
  6627. *
  6628. * Description:
  6629. *
  6630. *
  6631. *****************************************************************************/
  6632. HRESULT CInterceptor_IWbemSyncProvider :: FindConsumer (
  6633. IWbemClassObject *a_LogicalConsumer ,
  6634. IWbemUnboundObjectSink **a_Consumer
  6635. )
  6636. {
  6637. return InternalEx_FindConsumer (
  6638. false ,
  6639. a_LogicalConsumer ,
  6640. a_Consumer
  6641. ) ;
  6642. }
  6643. /******************************************************************************
  6644. *
  6645. * Name:
  6646. *
  6647. *
  6648. * Description:
  6649. *
  6650. *
  6651. *****************************************************************************/
  6652. HRESULT CInterceptor_IWbemSyncProvider :: ValidateSubscription (
  6653. IWbemClassObject *a_LogicalConsumer
  6654. )
  6655. {
  6656. return InternalEx_ValidateSubscription (
  6657. false ,
  6658. a_LogicalConsumer
  6659. ) ;
  6660. }
  6661. /******************************************************************************
  6662. *
  6663. * Name:
  6664. *
  6665. *
  6666. * Description:
  6667. *
  6668. *
  6669. *****************************************************************************/
  6670. HRESULT CInterceptor_IWbemSyncProvider :: IndicateToConsumer (
  6671. IWbemClassObject *a_LogicalConsumer ,
  6672. long a_ObjectCount ,
  6673. IWbemClassObject **a_Objects
  6674. )
  6675. {
  6676. return InternalEx_IndicateToConsumer (
  6677. false ,
  6678. a_LogicalConsumer ,
  6679. a_ObjectCount ,
  6680. a_Objects
  6681. ) ;
  6682. }
  6683. /******************************************************************************
  6684. *
  6685. * Name:
  6686. *
  6687. *
  6688. * Description:
  6689. *
  6690. *
  6691. *****************************************************************************/
  6692. HRESULT CInterceptor_IWbemSyncProvider :: InternalEx_ProvideEvents (
  6693. bool a_Identify ,
  6694. IWbemObjectSink *a_Sink ,
  6695. long a_Flags
  6696. )
  6697. {
  6698. if ( m_Provider_IWbemEventProvider )
  6699. {
  6700. WmiSetAndCommitObject (
  6701. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_ProvideEvents_Pre ] ,
  6702. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  6703. m_Namespace ,
  6704. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  6705. m_User ,
  6706. m_Locale ,
  6707. m_TransactionIdentifier ,
  6708. a_Flags
  6709. ) ;
  6710. IUnknown *t_ServerInterface = m_Provider_IWbemEventProvider ;
  6711. REFIID t_InterfaceIdentifier = IID_IWbemEventProvider ;
  6712. DWORD t_ProxyIndex = ProxyIndex_IWbemEventProvider ;
  6713. BOOL t_Impersonating ;
  6714. IUnknown *t_OldContext ;
  6715. IServerSecurity *t_OldSecurity ;
  6716. BOOL t_IsProxy ;
  6717. IUnknown *t_Interface ;
  6718. BOOL t_Revert ;
  6719. IUnknown *t_Proxy ;
  6720. HRESULT t_Result = Begin_Interface_Events (
  6721. a_Identify ,
  6722. t_ServerInterface ,
  6723. t_InterfaceIdentifier ,
  6724. t_ProxyIndex ,
  6725. t_Impersonating ,
  6726. t_OldContext ,
  6727. t_OldSecurity ,
  6728. t_IsProxy ,
  6729. t_Interface ,
  6730. t_Revert ,
  6731. t_Proxy
  6732. ) ;
  6733. if ( SUCCEEDED ( t_Result ) )
  6734. {
  6735. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  6736. {
  6737. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_ProvideEvents () ;
  6738. }
  6739. Increment_ProviderOperation_ProvideEvents () ;
  6740. try
  6741. {
  6742. t_Result = ( ( IWbemEventProvider * ) t_Interface )->ProvideEvents (
  6743. a_Sink ,
  6744. a_Flags
  6745. ) ;
  6746. }
  6747. catch ( ... )
  6748. {
  6749. t_Result = WBEM_E_PROVIDER_FAILURE ;
  6750. }
  6751. End_Interface_Events (
  6752. t_ServerInterface ,
  6753. t_InterfaceIdentifier ,
  6754. t_ProxyIndex ,
  6755. t_Impersonating ,
  6756. t_OldContext ,
  6757. t_OldSecurity ,
  6758. t_IsProxy ,
  6759. t_Interface ,
  6760. t_Revert ,
  6761. t_Proxy
  6762. ) ;
  6763. }
  6764. WmiSetAndCommitObject (
  6765. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_ProvideEvents_Post ] ,
  6766. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  6767. m_Namespace ,
  6768. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  6769. m_User ,
  6770. m_Locale ,
  6771. m_TransactionIdentifier ,
  6772. a_Flags ,
  6773. t_Result
  6774. ) ;
  6775. return t_Result ;
  6776. }
  6777. return WBEM_E_PROVIDER_NOT_CAPABLE;
  6778. }
  6779. /******************************************************************************
  6780. *
  6781. * Name:
  6782. *
  6783. *
  6784. * Description:
  6785. *
  6786. *
  6787. *****************************************************************************/
  6788. HRESULT CInterceptor_IWbemSyncProvider :: InternalEx_NewQuery (
  6789. bool a_Identify ,
  6790. unsigned long a_Id ,
  6791. WBEM_WSTR a_QueryLanguage ,
  6792. WBEM_WSTR a_Query
  6793. )
  6794. {
  6795. if ( m_Provider_IWbemEventProviderQuerySink )
  6796. {
  6797. WmiSetAndCommitObject (
  6798. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_NewQuery_Pre ] ,
  6799. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  6800. m_Namespace ,
  6801. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  6802. m_User ,
  6803. m_Locale ,
  6804. m_TransactionIdentifier ,
  6805. a_Id ,
  6806. a_QueryLanguage ,
  6807. a_Query
  6808. ) ;
  6809. IUnknown *t_ServerInterface = m_Provider_IWbemEventProviderQuerySink ;
  6810. REFIID t_InterfaceIdentifier = IID_IWbemEventProviderQuerySink ;
  6811. DWORD t_ProxyIndex = ProxyIndex_IWbemEventProviderQuerySink ;
  6812. BOOL t_Impersonating ;
  6813. IUnknown *t_OldContext ;
  6814. IServerSecurity *t_OldSecurity ;
  6815. BOOL t_IsProxy ;
  6816. IUnknown *t_Interface ;
  6817. BOOL t_Revert ;
  6818. IUnknown *t_Proxy ;
  6819. HRESULT t_Result = Begin_Interface_Events (
  6820. a_Identify ,
  6821. t_ServerInterface ,
  6822. t_InterfaceIdentifier ,
  6823. t_ProxyIndex ,
  6824. t_Impersonating ,
  6825. t_OldContext ,
  6826. t_OldSecurity ,
  6827. t_IsProxy ,
  6828. t_Interface ,
  6829. t_Revert ,
  6830. t_Proxy
  6831. ) ;
  6832. if ( SUCCEEDED ( t_Result ) )
  6833. {
  6834. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  6835. {
  6836. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_NewQuery () ;
  6837. }
  6838. Increment_ProviderOperation_NewQuery () ;
  6839. try
  6840. {
  6841. t_Result = ( ( IWbemEventProviderQuerySink * ) t_Interface )->NewQuery (
  6842. a_Id ,
  6843. a_QueryLanguage ,
  6844. a_Query
  6845. ) ;
  6846. }
  6847. catch ( ... )
  6848. {
  6849. t_Result = WBEM_E_PROVIDER_FAILURE ;
  6850. }
  6851. End_Interface_Events (
  6852. t_ServerInterface ,
  6853. t_InterfaceIdentifier ,
  6854. t_ProxyIndex ,
  6855. t_Impersonating ,
  6856. t_OldContext ,
  6857. t_OldSecurity ,
  6858. t_IsProxy ,
  6859. t_Interface ,
  6860. t_Revert ,
  6861. t_Proxy
  6862. ) ;
  6863. }
  6864. WmiSetAndCommitObject (
  6865. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_NewQuery_Post ] ,
  6866. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  6867. m_Namespace ,
  6868. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  6869. m_User ,
  6870. m_Locale ,
  6871. m_TransactionIdentifier ,
  6872. a_Id ,
  6873. a_QueryLanguage ,
  6874. a_Query ,
  6875. t_Result
  6876. ) ;
  6877. return t_Result ;
  6878. }
  6879. return WBEM_E_PROVIDER_NOT_CAPABLE;
  6880. }
  6881. /******************************************************************************
  6882. *
  6883. * Name:
  6884. *
  6885. *
  6886. * Description:
  6887. *
  6888. *
  6889. *****************************************************************************/
  6890. HRESULT CInterceptor_IWbemSyncProvider :: InternalEx_CancelQuery (
  6891. bool a_Identify ,
  6892. unsigned long a_Id
  6893. )
  6894. {
  6895. if ( m_Provider_IWbemEventProviderQuerySink )
  6896. {
  6897. WmiSetAndCommitObject (
  6898. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_CancelQuery_Pre ] ,
  6899. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  6900. m_Namespace ,
  6901. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  6902. m_User ,
  6903. m_Locale ,
  6904. m_TransactionIdentifier ,
  6905. a_Id
  6906. ) ;
  6907. IUnknown *t_ServerInterface = m_Provider_IWbemEventProviderQuerySink ;
  6908. REFIID t_InterfaceIdentifier = IID_IWbemEventProviderQuerySink ;
  6909. DWORD t_ProxyIndex = ProxyIndex_IWbemEventProviderQuerySink ;
  6910. BOOL t_Impersonating ;
  6911. IUnknown *t_OldContext ;
  6912. IServerSecurity *t_OldSecurity ;
  6913. BOOL t_IsProxy ;
  6914. IUnknown *t_Interface ;
  6915. BOOL t_Revert ;
  6916. IUnknown *t_Proxy ;
  6917. HRESULT t_Result = Begin_Interface_Events (
  6918. a_Identify ,
  6919. t_ServerInterface ,
  6920. t_InterfaceIdentifier ,
  6921. t_ProxyIndex ,
  6922. t_Impersonating ,
  6923. t_OldContext ,
  6924. t_OldSecurity ,
  6925. t_IsProxy ,
  6926. t_Interface ,
  6927. t_Revert ,
  6928. t_Proxy
  6929. ) ;
  6930. if ( SUCCEEDED ( t_Result ) )
  6931. {
  6932. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  6933. {
  6934. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CancelQuery () ;
  6935. }
  6936. Increment_ProviderOperation_CancelQuery () ;
  6937. try
  6938. {
  6939. t_Result = ( ( IWbemEventProviderQuerySink * ) t_Interface )->CancelQuery (
  6940. a_Id
  6941. ) ;
  6942. }
  6943. catch ( ... )
  6944. {
  6945. t_Result = WBEM_E_PROVIDER_FAILURE ;
  6946. }
  6947. End_Interface_Events (
  6948. t_ServerInterface ,
  6949. t_InterfaceIdentifier ,
  6950. t_ProxyIndex ,
  6951. t_Impersonating ,
  6952. t_OldContext ,
  6953. t_OldSecurity ,
  6954. t_IsProxy ,
  6955. t_Interface ,
  6956. t_Revert ,
  6957. t_Proxy
  6958. ) ;
  6959. }
  6960. WmiSetAndCommitObject (
  6961. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_CancelQuery_Post ] ,
  6962. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  6963. m_Namespace ,
  6964. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  6965. m_User ,
  6966. m_Locale ,
  6967. m_TransactionIdentifier ,
  6968. a_Id ,
  6969. t_Result
  6970. ) ;
  6971. return t_Result ;
  6972. }
  6973. return WBEM_E_PROVIDER_NOT_CAPABLE;
  6974. }
  6975. /******************************************************************************
  6976. *
  6977. * Name:
  6978. *
  6979. *
  6980. * Description:
  6981. *
  6982. *
  6983. *****************************************************************************/
  6984. HRESULT CInterceptor_IWbemSyncProvider :: InternalEx_AccessCheck (
  6985. bool a_Identify ,
  6986. WBEM_CWSTR a_QueryLanguage ,
  6987. WBEM_CWSTR a_Query ,
  6988. long a_SidLength ,
  6989. const BYTE *a_Sid
  6990. )
  6991. {
  6992. if ( m_Provider_IWbemEventProviderSecurity )
  6993. {
  6994. WmiSetAndCommitObject (
  6995. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_AccessCheck_Pre ] ,
  6996. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  6997. m_Namespace ,
  6998. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  6999. m_User ,
  7000. m_Locale ,
  7001. m_TransactionIdentifier ,
  7002. a_QueryLanguage ,
  7003. a_Query ,
  7004. a_Sid,
  7005. a_SidLength
  7006. ) ;
  7007. IUnknown *t_ServerInterface = m_Provider_IWbemEventProviderSecurity ;
  7008. REFIID t_InterfaceIdentifier = IID_IWbemEventProviderSecurity ;
  7009. DWORD t_ProxyIndex = ProxyIndex_IWbemEventProviderSecurity ;
  7010. BOOL t_Impersonating ;
  7011. IUnknown *t_OldContext ;
  7012. IServerSecurity *t_OldSecurity ;
  7013. BOOL t_IsProxy ;
  7014. IUnknown *t_Interface ;
  7015. BOOL t_Revert ;
  7016. IUnknown *t_Proxy ;
  7017. HRESULT t_Result ;
  7018. if ( a_Sid )
  7019. {
  7020. t_Result = Begin_Interface_Events (
  7021. a_Identify ,
  7022. t_ServerInterface ,
  7023. t_InterfaceIdentifier ,
  7024. t_ProxyIndex ,
  7025. t_Impersonating ,
  7026. t_OldContext ,
  7027. t_OldSecurity ,
  7028. t_IsProxy ,
  7029. t_Interface ,
  7030. t_Revert ,
  7031. t_Proxy
  7032. ) ;
  7033. }
  7034. else
  7035. {
  7036. t_Result = Begin_Interface (
  7037. t_ServerInterface ,
  7038. t_InterfaceIdentifier ,
  7039. t_ProxyIndex ,
  7040. t_Impersonating ,
  7041. t_OldContext ,
  7042. t_OldSecurity ,
  7043. t_IsProxy ,
  7044. t_Interface ,
  7045. t_Revert ,
  7046. t_Proxy
  7047. ) ;
  7048. }
  7049. if ( SUCCEEDED ( t_Result ) )
  7050. {
  7051. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7052. {
  7053. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_AccessCheck () ;
  7054. }
  7055. Increment_ProviderOperation_AccessCheck () ;
  7056. try
  7057. {
  7058. t_Result = ( ( IWbemEventProviderSecurity * ) t_Interface )->AccessCheck (
  7059. a_QueryLanguage ,
  7060. a_Query ,
  7061. a_SidLength ,
  7062. a_Sid
  7063. ) ;
  7064. }
  7065. catch ( ... )
  7066. {
  7067. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7068. }
  7069. if ( a_Sid )
  7070. {
  7071. End_Interface_Events (
  7072. t_ServerInterface ,
  7073. t_InterfaceIdentifier ,
  7074. t_ProxyIndex ,
  7075. t_Impersonating ,
  7076. t_OldContext ,
  7077. t_OldSecurity ,
  7078. t_IsProxy ,
  7079. t_Interface ,
  7080. t_Revert ,
  7081. t_Proxy
  7082. ) ;
  7083. }
  7084. else
  7085. {
  7086. End_Interface (
  7087. t_ServerInterface ,
  7088. t_InterfaceIdentifier ,
  7089. t_ProxyIndex ,
  7090. t_Impersonating ,
  7091. t_OldContext ,
  7092. t_OldSecurity ,
  7093. t_IsProxy ,
  7094. t_Interface ,
  7095. t_Revert ,
  7096. t_Proxy
  7097. ) ;
  7098. }
  7099. }
  7100. WmiSetAndCommitObject (
  7101. ProviderSubSystem_Globals :: s_EventClassHandles [ Msft_WmiProvider_AccessCheck_Post ] ,
  7102. WMI_SENDCOMMIT_SET_NOT_REQUIRED,
  7103. m_Namespace ,
  7104. m_Registration->GetComRegistration ().GetClsidServer ().GetProviderName () ,
  7105. m_User ,
  7106. m_Locale ,
  7107. m_TransactionIdentifier ,
  7108. a_QueryLanguage ,
  7109. a_Query ,
  7110. a_Sid ,
  7111. a_SidLength
  7112. ) ;
  7113. return t_Result ;
  7114. }
  7115. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7116. }
  7117. /******************************************************************************
  7118. *
  7119. * Name:
  7120. *
  7121. *
  7122. * Description:
  7123. *
  7124. *
  7125. *****************************************************************************/
  7126. HRESULT CInterceptor_IWbemSyncProvider ::SetRegistrationObject (
  7127. long a_Flags ,
  7128. IWbemClassObject *a_ProviderRegistration
  7129. )
  7130. {
  7131. if ( m_Provider_IWbemProviderIdentity )
  7132. {
  7133. IUnknown *t_ServerInterface = m_Provider_IWbemProviderIdentity ;
  7134. REFIID t_InterfaceIdentifier = IID_IWbemProviderIdentity ;
  7135. DWORD t_ProxyIndex = ProxyIndex_IWbemProviderIdentity ;
  7136. BOOL t_Impersonating ;
  7137. IUnknown *t_OldContext ;
  7138. IServerSecurity *t_OldSecurity ;
  7139. BOOL t_IsProxy ;
  7140. IUnknown *t_Interface ;
  7141. BOOL t_Revert ;
  7142. IUnknown *t_Proxy ;
  7143. HRESULT t_Result = Begin_Interface_Events (
  7144. false ,
  7145. t_ServerInterface ,
  7146. t_InterfaceIdentifier ,
  7147. t_ProxyIndex ,
  7148. t_Impersonating ,
  7149. t_OldContext ,
  7150. t_OldSecurity ,
  7151. t_IsProxy ,
  7152. t_Interface ,
  7153. t_Revert ,
  7154. t_Proxy
  7155. ) ;
  7156. if ( SUCCEEDED ( t_Result ) )
  7157. {
  7158. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7159. {
  7160. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_SetRegistrationObject () ;
  7161. }
  7162. Increment_ProviderOperation_SetRegistrationObject () ;
  7163. try
  7164. {
  7165. t_Result = ( ( IWbemProviderIdentity * ) t_Interface )->SetRegistrationObject (
  7166. a_Flags ,
  7167. a_ProviderRegistration
  7168. ) ;
  7169. }
  7170. catch ( ... )
  7171. {
  7172. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7173. }
  7174. End_Interface_Events (
  7175. t_ServerInterface ,
  7176. t_InterfaceIdentifier ,
  7177. t_ProxyIndex ,
  7178. t_Impersonating ,
  7179. t_OldContext ,
  7180. t_OldSecurity ,
  7181. t_IsProxy ,
  7182. t_Interface ,
  7183. t_Revert ,
  7184. t_Proxy
  7185. ) ;
  7186. }
  7187. return t_Result ;
  7188. }
  7189. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7190. }
  7191. /******************************************************************************
  7192. *
  7193. * Name:
  7194. *
  7195. *
  7196. * Description:
  7197. *
  7198. *
  7199. *****************************************************************************/
  7200. HRESULT CInterceptor_IWbemSyncProvider :: InternalEx_FindConsumer (
  7201. bool a_Identify ,
  7202. IWbemClassObject *a_LogicalConsumer ,
  7203. IWbemUnboundObjectSink **a_Consumer
  7204. )
  7205. {
  7206. if ( m_Provider_IWbemEventConsumerProvider )
  7207. {
  7208. IWbemUnboundObjectSink *t_Consumer = NULL ;
  7209. IUnknown *t_ServerInterface = m_Provider_IWbemEventConsumerProvider ;
  7210. REFIID t_InterfaceIdentifier = IID_IWbemEventConsumerProvider ;
  7211. DWORD t_ProxyIndex = ProxyIndex_IWbemEventConsumerProvider ;
  7212. BOOL t_Impersonating ;
  7213. IUnknown *t_OldContext ;
  7214. IServerSecurity *t_OldSecurity ;
  7215. BOOL t_IsProxy ;
  7216. IUnknown *t_Interface ;
  7217. BOOL t_Revert ;
  7218. IUnknown *t_Proxy ;
  7219. HRESULT t_Result = Begin_Interface_Events (
  7220. a_Identify ,
  7221. t_ServerInterface ,
  7222. t_InterfaceIdentifier ,
  7223. t_ProxyIndex ,
  7224. t_Impersonating ,
  7225. t_OldContext ,
  7226. t_OldSecurity ,
  7227. t_IsProxy ,
  7228. t_Interface ,
  7229. t_Revert ,
  7230. t_Proxy
  7231. ) ;
  7232. if ( SUCCEEDED ( t_Result ) )
  7233. {
  7234. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7235. {
  7236. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_FindConsumer () ;
  7237. }
  7238. Increment_ProviderOperation_FindConsumer () ;
  7239. try
  7240. {
  7241. t_Result = ( ( IWbemEventConsumerProvider * ) t_Interface )->FindConsumer (
  7242. a_LogicalConsumer ,
  7243. & t_Consumer
  7244. ) ;
  7245. }
  7246. catch ( ... )
  7247. {
  7248. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7249. }
  7250. End_Interface_Events (
  7251. t_ServerInterface ,
  7252. t_InterfaceIdentifier ,
  7253. t_ProxyIndex ,
  7254. t_Impersonating ,
  7255. t_OldContext ,
  7256. t_OldSecurity ,
  7257. t_IsProxy ,
  7258. t_Interface ,
  7259. t_Revert ,
  7260. t_Proxy
  7261. ) ;
  7262. }
  7263. if ( SUCCEEDED ( t_Result ) )
  7264. {
  7265. if ( a_Consumer )
  7266. {
  7267. CInterceptor_IWbemSyncUnboundObjectSink *t_UnboundObjectSink = new CInterceptor_IWbemSyncUnboundObjectSink (
  7268. m_Allocator ,
  7269. t_Consumer ,
  7270. this ,
  7271. *m_Registration
  7272. ) ;
  7273. if ( t_UnboundObjectSink )
  7274. {
  7275. t_UnboundObjectSink->AddRef () ;
  7276. t_Result = t_UnboundObjectSink->Initialize () ;
  7277. if ( SUCCEEDED ( t_Result ) )
  7278. {
  7279. CWbemGlobal_VoidPointerController_Container_Iterator t_Iterator ;
  7280. Lock () ;
  7281. WmiStatusCode t_StatusCode = Insert (
  7282. *t_UnboundObjectSink ,
  7283. t_Iterator
  7284. ) ;
  7285. if ( t_StatusCode == e_StatusCode_Success )
  7286. {
  7287. UnLock () ;
  7288. *a_Consumer = t_UnboundObjectSink ;
  7289. t_UnboundObjectSink->AddRef () ;
  7290. }
  7291. else
  7292. {
  7293. UnLock () ;
  7294. t_Result = WBEM_E_OUT_OF_MEMORY ;
  7295. }
  7296. }
  7297. t_UnboundObjectSink->Release () ;
  7298. }
  7299. }
  7300. }
  7301. if ( t_Consumer )
  7302. {
  7303. t_Consumer->Release () ;
  7304. }
  7305. return t_Result ;
  7306. }
  7307. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7308. }
  7309. /******************************************************************************
  7310. *
  7311. * Name:
  7312. *
  7313. *
  7314. * Description:
  7315. *
  7316. *
  7317. *****************************************************************************/
  7318. HRESULT CInterceptor_IWbemSyncProvider :: InternalEx_ValidateSubscription (
  7319. bool a_Identify ,
  7320. IWbemClassObject *a_LogicalConsumer
  7321. )
  7322. {
  7323. if ( m_Provider_IWbemEventConsumerProviderEx )
  7324. {
  7325. IUnknown *t_ServerInterface = m_Provider_IWbemEventConsumerProviderEx ;
  7326. REFIID t_InterfaceIdentifier = IID_IWbemEventConsumerProviderEx ;
  7327. DWORD t_ProxyIndex = ProxyIndex_IWbemEventConsumerProviderEx ;
  7328. BOOL t_Impersonating ;
  7329. IUnknown *t_OldContext ;
  7330. IServerSecurity *t_OldSecurity ;
  7331. BOOL t_IsProxy ;
  7332. IUnknown *t_Interface ;
  7333. BOOL t_Revert ;
  7334. IUnknown *t_Proxy ;
  7335. HRESULT t_Result = Begin_Interface_Events (
  7336. a_Identify ,
  7337. t_ServerInterface ,
  7338. t_InterfaceIdentifier ,
  7339. t_ProxyIndex ,
  7340. t_Impersonating ,
  7341. t_OldContext ,
  7342. t_OldSecurity ,
  7343. t_IsProxy ,
  7344. t_Interface ,
  7345. t_Revert ,
  7346. t_Proxy
  7347. ) ;
  7348. if ( SUCCEEDED ( t_Result ) )
  7349. {
  7350. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7351. {
  7352. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_ValidateSubscription () ;
  7353. }
  7354. Increment_ProviderOperation_ValidateSubscription () ;
  7355. try
  7356. {
  7357. t_Result = ( ( IWbemEventConsumerProviderEx * ) t_Interface )->ValidateSubscription (
  7358. a_LogicalConsumer
  7359. ) ;
  7360. }
  7361. catch ( ... )
  7362. {
  7363. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7364. }
  7365. End_Interface_Events (
  7366. t_ServerInterface ,
  7367. t_InterfaceIdentifier ,
  7368. t_ProxyIndex ,
  7369. t_Impersonating ,
  7370. t_OldContext ,
  7371. t_OldSecurity ,
  7372. t_IsProxy ,
  7373. t_Interface ,
  7374. t_Revert ,
  7375. t_Proxy
  7376. ) ;
  7377. }
  7378. return t_Result ;
  7379. }
  7380. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7381. }
  7382. /******************************************************************************
  7383. *
  7384. * Name:
  7385. *
  7386. *
  7387. * Description:
  7388. *
  7389. *
  7390. *****************************************************************************/
  7391. HRESULT CInterceptor_IWbemSyncProvider :: InternalEx_IndicateToConsumer (
  7392. bool a_Identify ,
  7393. IWbemClassObject *a_LogicalConsumer ,
  7394. long a_ObjectCount ,
  7395. IWbemClassObject **a_Objects
  7396. )
  7397. {
  7398. if ( m_Provider_IWbemUnboundObjectSink )
  7399. {
  7400. IUnknown *t_ServerInterface = m_Provider_IWbemUnboundObjectSink ;
  7401. REFIID t_InterfaceIdentifier = IID_IWbemUnboundObjectSink ;
  7402. DWORD t_ProxyIndex = ProxyIndex_IWbemUnboundObjectSink ;
  7403. BOOL t_Impersonating ;
  7404. IUnknown *t_OldContext ;
  7405. IServerSecurity *t_OldSecurity ;
  7406. BOOL t_IsProxy ;
  7407. IUnknown *t_Interface ;
  7408. BOOL t_Revert ;
  7409. IUnknown *t_Proxy ;
  7410. HRESULT t_Result = Begin_Interface_Events (
  7411. a_Identify ,
  7412. t_ServerInterface ,
  7413. t_InterfaceIdentifier ,
  7414. t_ProxyIndex ,
  7415. t_Impersonating ,
  7416. t_OldContext ,
  7417. t_OldSecurity ,
  7418. t_IsProxy ,
  7419. t_Interface ,
  7420. t_Revert ,
  7421. t_Proxy
  7422. ) ;
  7423. if ( SUCCEEDED ( t_Result ) )
  7424. {
  7425. try
  7426. {
  7427. t_Result = ( ( IWbemUnboundObjectSink * ) t_Interface )->IndicateToConsumer (
  7428. a_LogicalConsumer ,
  7429. a_ObjectCount ,
  7430. a_Objects
  7431. ) ;
  7432. }
  7433. catch ( ... )
  7434. {
  7435. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7436. }
  7437. End_Interface_Events (
  7438. t_ServerInterface ,
  7439. t_InterfaceIdentifier ,
  7440. t_ProxyIndex ,
  7441. t_Impersonating ,
  7442. t_OldContext ,
  7443. t_OldSecurity ,
  7444. t_IsProxy ,
  7445. t_Interface ,
  7446. t_Revert ,
  7447. t_Proxy
  7448. ) ;
  7449. }
  7450. return t_Result ;
  7451. }
  7452. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7453. }
  7454. /******************************************************************************
  7455. *
  7456. * Name:
  7457. *
  7458. *
  7459. * Description:
  7460. *
  7461. *
  7462. *****************************************************************************/
  7463. HRESULT CInterceptor_IWbemSyncProvider ::QueryInstances (
  7464. IWbemServices *a_Namespace ,
  7465. WCHAR *a_Class ,
  7466. long a_Flags ,
  7467. IWbemContext *a_Context ,
  7468. IWbemObjectSink *a_Sink
  7469. )
  7470. {
  7471. if ( m_Provider_IWbemHiPerfProvider )
  7472. {
  7473. BOOL t_Impersonating = FALSE ;
  7474. IUnknown *t_OldContext = NULL ;
  7475. IServerSecurity *t_OldSecurity = NULL ;
  7476. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7477. if ( SUCCEEDED ( t_Result ) )
  7478. {
  7479. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7480. {
  7481. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_QueryInstances () ;
  7482. }
  7483. Increment_ProviderOperation_QueryInstances () ;
  7484. try
  7485. {
  7486. t_Result = m_Provider_IWbemHiPerfProvider->QueryInstances (
  7487. a_Namespace ,
  7488. a_Class ,
  7489. a_Flags ,
  7490. a_Context ,
  7491. a_Sink
  7492. ) ;
  7493. }
  7494. catch ( ... )
  7495. {
  7496. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7497. }
  7498. CoRevertToSelf () ;
  7499. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7500. return t_Result;
  7501. }
  7502. }
  7503. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7504. }
  7505. /******************************************************************************
  7506. *
  7507. * Name:
  7508. *
  7509. *
  7510. * Description:
  7511. *
  7512. *
  7513. *****************************************************************************/
  7514. HRESULT CInterceptor_IWbemSyncProvider ::CreateRefresher (
  7515. IWbemServices *a_Namespace ,
  7516. long a_Flags ,
  7517. IWbemRefresher **a_Refresher
  7518. )
  7519. {
  7520. if ( m_Provider_IWbemHiPerfProvider )
  7521. {
  7522. BOOL t_Impersonating = FALSE ;
  7523. IUnknown *t_OldContext = NULL ;
  7524. IServerSecurity *t_OldSecurity = NULL ;
  7525. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7526. if ( SUCCEEDED ( t_Result ) )
  7527. {
  7528. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7529. {
  7530. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateRefresher () ;
  7531. }
  7532. Increment_ProviderOperation_CreateRefresher () ;
  7533. try
  7534. {
  7535. t_Result = m_Provider_IWbemHiPerfProvider->CreateRefresher (
  7536. a_Namespace ,
  7537. a_Flags ,
  7538. a_Refresher
  7539. ) ;
  7540. }
  7541. catch ( ... )
  7542. {
  7543. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7544. }
  7545. CoRevertToSelf () ;
  7546. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7547. return t_Result;
  7548. }
  7549. }
  7550. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7551. }
  7552. /******************************************************************************
  7553. *
  7554. * Name:
  7555. *
  7556. *
  7557. * Description:
  7558. *
  7559. *
  7560. *****************************************************************************/
  7561. HRESULT CInterceptor_IWbemSyncProvider ::CreateRefreshableObject (
  7562. IWbemServices *a_Namespace ,
  7563. IWbemObjectAccess *a_Template ,
  7564. IWbemRefresher *a_Refresher ,
  7565. long a_Flags ,
  7566. IWbemContext *a_Context ,
  7567. IWbemObjectAccess **a_Refreshable ,
  7568. long *a_Id
  7569. )
  7570. {
  7571. if ( m_Provider_IWbemHiPerfProvider )
  7572. {
  7573. BOOL t_Impersonating = FALSE ;
  7574. IUnknown *t_OldContext = NULL ;
  7575. IServerSecurity *t_OldSecurity = NULL ;
  7576. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7577. if ( SUCCEEDED ( t_Result ) )
  7578. {
  7579. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7580. {
  7581. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateRefreshableObject () ;
  7582. }
  7583. Increment_ProviderOperation_CreateRefreshableObject () ;
  7584. try
  7585. {
  7586. t_Result = m_Provider_IWbemHiPerfProvider->CreateRefreshableObject (
  7587. a_Namespace ,
  7588. a_Template ,
  7589. a_Refresher ,
  7590. a_Flags ,
  7591. a_Context ,
  7592. a_Refreshable ,
  7593. a_Id
  7594. ) ;
  7595. }
  7596. catch ( ... )
  7597. {
  7598. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7599. }
  7600. CoRevertToSelf () ;
  7601. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7602. return t_Result;
  7603. }
  7604. }
  7605. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7606. }
  7607. /******************************************************************************
  7608. *
  7609. * Name:
  7610. *
  7611. *
  7612. * Description:
  7613. *
  7614. *
  7615. *****************************************************************************/
  7616. HRESULT CInterceptor_IWbemSyncProvider ::StopRefreshing (
  7617. IWbemRefresher *a_Refresher ,
  7618. long a_Id ,
  7619. long a_Flags
  7620. )
  7621. {
  7622. if ( m_Provider_IWbemHiPerfProvider )
  7623. {
  7624. BOOL t_Impersonating = FALSE ;
  7625. IUnknown *t_OldContext = NULL ;
  7626. IServerSecurity *t_OldSecurity = NULL ;
  7627. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7628. if ( SUCCEEDED ( t_Result ) )
  7629. {
  7630. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7631. {
  7632. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_StopRefreshing () ;
  7633. }
  7634. Increment_ProviderOperation_StopRefreshing () ;
  7635. try
  7636. {
  7637. t_Result = m_Provider_IWbemHiPerfProvider->StopRefreshing (
  7638. a_Refresher ,
  7639. a_Id ,
  7640. a_Flags
  7641. ) ;
  7642. }
  7643. catch ( ... )
  7644. {
  7645. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7646. }
  7647. CoRevertToSelf () ;
  7648. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7649. return t_Result;
  7650. }
  7651. }
  7652. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7653. }
  7654. /******************************************************************************
  7655. *
  7656. * Name:
  7657. *
  7658. *
  7659. * Description:
  7660. *
  7661. *
  7662. *****************************************************************************/
  7663. HRESULT CInterceptor_IWbemSyncProvider ::CreateRefreshableEnum (
  7664. IWbemServices *a_Namespace ,
  7665. LPCWSTR a_Class ,
  7666. IWbemRefresher *a_Refresher ,
  7667. long a_Flags ,
  7668. IWbemContext *a_Context ,
  7669. IWbemHiPerfEnum *a_HiPerfEnum ,
  7670. long *a_Id
  7671. )
  7672. {
  7673. if ( m_Provider_IWbemHiPerfProvider )
  7674. {
  7675. BOOL t_Impersonating = FALSE ;
  7676. IUnknown *t_OldContext = NULL ;
  7677. IServerSecurity *t_OldSecurity = NULL ;
  7678. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7679. if ( SUCCEEDED ( t_Result ) )
  7680. {
  7681. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7682. {
  7683. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_CreateRefreshableEnum () ;
  7684. }
  7685. Increment_ProviderOperation_CreateRefreshableEnum () ;
  7686. try
  7687. {
  7688. t_Result = m_Provider_IWbemHiPerfProvider->CreateRefreshableEnum (
  7689. a_Namespace ,
  7690. a_Class ,
  7691. a_Refresher ,
  7692. a_Flags ,
  7693. a_Context ,
  7694. a_HiPerfEnum ,
  7695. a_Id
  7696. ) ;
  7697. }
  7698. catch ( ... )
  7699. {
  7700. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7701. }
  7702. CoRevertToSelf () ;
  7703. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7704. return t_Result;
  7705. }
  7706. }
  7707. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7708. }
  7709. /******************************************************************************
  7710. *
  7711. * Name:
  7712. *
  7713. *
  7714. * Description:
  7715. *
  7716. *
  7717. *****************************************************************************/
  7718. HRESULT CInterceptor_IWbemSyncProvider ::GetObjects (
  7719. IWbemServices *a_Namespace ,
  7720. long a_ObjectCount ,
  7721. IWbemObjectAccess **a_Objects ,
  7722. long a_Flags ,
  7723. IWbemContext *a_Context
  7724. )
  7725. {
  7726. if ( m_Provider_IWbemHiPerfProvider )
  7727. {
  7728. BOOL t_Impersonating = FALSE ;
  7729. IUnknown *t_OldContext = NULL ;
  7730. IServerSecurity *t_OldSecurity = NULL ;
  7731. HRESULT t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7732. if ( SUCCEEDED ( t_Result ) )
  7733. {
  7734. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  7735. {
  7736. ProviderSubSystem_Globals :: GetSharedCounters ()->Increment_ProviderOperation_GetObjects () ;
  7737. }
  7738. Increment_ProviderOperation_GetObjects () ;
  7739. try
  7740. {
  7741. t_Result = m_Provider_IWbemHiPerfProvider->GetObjects (
  7742. a_Namespace ,
  7743. a_ObjectCount ,
  7744. a_Objects ,
  7745. a_Flags ,
  7746. a_Context
  7747. ) ;
  7748. }
  7749. catch ( ... )
  7750. {
  7751. t_Result = WBEM_E_PROVIDER_FAILURE ;
  7752. }
  7753. CoRevertToSelf () ;
  7754. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  7755. return t_Result;
  7756. }
  7757. }
  7758. return WBEM_E_PROVIDER_NOT_CAPABLE;
  7759. }
  7760. /******************************************************************************
  7761. *
  7762. * Name:
  7763. *
  7764. *
  7765. * Description:
  7766. *
  7767. *
  7768. *****************************************************************************/
  7769. HRESULT CInterceptor_IWbemSyncProvider :: Get (
  7770. IWbemServices *a_Service ,
  7771. long a_Flags ,
  7772. IWbemContext *a_Context ,
  7773. LPCWSTR a_Class ,
  7774. LPCWSTR a_Path ,
  7775. IWbemObjectSink *a_Sink
  7776. )
  7777. {
  7778. HRESULT t_Result = S_OK ;
  7779. if ( wbem_wcsicmp ( a_Class , L"Msft_Providers" ) == 0 )
  7780. {
  7781. IWbemClassObject *t_Object = NULL ;
  7782. BSTR t_Class = SysAllocString ( a_Class ) ;
  7783. if ( t_Class )
  7784. {
  7785. t_Result = a_Service->GetObject (
  7786. t_Class ,
  7787. 0 ,
  7788. a_Context ,
  7789. & t_Object ,
  7790. NULL
  7791. ) ;
  7792. if ( SUCCEEDED ( t_Result ) )
  7793. {
  7794. IWbemClassObject *t_Instance = NULL ;
  7795. t_Result = t_Object->SpawnInstance (
  7796. 0 ,
  7797. & t_Instance
  7798. ) ;
  7799. if ( SUCCEEDED ( t_Result ) )
  7800. {
  7801. _IWmiObject *t_FastObject = NULL ;
  7802. t_Instance->QueryInterface ( IID__IWmiObject , ( void ** ) & t_FastObject ) ;
  7803. t_FastObject->WriteProp (
  7804. L"ProviderOperation_GetObjectAsync" ,
  7805. 0 ,
  7806. sizeof ( UINT64 ) ,
  7807. 1 ,
  7808. CIM_UINT64 ,
  7809. & m_ProviderOperation_GetObjectAsync
  7810. ) ;
  7811. t_FastObject->WriteProp (
  7812. L"ProviderOperation_PutClassAsync" ,
  7813. 0 ,
  7814. sizeof ( UINT64 ) ,
  7815. 1 ,
  7816. CIM_UINT64 ,
  7817. & m_ProviderOperation_PutClassAsync
  7818. ) ;
  7819. t_FastObject->WriteProp (
  7820. L"ProviderOperation_DeleteClassAsync" ,
  7821. 0 ,
  7822. sizeof ( UINT64 ) ,
  7823. 1 ,
  7824. CIM_UINT64 ,
  7825. & m_ProviderOperation_DeleteClassAsync
  7826. ) ;
  7827. t_FastObject->WriteProp (
  7828. L"ProviderOperation_CreateClassEnumAsync" ,
  7829. 0 ,
  7830. sizeof ( UINT64 ) ,
  7831. 1 ,
  7832. CIM_UINT64 ,
  7833. & m_ProviderOperation_CreateClassEnumAsync
  7834. ) ;
  7835. t_FastObject->WriteProp (
  7836. L"ProviderOperation_PutInstanceAsync" ,
  7837. 0 ,
  7838. sizeof ( UINT64 ) ,
  7839. 1 ,
  7840. CIM_UINT64 ,
  7841. & m_ProviderOperation_PutInstanceAsync
  7842. ) ;
  7843. t_FastObject->WriteProp (
  7844. L"ProviderOperation_CreateInstanceEnumAsync" ,
  7845. 0 ,
  7846. sizeof ( UINT64 ) ,
  7847. 1 ,
  7848. CIM_UINT64 ,
  7849. & m_ProviderOperation_CreateInstanceEnumAsync
  7850. ) ;
  7851. t_FastObject->WriteProp (
  7852. L"ProviderOperation_ExecQueryAsync" ,
  7853. 0 ,
  7854. sizeof ( UINT64 ) ,
  7855. 1 ,
  7856. CIM_UINT64 ,
  7857. & m_ProviderOperation_ExecQueryAsync
  7858. ) ;
  7859. t_FastObject->WriteProp (
  7860. L"ProviderOperation_ExecNotificationQueryAsync" ,
  7861. 0 ,
  7862. sizeof ( UINT64 ) ,
  7863. 1 ,
  7864. CIM_UINT64 ,
  7865. & m_ProviderOperation_ExecNotificationQueryAsync
  7866. ) ;
  7867. t_FastObject->WriteProp (
  7868. L"ProviderOperation_DeleteInstanceAsync" ,
  7869. 0 ,
  7870. sizeof ( UINT64 ) ,
  7871. 1 ,
  7872. CIM_UINT64 ,
  7873. & m_ProviderOperation_DeleteInstanceAsync
  7874. ) ;
  7875. t_FastObject->WriteProp (
  7876. L"ProviderOperation_ExecMethodAsync" ,
  7877. 0 ,
  7878. sizeof ( UINT64 ) ,
  7879. 1 ,
  7880. CIM_UINT64 ,
  7881. & m_ProviderOperation_ExecMethodAsync
  7882. ) ;
  7883. t_FastObject->WriteProp (
  7884. L"ProviderOperation_QueryInstances" ,
  7885. 0 ,
  7886. sizeof ( UINT64 ) ,
  7887. 1 ,
  7888. CIM_UINT64,
  7889. & m_ProviderOperation_QueryInstances
  7890. ) ;
  7891. t_FastObject->WriteProp (
  7892. L"ProviderOperation_CreateRefresher" ,
  7893. 0 ,
  7894. sizeof ( UINT64 ) ,
  7895. 1 ,
  7896. CIM_UINT64,
  7897. & m_ProviderOperation_CreateRefresher
  7898. ) ;
  7899. t_FastObject->WriteProp (
  7900. L"ProviderOperation_CreateRefreshableObject" ,
  7901. 0 ,
  7902. sizeof ( UINT64 ) ,
  7903. 1 ,
  7904. CIM_UINT64,
  7905. & m_ProviderOperation_CreateRefreshableObject
  7906. ) ;
  7907. t_FastObject->WriteProp (
  7908. L"ProviderOperation_StopRefreshing" ,
  7909. 0 ,
  7910. sizeof ( UINT64 ) ,
  7911. 1 ,
  7912. CIM_UINT64,
  7913. & m_ProviderOperation_StopRefreshing
  7914. ) ;
  7915. t_FastObject->WriteProp (
  7916. L"ProviderOperation_CreateRefreshableEnum" ,
  7917. 0 ,
  7918. sizeof ( UINT64 ) ,
  7919. 1 ,
  7920. CIM_UINT64,
  7921. & m_ProviderOperation_CreateRefreshableEnum
  7922. ) ;
  7923. t_FastObject->WriteProp (
  7924. L"ProviderOperation_GetObjects" ,
  7925. 0 ,
  7926. sizeof ( UINT64 ) ,
  7927. 1 ,
  7928. CIM_UINT64,
  7929. & m_ProviderOperation_GetObjects
  7930. ) ;
  7931. t_FastObject->WriteProp (
  7932. L"ProviderOperation_GetProperty" ,
  7933. 0 ,
  7934. sizeof ( UINT64 ) ,
  7935. 1 ,
  7936. CIM_UINT64,
  7937. & m_ProviderOperation_GetProperty
  7938. ) ;
  7939. t_FastObject->WriteProp (
  7940. L"ProviderOperation_PutProperty" ,
  7941. 0 ,
  7942. sizeof ( UINT64 ) ,
  7943. 1 ,
  7944. CIM_UINT64,
  7945. & m_ProviderOperation_PutProperty
  7946. ) ;
  7947. t_FastObject->WriteProp (
  7948. L"ProviderOperation_ProvideEvents" ,
  7949. 0 ,
  7950. sizeof ( UINT64 ) ,
  7951. 1 ,
  7952. CIM_UINT64,
  7953. & m_ProviderOperation_ProvideEvents
  7954. ) ;
  7955. t_FastObject->WriteProp (
  7956. L"ProviderOperation_NewQuery" ,
  7957. 0 ,
  7958. sizeof ( UINT64 ) ,
  7959. 1 ,
  7960. CIM_UINT64,
  7961. & m_ProviderOperation_NewQuery
  7962. ) ;
  7963. t_FastObject->WriteProp (
  7964. L"ProviderOperation_CancelQuery" ,
  7965. 0 ,
  7966. sizeof ( UINT64 ) ,
  7967. 1 ,
  7968. CIM_UINT64,
  7969. & m_ProviderOperation_CancelQuery
  7970. ) ;
  7971. t_FastObject->WriteProp (
  7972. L"ProviderOperation_AccessCheck" ,
  7973. 0 ,
  7974. sizeof ( UINT64 ) ,
  7975. 1 ,
  7976. CIM_UINT64,
  7977. & m_ProviderOperation_AccessCheck
  7978. ) ;
  7979. t_FastObject->WriteProp (
  7980. L"ProviderOperation_SetRegistrationObject" ,
  7981. 0 ,
  7982. sizeof ( UINT64 ) ,
  7983. 1 ,
  7984. CIM_UINT64,
  7985. & m_ProviderOperation_SetRegistrationObject
  7986. ) ;
  7987. t_FastObject->WriteProp (
  7988. L"ProviderOperation_FindConsumer" ,
  7989. 0 ,
  7990. sizeof ( UINT64 ) ,
  7991. 1 ,
  7992. CIM_UINT64,
  7993. & m_ProviderOperation_FindConsumer
  7994. ) ;
  7995. t_FastObject->WriteProp (
  7996. L"ProviderOperation_ValidateSubscription" ,
  7997. 0 ,
  7998. sizeof ( UINT64 ) ,
  7999. 1 ,
  8000. CIM_UINT64,
  8001. & m_ProviderOperation_ValidateSubscription
  8002. ) ;
  8003. t_FastObject->Release () ;
  8004. VARIANT t_VariantProcessIdentifier ;
  8005. VariantInit ( & t_VariantProcessIdentifier ) ;
  8006. t_VariantProcessIdentifier.vt = VT_I4 ;
  8007. t_VariantProcessIdentifier.lVal = GetCurrentProcessId () ;
  8008. t_Instance->Put ( L"HostProcessIdentifier" , 0 , & t_VariantProcessIdentifier , 0 ) ;
  8009. VariantClear ( & t_VariantProcessIdentifier ) ;
  8010. t_Result = a_Sink->Indicate ( 1 , & t_Instance ) ;
  8011. t_Instance->Release () ;
  8012. }
  8013. t_Object->Release () ;
  8014. }
  8015. SysFreeString ( t_Class ) ;
  8016. }
  8017. else
  8018. {
  8019. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8020. }
  8021. }
  8022. else
  8023. {
  8024. t_Result = WBEM_E_INVALID_CLASS ;
  8025. }
  8026. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  8027. return t_Result ;
  8028. }
  8029. /******************************************************************************
  8030. *
  8031. * Name:
  8032. *
  8033. *
  8034. * Description:
  8035. *
  8036. *
  8037. *****************************************************************************/
  8038. HRESULT CInterceptor_IWbemSyncProvider :: Set (
  8039. IWbemServices *a_Service ,
  8040. long a_Flags ,
  8041. IWbemContext *a_Context ,
  8042. LPCWSTR a_Provider ,
  8043. LPCWSTR a_Class ,
  8044. LPCWSTR a_Path ,
  8045. IWbemClassObject *a_OldObject ,
  8046. IWbemClassObject *a_NewObject
  8047. )
  8048. {
  8049. return S_OK ;
  8050. }
  8051. /******************************************************************************
  8052. *
  8053. * Name:
  8054. *
  8055. *
  8056. * Description:
  8057. *
  8058. *
  8059. *****************************************************************************/
  8060. HRESULT CInterceptor_IWbemSyncProvider :: Deleted (
  8061. IWbemServices *a_Service ,
  8062. long a_Flags ,
  8063. IWbemContext *a_Context ,
  8064. LPCWSTR a_Provider ,
  8065. LPCWSTR a_Class ,
  8066. LPCWSTR a_Path ,
  8067. IWbemClassObject *a_Object
  8068. )
  8069. {
  8070. return S_OK ;
  8071. }
  8072. /******************************************************************************
  8073. *
  8074. * Name:
  8075. *
  8076. *
  8077. * Description:
  8078. *
  8079. *
  8080. *****************************************************************************/
  8081. HRESULT CInterceptor_IWbemSyncProvider :: Enumerate (
  8082. IWbemServices *a_Service ,
  8083. long a_Flags ,
  8084. IWbemContext *a_Context ,
  8085. LPCWSTR a_Class ,
  8086. IWbemObjectSink *a_Sink
  8087. )
  8088. {
  8089. HRESULT t_Result = S_OK ;
  8090. if ( wbem_wcsicmp ( a_Class , L"Msft_Providers" ) == 0 )
  8091. {
  8092. IWbemClassObject *t_Object = NULL ;
  8093. BSTR t_Class = SysAllocString ( a_Class ) ;
  8094. if ( t_Class )
  8095. {
  8096. t_Result = a_Service->GetObject (
  8097. t_Class ,
  8098. 0 ,
  8099. a_Context ,
  8100. & t_Object ,
  8101. NULL
  8102. ) ;
  8103. if ( SUCCEEDED ( t_Result ) )
  8104. {
  8105. IWbemClassObject *t_Instance = NULL ;
  8106. t_Result = t_Object->SpawnInstance (
  8107. 0 ,
  8108. & t_Instance
  8109. ) ;
  8110. if ( SUCCEEDED ( t_Result ) )
  8111. {
  8112. _IWmiObject *t_FastObject = NULL ;
  8113. t_Instance->QueryInterface ( IID__IWmiObject , ( void ** ) & t_FastObject ) ;
  8114. t_FastObject->WriteProp (
  8115. L"ProviderOperation_GetObjectAsync" ,
  8116. 0 ,
  8117. sizeof ( UINT64 ) ,
  8118. 1 ,
  8119. CIM_UINT64 ,
  8120. & m_ProviderOperation_GetObjectAsync
  8121. ) ;
  8122. t_FastObject->WriteProp (
  8123. L"ProviderOperation_PutClassAsync" ,
  8124. 0 ,
  8125. sizeof ( UINT64 ) ,
  8126. 1 ,
  8127. CIM_UINT64 ,
  8128. & m_ProviderOperation_PutClassAsync
  8129. ) ;
  8130. t_FastObject->WriteProp (
  8131. L"ProviderOperation_DeleteClassAsync" ,
  8132. 0 ,
  8133. sizeof ( UINT64 ) ,
  8134. 1 ,
  8135. CIM_UINT64 ,
  8136. & m_ProviderOperation_DeleteClassAsync
  8137. ) ;
  8138. t_FastObject->WriteProp (
  8139. L"ProviderOperation_CreateClassEnumAsync" ,
  8140. 0 ,
  8141. sizeof ( UINT64 ) ,
  8142. 1 ,
  8143. CIM_UINT64 ,
  8144. & m_ProviderOperation_CreateClassEnumAsync
  8145. ) ;
  8146. t_FastObject->WriteProp (
  8147. L"ProviderOperation_PutInstanceAsync" ,
  8148. 0 ,
  8149. sizeof ( UINT64 ) ,
  8150. 1 ,
  8151. CIM_UINT64 ,
  8152. & m_ProviderOperation_PutInstanceAsync
  8153. ) ;
  8154. t_FastObject->WriteProp (
  8155. L"ProviderOperation_CreateInstanceEnumAsync" ,
  8156. 0 ,
  8157. sizeof ( UINT64 ) ,
  8158. 1 ,
  8159. CIM_UINT64 ,
  8160. & m_ProviderOperation_CreateInstanceEnumAsync
  8161. ) ;
  8162. t_FastObject->WriteProp (
  8163. L"ProviderOperation_ExecQueryAsync" ,
  8164. 0 ,
  8165. sizeof ( UINT64 ) ,
  8166. 1 ,
  8167. CIM_UINT64 ,
  8168. & m_ProviderOperation_ExecQueryAsync
  8169. ) ;
  8170. t_FastObject->WriteProp (
  8171. L"ProviderOperation_ExecNotificationQueryAsync" ,
  8172. 0 ,
  8173. sizeof ( UINT64 ) ,
  8174. 1 ,
  8175. CIM_UINT64 ,
  8176. & m_ProviderOperation_ExecNotificationQueryAsync
  8177. ) ;
  8178. t_FastObject->WriteProp (
  8179. L"ProviderOperation_DeleteInstanceAsync" ,
  8180. 0 ,
  8181. sizeof ( UINT64 ) ,
  8182. 1 ,
  8183. CIM_UINT64 ,
  8184. & m_ProviderOperation_DeleteInstanceAsync
  8185. ) ;
  8186. t_FastObject->WriteProp (
  8187. L"ProviderOperation_ExecMethodAsync" ,
  8188. 0 ,
  8189. sizeof ( UINT64 ) ,
  8190. 1 ,
  8191. CIM_UINT64 ,
  8192. & m_ProviderOperation_ExecMethodAsync
  8193. ) ;
  8194. t_FastObject->WriteProp (
  8195. L"ProviderOperation_QueryInstances" ,
  8196. 0 ,
  8197. sizeof ( UINT64 ) ,
  8198. 1 ,
  8199. CIM_UINT64,
  8200. & m_ProviderOperation_QueryInstances
  8201. ) ;
  8202. t_FastObject->WriteProp (
  8203. L"ProviderOperation_CreateRefresher" ,
  8204. 0 ,
  8205. sizeof ( UINT64 ) ,
  8206. 1 ,
  8207. CIM_UINT64,
  8208. & m_ProviderOperation_CreateRefresher
  8209. ) ;
  8210. t_FastObject->WriteProp (
  8211. L"ProviderOperation_CreateRefreshableObject" ,
  8212. 0 ,
  8213. sizeof ( UINT64 ) ,
  8214. 1 ,
  8215. CIM_UINT64,
  8216. & m_ProviderOperation_CreateRefreshableObject
  8217. ) ;
  8218. t_FastObject->WriteProp (
  8219. L"ProviderOperation_StopRefreshing" ,
  8220. 0 ,
  8221. sizeof ( UINT64 ) ,
  8222. 1 ,
  8223. CIM_UINT64,
  8224. & m_ProviderOperation_StopRefreshing
  8225. ) ;
  8226. t_FastObject->WriteProp (
  8227. L"ProviderOperation_CreateRefreshableEnum" ,
  8228. 0 ,
  8229. sizeof ( UINT64 ) ,
  8230. 1 ,
  8231. CIM_UINT64,
  8232. & m_ProviderOperation_CreateRefreshableEnum
  8233. ) ;
  8234. t_FastObject->WriteProp (
  8235. L"ProviderOperation_GetObjects" ,
  8236. 0 ,
  8237. sizeof ( UINT64 ) ,
  8238. 1 ,
  8239. CIM_UINT64,
  8240. & m_ProviderOperation_GetObjects
  8241. ) ;
  8242. t_FastObject->WriteProp (
  8243. L"ProviderOperation_GetProperty" ,
  8244. 0 ,
  8245. sizeof ( UINT64 ) ,
  8246. 1 ,
  8247. CIM_UINT64,
  8248. & m_ProviderOperation_GetProperty
  8249. ) ;
  8250. t_FastObject->WriteProp (
  8251. L"ProviderOperation_PutProperty" ,
  8252. 0 ,
  8253. sizeof ( UINT64 ) ,
  8254. 1 ,
  8255. CIM_UINT64,
  8256. & m_ProviderOperation_PutProperty
  8257. ) ;
  8258. t_FastObject->WriteProp (
  8259. L"ProviderOperation_ProvideEvents" ,
  8260. 0 ,
  8261. sizeof ( UINT64 ) ,
  8262. 1 ,
  8263. CIM_UINT64,
  8264. & m_ProviderOperation_ProvideEvents
  8265. ) ;
  8266. t_FastObject->WriteProp (
  8267. L"ProviderOperation_NewQuery" ,
  8268. 0 ,
  8269. sizeof ( UINT64 ) ,
  8270. 1 ,
  8271. CIM_UINT64,
  8272. & m_ProviderOperation_NewQuery
  8273. ) ;
  8274. t_FastObject->WriteProp (
  8275. L"ProviderOperation_CancelQuery" ,
  8276. 0 ,
  8277. sizeof ( UINT64 ) ,
  8278. 1 ,
  8279. CIM_UINT64,
  8280. & m_ProviderOperation_CancelQuery
  8281. ) ;
  8282. t_FastObject->WriteProp (
  8283. L"ProviderOperation_AccessCheck" ,
  8284. 0 ,
  8285. sizeof ( UINT64 ) ,
  8286. 1 ,
  8287. CIM_UINT64,
  8288. & m_ProviderOperation_AccessCheck
  8289. ) ;
  8290. t_FastObject->WriteProp (
  8291. L"ProviderOperation_SetRegistrationObject" ,
  8292. 0 ,
  8293. sizeof ( UINT64 ) ,
  8294. 1 ,
  8295. CIM_UINT64,
  8296. & m_ProviderOperation_SetRegistrationObject
  8297. ) ;
  8298. t_FastObject->WriteProp (
  8299. L"ProviderOperation_FindConsumer" ,
  8300. 0 ,
  8301. sizeof ( UINT64 ) ,
  8302. 1 ,
  8303. CIM_UINT64,
  8304. & m_ProviderOperation_FindConsumer
  8305. ) ;
  8306. t_FastObject->WriteProp (
  8307. L"ProviderOperation_ValidateSubscription" ,
  8308. 0 ,
  8309. sizeof ( UINT64 ) ,
  8310. 1 ,
  8311. CIM_UINT64,
  8312. & m_ProviderOperation_ValidateSubscription
  8313. ) ;
  8314. t_FastObject->Release () ;
  8315. VARIANT t_VariantProcessIdentifier ;
  8316. VariantInit ( & t_VariantProcessIdentifier ) ;
  8317. t_VariantProcessIdentifier.vt = VT_I4 ;
  8318. t_VariantProcessIdentifier.lVal = GetCurrentProcessId () ;
  8319. t_Instance->Put ( L"HostProcessIdentifier" , 0 , & t_VariantProcessIdentifier , 0 ) ;
  8320. VariantClear ( & t_VariantProcessIdentifier ) ;
  8321. t_Result = a_Sink->Indicate ( 1 , & t_Instance ) ;
  8322. t_Instance->Release () ;
  8323. }
  8324. t_Object->Release () ;
  8325. }
  8326. SysFreeString ( t_Class ) ;
  8327. }
  8328. else
  8329. {
  8330. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8331. }
  8332. }
  8333. else
  8334. {
  8335. t_Result = WBEM_E_INVALID_CLASS ;
  8336. }
  8337. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  8338. return t_Result ;
  8339. }
  8340. /******************************************************************************
  8341. *
  8342. * Name:
  8343. *
  8344. *
  8345. * Description:
  8346. *
  8347. *
  8348. *****************************************************************************/
  8349. HRESULT CInterceptor_IWbemSyncProvider :: Call (
  8350. IWbemServices *a_Service ,
  8351. long a_Flags ,
  8352. IWbemContext *a_Context ,
  8353. LPCWSTR a_Class ,
  8354. LPCWSTR a_Path ,
  8355. LPCWSTR a_Method,
  8356. IWbemClassObject *a_InParams,
  8357. IWbemObjectSink *a_Sink
  8358. )
  8359. {
  8360. HRESULT t_Result = S_OK ;
  8361. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  8362. return t_Result ;
  8363. }
  8364. /******************************************************************************
  8365. *
  8366. * Name:
  8367. *
  8368. *
  8369. * Description:
  8370. *
  8371. *
  8372. *****************************************************************************/
  8373. HRESULT CInterceptor_IWbemSyncProvider :: Query (
  8374. IWbemServices *a_Service ,
  8375. long a_Flags ,
  8376. IWbemContext *a_Context ,
  8377. WBEM_PROVIDER_CONFIGURATION_CLASS_ID a_ClassIdentifier ,
  8378. WBEM_PROVIDER_CONFIGURATION_PROPERTY_ID a_PropertyIdentifier ,
  8379. VARIANT *a_Value
  8380. )
  8381. {
  8382. HRESULT t_Result = WBEM_E_INVALID_PROPERTY ;
  8383. if ( a_ClassIdentifier == WBEM_PROVIDER_CONFIGURATION_CLASS_ID_INSTANCE_PROVIDER_REGISTRATION )
  8384. {
  8385. if ( a_PropertyIdentifier == WBEM_PROVIDER_CONFIGURATION_PROPERTY_ID_EXTENDEDQUERY_SUPPORT )
  8386. {
  8387. if ( m_Registration->GetInstanceProviderRegistration ().QuerySupportLevels () & e_QuerySupportLevels_V1ProviderDefined )
  8388. {
  8389. a_Value->vt = VT_BOOL ;
  8390. a_Value->boolVal = VARIANT_TRUE ;
  8391. }
  8392. else
  8393. {
  8394. a_Value->vt = VT_BOOL ;
  8395. a_Value->boolVal = VARIANT_FALSE ;
  8396. }
  8397. t_Result = S_OK ;
  8398. }
  8399. }
  8400. return t_Result ;
  8401. }
  8402. /******************************************************************************
  8403. *
  8404. * Name:
  8405. *
  8406. *
  8407. * Description:
  8408. *
  8409. *
  8410. *****************************************************************************/
  8411. HRESULT CInterceptor_IWbemSyncProvider :: ForceReload ()
  8412. {
  8413. return WBEM_E_NOT_SUPPORTED ;
  8414. }
  8415. /******************************************************************************
  8416. *
  8417. * Name:
  8418. *
  8419. *
  8420. * Description:
  8421. *
  8422. *
  8423. *****************************************************************************/
  8424. HRESULT CInterceptor_IWbemSyncProvider :: Shutdown (
  8425. IWbemServices *a_Service ,
  8426. long a_Flags ,
  8427. IWbemContext *a_Context ,
  8428. LPCWSTR a_Provider ,
  8429. ULONG a_MilliSeconds
  8430. )
  8431. {
  8432. return S_OK ;
  8433. }
  8434. /******************************************************************************
  8435. *
  8436. * Name:
  8437. *
  8438. *
  8439. * Description:
  8440. *
  8441. *
  8442. *****************************************************************************/
  8443. HRESULT CInterceptor_IWbemSyncProvider :: Violation (
  8444. long a_Flags ,
  8445. IWbemContext *a_Context ,
  8446. IWbemClassObject *a_Object
  8447. )
  8448. {
  8449. if ( m_Quota )
  8450. {
  8451. return m_Quota->Violation (
  8452. a_Flags ,
  8453. a_Context ,
  8454. a_Object
  8455. ) ;
  8456. }
  8457. return S_OK ;
  8458. }
  8459. /******************************************************************************
  8460. *
  8461. * Name:
  8462. *
  8463. *
  8464. * Description:
  8465. *
  8466. *
  8467. *****************************************************************************/
  8468. HRESULT CInterceptor_IWbemSyncProvider :: GetSite ( DWORD *a_ProcessIdentifier )
  8469. {
  8470. HRESULT t_Result = S_OK ;
  8471. if ( a_ProcessIdentifier )
  8472. {
  8473. *a_ProcessIdentifier = GetCurrentProcessId () ;
  8474. }
  8475. else
  8476. {
  8477. t_Result = WBEM_E_INVALID_PARAMETER ;
  8478. }
  8479. return t_Result ;
  8480. }
  8481. /******************************************************************************
  8482. *
  8483. * Name:
  8484. *
  8485. *
  8486. * Description:
  8487. *
  8488. *
  8489. *****************************************************************************/
  8490. HRESULT CInterceptor_IWbemSyncProvider :: SetContainer ( IUnknown *a_Container )
  8491. {
  8492. if ( a_Container )
  8493. {
  8494. HRESULT t_Result = a_Container->QueryInterface ( IID__IWmiProviderQuota , ( void ** ) & m_Quota ) ;
  8495. return t_Result ;
  8496. }
  8497. return WBEM_E_INVALID_PARAMETER ;
  8498. }
  8499. /******************************************************************************
  8500. *
  8501. * Name:
  8502. *
  8503. *
  8504. * Description:
  8505. *
  8506. *
  8507. *****************************************************************************/
  8508. HRESULT CInterceptor_IWbemSyncProvider :: SetInitialized ( HRESULT a_InitializeResult )
  8509. {
  8510. m_InitializeResult = a_InitializeResult ;
  8511. InterlockedExchange ( & m_Initialized , 1 ) ;
  8512. if ( m_InitializedEvent )
  8513. {
  8514. SetEvent ( m_InitializedEvent ) ;
  8515. }
  8516. return S_OK ;
  8517. }
  8518. /******************************************************************************
  8519. *
  8520. * Name:
  8521. *
  8522. *
  8523. * Description:
  8524. *
  8525. *
  8526. *****************************************************************************/
  8527. HRESULT CInterceptor_IWbemSyncProvider :: WaitProvider ( IWbemContext *a_Context , ULONG a_Timeout )
  8528. {
  8529. HRESULT t_Result = WBEM_E_UNEXPECTED ;
  8530. if ( m_Initialized == 0 )
  8531. {
  8532. BOOL t_DependantCall = FALSE ;
  8533. t_Result = ProviderSubSystem_Common_Globals :: IsDependantCall ( m_InitializationContext , a_Context , t_DependantCall ) ;
  8534. if ( SUCCEEDED ( t_Result ) )
  8535. {
  8536. if ( t_DependantCall == FALSE )
  8537. {
  8538. if ( WaitForSingleObject ( m_InitializedEvent , a_Timeout ) == WAIT_TIMEOUT )
  8539. {
  8540. return WBEM_E_PROVIDER_LOAD_FAILURE ;
  8541. }
  8542. }
  8543. else
  8544. {
  8545. if ( WaitForSingleObject ( m_InitializedEvent , 0 ) == WAIT_TIMEOUT )
  8546. {
  8547. return S_FALSE ;
  8548. }
  8549. }
  8550. }
  8551. }
  8552. else
  8553. {
  8554. t_Result = S_OK ;
  8555. }
  8556. return t_Result ;
  8557. }
  8558. /******************************************************************************
  8559. *
  8560. * Name:
  8561. *
  8562. *
  8563. * Description:
  8564. *
  8565. *
  8566. *****************************************************************************/
  8567. HRESULT CInterceptor_IWbemSyncProvider :: Initialize (
  8568. LONG a_Flags ,
  8569. IWbemContext *a_Context ,
  8570. GUID *a_TransactionIdentifier,
  8571. LPCWSTR a_User ,
  8572. LPCWSTR a_Locale ,
  8573. LPCWSTR a_Namespace ,
  8574. IWbemServices *a_Repository ,
  8575. IWbemServices *a_Service ,
  8576. IWbemProviderInitSink *a_Sink
  8577. )
  8578. {
  8579. HRESULT t_Result = S_OK ;
  8580. WmiStatusCode t_StatusCode = CWbemGlobal_IWmiObjectSinkController :: Initialize () ;
  8581. if ( t_StatusCode != e_StatusCode_Success )
  8582. {
  8583. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8584. }
  8585. if ( SUCCEEDED ( t_Result ) )
  8586. {
  8587. t_StatusCode = m_ProxyContainer.Initialize () ;
  8588. if ( t_StatusCode != e_StatusCode_Success )
  8589. {
  8590. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8591. }
  8592. }
  8593. if ( SUCCEEDED ( t_Result ) )
  8594. {
  8595. if ( a_User )
  8596. {
  8597. m_User = SysAllocString ( a_User ) ;
  8598. if ( m_User == NULL )
  8599. {
  8600. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8601. }
  8602. }
  8603. }
  8604. if ( SUCCEEDED ( t_Result ) )
  8605. {
  8606. if ( a_Locale )
  8607. {
  8608. m_Locale = SysAllocString ( a_Locale ) ;
  8609. if ( m_Locale == NULL )
  8610. {
  8611. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8612. }
  8613. }
  8614. }
  8615. if ( SUCCEEDED ( t_Result ) )
  8616. {
  8617. if ( a_Namespace )
  8618. {
  8619. m_Namespace = SysAllocString ( a_Namespace ) ;
  8620. if ( m_Namespace == NULL )
  8621. {
  8622. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8623. }
  8624. }
  8625. }
  8626. if ( SUCCEEDED ( t_Result ) )
  8627. {
  8628. if ( a_TransactionIdentifier )
  8629. {
  8630. wchar_t t_TransactionIdentifier [ sizeof ( L"{00000000-0000-0000-0000-000000000000}" ) ] ;
  8631. if ( a_TransactionIdentifier )
  8632. {
  8633. StringFromGUID2 ( *a_TransactionIdentifier , t_TransactionIdentifier , sizeof ( t_TransactionIdentifier ) / sizeof ( wchar_t ) );
  8634. }
  8635. m_TransactionIdentifier = SysAllocString ( t_TransactionIdentifier ) ;
  8636. }
  8637. }
  8638. if ( a_Repository )
  8639. {
  8640. t_Result = a_Repository->GetObject (
  8641. L"__ExtendedStatus" ,
  8642. 0 ,
  8643. a_Context ,
  8644. & m_ExtendedStatusObject ,
  8645. NULL
  8646. ) ;
  8647. }
  8648. if ( SUCCEEDED ( t_Result ) )
  8649. {
  8650. m_InitializedEvent = CreateEvent ( NULL , TRUE , FALSE , NULL ) ;
  8651. if ( m_InitializedEvent == NULL )
  8652. {
  8653. t_Result = t_Result = WBEM_E_OUT_OF_MEMORY ;
  8654. }
  8655. }
  8656. a_Sink->SetStatus ( t_Result , 0 ) ;
  8657. return t_Result ;
  8658. }
  8659. /******************************************************************************
  8660. *
  8661. * Name:
  8662. *
  8663. *
  8664. * Description:
  8665. *
  8666. *
  8667. *****************************************************************************/
  8668. HRESULT CInterceptor_IWbemSyncProvider :: Shutdown (
  8669. LONG a_Flags ,
  8670. ULONG a_MaxMilliSeconds ,
  8671. IWbemContext *a_Context
  8672. )
  8673. {
  8674. HRESULT t_Result = S_OK ;
  8675. IWbemShutdown *t_Shutdown = NULL ;
  8676. if ( m_Unknown )
  8677. {
  8678. t_Result = m_Unknown->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  8679. if ( SUCCEEDED ( t_Result ) )
  8680. {
  8681. BOOL t_Impersonating = FALSE ;
  8682. IUnknown *t_OldContext = NULL ;
  8683. IServerSecurity *t_OldSecurity = NULL ;
  8684. t_Result = ProviderSubSystem_Common_Globals :: BeginImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  8685. if ( SUCCEEDED ( t_Result ) )
  8686. {
  8687. BOOL t_Revert = FALSE ;
  8688. IUnknown *t_Proxy = NULL ;
  8689. t_Result = ProviderSubSystem_Common_Globals :: SetProxyState ( m_ProxyContainer , ProxyIndex_IWbemShutdown , IID_IWbemShutdown , t_Shutdown , t_Proxy , t_Revert ) ;
  8690. if ( t_Result == WBEM_E_NOT_FOUND )
  8691. {
  8692. try
  8693. {
  8694. t_Result = t_Shutdown->Shutdown (
  8695. a_Flags ,
  8696. a_MaxMilliSeconds ,
  8697. a_Context
  8698. ) ;
  8699. }
  8700. catch ( ... )
  8701. {
  8702. t_Result = WBEM_E_PROVIDER_FAILURE ;
  8703. }
  8704. CoRevertToSelf () ;
  8705. }
  8706. else
  8707. {
  8708. if ( SUCCEEDED ( t_Result ) )
  8709. {
  8710. IWbemShutdown *t_Provider = ( IWbemShutdown * ) t_Proxy ;
  8711. // Set cloaking on the proxy
  8712. // =========================
  8713. DWORD t_ImpersonationLevel = ProviderSubSystem_Common_Globals :: GetCurrentImpersonationLevel () ;
  8714. t_Result = ProviderSubSystem_Common_Globals :: SetCloaking (
  8715. t_Provider ,
  8716. RPC_C_AUTHN_LEVEL_DEFAULT ,
  8717. t_ImpersonationLevel
  8718. ) ;
  8719. if ( SUCCEEDED ( t_Result ) )
  8720. {
  8721. t_Result = CoImpersonateClient () ;
  8722. if ( SUCCEEDED ( t_Result ) )
  8723. {
  8724. try
  8725. {
  8726. t_Result = t_Provider->Shutdown (
  8727. a_Flags ,
  8728. a_MaxMilliSeconds ,
  8729. a_Context
  8730. ) ;
  8731. }
  8732. catch ( ... )
  8733. {
  8734. t_Result = WBEM_E_PROVIDER_FAILURE ;
  8735. }
  8736. CoRevertToSelf () ;
  8737. }
  8738. }
  8739. HRESULT t_TempResult = ProviderSubSystem_Common_Globals :: RevertProxyState ( m_ProxyContainer , ProxyIndex_IWbemShutdown , t_Proxy , t_Revert ) ;
  8740. }
  8741. }
  8742. ProviderSubSystem_Common_Globals :: EndImpersonation ( t_OldContext , t_OldSecurity , t_Impersonating ) ;
  8743. }
  8744. t_Shutdown->Release () ;
  8745. }
  8746. }
  8747. if ( m_CoreStub )
  8748. {
  8749. t_Shutdown = NULL ;
  8750. t_Result = m_CoreStub->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  8751. if ( SUCCEEDED ( t_Result ) )
  8752. {
  8753. t_Result = t_Shutdown->Shutdown (
  8754. a_Flags ,
  8755. a_MaxMilliSeconds ,
  8756. a_Context
  8757. ) ;
  8758. t_Shutdown->Release () ;
  8759. }
  8760. }
  8761. Lock () ;
  8762. CWbemGlobal_IWmiObjectSinkController_Container *t_Container = NULL ;
  8763. GetContainer ( t_Container ) ;
  8764. IWbemShutdown **t_ShutdownElements = new IWbemShutdown * [ t_Container->Size () ] ;
  8765. if ( t_ShutdownElements )
  8766. {
  8767. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator = t_Container->Begin ();
  8768. ULONG t_Count = 0 ;
  8769. while ( ! t_Iterator.Null () )
  8770. {
  8771. t_Result = t_Iterator.GetElement ()->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_ShutdownElements [ t_Count ] ) ;
  8772. t_Iterator.Increment () ;
  8773. t_Count ++ ;
  8774. }
  8775. UnLock () ;
  8776. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  8777. {
  8778. if ( t_ShutdownElements [ t_Index ] )
  8779. {
  8780. t_Result = t_ShutdownElements [ t_Index ]->Shutdown (
  8781. a_Flags ,
  8782. a_MaxMilliSeconds ,
  8783. a_Context
  8784. ) ;
  8785. t_ShutdownElements [ t_Index ]->Release () ;
  8786. }
  8787. }
  8788. delete [] t_ShutdownElements ;
  8789. }
  8790. else
  8791. {
  8792. UnLock () ;
  8793. t_Result = WBEM_E_OUT_OF_MEMORY ;
  8794. }
  8795. CWbemGlobal_IWmiObjectSinkController :: Shutdown () ;
  8796. return t_Result ;
  8797. }