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.

1882 lines
40 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 "ProvResv.h"
  13. #include "ProvFact.h"
  14. #include "ProvSubS.h"
  15. #include "ProvRegInfo.h"
  16. #include "ProvSelf.h"
  17. /******************************************************************************
  18. *
  19. * Name:
  20. *
  21. *
  22. * Description:
  23. *
  24. *
  25. *****************************************************************************/
  26. CServerObject_IWbemServices :: CServerObject_IWbemServices (
  27. WmiAllocator &a_Allocator
  28. ) :
  29. m_ReferenceCount ( 0 ) ,
  30. m_Service ( NULL )
  31. {
  32. InterlockedIncrement ( & ProviderSubSystem_Globals :: s_CServerObject_IWbemServices_ObjectsInProgress ) ;
  33. ProviderSubSystem_Globals :: Increment_Global_Object_Count () ;
  34. }
  35. /******************************************************************************
  36. *
  37. * Name:
  38. *
  39. *
  40. * Description:
  41. *
  42. *
  43. *****************************************************************************/
  44. CServerObject_IWbemServices :: ~CServerObject_IWbemServices ()
  45. {
  46. if ( m_Service )
  47. {
  48. m_Service->Release () ;
  49. }
  50. InterlockedDecrement ( & ProviderSubSystem_Globals :: s_CServerObject_IWbemServices_ObjectsInProgress ) ;
  51. ProviderSubSystem_Globals :: Decrement_Global_Object_Count () ;
  52. }
  53. /******************************************************************************
  54. *
  55. * Name:
  56. *
  57. *
  58. * Description:
  59. *
  60. *
  61. *****************************************************************************/
  62. STDMETHODIMP_(ULONG) CServerObject_IWbemServices :: AddRef ( void )
  63. {
  64. return InterlockedIncrement ( & m_ReferenceCount ) ;
  65. }
  66. /******************************************************************************
  67. *
  68. * Name:
  69. *
  70. *
  71. * Description:
  72. *
  73. *
  74. *****************************************************************************/
  75. STDMETHODIMP_(ULONG) CServerObject_IWbemServices :: Release ( void )
  76. {
  77. LONG t_ReferenceCount = InterlockedDecrement ( & m_ReferenceCount ) ;
  78. if ( t_ReferenceCount == 0 )
  79. {
  80. delete this ;
  81. return 0 ;
  82. }
  83. else
  84. {
  85. return t_ReferenceCount ;
  86. }
  87. }
  88. /******************************************************************************
  89. *
  90. * Name:
  91. *
  92. *
  93. * Description:
  94. *
  95. *
  96. *****************************************************************************/
  97. STDMETHODIMP CServerObject_IWbemServices :: QueryInterface (
  98. REFIID iid ,
  99. LPVOID FAR *iplpv
  100. )
  101. {
  102. *iplpv = NULL ;
  103. if ( iid == IID_IUnknown )
  104. {
  105. *iplpv = ( LPVOID ) this ;
  106. }
  107. else if ( iid == IID_IWbemServices )
  108. {
  109. *iplpv = ( LPVOID ) ( IWbemServices * ) this ;
  110. }
  111. else if ( iid == IID_IWbemProviderInit )
  112. {
  113. *iplpv = ( LPVOID ) ( IWbemProviderInit * ) this ;
  114. }
  115. else if ( iid == IID_IWbemShutdown )
  116. {
  117. *iplpv = ( LPVOID ) ( IWbemShutdown * ) this ;
  118. }
  119. if ( *iplpv )
  120. {
  121. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  122. return ResultFromScode ( S_OK ) ;
  123. }
  124. else
  125. {
  126. return ResultFromScode ( E_NOINTERFACE ) ;
  127. }
  128. }
  129. /******************************************************************************
  130. *
  131. * Name:
  132. *
  133. *
  134. * Description:
  135. *
  136. *
  137. *****************************************************************************/
  138. HRESULT CServerObject_IWbemServices::OpenNamespace (
  139. const BSTR a_ObjectPath,
  140. long a_Flags,
  141. IWbemContext *a_Context,
  142. IWbemServices **a_NamespaceService,
  143. IWbemCallResult **a_CallResult
  144. )
  145. {
  146. return WBEM_E_NOT_AVAILABLE ;
  147. }
  148. /******************************************************************************
  149. *
  150. * Name:
  151. *
  152. *
  153. * Description:
  154. *
  155. *
  156. *****************************************************************************/
  157. HRESULT CServerObject_IWbemServices :: CancelAsyncCall (
  158. IWbemObjectSink *a_Sink
  159. )
  160. {
  161. return WBEM_E_NOT_AVAILABLE ;
  162. }
  163. /******************************************************************************
  164. *
  165. * Name:
  166. *
  167. *
  168. * Description:
  169. *
  170. *
  171. *****************************************************************************/
  172. HRESULT CServerObject_IWbemServices :: QueryObjectSink (
  173. long a_Flags,
  174. IWbemObjectSink **a_Sink
  175. )
  176. {
  177. return WBEM_E_NOT_AVAILABLE ;
  178. }
  179. /******************************************************************************
  180. *
  181. * Name:
  182. *
  183. *
  184. * Description:
  185. *
  186. *
  187. *****************************************************************************/
  188. HRESULT CServerObject_IWbemServices :: GetObject (
  189. const BSTR a_ObjectPath,
  190. long a_Flags,
  191. IWbemContext *a_Context,
  192. IWbemClassObject **a_Object,
  193. IWbemCallResult **a_CallResult
  194. )
  195. {
  196. return WBEM_E_NOT_AVAILABLE ;
  197. }
  198. /******************************************************************************
  199. *
  200. * Name:
  201. *
  202. *
  203. * Description:
  204. *
  205. *
  206. *****************************************************************************/
  207. HRESULT CServerObject_IWbemServices :: Write_Msft_WmiProvider_Counters (
  208. IWbemClassObject *a_Object
  209. )
  210. {
  211. if ( ProviderSubSystem_Globals :: GetSharedCounters () )
  212. {
  213. _IWmiObject *t_FastObject = NULL ;
  214. HRESULT t_Result = a_Object->QueryInterface ( IID__IWmiObject , ( void ** ) & t_FastObject ) ;
  215. if ( SUCCEEDED ( t_Result ) )
  216. {
  217. t_FastObject->WriteProp (
  218. L"ProviderOperation_GetObjectAsync" ,
  219. 0 ,
  220. sizeof ( UINT64 ) ,
  221. 1 ,
  222. CIM_UINT64 ,
  223. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_GetObjectAsync
  224. ) ;
  225. t_FastObject->WriteProp (
  226. L"ProviderOperation_PutClassAsync" ,
  227. 0 ,
  228. sizeof ( UINT64 ) ,
  229. 1 ,
  230. CIM_UINT64 ,
  231. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_PutClassAsync
  232. ) ;
  233. t_FastObject->WriteProp (
  234. L"ProviderOperation_DeleteClassAsync" ,
  235. 0 ,
  236. sizeof ( UINT64 ) ,
  237. 1 ,
  238. CIM_UINT64 ,
  239. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_DeleteClassAsync
  240. ) ;
  241. t_FastObject->WriteProp (
  242. L"ProviderOperation_CreateClassEnumAsync" ,
  243. 0 ,
  244. sizeof ( UINT64 ) ,
  245. 1 ,
  246. CIM_UINT64 ,
  247. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_CreateClassEnumAsync
  248. ) ;
  249. t_FastObject->WriteProp (
  250. L"ProviderOperation_PutInstanceAsync" ,
  251. 0 ,
  252. sizeof ( UINT64 ) ,
  253. 1 ,
  254. CIM_UINT64 ,
  255. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_PutInstanceAsync
  256. ) ;
  257. t_FastObject->WriteProp (
  258. L"ProviderOperation_CreateInstanceEnumAsync" ,
  259. 0 ,
  260. sizeof ( UINT64 ) ,
  261. 1 ,
  262. CIM_UINT64 ,
  263. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_CreateInstanceEnumAsync
  264. ) ;
  265. t_FastObject->WriteProp (
  266. L"ProviderOperation_ExecQueryAsync" ,
  267. 0 ,
  268. sizeof ( UINT64 ) ,
  269. 1 ,
  270. CIM_UINT64 ,
  271. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_ExecQueryAsync
  272. ) ;
  273. t_FastObject->WriteProp (
  274. L"ProviderOperation_ExecNotificationQueryAsync" ,
  275. 0 ,
  276. sizeof ( UINT64 ) ,
  277. 1 ,
  278. CIM_UINT64 ,
  279. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_ExecNotificationQueryAsync
  280. ) ;
  281. t_FastObject->WriteProp (
  282. L"ProviderOperation_DeleteInstanceAsync" ,
  283. 0 ,
  284. sizeof ( UINT64 ) ,
  285. 1 ,
  286. CIM_UINT64 ,
  287. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_DeleteInstanceAsync
  288. ) ;
  289. t_FastObject->WriteProp (
  290. L"ProviderOperation_ExecMethodAsync" ,
  291. 0 ,
  292. sizeof ( UINT64 ) ,
  293. 1 ,
  294. CIM_UINT64 ,
  295. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_ExecMethodAsync
  296. ) ;
  297. t_FastObject->WriteProp (
  298. L"ProviderOperation_QueryInstances" ,
  299. 0 ,
  300. sizeof ( UINT64 ) ,
  301. 1 ,
  302. CIM_UINT64,
  303. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_QueryInstances
  304. ) ;
  305. t_FastObject->WriteProp (
  306. L"ProviderOperation_CreateRefresher" ,
  307. 0 ,
  308. sizeof ( UINT64 ) ,
  309. 1 ,
  310. CIM_UINT64,
  311. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_CreateRefresher
  312. ) ;
  313. t_FastObject->WriteProp (
  314. L"ProviderOperation_CreateRefreshableObject" ,
  315. 0 ,
  316. sizeof ( UINT64 ) ,
  317. 1 ,
  318. CIM_UINT64,
  319. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_CreateRefreshableObject
  320. ) ;
  321. t_FastObject->WriteProp (
  322. L"ProviderOperation_StopRefreshing" ,
  323. 0 ,
  324. sizeof ( UINT64 ) ,
  325. 1 ,
  326. CIM_UINT64,
  327. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_StopRefreshing
  328. ) ;
  329. t_FastObject->WriteProp (
  330. L"ProviderOperation_CreateRefreshableEnum" ,
  331. 0 ,
  332. sizeof ( UINT64 ) ,
  333. 1 ,
  334. CIM_UINT64,
  335. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_CreateRefreshableEnum
  336. ) ;
  337. t_FastObject->WriteProp (
  338. L"ProviderOperation_GetObjects" ,
  339. 0 ,
  340. sizeof ( UINT64 ) ,
  341. 1 ,
  342. CIM_UINT64,
  343. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_GetObjects
  344. ) ;
  345. t_FastObject->WriteProp (
  346. L"ProviderOperation_GetProperty" ,
  347. 0 ,
  348. sizeof ( UINT64 ) ,
  349. 1 ,
  350. CIM_UINT64,
  351. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_GetProperty
  352. ) ;
  353. t_FastObject->WriteProp (
  354. L"ProviderOperation_PutProperty" ,
  355. 0 ,
  356. sizeof ( UINT64 ) ,
  357. 1 ,
  358. CIM_UINT64,
  359. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_PutProperty
  360. ) ;
  361. t_FastObject->WriteProp (
  362. L"ProviderOperation_ProvideEvents" ,
  363. 0 ,
  364. sizeof ( UINT64 ) ,
  365. 1 ,
  366. CIM_UINT64,
  367. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_ProvideEvents
  368. ) ;
  369. t_FastObject->WriteProp (
  370. L"ProviderOperation_NewQuery" ,
  371. 0 ,
  372. sizeof ( UINT64 ) ,
  373. 1 ,
  374. CIM_UINT64,
  375. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_NewQuery
  376. ) ;
  377. t_FastObject->WriteProp (
  378. L"ProviderOperation_CancelQuery" ,
  379. 0 ,
  380. sizeof ( UINT64 ) ,
  381. 1 ,
  382. CIM_UINT64,
  383. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_CancelQuery
  384. ) ;
  385. t_FastObject->WriteProp (
  386. L"ProviderOperation_AccessCheck" ,
  387. 0 ,
  388. sizeof ( UINT64 ) ,
  389. 1 ,
  390. CIM_UINT64,
  391. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_AccessCheck
  392. ) ;
  393. t_FastObject->WriteProp (
  394. L"ProviderOperation_SetRegistrationObject" ,
  395. 0 ,
  396. sizeof ( UINT64 ) ,
  397. 1 ,
  398. CIM_UINT64,
  399. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_SetRegistrationObject
  400. ) ;
  401. t_FastObject->WriteProp (
  402. L"ProviderOperation_FindConsumer" ,
  403. 0 ,
  404. sizeof ( UINT64 ) ,
  405. 1 ,
  406. CIM_UINT64,
  407. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_FindConsumer
  408. ) ;
  409. t_FastObject->WriteProp (
  410. L"ProviderOperation_ValidateSubscription" ,
  411. 0 ,
  412. sizeof ( UINT64 ) ,
  413. 1 ,
  414. CIM_UINT64,
  415. & ProviderSubSystem_Globals :: GetSharedCounters ()->m_ProviderOperation_ValidateSubscription
  416. ) ;
  417. t_FastObject->Release () ;
  418. }
  419. return t_Result ;
  420. }
  421. return WBEM_E_NOT_AVAILABLE ;
  422. }
  423. /******************************************************************************
  424. *
  425. * Name:
  426. *
  427. *
  428. * Description:
  429. *
  430. *
  431. *****************************************************************************/
  432. HRESULT CServerObject_IWbemServices :: GetObjectAsync_Msft_WmiProvider_Counters (
  433. IWbemPath *a_Path,
  434. BSTR a_Class ,
  435. const BSTR a_ObjectPath,
  436. long a_Flags,
  437. IWbemContext *a_Context,
  438. IWbemObjectSink *a_Sink
  439. )
  440. {
  441. HRESULT t_Result = S_OK ;
  442. ULONGLONG t_Information = 0 ;
  443. t_Result = a_Path->GetInfo (
  444. 0 ,
  445. & t_Information
  446. ) ;
  447. if ( t_Information & WBEMPATH_INFO_IS_SINGLETON )
  448. {
  449. IWbemClassObject *t_Object = NULL ;
  450. t_Result = m_Service->GetObject (
  451. a_Class ,
  452. 0 ,
  453. a_Context ,
  454. & t_Object ,
  455. NULL
  456. ) ;
  457. if ( SUCCEEDED ( t_Result ) )
  458. {
  459. IWbemClassObject *t_Instance = NULL ;
  460. t_Result = t_Object->SpawnInstance (
  461. 0 ,
  462. & t_Instance
  463. ) ;
  464. if ( SUCCEEDED ( t_Result ) )
  465. {
  466. t_Result = Write_Msft_WmiProvider_Counters (
  467. t_Instance
  468. ) ;
  469. if ( SUCCEEDED ( t_Result ) )
  470. {
  471. t_Result = a_Sink->Indicate ( 1 , & t_Instance ) ;
  472. t_Instance->Release () ;
  473. }
  474. }
  475. }
  476. }
  477. else
  478. {
  479. t_Result = WBEM_E_INVALID_OBJECT_PATH ;
  480. }
  481. return t_Result ;
  482. }
  483. /******************************************************************************
  484. *
  485. * Name:
  486. *
  487. *
  488. * Description:
  489. *
  490. *
  491. *****************************************************************************/
  492. HRESULT CServerObject_IWbemServices :: GetObjectAsync_Msft_Providers (
  493. IWbemPath *a_Path,
  494. BSTR a_Class ,
  495. const BSTR a_ObjectPath,
  496. long a_Flags,
  497. IWbemContext *a_Context,
  498. IWbemObjectSink *a_Sink
  499. )
  500. {
  501. HRESULT t_Result = S_OK ;
  502. CWbemGlobal_IWmiProvSubSysController *t_SubSystemController = ProviderSubSystem_Globals :: GetProvSubSysController () ;
  503. if ( t_SubSystemController )
  504. {
  505. t_SubSystemController->Lock () ;
  506. CWbemGlobal_IWmiProvSubSysController_Container *t_Container = NULL ;
  507. t_SubSystemController->GetContainer ( t_Container ) ;
  508. if ( t_Container->Size () )
  509. {
  510. CWbemGlobal_IWmiProvSubSysController_Container_Iterator t_Iterator = t_Container->Begin ();
  511. _IWmiProviderConfiguration **t_ControllerElements = new _IWmiProviderConfiguration * [ t_Container->Size () ] ;
  512. if ( t_ControllerElements )
  513. {
  514. ULONG t_Count = 0 ;
  515. while ( ! t_Iterator.Null () )
  516. {
  517. HRESULT t_Result = t_Iterator.GetElement ()->QueryInterface ( IID__IWmiProviderConfiguration , ( void ** ) & t_ControllerElements [ t_Count ] ) ;
  518. t_Iterator.Increment () ;
  519. t_Count ++ ;
  520. }
  521. t_SubSystemController->UnLock () ;
  522. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  523. {
  524. if ( t_ControllerElements [ t_Index ] )
  525. {
  526. t_Result = t_ControllerElements [ t_Index ]->Get (
  527. m_Service ,
  528. a_Flags,
  529. a_Context,
  530. a_Class ,
  531. a_ObjectPath,
  532. a_Sink
  533. ) ;
  534. t_ControllerElements [ t_Index ]->Release () ;
  535. }
  536. }
  537. delete [] t_ControllerElements ;
  538. }
  539. else
  540. {
  541. t_SubSystemController->UnLock () ;
  542. }
  543. }
  544. else
  545. {
  546. t_SubSystemController->UnLock () ;
  547. }
  548. }
  549. else
  550. {
  551. t_Result = WBEM_E_CRITICAL_ERROR ;
  552. }
  553. return t_Result ;
  554. }
  555. /******************************************************************************
  556. *
  557. * Name:
  558. *
  559. *
  560. * Description:
  561. *
  562. *
  563. *****************************************************************************/
  564. HRESULT CServerObject_IWbemServices :: GetObjectAsync (
  565. const BSTR a_ObjectPath,
  566. long a_Flags,
  567. IWbemContext *a_Context,
  568. IWbemObjectSink *a_Sink
  569. )
  570. {
  571. HRESULT t_Result = S_OK ;
  572. IWbemPath *t_Path = NULL ;
  573. if ( a_ObjectPath )
  574. {
  575. t_Result = CoCreateInstance (
  576. CLSID_WbemDefPath ,
  577. NULL ,
  578. CLSCTX_INPROC_SERVER ,
  579. IID_IWbemPath ,
  580. ( void ** ) & t_Path
  581. ) ;
  582. if ( SUCCEEDED ( t_Result ) )
  583. {
  584. t_Result = t_Path->SetText ( WBEMPATH_CREATE_ACCEPT_ALL , a_ObjectPath ) ;
  585. if ( SUCCEEDED ( t_Result ) )
  586. {
  587. ULONG t_Length = 32 ; // None of supported classes is longer than this length
  588. BSTR t_Class = SysAllocStringLen ( NULL , t_Length ) ;
  589. if ( t_Class )
  590. {
  591. t_Result = t_Path->GetClassName (
  592. & t_Length ,
  593. t_Class
  594. ) ;
  595. if ( SUCCEEDED ( t_Result ) )
  596. {
  597. if ( wbem_wcsicmp ( t_Class , L"Msft_WmiProvider_Counters" ) == 0 )
  598. {
  599. t_Result = GetObjectAsync_Msft_WmiProvider_Counters (
  600. t_Path ,
  601. t_Class ,
  602. a_ObjectPath,
  603. a_Flags,
  604. a_Context,
  605. a_Sink
  606. ) ;
  607. }
  608. else if ( wbem_wcsicmp ( t_Class , L"Msft_Providers" ) == 0 )
  609. {
  610. t_Result = GetObjectAsync_Msft_Providers (
  611. t_Path ,
  612. t_Class ,
  613. a_ObjectPath,
  614. a_Flags,
  615. a_Context,
  616. a_Sink
  617. ) ;
  618. }
  619. else
  620. {
  621. t_Result = WBEM_E_INVALID_CLASS ;
  622. }
  623. }
  624. else
  625. {
  626. t_Result = WBEM_E_INVALID_CLASS ;
  627. }
  628. SysFreeString ( t_Class ) ;
  629. }
  630. else
  631. {
  632. t_Result = WBEM_E_OUT_OF_MEMORY ;
  633. }
  634. }
  635. }
  636. t_Path->Release () ;
  637. }
  638. else
  639. {
  640. t_Result = WBEM_E_INVALID_PARAMETER ;
  641. }
  642. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  643. return t_Result ;
  644. }
  645. /******************************************************************************
  646. *
  647. * Name:
  648. *
  649. *
  650. * Description:
  651. *
  652. *
  653. *****************************************************************************/
  654. HRESULT CServerObject_IWbemServices :: PutClass (
  655. IWbemClassObject *a_Object,
  656. long a_Flags,
  657. IWbemContext *a_Context,
  658. IWbemCallResult **a_CallResult
  659. )
  660. {
  661. return WBEM_E_NOT_AVAILABLE ;
  662. }
  663. /******************************************************************************
  664. *
  665. * Name:
  666. *
  667. *
  668. * Description:
  669. *
  670. *
  671. *****************************************************************************/
  672. HRESULT CServerObject_IWbemServices :: PutClassAsync (
  673. IWbemClassObject *a_Object,
  674. long a_Flags,
  675. IWbemContext *a_Context,
  676. IWbemObjectSink *a_Sink
  677. )
  678. {
  679. return WBEM_E_NOT_AVAILABLE ;
  680. }
  681. /******************************************************************************
  682. *
  683. * Name:
  684. *
  685. *
  686. * Description:
  687. *
  688. *
  689. *****************************************************************************/
  690. HRESULT CServerObject_IWbemServices :: DeleteClass (
  691. const BSTR a_Class,
  692. long a_Flags,
  693. IWbemContext *a_Context,
  694. IWbemCallResult **a_CallResult
  695. )
  696. {
  697. return WBEM_E_NOT_AVAILABLE ;
  698. }
  699. /******************************************************************************
  700. *
  701. * Name:
  702. *
  703. *
  704. * Description:
  705. *
  706. *
  707. *****************************************************************************/
  708. HRESULT CServerObject_IWbemServices :: DeleteClassAsync (
  709. const BSTR a_Class,
  710. long a_Flags,
  711. IWbemContext *a_Context,
  712. IWbemObjectSink *a_Sink
  713. )
  714. {
  715. return WBEM_E_NOT_AVAILABLE ;
  716. }
  717. /******************************************************************************
  718. *
  719. * Name:
  720. *
  721. *
  722. * Description:
  723. *
  724. *
  725. *****************************************************************************/
  726. HRESULT CServerObject_IWbemServices :: CreateClassEnum (
  727. const BSTR a_Superclass,
  728. long a_Flags,
  729. IWbemContext *a_Context,
  730. IEnumWbemClassObject **a_Enum
  731. )
  732. {
  733. return WBEM_E_NOT_AVAILABLE ;
  734. }
  735. /******************************************************************************
  736. *
  737. * Name:
  738. *
  739. *
  740. * Description:
  741. *
  742. *
  743. *****************************************************************************/
  744. SCODE CServerObject_IWbemServices :: CreateClassEnumAsync (
  745. const BSTR a_Superclass,
  746. long a_Flags,
  747. IWbemContext *a_Context,
  748. IWbemObjectSink *a_Sink
  749. )
  750. {
  751. return WBEM_E_NOT_AVAILABLE ;
  752. }
  753. /******************************************************************************
  754. *
  755. * Name:
  756. *
  757. *
  758. * Description:
  759. *
  760. *
  761. *****************************************************************************/
  762. HRESULT CServerObject_IWbemServices :: PutInstance (
  763. IWbemClassObject *a_Instance,
  764. long a_Flags,
  765. IWbemContext *a_Context,
  766. IWbemCallResult **a_CallResult
  767. )
  768. {
  769. return WBEM_E_NOT_AVAILABLE ;
  770. }
  771. /******************************************************************************
  772. *
  773. * Name:
  774. *
  775. *
  776. * Description:
  777. *
  778. *
  779. *****************************************************************************/
  780. HRESULT CServerObject_IWbemServices :: PutInstanceAsync (
  781. IWbemClassObject *a_Instance,
  782. long a_Flags,
  783. IWbemContext *a_Context,
  784. IWbemObjectSink *a_Sink
  785. )
  786. {
  787. return WBEM_E_NOT_AVAILABLE ;
  788. }
  789. /******************************************************************************
  790. *
  791. * Name:
  792. *
  793. *
  794. * Description:
  795. *
  796. *
  797. *****************************************************************************/
  798. HRESULT CServerObject_IWbemServices :: DeleteInstance (
  799. const BSTR a_ObjectPath,
  800. long a_Flags,
  801. IWbemContext *a_Context,
  802. IWbemCallResult **a_CallResult
  803. )
  804. {
  805. return WBEM_E_NOT_AVAILABLE ;
  806. }
  807. /******************************************************************************
  808. *
  809. * Name:
  810. *
  811. *
  812. * Description:
  813. *
  814. *
  815. *****************************************************************************/
  816. HRESULT CServerObject_IWbemServices :: DeleteInstanceAsync (
  817. const BSTR a_ObjectPath,
  818. long a_Flags,
  819. IWbemContext *a_Context,
  820. IWbemObjectSink *a_Sink
  821. )
  822. {
  823. return WBEM_E_NOT_AVAILABLE ;
  824. }
  825. /******************************************************************************
  826. *
  827. * Name:
  828. *
  829. *
  830. * Description:
  831. *
  832. *
  833. *****************************************************************************/
  834. HRESULT CServerObject_IWbemServices :: CreateInstanceEnum (
  835. const BSTR a_Class,
  836. long a_Flags,
  837. IWbemContext FAR *a_Context,
  838. IEnumWbemClassObject **a_Enum
  839. )
  840. {
  841. return WBEM_E_NOT_AVAILABLE ;
  842. }
  843. /******************************************************************************
  844. *
  845. * Name:
  846. *
  847. *
  848. * Description:
  849. *
  850. *
  851. *****************************************************************************/
  852. HRESULT CServerObject_IWbemServices :: CreateInstanceEnumAsync_Msft_Providers (
  853. const BSTR a_Class,
  854. long a_Flags,
  855. IWbemContext *a_Context,
  856. IWbemObjectSink *a_Sink
  857. )
  858. {
  859. HRESULT t_Result = S_OK ;
  860. CWbemGlobal_IWmiProvSubSysController *t_SubSystemController = ProviderSubSystem_Globals :: GetProvSubSysController () ;
  861. if ( t_SubSystemController )
  862. {
  863. t_SubSystemController->Lock () ;
  864. CWbemGlobal_IWmiProvSubSysController_Container *t_Container = NULL ;
  865. t_SubSystemController->GetContainer ( t_Container ) ;
  866. if ( t_Container->Size () )
  867. {
  868. CWbemGlobal_IWmiProvSubSysController_Container_Iterator t_Iterator = t_Container->Begin ();
  869. _IWmiProviderConfiguration **t_ControllerElements = new _IWmiProviderConfiguration * [ t_Container->Size () ] ;
  870. if ( t_ControllerElements )
  871. {
  872. ULONG t_Count = 0 ;
  873. while ( ! t_Iterator.Null () )
  874. {
  875. HRESULT t_Result = t_Iterator.GetElement ()->QueryInterface ( IID__IWmiProviderConfiguration , ( void ** ) & t_ControllerElements [ t_Count ] ) ;
  876. t_Iterator.Increment () ;
  877. t_Count ++ ;
  878. }
  879. t_SubSystemController->UnLock () ;
  880. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  881. {
  882. if ( t_ControllerElements [ t_Index ] )
  883. {
  884. HRESULT t_Result = t_ControllerElements [ t_Index ]->Enumerate (
  885. m_Service ,
  886. a_Flags,
  887. a_Context,
  888. a_Class,
  889. a_Sink
  890. ) ;
  891. t_ControllerElements [ t_Index ]->Release () ;
  892. }
  893. }
  894. delete [] t_ControllerElements ;
  895. }
  896. else
  897. {
  898. t_SubSystemController->UnLock () ;
  899. }
  900. }
  901. else
  902. {
  903. t_SubSystemController->UnLock () ;
  904. }
  905. }
  906. else
  907. {
  908. t_Result = WBEM_E_CRITICAL_ERROR ;
  909. }
  910. return t_Result ;
  911. }
  912. /******************************************************************************
  913. *
  914. * Name:
  915. *
  916. *
  917. * Description:
  918. *
  919. *
  920. *****************************************************************************/
  921. HRESULT CServerObject_IWbemServices :: CreateInstanceEnumAsync_Msft_WmiProvider_Counters (
  922. const BSTR a_Class,
  923. long a_Flags,
  924. IWbemContext *a_Context,
  925. IWbemObjectSink *a_Sink
  926. )
  927. {
  928. IWbemClassObject *t_Object = NULL ;
  929. HRESULT t_Result = m_Service->GetObject (
  930. a_Class ,
  931. 0 ,
  932. a_Context ,
  933. & t_Object ,
  934. NULL
  935. ) ;
  936. if ( SUCCEEDED ( t_Result ) )
  937. {
  938. IWbemClassObject *t_Instance = NULL ;
  939. t_Result = t_Object->SpawnInstance (
  940. 0 ,
  941. & t_Instance
  942. ) ;
  943. if ( SUCCEEDED ( t_Result ) )
  944. {
  945. t_Result = Write_Msft_WmiProvider_Counters (
  946. t_Instance
  947. ) ;
  948. if ( SUCCEEDED ( t_Result ) )
  949. {
  950. t_Result = a_Sink->Indicate ( 1 , & t_Instance ) ;
  951. }
  952. t_Instance->Release () ;
  953. }
  954. t_Object->Release () ;
  955. }
  956. return t_Result ;
  957. }
  958. /******************************************************************************
  959. *
  960. * Name:
  961. *
  962. *
  963. * Description:
  964. *
  965. *
  966. *****************************************************************************/
  967. HRESULT CServerObject_IWbemServices :: CreateInstanceEnumAsync (
  968. const BSTR a_Class,
  969. long a_Flags,
  970. IWbemContext *a_Context,
  971. IWbemObjectSink *a_Sink
  972. )
  973. {
  974. HRESULT t_Result = S_OK ;
  975. if ( wbem_wcsicmp ( a_Class , L"Msft_WmiProvider_Counters" ) == 0 )
  976. {
  977. t_Result = CreateInstanceEnumAsync_Msft_WmiProvider_Counters (
  978. a_Class,
  979. a_Flags,
  980. a_Context,
  981. a_Sink
  982. ) ;
  983. }
  984. else if ( wbem_wcsicmp ( a_Class , L"Msft_Providers" ) == 0 )
  985. {
  986. t_Result = CreateInstanceEnumAsync_Msft_Providers (
  987. a_Class,
  988. a_Flags,
  989. a_Context,
  990. a_Sink
  991. ) ;
  992. }
  993. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  994. return t_Result ;
  995. }
  996. /******************************************************************************
  997. *
  998. * Name:
  999. *
  1000. *
  1001. * Description:
  1002. *
  1003. *
  1004. *****************************************************************************/
  1005. HRESULT CServerObject_IWbemServices :: ExecQuery (
  1006. const BSTR a_QueryLanguage,
  1007. const BSTR a_Query,
  1008. long a_Flags,
  1009. IWbemContext *a_Context,
  1010. IEnumWbemClassObject **a_Enum
  1011. )
  1012. {
  1013. return WBEM_E_NOT_AVAILABLE ;
  1014. }
  1015. /******************************************************************************
  1016. *
  1017. * Name:
  1018. *
  1019. *
  1020. * Description:
  1021. *
  1022. *
  1023. *****************************************************************************/
  1024. HRESULT CServerObject_IWbemServices :: ExecQueryAsync (
  1025. const BSTR a_QueryLanguage,
  1026. const BSTR a_Query,
  1027. long a_Flags,
  1028. IWbemContext *a_Context,
  1029. IWbemObjectSink *a_Sink
  1030. )
  1031. {
  1032. return WBEM_E_NOT_AVAILABLE ;
  1033. }
  1034. /******************************************************************************
  1035. *
  1036. * Name:
  1037. *
  1038. *
  1039. * Description:
  1040. *
  1041. *
  1042. *****************************************************************************/
  1043. HRESULT CServerObject_IWbemServices :: ExecNotificationQuery (
  1044. const BSTR a_QueryLanguage,
  1045. const BSTR a_Query,
  1046. long a_Flags,
  1047. IWbemContext *a_Context,
  1048. IEnumWbemClassObject **a_Enum
  1049. )
  1050. {
  1051. return WBEM_E_NOT_AVAILABLE ;
  1052. }
  1053. /******************************************************************************
  1054. *
  1055. * Name:
  1056. *
  1057. *
  1058. * Description:
  1059. *
  1060. *
  1061. *****************************************************************************/
  1062. HRESULT CServerObject_IWbemServices :: ExecNotificationQueryAsync (
  1063. const BSTR a_QueryLanguage,
  1064. const BSTR a_Query,
  1065. long a_Flags,
  1066. IWbemContext *a_Context,
  1067. IWbemObjectSink *a_Sink
  1068. )
  1069. {
  1070. return WBEM_E_NOT_AVAILABLE ;
  1071. }
  1072. /******************************************************************************
  1073. *
  1074. * Name:
  1075. *
  1076. *
  1077. * Description:
  1078. *
  1079. *
  1080. *****************************************************************************/
  1081. HRESULT STDMETHODCALLTYPE CServerObject_IWbemServices :: ExecMethod (
  1082. const BSTR a_ObjectPath,
  1083. const BSTR a_MethodName,
  1084. long a_Flags,
  1085. IWbemContext *a_Context,
  1086. IWbemClassObject *a_InParams,
  1087. IWbemClassObject **a_OutParams,
  1088. IWbemCallResult **a_CallResult
  1089. )
  1090. {
  1091. return WBEM_E_NOT_AVAILABLE ;
  1092. }
  1093. /******************************************************************************
  1094. *
  1095. * Name:
  1096. *
  1097. *
  1098. * Description:
  1099. *
  1100. *
  1101. *****************************************************************************/
  1102. HRESULT CServerObject_IWbemServices :: Helper_ExecMethodAsync_Suspend (
  1103. IWbemPath *a_Path ,
  1104. const BSTR a_ObjectPath,
  1105. const BSTR a_MethodName,
  1106. long a_Flags,
  1107. IWbemContext *a_Context,
  1108. IWbemClassObject *a_InParams,
  1109. IWbemObjectSink *a_Sink
  1110. )
  1111. {
  1112. HRESULT t_Result = S_OK ;
  1113. CWbemGlobal_IWmiProvSubSysController *t_SubSystemController = ProviderSubSystem_Globals :: GetProvSubSysController () ;
  1114. if ( t_SubSystemController )
  1115. {
  1116. t_SubSystemController->Lock () ;
  1117. CWbemGlobal_IWmiProvSubSysController_Container *t_Container = NULL ;
  1118. t_SubSystemController->GetContainer ( t_Container ) ;
  1119. if ( t_Container->Size () )
  1120. {
  1121. CWbemGlobal_IWmiProvSubSysController_Container_Iterator t_Iterator = t_Container->Begin ();
  1122. _IWmiProviderConfiguration **t_ControllerElements = new _IWmiProviderConfiguration * [ t_Container->Size () ] ;
  1123. if ( t_ControllerElements )
  1124. {
  1125. ULONG t_Count = 0 ;
  1126. while ( ! t_Iterator.Null () )
  1127. {
  1128. HRESULT t_Result = t_Iterator.GetElement ()->QueryInterface ( IID__IWmiProviderConfiguration , ( void ** ) & t_ControllerElements [ t_Count ] ) ;
  1129. t_Iterator.Increment () ;
  1130. t_Count ++ ;
  1131. }
  1132. t_SubSystemController->UnLock () ;
  1133. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  1134. {
  1135. if ( t_ControllerElements [ t_Index ] )
  1136. {
  1137. t_Result = t_ControllerElements [ t_Index ]->Call (
  1138. m_Service ,
  1139. a_Flags ,
  1140. a_Context ,
  1141. L"Msft_Providers" ,
  1142. a_ObjectPath ,
  1143. a_MethodName ,
  1144. a_InParams,
  1145. a_Sink
  1146. ) ;
  1147. t_ControllerElements [ t_Index ]->Release () ;
  1148. }
  1149. }
  1150. delete [] t_ControllerElements ;
  1151. }
  1152. else
  1153. {
  1154. t_SubSystemController->UnLock () ;
  1155. }
  1156. }
  1157. else
  1158. {
  1159. t_SubSystemController->UnLock () ;
  1160. }
  1161. }
  1162. else
  1163. {
  1164. t_Result = WBEM_E_CRITICAL_ERROR ;
  1165. }
  1166. return t_Result ;
  1167. }
  1168. /******************************************************************************
  1169. *
  1170. * Name:
  1171. *
  1172. *
  1173. * Description:
  1174. *
  1175. *
  1176. *****************************************************************************/
  1177. HRESULT CServerObject_IWbemServices :: Helper_ExecMethodAsync_Resume (
  1178. IWbemPath *a_Path ,
  1179. const BSTR a_ObjectPath,
  1180. const BSTR a_MethodName,
  1181. long a_Flags,
  1182. IWbemContext *a_Context,
  1183. IWbemClassObject *a_InParams,
  1184. IWbemObjectSink *a_Sink
  1185. )
  1186. {
  1187. HRESULT t_Result = S_OK ;
  1188. CWbemGlobal_IWmiProvSubSysController *t_SubSystemController = ProviderSubSystem_Globals :: GetProvSubSysController () ;
  1189. if ( t_SubSystemController )
  1190. {
  1191. t_SubSystemController->Lock () ;
  1192. CWbemGlobal_IWmiProvSubSysController_Container *t_Container = NULL ;
  1193. t_SubSystemController->GetContainer ( t_Container ) ;
  1194. if ( t_Container->Size () )
  1195. {
  1196. CWbemGlobal_IWmiProvSubSysController_Container_Iterator t_Iterator = t_Container->Begin ();
  1197. _IWmiProviderConfiguration **t_ControllerElements = new _IWmiProviderConfiguration * [ t_Container->Size () ] ;
  1198. if ( t_ControllerElements )
  1199. {
  1200. ULONG t_Count = 0 ;
  1201. while ( ! t_Iterator.Null () )
  1202. {
  1203. HRESULT t_Result = t_Iterator.GetElement ()->QueryInterface ( IID__IWmiProviderConfiguration , ( void ** ) & t_ControllerElements [ t_Count ] ) ;
  1204. t_Iterator.Increment () ;
  1205. t_Count ++ ;
  1206. }
  1207. t_SubSystemController->UnLock () ;
  1208. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  1209. {
  1210. if ( t_ControllerElements [ t_Index ] )
  1211. {
  1212. t_Result = t_ControllerElements [ t_Index ]->Call (
  1213. m_Service ,
  1214. a_Flags ,
  1215. a_Context ,
  1216. L"Msft_Providers" ,
  1217. a_ObjectPath ,
  1218. a_MethodName ,
  1219. a_InParams,
  1220. a_Sink
  1221. ) ;
  1222. t_ControllerElements [ t_Index ]->Release () ;
  1223. }
  1224. }
  1225. delete [] t_ControllerElements ;
  1226. }
  1227. else
  1228. {
  1229. t_SubSystemController->UnLock () ;
  1230. }
  1231. }
  1232. else
  1233. {
  1234. t_SubSystemController->UnLock () ;
  1235. }
  1236. }
  1237. else
  1238. {
  1239. t_Result = WBEM_E_CRITICAL_ERROR ;
  1240. }
  1241. return t_Result ;
  1242. }
  1243. /******************************************************************************
  1244. *
  1245. * Name:
  1246. *
  1247. *
  1248. * Description:
  1249. *
  1250. *
  1251. *****************************************************************************/
  1252. HRESULT CServerObject_IWbemServices :: Helper_ExecMethodAsync_Load (
  1253. IWbemPath *a_Path ,
  1254. const BSTR a_ObjectPath,
  1255. const BSTR a_MethodName,
  1256. long a_Flags,
  1257. IWbemContext *a_Context,
  1258. IWbemClassObject *a_InParams,
  1259. IWbemObjectSink *a_Sink
  1260. )
  1261. {
  1262. HRESULT t_Result = S_OK ;
  1263. CWbemGlobal_IWmiProvSubSysController *t_SubSystemController = ProviderSubSystem_Globals :: GetProvSubSysController () ;
  1264. if ( t_SubSystemController )
  1265. {
  1266. t_SubSystemController->Lock () ;
  1267. CWbemGlobal_IWmiProvSubSysController_Container *t_Container = NULL ;
  1268. t_SubSystemController->GetContainer ( t_Container ) ;
  1269. if ( t_Container->Size () )
  1270. {
  1271. CWbemGlobal_IWmiProvSubSysController_Container_Iterator t_Iterator = t_Container->Begin ();
  1272. _IWmiProviderConfiguration **t_ControllerElements = new _IWmiProviderConfiguration * [ t_Container->Size () ] ;
  1273. if ( t_ControllerElements )
  1274. {
  1275. ULONG t_Count = 0 ;
  1276. while ( ! t_Iterator.Null () )
  1277. {
  1278. HRESULT t_Result = t_Iterator.GetElement ()->QueryInterface ( IID__IWmiProviderConfiguration , ( void ** ) & t_ControllerElements [ t_Count ] ) ;
  1279. t_Iterator.Increment () ;
  1280. t_Count ++ ;
  1281. }
  1282. t_SubSystemController->UnLock () ;
  1283. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  1284. {
  1285. if ( t_ControllerElements [ t_Index ] )
  1286. {
  1287. t_Result = t_ControllerElements [ t_Index ]->Call (
  1288. m_Service ,
  1289. a_Flags ,
  1290. a_Context ,
  1291. L"Msft_Providers" ,
  1292. a_ObjectPath ,
  1293. a_MethodName ,
  1294. a_InParams,
  1295. a_Sink
  1296. ) ;
  1297. t_ControllerElements [ t_Index ]->Release () ;
  1298. }
  1299. }
  1300. delete [] t_ControllerElements ;
  1301. }
  1302. else
  1303. {
  1304. t_SubSystemController->UnLock () ;
  1305. }
  1306. }
  1307. else
  1308. {
  1309. t_SubSystemController->UnLock () ;
  1310. }
  1311. }
  1312. else
  1313. {
  1314. t_Result = WBEM_E_CRITICAL_ERROR ;
  1315. }
  1316. return t_Result ;
  1317. }
  1318. /******************************************************************************
  1319. *
  1320. * Name:
  1321. *
  1322. *
  1323. * Description:
  1324. *
  1325. *
  1326. *****************************************************************************/
  1327. HRESULT CServerObject_IWbemServices :: Helper_ExecMethodAsync_UnLoad (
  1328. IWbemPath *a_Path ,
  1329. const BSTR a_ObjectPath,
  1330. const BSTR a_MethodName,
  1331. long a_Flags,
  1332. IWbemContext *a_Context,
  1333. IWbemClassObject *a_InParams,
  1334. IWbemObjectSink *a_Sink
  1335. )
  1336. {
  1337. HRESULT t_Result = S_OK ;
  1338. CWbemGlobal_IWmiProvSubSysController *t_SubSystemController = ProviderSubSystem_Globals :: GetProvSubSysController () ;
  1339. if ( t_SubSystemController )
  1340. {
  1341. t_SubSystemController->Lock () ;
  1342. CWbemGlobal_IWmiProvSubSysController_Container *t_Container = NULL ;
  1343. t_SubSystemController->GetContainer ( t_Container ) ;
  1344. if ( t_Container->Size () )
  1345. {
  1346. CWbemGlobal_IWmiProvSubSysController_Container_Iterator t_Iterator = t_Container->Begin ();
  1347. _IWmiProviderConfiguration **t_ControllerElements = new _IWmiProviderConfiguration * [ t_Container->Size () ] ;
  1348. if ( t_ControllerElements )
  1349. {
  1350. ULONG t_Count = 0 ;
  1351. while ( ! t_Iterator.Null () )
  1352. {
  1353. HRESULT t_Result = t_Iterator.GetElement ()->QueryInterface ( IID__IWmiProviderConfiguration , ( void ** ) & t_ControllerElements [ t_Count ] ) ;
  1354. t_Iterator.Increment () ;
  1355. t_Count ++ ;
  1356. }
  1357. t_SubSystemController->UnLock () ;
  1358. for ( ULONG t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
  1359. {
  1360. if ( t_ControllerElements [ t_Index ] )
  1361. {
  1362. t_Result = t_ControllerElements [ t_Index ]->Call (
  1363. m_Service ,
  1364. a_Flags ,
  1365. a_Context ,
  1366. L"Msft_Providers" ,
  1367. a_ObjectPath ,
  1368. a_MethodName ,
  1369. a_InParams,
  1370. a_Sink
  1371. ) ;
  1372. t_ControllerElements [ t_Index ]->Release () ;
  1373. }
  1374. }
  1375. delete [] t_ControllerElements ;
  1376. }
  1377. else
  1378. {
  1379. t_SubSystemController->UnLock () ;
  1380. }
  1381. }
  1382. else
  1383. {
  1384. t_SubSystemController->UnLock () ;
  1385. }
  1386. }
  1387. else
  1388. {
  1389. t_Result = WBEM_E_CRITICAL_ERROR ;
  1390. }
  1391. return t_Result ;
  1392. }
  1393. /******************************************************************************
  1394. *
  1395. * Name:
  1396. *
  1397. *
  1398. * Description:
  1399. *
  1400. *
  1401. *****************************************************************************/
  1402. HRESULT CServerObject_IWbemServices :: ExecMethodAsync (
  1403. const BSTR a_ObjectPath,
  1404. const BSTR a_MethodName,
  1405. long a_Flags,
  1406. IWbemContext *a_Context,
  1407. IWbemClassObject *a_InParams,
  1408. IWbemObjectSink *a_Sink
  1409. )
  1410. {
  1411. HRESULT t_Result = S_OK ;
  1412. t_Result = CoImpersonateClient () ;
  1413. if ( SUCCEEDED ( t_Result ) )
  1414. {
  1415. t_Result = ProviderSubSystem_Common_Globals :: Check_SecurityDescriptor_CallIdentity (
  1416. ProviderSubSystem_Common_Globals :: GetMethodSecurityDescriptor () ,
  1417. MASK_PROVIDER_BINDING_BIND ,
  1418. & g_ProviderBindingMapping
  1419. ) ;
  1420. CoRevertToSelf () ;
  1421. }
  1422. if ( SUCCEEDED ( t_Result ) )
  1423. {
  1424. IWbemPath *t_Path = NULL ;
  1425. if ( a_ObjectPath && a_MethodName )
  1426. {
  1427. t_Result = CoCreateInstance (
  1428. CLSID_WbemDefPath ,
  1429. NULL ,
  1430. CLSCTX_INPROC_SERVER ,
  1431. IID_IWbemPath ,
  1432. ( void ** ) & t_Path
  1433. ) ;
  1434. if ( SUCCEEDED ( t_Result ) )
  1435. {
  1436. t_Result = t_Path->SetText ( WBEMPATH_CREATE_ACCEPT_ALL , a_ObjectPath ) ;
  1437. if ( SUCCEEDED ( t_Result ) )
  1438. {
  1439. ULONG t_Length = 32 ; // None of supported classes is longer than this length
  1440. BSTR t_Class = SysAllocStringLen ( NULL , t_Length ) ;
  1441. if ( t_Class )
  1442. {
  1443. t_Result = t_Path->GetClassName (
  1444. & t_Length ,
  1445. t_Class
  1446. ) ;
  1447. if ( SUCCEEDED ( t_Result ) )
  1448. {
  1449. if ( wbem_wcsicmp ( t_Class , L"Msft_Providers" ) == 0 )
  1450. {
  1451. if ( wbem_wcsicmp ( a_MethodName , L"Suspend" ) == 0 )
  1452. {
  1453. t_Result = Helper_ExecMethodAsync_Suspend (
  1454. t_Path ,
  1455. a_ObjectPath,
  1456. a_MethodName,
  1457. a_Flags,
  1458. a_Context,
  1459. a_InParams,
  1460. a_Sink
  1461. ) ;
  1462. }
  1463. else if ( wbem_wcsicmp ( a_MethodName , L"Resume" ) == 0 )
  1464. {
  1465. t_Result = Helper_ExecMethodAsync_Resume (
  1466. t_Path ,
  1467. a_ObjectPath,
  1468. a_MethodName,
  1469. a_Flags,
  1470. a_Context,
  1471. a_InParams,
  1472. a_Sink
  1473. ) ;
  1474. }
  1475. else if ( wbem_wcsicmp ( a_MethodName , L"Load" ) == 0 )
  1476. {
  1477. t_Result = Helper_ExecMethodAsync_Load (
  1478. t_Path ,
  1479. a_ObjectPath,
  1480. a_MethodName,
  1481. a_Flags,
  1482. a_Context,
  1483. a_InParams,
  1484. a_Sink
  1485. ) ;
  1486. }
  1487. else if ( wbem_wcsicmp ( a_MethodName , L"UnLoad" ) == 0 )
  1488. {
  1489. t_Result = Helper_ExecMethodAsync_UnLoad (
  1490. t_Path ,
  1491. a_ObjectPath,
  1492. a_MethodName,
  1493. a_Flags,
  1494. a_Context,
  1495. a_InParams,
  1496. a_Sink
  1497. ) ;
  1498. }
  1499. }
  1500. else
  1501. {
  1502. t_Result = WBEM_E_INVALID_CLASS ;
  1503. }
  1504. }
  1505. SysFreeString ( t_Class ) ;
  1506. }
  1507. }
  1508. t_Path->Release () ;
  1509. }
  1510. }
  1511. else
  1512. {
  1513. t_Result = WBEM_E_INVALID_PARAMETER ;
  1514. t_Result = WBEM_E_INVALID_OBJECT_PATH ;
  1515. }
  1516. }
  1517. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  1518. return t_Result ;
  1519. }
  1520. /******************************************************************************
  1521. *
  1522. * Name:
  1523. *
  1524. *
  1525. * Description:
  1526. *
  1527. *
  1528. *****************************************************************************/
  1529. HRESULT CServerObject_IWbemServices :: Initialize (
  1530. LPWSTR a_User,
  1531. LONG a_Flags,
  1532. LPWSTR a_Namespace,
  1533. LPWSTR a_Locale,
  1534. IWbemServices *a_Core ,
  1535. IWbemContext *a_Context ,
  1536. IWbemProviderInitSink *a_Sink
  1537. )
  1538. {
  1539. HRESULT t_Result = S_OK ;
  1540. m_Service = a_Core ;
  1541. if ( m_Service )
  1542. {
  1543. m_Service->AddRef () ;
  1544. }
  1545. else
  1546. {
  1547. t_Result = WBEM_E_INVALID_PARAMETER ;
  1548. }
  1549. a_Sink->SetStatus ( t_Result , 0 ) ;
  1550. return t_Result ;
  1551. }
  1552. /******************************************************************************
  1553. *
  1554. * Name:
  1555. *
  1556. *
  1557. * Description:
  1558. *
  1559. *
  1560. *****************************************************************************/
  1561. HRESULT CServerObject_IWbemServices :: Shutdown (
  1562. LONG a_Flags ,
  1563. ULONG a_MaxMilliSeconds ,
  1564. IWbemContext *a_Context
  1565. )
  1566. {
  1567. return S_OK ;
  1568. }