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.

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