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.

4954 lines
116 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 <typeinfo.h>
  10. #include <wbemint.h>
  11. #include <Like.h>
  12. #include "Globals.h"
  13. #include "CGlobals.h"
  14. #include "ProvAggr.h"
  15. #include "ProvFact.h"
  16. #include "ProvObSk.h"
  17. #include "ProvInSk.h"
  18. #include "ProvRegInfo.h"
  19. /******************************************************************************
  20. *
  21. * Name:
  22. *
  23. *
  24. * Description:
  25. *
  26. *
  27. *****************************************************************************/
  28. CAggregator_IWbemProvider :: CAggregator_IWbemProvider (
  29. WmiAllocator &a_Allocator ,
  30. CWbemGlobal_IWmiProviderController *a_Controller ,
  31. _IWmiProviderFactory *a_Factory ,
  32. IWbemServices *a_CoreRepositoryStub ,
  33. IWbemServices *a_CoreFullStub ,
  34. const ProviderCacheKey &a_Key ,
  35. const ULONG &a_Period ,
  36. IWbemContext *a_InitializationContext
  37. ) : CWbemGlobal_IWmiObjectSinkController ( a_Allocator ) ,
  38. ServiceCacheElement (
  39. a_Controller ,
  40. a_Key ,
  41. a_Period
  42. ) ,
  43. m_ReferenceCount ( 0 ) ,
  44. m_Allocator ( a_Allocator ) ,
  45. m_CoreRepositoryStub ( a_CoreRepositoryStub ) ,
  46. m_CoreFullStub ( a_CoreFullStub ) ,
  47. m_Factory ( a_Factory ) ,
  48. m_ClassProvidersCount ( 0 ) ,
  49. m_ClassProviders ( NULL ) ,
  50. m_User ( NULL ) ,
  51. m_Locale ( NULL ) ,
  52. m_Initialized ( 0 ) ,
  53. m_InitializeResult ( S_OK ) ,
  54. m_InitializedEvent ( NULL ) ,
  55. m_InitializationContext ( a_InitializationContext )
  56. {
  57. InterlockedIncrement ( & ProviderSubSystem_Globals :: s_CAggregator_IWbemProvider_ObjectsInProgress ) ;
  58. ProviderSubSystem_Globals :: Increment_Global_Object_Count () ;
  59. if ( m_InitializationContext )
  60. {
  61. m_InitializationContext->AddRef () ;
  62. }
  63. if ( m_Factory )
  64. {
  65. m_Factory->AddRef () ;
  66. }
  67. if ( m_CoreRepositoryStub )
  68. {
  69. m_CoreRepositoryStub->AddRef () ;
  70. }
  71. if ( m_CoreFullStub )
  72. {
  73. m_CoreFullStub->AddRef () ;
  74. }
  75. }
  76. /******************************************************************************
  77. *
  78. * Name:
  79. *
  80. *
  81. * Description:
  82. *
  83. *
  84. *****************************************************************************/
  85. CAggregator_IWbemProvider :: ~CAggregator_IWbemProvider ()
  86. {
  87. if ( m_Factory )
  88. {
  89. m_Factory->Release () ;
  90. }
  91. if ( m_CoreRepositoryStub )
  92. {
  93. m_CoreRepositoryStub->Release () ;
  94. }
  95. if ( m_CoreFullStub )
  96. {
  97. m_CoreFullStub->Release () ;
  98. }
  99. if ( m_User )
  100. {
  101. SysFreeString ( m_User ) ;
  102. }
  103. if ( m_Locale )
  104. {
  105. SysFreeString ( m_Locale ) ;
  106. }
  107. if ( m_ClassProviders )
  108. {
  109. for ( ULONG t_Index = 0 ; t_Index < m_ClassProvidersCount ; t_Index ++ )
  110. {
  111. if ( m_ClassProviders [ t_Index ] )
  112. {
  113. m_ClassProviders [ t_Index ]->Release () ;
  114. }
  115. }
  116. delete [] m_ClassProviders ;
  117. }
  118. if ( m_InitializationContext )
  119. {
  120. m_InitializationContext->Release () ;
  121. }
  122. if ( m_InitializedEvent )
  123. {
  124. CloseHandle ( m_InitializedEvent ) ;
  125. }
  126. WmiStatusCode t_StatusCode = CWbemGlobal_IWmiObjectSinkController :: UnInitialize () ;
  127. InterlockedDecrement ( & ProviderSubSystem_Globals :: s_CAggregator_IWbemProvider_ObjectsInProgress ) ;
  128. ProviderSubSystem_Globals :: Decrement_Global_Object_Count () ;
  129. }
  130. /******************************************************************************
  131. *
  132. * Name:
  133. *
  134. *
  135. * Description:
  136. *
  137. *
  138. *****************************************************************************/
  139. HRESULT CAggregator_IWbemProvider :: Initialize (
  140. long a_Flags ,
  141. IWbemContext *a_Context ,
  142. GUID *a_TransactionIdentifier,
  143. LPCWSTR a_User,
  144. LPCWSTR a_Locale,
  145. LPCWSTR a_Namespace ,
  146. IWbemServices *a_Repository ,
  147. IWbemServices *a_Service ,
  148. IWbemProviderInitSink *a_Sink // For init signals
  149. )
  150. {
  151. HRESULT t_Result = S_OK ;
  152. WmiStatusCode t_StatusCode = CWbemGlobal_IWmiObjectSinkController :: Initialize () ;
  153. if ( t_StatusCode != e_StatusCode_Success )
  154. {
  155. t_Result = WBEM_E_OUT_OF_MEMORY ;
  156. }
  157. if ( SUCCEEDED ( t_Result ) )
  158. {
  159. m_InitializedEvent = CreateEvent ( NULL , TRUE , FALSE , NULL ) ;
  160. if ( m_InitializedEvent == NULL )
  161. {
  162. t_Result = t_Result = WBEM_E_OUT_OF_MEMORY ;
  163. }
  164. }
  165. if ( SUCCEEDED ( t_Result ) )
  166. {
  167. if ( a_User )
  168. {
  169. m_User = SysAllocString ( a_User ) ;
  170. if ( ! m_User )
  171. {
  172. t_Result = WBEM_E_OUT_OF_MEMORY ;
  173. }
  174. }
  175. }
  176. if ( SUCCEEDED ( t_Result ) )
  177. {
  178. if ( a_Locale )
  179. {
  180. m_Locale = SysAllocString ( a_Locale ) ;
  181. if ( ! m_Locale )
  182. {
  183. t_Result = WBEM_E_OUT_OF_MEMORY ;
  184. }
  185. }
  186. }
  187. a_Sink->SetStatus ( t_Result , 0 ) ;
  188. return t_Result ;
  189. }
  190. /******************************************************************************
  191. *
  192. * Name:
  193. *
  194. *
  195. * Description:
  196. *
  197. *
  198. *****************************************************************************/
  199. HRESULT CAggregator_IWbemProvider :: IsIndependant ( IWbemContext *a_Context )
  200. {
  201. BOOL t_DependantCall = FALSE ;
  202. HRESULT t_Result = ProviderSubSystem_Common_Globals :: IsDependantCall ( m_InitializationContext , a_Context , t_DependantCall ) ;
  203. if ( SUCCEEDED ( t_Result ) )
  204. {
  205. if ( t_DependantCall == FALSE )
  206. {
  207. }
  208. else
  209. {
  210. return S_FALSE ;
  211. }
  212. }
  213. return t_Result ;
  214. }
  215. /******************************************************************************
  216. *
  217. * Name:
  218. *
  219. *
  220. * Description:
  221. *
  222. *
  223. *****************************************************************************/
  224. HRESULT CAggregator_IWbemProvider :: WaitProvider ( IWbemContext *a_Context , ULONG a_Timeout )
  225. {
  226. HRESULT t_Result = WBEM_E_UNEXPECTED ;
  227. if ( m_Initialized == 0 )
  228. {
  229. BOOL t_DependantCall = FALSE ;
  230. t_Result = ProviderSubSystem_Common_Globals :: IsDependantCall ( m_InitializationContext , a_Context , t_DependantCall ) ;
  231. if ( SUCCEEDED ( t_Result ) )
  232. {
  233. if ( t_DependantCall == FALSE )
  234. {
  235. if ( WaitForSingleObject ( m_InitializedEvent , a_Timeout ) == WAIT_TIMEOUT )
  236. {
  237. return WBEM_E_PROVIDER_LOAD_FAILURE ;
  238. }
  239. }
  240. else
  241. {
  242. if ( WaitForSingleObject ( m_InitializedEvent , 0 ) == WAIT_TIMEOUT )
  243. {
  244. return S_FALSE ;
  245. }
  246. }
  247. }
  248. }
  249. else
  250. {
  251. t_Result = S_OK ;
  252. }
  253. return t_Result ;
  254. }
  255. /******************************************************************************
  256. *
  257. * Name:
  258. *
  259. *
  260. * Description:
  261. *
  262. *
  263. *****************************************************************************/
  264. HRESULT CAggregator_IWbemProvider :: SetInitialized ( HRESULT a_InitializeResult )
  265. {
  266. m_InitializeResult = a_InitializeResult ;
  267. InterlockedExchange ( & m_Initialized , 1 ) ;
  268. if ( m_InitializedEvent )
  269. {
  270. SetEvent ( m_InitializedEvent ) ;
  271. }
  272. return S_OK ;
  273. }
  274. /******************************************************************************
  275. *
  276. * Name:
  277. *
  278. *
  279. * Description:
  280. *
  281. *
  282. *****************************************************************************/
  283. STDMETHODIMP_(ULONG) CAggregator_IWbemProvider :: AddRef ( void )
  284. {
  285. return ServiceCacheElement :: AddRef () ;
  286. }
  287. /******************************************************************************
  288. *
  289. * Name:
  290. *
  291. *
  292. * Description:
  293. *
  294. *
  295. *****************************************************************************/
  296. STDMETHODIMP_(ULONG) CAggregator_IWbemProvider :: Release ( void )
  297. {
  298. return ServiceCacheElement :: Release () ;
  299. }
  300. /******************************************************************************
  301. *
  302. * Name:
  303. *
  304. *
  305. * Description:
  306. *
  307. *
  308. *****************************************************************************/
  309. STDMETHODIMP CAggregator_IWbemProvider :: QueryInterface (
  310. REFIID iid ,
  311. LPVOID FAR *iplpv
  312. )
  313. {
  314. *iplpv = NULL ;
  315. if ( iid == IID_IUnknown )
  316. {
  317. *iplpv = ( LPVOID ) this ;
  318. }
  319. else if ( iid == IID_IWbemServices )
  320. {
  321. *iplpv = ( LPVOID ) ( IWbemServices * ) this ;
  322. }
  323. else if ( iid == IID__IWmiProviderInitialize )
  324. {
  325. *iplpv = ( LPVOID ) ( _IWmiProviderInitialize * ) this ;
  326. }
  327. else if ( iid == IID__IWmiProviderCache )
  328. {
  329. *iplpv = ( LPVOID ) ( _IWmiProviderCache * ) this ;
  330. }
  331. else if ( iid == IID_IWbemShutdown )
  332. {
  333. *iplpv = ( LPVOID ) ( IWbemShutdown * ) this ;
  334. }
  335. else if ( iid == IID_CAggregator_IWbemProvider )
  336. {
  337. *iplpv = ( LPVOID ) ( CAggregator_IWbemProvider * ) this ;
  338. }
  339. else if ( iid == IID__IWmiProviderAssociatorsHelper )
  340. {
  341. *iplpv = ( LPVOID ) ( _IWmiProviderAssociatorsHelper * ) this ;
  342. }
  343. if ( *iplpv )
  344. {
  345. ( ( LPUNKNOWN ) *iplpv )->AddRef () ;
  346. return ResultFromScode ( S_OK ) ;
  347. }
  348. else
  349. {
  350. return ResultFromScode ( E_NOINTERFACE ) ;
  351. }
  352. }
  353. /******************************************************************************
  354. *
  355. * Name:
  356. *
  357. *
  358. * Description:
  359. *
  360. *
  361. *****************************************************************************/
  362. QueryPreprocessor :: QuadState CAggregator_IWbemProvider :: Get_RecursiveEvaluate (
  363. wchar_t *a_Class ,
  364. IWbemContext *a_Context ,
  365. WmiTreeNode *&a_Node
  366. )
  367. {
  368. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_Undefined ;
  369. if ( a_Node )
  370. {
  371. if ( a_Node->GetType () == TypeId_WmiOrNode )
  372. {
  373. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  374. WmiTreeNode *t_Right = a_Node->GetRight () ;
  375. if ( t_Left )
  376. {
  377. t_Status = Get_RecursiveEvaluate ( a_Class , a_Context , t_Left ) ;
  378. if ( t_Status == QueryPreprocessor :: State_False )
  379. {
  380. if ( t_Right )
  381. {
  382. t_Status = Get_RecursiveEvaluate ( a_Class , a_Context , t_Right ) ;
  383. return t_Status ;
  384. }
  385. }
  386. }
  387. }
  388. else if ( a_Node->GetType () == TypeId_WmiAndNode )
  389. {
  390. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  391. WmiTreeNode *t_Right = a_Node->GetRight () ;
  392. if ( t_Left )
  393. {
  394. t_Status = Get_RecursiveEvaluate ( a_Class , a_Context , t_Left ) ;
  395. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  396. {
  397. if ( t_Right )
  398. {
  399. t_Status = Get_RecursiveEvaluate ( a_Class , a_Context , t_Right ) ;
  400. return t_Status ;
  401. }
  402. }
  403. }
  404. }
  405. else if ( a_Node->GetType () == TypeId_WmiNotNode )
  406. {
  407. // Should never happen, failure in DFN evaluation otherwise
  408. }
  409. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualNode )
  410. {
  411. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  412. if ( t_Left )
  413. {
  414. if ( t_Left->GetType () == TypeId_WmiStringNode )
  415. {
  416. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  417. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  418. {
  419. if ( t_String->GetValue () && wbem_wcsicmp ( a_Class , t_String->GetValue () ) == 0 )
  420. {
  421. t_Status = QueryPreprocessor :: State_True ;
  422. }
  423. else
  424. {
  425. t_Status = QueryPreprocessor :: State_False ;
  426. }
  427. }
  428. }
  429. }
  430. else
  431. {
  432. // Should never happen, failure in DFN evaluation otherwise
  433. }
  434. }
  435. else if ( a_Node->GetType () == TypeId_WmiOperatorNotEqualNode )
  436. {
  437. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  438. if ( t_Left )
  439. {
  440. if ( t_Left->GetType () == TypeId_WmiStringNode )
  441. {
  442. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  443. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  444. {
  445. if ( t_String->GetValue () && wbem_wcsicmp ( a_Class , t_String->GetValue () ) != 0 )
  446. {
  447. t_Status = QueryPreprocessor :: State_True ;
  448. }
  449. else
  450. {
  451. t_Status = QueryPreprocessor :: State_False ;
  452. }
  453. }
  454. }
  455. }
  456. else
  457. {
  458. // Should never happen, failure in DFN evaluation otherwise
  459. }
  460. }
  461. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualOrGreaterNode )
  462. {
  463. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  464. if ( t_Left )
  465. {
  466. if ( t_Left->GetType () == TypeId_WmiStringNode )
  467. {
  468. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  469. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  470. {
  471. if ( t_String->GetValue () && wbem_wcsicmp ( a_Class , t_String->GetValue () ) >= 0 )
  472. {
  473. t_Status = QueryPreprocessor :: State_True ;
  474. }
  475. else
  476. {
  477. t_Status = QueryPreprocessor :: State_False ;
  478. }
  479. }
  480. }
  481. }
  482. else
  483. {
  484. // Should never happen, failure in DFN evaluation otherwise
  485. }
  486. }
  487. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualOrLessNode )
  488. {
  489. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  490. if ( t_Left )
  491. {
  492. if ( t_Left->GetType () == TypeId_WmiStringNode )
  493. {
  494. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  495. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  496. {
  497. if ( t_String->GetValue () && wbem_wcsicmp ( a_Class , t_String->GetValue () ) <= 0 )
  498. {
  499. t_Status = QueryPreprocessor :: State_True ;
  500. }
  501. else
  502. {
  503. t_Status = QueryPreprocessor :: State_False ;
  504. }
  505. }
  506. }
  507. }
  508. else
  509. {
  510. // Should never happen, failure in DFN evaluation otherwise
  511. }
  512. }
  513. else if ( a_Node->GetType () == TypeId_WmiOperatorLessNode )
  514. {
  515. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  516. if ( t_Left )
  517. {
  518. if ( t_Left->GetType () == TypeId_WmiStringNode )
  519. {
  520. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  521. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  522. {
  523. if ( t_String->GetValue () && wbem_wcsicmp ( a_Class , t_String->GetValue () ) < 0 )
  524. {
  525. t_Status = QueryPreprocessor :: State_True ;
  526. }
  527. else
  528. {
  529. t_Status = QueryPreprocessor :: State_False ;
  530. }
  531. }
  532. }
  533. }
  534. else
  535. {
  536. // Should never happen, failure in DFN evaluation otherwise
  537. }
  538. }
  539. else if ( a_Node->GetType () == TypeId_WmiOperatorGreaterNode )
  540. {
  541. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  542. if ( t_Left )
  543. {
  544. if ( t_Left->GetType () == TypeId_WmiStringNode )
  545. {
  546. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  547. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  548. {
  549. if ( t_String->GetValue () && wbem_wcsicmp ( a_Class , t_String->GetValue () ) > 0 )
  550. {
  551. t_Status = QueryPreprocessor :: State_True ;
  552. }
  553. else
  554. {
  555. t_Status = QueryPreprocessor :: State_False ;
  556. }
  557. }
  558. }
  559. }
  560. else
  561. {
  562. // Should never happen, failure in DFN evaluation otherwise
  563. }
  564. }
  565. else if ( a_Node->GetType () == TypeId_WmiOperatorLikeNode )
  566. {
  567. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  568. if ( t_Left )
  569. {
  570. if ( t_Left->GetType () == TypeId_WmiStringNode )
  571. {
  572. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  573. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  574. {
  575. CLike t_Like ( t_String->GetValue () ) ;
  576. if ( t_Like.Match ( a_Class ) )
  577. {
  578. t_Status = QueryPreprocessor :: State_True ;
  579. }
  580. else
  581. {
  582. t_Status = QueryPreprocessor :: State_False ;
  583. }
  584. }
  585. }
  586. }
  587. else
  588. {
  589. // Should never happen, failure in DFN evaluation otherwise
  590. }
  591. }
  592. else if ( a_Node->GetType () == TypeId_WmiOperatorNotLikeNode )
  593. {
  594. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  595. if ( t_Left )
  596. {
  597. if ( t_Left->GetType () == TypeId_WmiStringNode )
  598. {
  599. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  600. if ( wbem_wcsicmp ( L"__Class" , t_String->GetPropertyName () ) == 0 )
  601. {
  602. CLike t_Like ( t_String->GetValue () ) ;
  603. if ( ! t_Like.Match ( a_Class ) )
  604. {
  605. t_Status = QueryPreprocessor :: State_True ;
  606. }
  607. else
  608. {
  609. t_Status = QueryPreprocessor :: State_False ;
  610. }
  611. }
  612. }
  613. }
  614. else
  615. {
  616. // Should never happen, failure in DFN evaluation otherwise
  617. }
  618. }
  619. else if ( a_Node->GetType () == TypeId_WmiOperatorIsANode )
  620. {
  621. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  622. if ( t_Left )
  623. {
  624. }
  625. else
  626. {
  627. // Should never happen, failure in DFN evaluation otherwise
  628. }
  629. }
  630. else if ( a_Node->GetType () == TypeId_WmiOperatorNotIsANode )
  631. {
  632. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  633. if ( t_Left )
  634. {
  635. }
  636. else
  637. {
  638. // Should never happen, failure in DFN evaluation otherwise
  639. }
  640. }
  641. else
  642. {
  643. // Should never happen, failure in DFN evaluation otherwise
  644. }
  645. }
  646. return t_Status ;
  647. }
  648. /******************************************************************************
  649. *
  650. * Name:
  651. *
  652. *
  653. * Description:
  654. *
  655. *
  656. *****************************************************************************/
  657. QueryPreprocessor :: QuadState CAggregator_IWbemProvider :: Get_Evaluate (
  658. wchar_t *a_Class ,
  659. IWbemContext *a_Context ,
  660. WmiTreeNode *&a_Root
  661. )
  662. {
  663. QueryPreprocessor :: QuadState t_Status = Get_RecursiveEvaluate ( a_Class , a_Context , a_Root ) ;
  664. return t_Status ;
  665. }
  666. /******************************************************************************
  667. *
  668. * Name:
  669. *
  670. *
  671. * Description:
  672. *
  673. *
  674. *****************************************************************************/
  675. QueryPreprocessor :: QuadState CAggregator_IWbemProvider :: EnumDeep_RecursiveEvaluate (
  676. IWbemClassObject *a_Class ,
  677. IWbemContext *a_Context ,
  678. WmiTreeNode *&a_Node
  679. )
  680. {
  681. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_Undefined ;
  682. if ( a_Node )
  683. {
  684. if ( a_Node->GetType () == TypeId_WmiOrNode )
  685. {
  686. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  687. WmiTreeNode *t_Right = a_Node->GetRight () ;
  688. if ( t_Left )
  689. {
  690. t_Status = EnumDeep_RecursiveEvaluate ( a_Class , a_Context , t_Left ) ;
  691. if ( t_Status == QueryPreprocessor :: State_False )
  692. {
  693. if ( t_Right )
  694. {
  695. t_Status = EnumDeep_RecursiveEvaluate ( a_Class , a_Context , t_Right ) ;
  696. return t_Status ;
  697. }
  698. }
  699. }
  700. }
  701. else if ( a_Node->GetType () == TypeId_WmiAndNode )
  702. {
  703. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  704. WmiTreeNode *t_Right = a_Node->GetRight () ;
  705. if ( t_Left )
  706. {
  707. t_Status = EnumDeep_RecursiveEvaluate ( a_Class , a_Context , t_Left ) ;
  708. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  709. {
  710. if ( t_Right )
  711. {
  712. t_Status = EnumDeep_RecursiveEvaluate ( a_Class , a_Context , t_Right ) ;
  713. return t_Status ;
  714. }
  715. }
  716. }
  717. }
  718. else if ( a_Node->GetType () == TypeId_WmiNotNode )
  719. {
  720. // Should never happen, failure in DFN evaluation otherwise
  721. }
  722. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualNode )
  723. {
  724. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  725. if ( t_Left )
  726. {
  727. if ( t_Left->GetType () == TypeId_WmiStringNode )
  728. {
  729. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  730. if ( wbem_wcsicmp ( L"__SuperClass" , t_String->GetPropertyName () ) == 0 )
  731. {
  732. VARIANT t_Variant ;
  733. VariantInit ( & t_Variant ) ;
  734. LONG t_VarType = 0 ;
  735. LONG t_Flavour = 0 ;
  736. HRESULT t_Result = a_Class->Get ( L"__SuperClass" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  737. if ( SUCCEEDED ( t_Result ) )
  738. {
  739. if ( t_Variant.vt == VT_BSTR )
  740. {
  741. if ( t_String->GetValue () && wbem_wcsicmp ( t_Variant.bstrVal , t_String->GetValue () ) == 0 )
  742. {
  743. t_Status = QueryPreprocessor :: State_True ;
  744. }
  745. else
  746. {
  747. t_Status = QueryPreprocessor :: State_False ;
  748. }
  749. }
  750. VariantClear ( & t_Variant ) ;
  751. }
  752. }
  753. }
  754. }
  755. else
  756. {
  757. // Should never happen, failure in DFN evaluation otherwise
  758. }
  759. }
  760. else if ( a_Node->GetType () == TypeId_WmiOperatorNotEqualNode )
  761. {
  762. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  763. if ( t_Left )
  764. {
  765. }
  766. else
  767. {
  768. // Should never happen, failure in DFN evaluation otherwise
  769. }
  770. }
  771. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualOrGreaterNode )
  772. {
  773. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  774. if ( t_Left )
  775. {
  776. }
  777. else
  778. {
  779. // Should never happen, failure in DFN evaluation otherwise
  780. }
  781. }
  782. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualOrLessNode )
  783. {
  784. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  785. if ( t_Left )
  786. {
  787. }
  788. else
  789. {
  790. // Should never happen, failure in DFN evaluation otherwise
  791. }
  792. }
  793. else if ( a_Node->GetType () == TypeId_WmiOperatorLessNode )
  794. {
  795. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  796. if ( t_Left )
  797. {
  798. }
  799. else
  800. {
  801. // Should never happen, failure in DFN evaluation otherwise
  802. }
  803. }
  804. else if ( a_Node->GetType () == TypeId_WmiOperatorGreaterNode )
  805. {
  806. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  807. if ( t_Left )
  808. {
  809. }
  810. else
  811. {
  812. // Should never happen, failure in DFN evaluation otherwise
  813. }
  814. }
  815. else if ( a_Node->GetType () == TypeId_WmiOperatorLikeNode )
  816. {
  817. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  818. if ( t_Left )
  819. {
  820. }
  821. else
  822. {
  823. // Should never happen, failure in DFN evaluation otherwise
  824. }
  825. }
  826. else if ( a_Node->GetType () == TypeId_WmiOperatorNotLikeNode )
  827. {
  828. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  829. if ( t_Left )
  830. {
  831. }
  832. else
  833. {
  834. // Should never happen, failure in DFN evaluation otherwise
  835. }
  836. }
  837. else if ( a_Node->GetType () == TypeId_WmiOperatorIsANode )
  838. {
  839. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  840. if ( t_Left )
  841. {
  842. if ( t_Left->GetType () == TypeId_WmiStringNode )
  843. {
  844. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  845. if ( wbem_wcsicmp ( L"__this" , t_String->GetPropertyName () ) == 0 )
  846. {
  847. IWbemClassObject *t_FilterObject = NULL ;
  848. HRESULT t_Result = m_CoreFullStub->GetObject (
  849. t_String->GetValue () ,
  850. 0 ,
  851. a_Context ,
  852. & t_FilterObject ,
  853. NULL
  854. ) ;
  855. if ( SUCCEEDED ( t_Result ) )
  856. {
  857. LONG t_LeftLength = 0 ;
  858. LONG t_RightLength = 0 ;
  859. BOOL t_LeftIsA = FALSE ;
  860. t_Status = IsA (
  861. a_Class ,
  862. t_FilterObject ,
  863. t_LeftLength ,
  864. t_RightLength ,
  865. t_LeftIsA
  866. ) ;
  867. if ( ( t_Status == QueryPreprocessor :: State_True ) && ( t_LeftIsA == TRUE ) )
  868. {
  869. t_Status = QueryPreprocessor :: State_True ;
  870. }
  871. else
  872. {
  873. t_Status = QueryPreprocessor :: State_False ;
  874. }
  875. t_FilterObject->Release () ;
  876. }
  877. }
  878. }
  879. }
  880. else
  881. {
  882. // Should never happen, failure in DFN evaluation otherwise
  883. }
  884. }
  885. else if ( a_Node->GetType () == TypeId_WmiOperatorNotIsANode )
  886. {
  887. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  888. if ( t_Left )
  889. {
  890. if ( t_Left->GetType () == TypeId_WmiStringNode )
  891. {
  892. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  893. if ( wbem_wcsicmp ( L"__this" , t_String->GetPropertyName () ) == 0 )
  894. {
  895. IWbemClassObject *t_FilterObject = NULL ;
  896. HRESULT t_Result = m_CoreFullStub->GetObject (
  897. t_String->GetValue () ,
  898. 0 ,
  899. a_Context ,
  900. & t_FilterObject ,
  901. NULL
  902. ) ;
  903. if ( SUCCEEDED ( t_Result ) )
  904. {
  905. LONG t_LeftLength = 0 ;
  906. LONG t_RightLength = 0 ;
  907. BOOL t_LeftIsA = FALSE ;
  908. t_Status = IsA (
  909. a_Class ,
  910. t_FilterObject ,
  911. t_LeftLength ,
  912. t_RightLength ,
  913. t_LeftIsA
  914. ) ;
  915. if ( ! ( ( t_Status == QueryPreprocessor :: State_True ) && ( t_LeftIsA == TRUE ) ) )
  916. {
  917. t_Status = QueryPreprocessor :: State_True ;
  918. }
  919. else
  920. {
  921. t_Status = QueryPreprocessor :: State_False ;
  922. }
  923. t_FilterObject->Release () ;
  924. }
  925. }
  926. }
  927. }
  928. }
  929. else
  930. {
  931. // Should never happen, failure in DFN evaluation otherwise
  932. }
  933. }
  934. return t_Status ;
  935. }
  936. /******************************************************************************
  937. *
  938. * Name:
  939. *
  940. *
  941. * Description:
  942. *
  943. *
  944. *****************************************************************************/
  945. QueryPreprocessor :: QuadState CAggregator_IWbemProvider :: EnumDeep_Evaluate (
  946. IWbemClassObject *a_Class ,
  947. IWbemContext *a_Context ,
  948. WmiTreeNode *&a_Root
  949. )
  950. {
  951. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_True ;
  952. VARIANT t_Variant ;
  953. VariantInit ( & t_Variant ) ;
  954. LONG t_VarType = 0 ;
  955. LONG t_Flavour = 0 ;
  956. HRESULT t_Result = a_Class->Get ( L"__Class" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  957. if ( SUCCEEDED ( t_Result ) )
  958. {
  959. if ( t_Variant.vt == ( VT_NULL ) )
  960. {
  961. t_Status = QueryPreprocessor :: State_True ;
  962. }
  963. else
  964. {
  965. t_Status = EnumDeep_RecursiveEvaluate ( a_Class , a_Context , a_Root ) ;
  966. }
  967. VariantClear ( & t_Variant ) ;
  968. }
  969. else
  970. {
  971. t_Status = QueryPreprocessor :: State_Error ;
  972. }
  973. return t_Status ;
  974. }
  975. /******************************************************************************
  976. *
  977. * Name:
  978. *
  979. *
  980. * Description:
  981. *
  982. *
  983. *****************************************************************************/
  984. QueryPreprocessor :: QuadState CAggregator_IWbemProvider :: EnumShallow_RecursiveEvaluate (
  985. IWbemClassObject *a_Class ,
  986. IWbemContext *a_Context ,
  987. WmiTreeNode *&a_Node
  988. )
  989. {
  990. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_Undefined ;
  991. if ( a_Node )
  992. {
  993. if ( a_Node->GetType () == TypeId_WmiOrNode )
  994. {
  995. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  996. WmiTreeNode *t_Right = a_Node->GetRight () ;
  997. if ( t_Left )
  998. {
  999. t_Status = EnumShallow_RecursiveEvaluate ( a_Class , a_Context , t_Left ) ;
  1000. if ( t_Status == QueryPreprocessor :: State_False )
  1001. {
  1002. if ( t_Right )
  1003. {
  1004. t_Status = EnumShallow_RecursiveEvaluate ( a_Class , a_Context , t_Right ) ;
  1005. return t_Status ;
  1006. }
  1007. }
  1008. }
  1009. }
  1010. else if ( a_Node->GetType () == TypeId_WmiAndNode )
  1011. {
  1012. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1013. WmiTreeNode *t_Right = a_Node->GetRight () ;
  1014. if ( t_Left )
  1015. {
  1016. t_Status = EnumShallow_RecursiveEvaluate ( a_Class , a_Context , t_Left ) ;
  1017. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  1018. {
  1019. if ( t_Right )
  1020. {
  1021. t_Status = EnumShallow_RecursiveEvaluate ( a_Class , a_Context , t_Right ) ;
  1022. return t_Status ;
  1023. }
  1024. }
  1025. }
  1026. }
  1027. else if ( a_Node->GetType () == TypeId_WmiNotNode )
  1028. {
  1029. // Should never happen, failure in DFN evaluation otherwise
  1030. }
  1031. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualNode )
  1032. {
  1033. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1034. if ( t_Left )
  1035. {
  1036. if ( t_Left->GetType () == TypeId_WmiStringNode )
  1037. {
  1038. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  1039. if ( wbem_wcsicmp ( L"__SuperClass" , t_String->GetPropertyName () ) == 0 )
  1040. {
  1041. VARIANT t_Variant ;
  1042. VariantInit ( & t_Variant ) ;
  1043. LONG t_VarType = 0 ;
  1044. LONG t_Flavour = 0 ;
  1045. HRESULT t_Result = a_Class->Get ( L"__SuperClass" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  1046. if ( SUCCEEDED ( t_Result ) )
  1047. {
  1048. if ( t_Variant.vt == VT_BSTR )
  1049. {
  1050. if ( t_String->GetValue () && wbem_wcsicmp ( t_Variant.bstrVal , t_String->GetValue () ) == 0 )
  1051. {
  1052. t_Status = QueryPreprocessor :: State_True ;
  1053. }
  1054. else
  1055. {
  1056. t_Status = QueryPreprocessor :: State_False ;
  1057. }
  1058. }
  1059. VariantClear ( & t_Variant ) ;
  1060. }
  1061. }
  1062. }
  1063. }
  1064. else
  1065. {
  1066. // Should never happen, failure in DFN evaluation otherwise
  1067. }
  1068. }
  1069. else if ( a_Node->GetType () == TypeId_WmiOperatorNotEqualNode )
  1070. {
  1071. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1072. if ( t_Left )
  1073. {
  1074. }
  1075. else
  1076. {
  1077. // Should never happen, failure in DFN evaluation otherwise
  1078. }
  1079. }
  1080. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualOrGreaterNode )
  1081. {
  1082. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1083. if ( t_Left )
  1084. {
  1085. }
  1086. else
  1087. {
  1088. // Should never happen, failure in DFN evaluation otherwise
  1089. }
  1090. }
  1091. else if ( a_Node->GetType () == TypeId_WmiOperatorEqualOrLessNode )
  1092. {
  1093. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1094. if ( t_Left )
  1095. {
  1096. }
  1097. else
  1098. {
  1099. // Should never happen, failure in DFN evaluation otherwise
  1100. }
  1101. }
  1102. else if ( a_Node->GetType () == TypeId_WmiOperatorLessNode )
  1103. {
  1104. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1105. if ( t_Left )
  1106. {
  1107. }
  1108. else
  1109. {
  1110. // Should never happen, failure in DFN evaluation otherwise
  1111. }
  1112. }
  1113. else if ( a_Node->GetType () == TypeId_WmiOperatorGreaterNode )
  1114. {
  1115. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1116. if ( t_Left )
  1117. {
  1118. }
  1119. else
  1120. {
  1121. // Should never happen, failure in DFN evaluation otherwise
  1122. }
  1123. }
  1124. else if ( a_Node->GetType () == TypeId_WmiOperatorLikeNode )
  1125. {
  1126. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1127. if ( t_Left )
  1128. {
  1129. }
  1130. else
  1131. {
  1132. // Should never happen, failure in DFN evaluation otherwise
  1133. }
  1134. }
  1135. else if ( a_Node->GetType () == TypeId_WmiOperatorNotLikeNode )
  1136. {
  1137. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1138. if ( t_Left )
  1139. {
  1140. }
  1141. else
  1142. {
  1143. // Should never happen, failure in DFN evaluation otherwise
  1144. }
  1145. }
  1146. else if ( a_Node->GetType () == TypeId_WmiOperatorIsANode )
  1147. {
  1148. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1149. if ( t_Left )
  1150. {
  1151. if ( t_Left->GetType () == TypeId_WmiStringNode )
  1152. {
  1153. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  1154. if ( wbem_wcsicmp ( L"__this" , t_String->GetPropertyName () ) == 0 )
  1155. {
  1156. IWbemClassObject *t_FilterObject = NULL ;
  1157. HRESULT t_Result = m_CoreFullStub->GetObject (
  1158. t_String->GetValue () ,
  1159. 0 ,
  1160. a_Context ,
  1161. & t_FilterObject ,
  1162. NULL
  1163. ) ;
  1164. if ( SUCCEEDED ( t_Result ) )
  1165. {
  1166. LONG t_LeftLength = 0 ;
  1167. LONG t_RightLength = 0 ;
  1168. BOOL t_LeftIsA = FALSE ;
  1169. t_Status = IsA (
  1170. a_Class ,
  1171. t_FilterObject ,
  1172. t_LeftLength ,
  1173. t_RightLength ,
  1174. t_LeftIsA
  1175. ) ;
  1176. if ( ( t_Status == QueryPreprocessor :: State_True ) && ( t_LeftIsA == TRUE ) )
  1177. {
  1178. t_Status = QueryPreprocessor :: State_True ;
  1179. }
  1180. else
  1181. {
  1182. t_Status = QueryPreprocessor :: State_False ;
  1183. }
  1184. t_FilterObject->Release () ;
  1185. }
  1186. }
  1187. }
  1188. }
  1189. else
  1190. {
  1191. // Should never happen, failure in DFN evaluation otherwise
  1192. }
  1193. }
  1194. else if ( a_Node->GetType () == TypeId_WmiOperatorNotIsANode )
  1195. {
  1196. WmiTreeNode *t_Left = a_Node->GetLeft () ;
  1197. if ( t_Left )
  1198. {
  1199. if ( t_Left->GetType () == TypeId_WmiStringNode )
  1200. {
  1201. WmiStringNode *t_String = ( WmiStringNode * ) t_Left ;
  1202. if ( wbem_wcsicmp ( L"__this" , t_String->GetPropertyName () ) == 0 )
  1203. {
  1204. IWbemClassObject *t_FilterObject = NULL ;
  1205. HRESULT t_Result = m_CoreFullStub->GetObject (
  1206. t_String->GetValue () ,
  1207. 0 ,
  1208. a_Context ,
  1209. & t_FilterObject ,
  1210. NULL
  1211. ) ;
  1212. if ( SUCCEEDED ( t_Result ) )
  1213. {
  1214. LONG t_LeftLength = 0 ;
  1215. LONG t_RightLength = 0 ;
  1216. BOOL t_LeftIsA = FALSE ;
  1217. t_Status = IsA (
  1218. a_Class ,
  1219. t_FilterObject,
  1220. t_LeftLength ,
  1221. t_RightLength ,
  1222. t_LeftIsA
  1223. ) ;
  1224. if ( ! ( ( t_Status == QueryPreprocessor :: State_True ) && ( t_LeftIsA == TRUE ) ) )
  1225. {
  1226. t_Status = QueryPreprocessor :: State_True ;
  1227. }
  1228. else
  1229. {
  1230. t_Status = QueryPreprocessor :: State_False ;
  1231. }
  1232. t_FilterObject->Release () ;
  1233. }
  1234. }
  1235. }
  1236. }
  1237. }
  1238. else
  1239. {
  1240. // Should never happen, failure in DFN evaluation otherwise
  1241. }
  1242. }
  1243. return t_Status ;
  1244. }
  1245. /******************************************************************************
  1246. *
  1247. * Name:
  1248. *
  1249. *
  1250. * Description:
  1251. *
  1252. *
  1253. *****************************************************************************/
  1254. QueryPreprocessor :: QuadState CAggregator_IWbemProvider :: EnumShallow_Evaluate (
  1255. IWbemClassObject *a_Class ,
  1256. IWbemContext *a_Context ,
  1257. WmiTreeNode *&a_Root
  1258. )
  1259. {
  1260. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_True ;
  1261. VARIANT t_Variant ;
  1262. VariantInit ( & t_Variant ) ;
  1263. LONG t_VarType = 0 ;
  1264. LONG t_Flavour = 0 ;
  1265. HRESULT t_Result = a_Class->Get ( L"__Class" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  1266. if ( SUCCEEDED ( t_Result ) )
  1267. {
  1268. if ( t_Variant.vt == ( VT_NULL ) )
  1269. {
  1270. t_Status = QueryPreprocessor :: State_True ;
  1271. }
  1272. else
  1273. {
  1274. t_Status = EnumShallow_RecursiveEvaluate ( a_Class , a_Context , a_Root ) ;
  1275. }
  1276. VariantClear ( & t_Variant ) ;
  1277. }
  1278. else
  1279. {
  1280. t_Status = QueryPreprocessor :: State_Error ;
  1281. }
  1282. return t_Status ;
  1283. }
  1284. /******************************************************************************
  1285. *
  1286. * Name:
  1287. *
  1288. *
  1289. * Description:
  1290. *
  1291. *
  1292. *****************************************************************************/
  1293. QueryPreprocessor :: QuadState CAggregator_IWbemProvider :: IsA (
  1294. IWbemClassObject *a_Left ,
  1295. IWbemClassObject *a_Right ,
  1296. LONG &a_LeftLength ,
  1297. LONG &a_RightLength ,
  1298. BOOL &a_LeftIsA
  1299. )
  1300. {
  1301. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_False ;
  1302. SAFEARRAY *t_LeftArray = NULL ;
  1303. SAFEARRAY *t_RightArray = NULL ;
  1304. VARIANT t_Variant ;
  1305. VariantInit ( & t_Variant ) ;
  1306. LONG t_VarType = 0 ;
  1307. LONG t_Flavour = 0 ;
  1308. BSTR t_LeftClass = NULL ;
  1309. BSTR t_RightClass = NULL ;
  1310. HRESULT t_Result = a_Left->Get ( L"__Class" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  1311. if ( SUCCEEDED ( t_Result ) )
  1312. {
  1313. if ( t_Variant.vt == ( VT_NULL ) )
  1314. {
  1315. t_Status = QueryPreprocessor :: State_True ;
  1316. a_LeftIsA = FALSE ;
  1317. }
  1318. else
  1319. {
  1320. t_LeftClass = SysAllocString ( t_Variant.bstrVal ) ;
  1321. }
  1322. VariantClear ( & t_Variant ) ;
  1323. }
  1324. else
  1325. {
  1326. t_Status = QueryPreprocessor :: State_Error ;
  1327. }
  1328. if ( t_Status == QueryPreprocessor :: State_False )
  1329. {
  1330. t_Result = a_Right->Get ( L"__Class" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  1331. if ( SUCCEEDED ( t_Result ) )
  1332. {
  1333. if ( t_Variant.vt == ( VT_NULL ) )
  1334. {
  1335. t_Status = QueryPreprocessor :: State_True ;
  1336. a_LeftIsA = TRUE ;
  1337. }
  1338. else
  1339. {
  1340. t_RightClass = SysAllocString ( t_Variant.bstrVal ) ;
  1341. }
  1342. VariantClear ( & t_Variant ) ;
  1343. }
  1344. else
  1345. {
  1346. t_Status = QueryPreprocessor :: State_Error ;
  1347. }
  1348. }
  1349. VARIANT t_RightSafeArray ;
  1350. VariantInit ( & t_RightSafeArray ) ;
  1351. VARIANT t_LeftSafeArray ;
  1352. VariantInit ( & t_LeftSafeArray ) ;
  1353. if ( t_Status == QueryPreprocessor :: State_False )
  1354. {
  1355. t_Result = a_Right->Get ( L"__Derivation" , 0 , & t_RightSafeArray , & t_VarType , & t_Flavour ) ;
  1356. if ( SUCCEEDED ( t_Result ) )
  1357. {
  1358. if ( t_RightSafeArray.vt == ( VT_BSTR | VT_ARRAY ) )
  1359. {
  1360. if ( SafeArrayGetDim ( t_RightSafeArray.parray ) == 1 )
  1361. {
  1362. LONG t_Dimension = 1 ;
  1363. LONG t_Lower ;
  1364. SafeArrayGetLBound ( t_RightSafeArray.parray , t_Dimension , & t_Lower ) ;
  1365. LONG t_Upper ;
  1366. SafeArrayGetUBound ( t_RightSafeArray.parray , t_Dimension , & t_Upper ) ;
  1367. a_RightLength = ( t_Upper - t_Lower ) + 2 ;
  1368. SAFEARRAYBOUND t_ArrayBounds ;
  1369. t_ArrayBounds.cElements = ( t_Upper - t_Lower ) + 2 ;
  1370. t_ArrayBounds.lLbound = t_Lower ;
  1371. t_RightArray = SafeArrayCreate (
  1372. VT_BSTR ,
  1373. t_Dimension ,
  1374. & t_ArrayBounds
  1375. ) ;
  1376. if ( t_RightArray )
  1377. {
  1378. for ( LONG t_Index = t_Lower ; t_Index <= t_Upper ; t_Index ++ )
  1379. {
  1380. LONG t_ElementIndex = t_Lower + 1 ;
  1381. BSTR t_Element = NULL ;
  1382. if ( SUCCEEDED ( SafeArrayGetElement ( t_RightSafeArray.parray , & t_Index , & t_Element ) ) )
  1383. {
  1384. if ( SUCCEEDED ( SafeArrayPutElement ( t_RightArray , & t_ElementIndex , t_Element ) ) )
  1385. {
  1386. }
  1387. else
  1388. {
  1389. t_Status = QueryPreprocessor :: State_Error ;
  1390. SysFreeString ( t_Element ) ;
  1391. break ;
  1392. }
  1393. SysFreeString ( t_Element ) ;
  1394. }
  1395. else
  1396. {
  1397. }
  1398. }
  1399. if ( t_Status != QueryPreprocessor :: State_Error )
  1400. {
  1401. LONG t_ElementIndex = t_Lower ;
  1402. if ( SUCCEEDED ( SafeArrayPutElement ( t_RightArray , & t_ElementIndex , t_RightClass ) ) )
  1403. {
  1404. }
  1405. else
  1406. {
  1407. t_Status = QueryPreprocessor :: State_Error ;
  1408. }
  1409. }
  1410. }
  1411. else
  1412. {
  1413. t_Status = QueryPreprocessor :: State_Error ;
  1414. }
  1415. }
  1416. else
  1417. {
  1418. t_Status = QueryPreprocessor :: State_Error ;
  1419. }
  1420. }
  1421. else
  1422. {
  1423. t_Status = QueryPreprocessor :: State_Error ;
  1424. }
  1425. }
  1426. else
  1427. {
  1428. t_Status = QueryPreprocessor :: State_Error ;
  1429. }
  1430. if ( t_Status != QueryPreprocessor :: State_Error )
  1431. {
  1432. t_Result = a_Left->Get ( L"__Derivation" , 0 , & t_LeftSafeArray , & t_VarType , & t_Flavour ) ;
  1433. if ( SUCCEEDED ( t_Result ) )
  1434. {
  1435. if ( t_LeftSafeArray.vt == ( VT_BSTR | VT_ARRAY ) )
  1436. {
  1437. t_LeftArray = t_LeftSafeArray.parray ;
  1438. if ( SafeArrayGetDim ( t_LeftSafeArray.parray ) == 1 )
  1439. {
  1440. LONG t_Dimension = 1 ;
  1441. LONG t_Lower ;
  1442. SafeArrayGetLBound ( t_LeftSafeArray.parray , t_Dimension , & t_Lower ) ;
  1443. LONG t_Upper ;
  1444. SafeArrayGetUBound ( t_LeftSafeArray.parray , t_Dimension , & t_Upper ) ;
  1445. a_LeftLength = ( t_Upper - t_Lower ) + 2 ;
  1446. SAFEARRAYBOUND t_ArrayBounds ;
  1447. t_ArrayBounds.cElements = ( t_Upper - t_Lower ) + 2 ;
  1448. t_ArrayBounds.lLbound = t_Lower ;
  1449. t_LeftArray = SafeArrayCreate (
  1450. VT_BSTR ,
  1451. t_Dimension ,
  1452. & t_ArrayBounds
  1453. ) ;
  1454. if ( t_LeftArray )
  1455. {
  1456. for ( LONG t_Index = t_Lower ; t_Index <= t_Upper ; t_Index ++ )
  1457. {
  1458. LONG t_ElementIndex = t_Lower + 1 ;
  1459. BSTR t_Element = NULL ;
  1460. if ( SUCCEEDED ( SafeArrayGetElement ( t_LeftSafeArray.parray , & t_Index , & t_Element ) ) )
  1461. {
  1462. if ( SUCCEEDED ( SafeArrayPutElement ( t_LeftArray , & t_ElementIndex , t_Element ) ) )
  1463. {
  1464. }
  1465. else
  1466. {
  1467. t_Status = QueryPreprocessor :: State_Error ;
  1468. SysFreeString ( t_Element ) ;
  1469. break ;
  1470. }
  1471. SysFreeString ( t_Element ) ;
  1472. }
  1473. else
  1474. {
  1475. t_Status = QueryPreprocessor :: State_Error ;
  1476. break ;
  1477. }
  1478. }
  1479. if ( t_Status != QueryPreprocessor :: State_Error )
  1480. {
  1481. LONG t_ElementIndex = t_Lower ;
  1482. if ( SUCCEEDED ( SafeArrayPutElement ( t_LeftArray , & t_ElementIndex , t_LeftClass ) ) )
  1483. {
  1484. }
  1485. else
  1486. {
  1487. t_Status = QueryPreprocessor :: State_Error ;
  1488. }
  1489. }
  1490. }
  1491. else
  1492. {
  1493. t_Status = QueryPreprocessor :: State_Error ;
  1494. }
  1495. }
  1496. else
  1497. {
  1498. t_Status = QueryPreprocessor :: State_Error ;
  1499. }
  1500. }
  1501. else
  1502. {
  1503. t_Status = QueryPreprocessor :: State_Error ;
  1504. }
  1505. }
  1506. else
  1507. {
  1508. t_Status = QueryPreprocessor :: State_Error ;
  1509. }
  1510. }
  1511. if ( t_Status != QueryPreprocessor :: State_Error )
  1512. {
  1513. if ( t_LeftArray && t_RightArray )
  1514. {
  1515. ULONG t_MinimumLength = a_LeftLength < a_RightLength ? a_LeftLength : a_RightLength ;
  1516. for ( LONG t_Index = t_MinimumLength ; t_Index > 0 ; t_Index -- )
  1517. {
  1518. BSTR t_LeftElement = NULL ;
  1519. BSTR t_RightElement = NULL ;
  1520. LONG t_Dimension = 1 ;
  1521. LONG t_Lower ;
  1522. SafeArrayGetLBound ( t_LeftArray , t_Dimension , & t_Lower ) ;
  1523. t_Lower = t_Lower + t_Index - 1 ;
  1524. if ( SUCCEEDED ( t_Result = SafeArrayGetElement ( t_LeftArray , & t_Lower , & t_LeftElement ) ) )
  1525. {
  1526. SafeArrayGetUBound ( t_RightArray , t_Dimension , & t_Lower ) ;
  1527. t_Lower = t_Lower + t_Index - 1 ;
  1528. if ( SUCCEEDED ( t_Result = SafeArrayGetElement ( t_RightArray , & t_Lower , & t_RightElement ) ) )
  1529. {
  1530. }
  1531. }
  1532. if ( SUCCEEDED ( t_Result ) )
  1533. {
  1534. if ( wbem_wcsicmp ( t_LeftElement , t_RightElement ) != 0 )
  1535. {
  1536. SysFreeString ( t_LeftElement ) ;
  1537. SysFreeString ( t_RightElement ) ;
  1538. break ;
  1539. }
  1540. }
  1541. SysFreeString ( t_LeftElement ) ;
  1542. SysFreeString ( t_RightElement ) ;
  1543. }
  1544. if ( t_Index == 0 )
  1545. {
  1546. t_Status = QueryPreprocessor :: State_True ;
  1547. a_LeftIsA = TRUE ;
  1548. }
  1549. else
  1550. {
  1551. if ( t_Index == t_MinimumLength )
  1552. {
  1553. if ( a_RightLength == t_MinimumLength )
  1554. {
  1555. t_Status = QueryPreprocessor :: State_True ;
  1556. a_LeftIsA = TRUE ;
  1557. }
  1558. else
  1559. {
  1560. if ( a_LeftLength == t_MinimumLength )
  1561. {
  1562. t_Status = QueryPreprocessor :: State_True ;
  1563. a_LeftIsA = FALSE ;
  1564. }
  1565. }
  1566. }
  1567. }
  1568. }
  1569. else
  1570. {
  1571. t_Status = QueryPreprocessor :: State_Error ;
  1572. }
  1573. }
  1574. SafeArrayDestroy ( t_LeftArray ) ;
  1575. SafeArrayDestroy ( t_RightArray ) ;
  1576. VariantClear ( & t_LeftSafeArray ) ;
  1577. VariantClear ( & t_RightSafeArray ) ;
  1578. }
  1579. SysFreeString ( t_LeftClass ) ;
  1580. SysFreeString ( t_RightClass ) ;
  1581. return t_Status ;
  1582. }
  1583. /******************************************************************************
  1584. *
  1585. * Name:
  1586. *
  1587. *
  1588. * Description:
  1589. *
  1590. *
  1591. *****************************************************************************/
  1592. HRESULT CAggregator_IWbemProvider :: Enum_ClassProviders ( IWbemContext *a_Context )
  1593. {
  1594. HRESULT t_Result = Enum_ClassProviders (
  1595. m_CoreRepositoryStub ,
  1596. a_Context
  1597. ) ;
  1598. if ( SUCCEEDED ( t_Result ) )
  1599. {
  1600. for ( ULONG t_Index = 0 ; t_Index < m_ClassProvidersCount ; t_Index ++ )
  1601. {
  1602. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  1603. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  1604. {
  1605. if ( t_Registration->InteractionType () == e_InteractionType_Push )
  1606. {
  1607. IWbemServices *t_Provider = NULL ;
  1608. WmiInternalContext t_InternalContext ;
  1609. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  1610. HRESULT t_TempResult = m_Factory->GetProvider (
  1611. t_InternalContext ,
  1612. 0 ,
  1613. a_Context ,
  1614. NULL ,
  1615. m_User ,
  1616. m_Locale ,
  1617. NULL ,
  1618. m_ClassProviders [ t_Index ]->GetProviderName () ,
  1619. IID_IWbemServices ,
  1620. ( void ** ) & t_Provider
  1621. ) ;
  1622. if ( SUCCEEDED ( t_TempResult ) )
  1623. {
  1624. t_Provider->Release () ;
  1625. }
  1626. }
  1627. }
  1628. }
  1629. }
  1630. return t_Result ;
  1631. }
  1632. /******************************************************************************
  1633. *
  1634. * Name:
  1635. *
  1636. *
  1637. * Description:
  1638. *
  1639. *
  1640. *****************************************************************************/
  1641. HRESULT CAggregator_IWbemProvider :: Enum_ClassProviders (
  1642. IWbemServices *a_Repository ,
  1643. IWbemContext *a_Context
  1644. )
  1645. {
  1646. HRESULT t_Result = S_OK ;
  1647. BSTR t_Query = SysAllocString ( L"Select * from __ClassProviderRegistration" ) ;
  1648. if ( t_Query )
  1649. {
  1650. IEnumWbemClassObject *t_ClassObjectEnum = NULL ;
  1651. BSTR t_Language = SysAllocString ( ProviderSubSystem_Globals :: s_Wql ) ;
  1652. if ( t_Language )
  1653. {
  1654. t_Result = a_Repository->ExecQuery (
  1655. t_Language ,
  1656. t_Query ,
  1657. WBEM_FLAG_BIDIRECTIONAL ,
  1658. a_Context ,
  1659. & t_ClassObjectEnum
  1660. ) ;
  1661. if ( SUCCEEDED ( t_Result ) )
  1662. {
  1663. m_ClassProvidersCount = 0 ;
  1664. IWbemClassObject *t_ClassObject = NULL ;
  1665. ULONG t_ObjectCount = 0 ;
  1666. t_ClassObjectEnum->Reset () ;
  1667. while ( t_ClassObjectEnum->Next ( WBEM_INFINITE , 1 , & t_ClassObject , &t_ObjectCount ) == WBEM_NO_ERROR )
  1668. {
  1669. m_ClassProvidersCount ++ ;
  1670. t_ClassObject->Release () ;
  1671. }
  1672. if ( m_ClassProvidersCount )
  1673. {
  1674. m_ClassProviders = new CServerObject_ProviderRegistrationV1 * [ m_ClassProvidersCount ] ;
  1675. if ( m_ClassProviders )
  1676. {
  1677. ZeroMemory ( m_ClassProviders , sizeof ( CServerObject_ProviderRegistrationV1 * ) * m_ClassProvidersCount ) ;
  1678. ULONG t_Index = 0 ;
  1679. t_ClassObjectEnum->Reset () ;
  1680. while ( SUCCEEDED ( t_Result ) && ( t_ClassObjectEnum->Next ( WBEM_INFINITE , 1 , & t_ClassObject , &t_ObjectCount ) == WBEM_NO_ERROR ) )
  1681. {
  1682. VARIANT t_Variant ;
  1683. VariantInit ( & t_Variant ) ;
  1684. LONG t_VarType = 0 ;
  1685. LONG t_Flavour = 0 ;
  1686. t_Result = t_ClassObject->Get ( L"Provider" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  1687. if ( SUCCEEDED ( t_Result ) )
  1688. {
  1689. if ( t_Variant.vt == VT_BSTR )
  1690. {
  1691. IWbemPath *t_Path = NULL ;
  1692. t_Result = CoCreateInstance (
  1693. CLSID_WbemDefPath ,
  1694. NULL ,
  1695. CLSCTX_INPROC_SERVER ,
  1696. IID_IWbemPath ,
  1697. ( void ** ) & t_Path
  1698. ) ;
  1699. if ( SUCCEEDED ( t_Result ) )
  1700. {
  1701. t_Result = t_Path->SetText ( WBEMPATH_TREAT_SINGLE_IDENT_AS_NS | WBEMPATH_CREATE_ACCEPT_ALL , t_Variant.bstrVal ) ;
  1702. if ( SUCCEEDED ( t_Result ) )
  1703. {
  1704. m_ClassProviders [ t_Index ] = new CServerObject_ProviderRegistrationV1 ;
  1705. if ( m_ClassProviders [ t_Index ] )
  1706. {
  1707. m_ClassProviders [ t_Index ]->AddRef () ;
  1708. t_Result = m_ClassProviders [ t_Index ]->SetContext (
  1709. a_Context ,
  1710. NULL ,
  1711. a_Repository
  1712. ) ;
  1713. if ( SUCCEEDED ( t_Result ) )
  1714. {
  1715. t_Result = m_ClassProviders [ t_Index ]->Load (
  1716. e_All ,
  1717. NULL ,
  1718. t_Path
  1719. ) ;
  1720. }
  1721. }
  1722. else
  1723. {
  1724. t_Result = WBEM_E_OUT_OF_MEMORY ;
  1725. }
  1726. }
  1727. t_Path->Release () ;
  1728. }
  1729. }
  1730. }
  1731. VariantClear ( & t_Variant ) ;
  1732. t_ClassObject->Release () ;
  1733. t_Index ++ ;
  1734. }
  1735. }
  1736. else
  1737. {
  1738. t_Result = WBEM_E_OUT_OF_MEMORY ;
  1739. }
  1740. }
  1741. t_ClassObjectEnum->Release () ;
  1742. }
  1743. SysFreeString ( t_Language ) ;
  1744. }
  1745. else
  1746. {
  1747. t_Result = WBEM_E_OUT_OF_MEMORY ;
  1748. }
  1749. SysFreeString ( t_Query ) ;
  1750. }
  1751. else
  1752. {
  1753. t_Result = WBEM_E_OUT_OF_MEMORY ;
  1754. }
  1755. return t_Result ;
  1756. }
  1757. /******************************************************************************
  1758. *
  1759. * Name:
  1760. *
  1761. *
  1762. * Description:
  1763. *
  1764. *
  1765. *****************************************************************************/
  1766. HRESULT CAggregator_IWbemProvider::OpenNamespace (
  1767. const BSTR a_ObjectPath,
  1768. long a_Flags,
  1769. IWbemContext *a_Context,
  1770. IWbemServices **a_NamespaceService,
  1771. IWbemCallResult **a_CallResult
  1772. )
  1773. {
  1774. return WBEM_E_NOT_AVAILABLE ;
  1775. }
  1776. /******************************************************************************
  1777. *
  1778. * Name:
  1779. *
  1780. *
  1781. * Description:
  1782. *
  1783. *
  1784. *****************************************************************************/
  1785. HRESULT CAggregator_IWbemProvider :: CancelAsyncCall (
  1786. IWbemObjectSink *a_Sink
  1787. )
  1788. {
  1789. HRESULT t_Result = S_OK ;
  1790. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  1791. Lock () ;
  1792. WmiStatusCode t_StatusCode = Find (
  1793. a_Sink ,
  1794. t_Iterator
  1795. ) ;
  1796. if ( t_StatusCode == e_StatusCode_Success )
  1797. {
  1798. ObjectSinkContainerElement *t_Element = t_Iterator.GetElement () ;
  1799. UnLock () ;
  1800. IObjectSink_CancelOperation *t_ObjectSink = NULL ;
  1801. t_Result = t_Element->QueryInterface ( IID_IObjectSink_CancelOperation , ( void ** ) & t_ObjectSink ) ;
  1802. if ( SUCCEEDED ( t_Result ) )
  1803. {
  1804. t_Result = t_ObjectSink->Cancel (
  1805. 0
  1806. ) ;
  1807. t_ObjectSink->Release () ;
  1808. }
  1809. IWbemShutdown *t_Shutdown = NULL ;
  1810. HRESULT t_TempResult = t_Element->QueryInterface ( IID_IWbemShutdown , ( void ** ) & t_Shutdown ) ;
  1811. if ( SUCCEEDED ( t_TempResult ) )
  1812. {
  1813. t_TempResult = t_Shutdown->Shutdown (
  1814. 0 ,
  1815. 0 ,
  1816. NULL
  1817. ) ;
  1818. t_Shutdown->Release () ;
  1819. }
  1820. t_Element->Release () ;
  1821. }
  1822. else
  1823. {
  1824. UnLock () ;
  1825. t_Result = WBEM_E_NOT_FOUND ;
  1826. }
  1827. return t_Result ;
  1828. }
  1829. /******************************************************************************
  1830. *
  1831. * Name:
  1832. *
  1833. *
  1834. * Description:
  1835. *
  1836. *
  1837. *****************************************************************************/
  1838. HRESULT CAggregator_IWbemProvider :: QueryObjectSink (
  1839. long a_Flags,
  1840. IWbemObjectSink **a_Sink
  1841. )
  1842. {
  1843. return WBEM_E_NOT_AVAILABLE ;
  1844. }
  1845. /******************************************************************************
  1846. *
  1847. * Name:
  1848. *
  1849. *
  1850. * Description:
  1851. *
  1852. *
  1853. *****************************************************************************/
  1854. HRESULT CAggregator_IWbemProvider :: GetObject (
  1855. const BSTR a_ObjectPath,
  1856. long a_Flags,
  1857. IWbemContext *a_Context,
  1858. IWbemClassObject **a_Object,
  1859. IWbemCallResult **a_CallResult
  1860. )
  1861. {
  1862. return WBEM_E_NOT_AVAILABLE ;
  1863. }
  1864. /******************************************************************************
  1865. *
  1866. * Name:
  1867. *
  1868. *
  1869. * Description:
  1870. *
  1871. *
  1872. *****************************************************************************/
  1873. HRESULT CAggregator_IWbemProvider :: GetObjectAsync (
  1874. const BSTR a_ObjectPath,
  1875. long a_Flags,
  1876. IWbemContext *a_Context,
  1877. IWbemObjectSink *a_Sink
  1878. )
  1879. {
  1880. HRESULT t_Result = S_OK ;
  1881. if ( m_Initialized == 0 )
  1882. {
  1883. a_Sink->SetStatus ( 0 , WBEM_E_NOT_FOUND , NULL , NULL ) ;
  1884. return WBEM_E_NOT_FOUND ;
  1885. }
  1886. if ( m_ClassProvidersCount )
  1887. {
  1888. IWbemPath *t_Path = NULL ;
  1889. t_Result = CoCreateInstance (
  1890. CLSID_WbemDefPath ,
  1891. NULL ,
  1892. CLSCTX_INPROC_SERVER ,
  1893. IID_IWbemPath ,
  1894. ( void ** ) & t_Path
  1895. ) ;
  1896. if ( SUCCEEDED ( t_Result ) )
  1897. {
  1898. t_Result = t_Path->SetText ( WBEMPATH_CREATE_ACCEPT_ALL , a_ObjectPath ) ;
  1899. if ( SUCCEEDED ( t_Result ) )
  1900. {
  1901. ULONG t_ClassNameLength = 0 ;
  1902. LPWSTR t_ClassName = NULL ;
  1903. t_Result = t_Path->GetClassName (
  1904. & t_ClassNameLength ,
  1905. t_ClassName
  1906. );
  1907. if ( SUCCEEDED ( t_Result ) )
  1908. {
  1909. t_ClassName = new wchar_t [ t_ClassNameLength ] ;
  1910. if ( t_ClassName )
  1911. {
  1912. t_Result = t_Path->GetClassName (
  1913. & t_ClassNameLength ,
  1914. t_ClassName
  1915. );
  1916. if ( SUCCEEDED ( t_Result ) )
  1917. {
  1918. BOOL t_ClassProviderFound = FALSE ;
  1919. for ( ULONG t_Index = 0 ; t_Index < m_ClassProvidersCount ; t_Index ++ )
  1920. {
  1921. BOOL t_ProbeProvider = FALSE ;
  1922. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  1923. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  1924. {
  1925. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  1926. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  1927. if ( t_ForestCount )
  1928. {
  1929. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  1930. {
  1931. QueryPreprocessor :: QuadState t_Status = Get_Evaluate (
  1932. t_ClassName ,
  1933. a_Context ,
  1934. t_Forest [ t_FilterIndex ]
  1935. ) ;
  1936. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  1937. {
  1938. t_ProbeProvider = TRUE ;
  1939. }
  1940. }
  1941. }
  1942. else
  1943. {
  1944. t_ProbeProvider = TRUE ;
  1945. }
  1946. }
  1947. if ( t_ProbeProvider )
  1948. {
  1949. IWbemServices *t_Provider = NULL ;
  1950. WmiInternalContext t_InternalContext ;
  1951. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  1952. t_Result = m_Factory->GetProvider (
  1953. t_InternalContext ,
  1954. 0 ,
  1955. a_Context ,
  1956. NULL ,
  1957. m_User ,
  1958. m_Locale ,
  1959. NULL ,
  1960. m_ClassProviders [ t_Index ]->GetProviderName () ,
  1961. IID_IWbemServices ,
  1962. ( void ** ) & t_Provider
  1963. ) ;
  1964. if ( SUCCEEDED ( t_Result ) )
  1965. {
  1966. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  1967. {
  1968. CInterceptor_IWbemWaitingObjectSink_GetObjectAsync *t_WaitingSink = new CInterceptor_IWbemWaitingObjectSink_GetObjectAsync (
  1969. m_Allocator ,
  1970. t_Provider ,
  1971. a_Sink ,
  1972. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  1973. *m_ClassProviders [ t_Index ]
  1974. ) ;
  1975. if ( t_WaitingSink )
  1976. {
  1977. t_WaitingSink->AddRef () ;
  1978. t_Result = t_WaitingSink->Initialize (
  1979. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  1980. a_ObjectPath ,
  1981. a_Flags ,
  1982. a_Context
  1983. ) ;
  1984. if ( SUCCEEDED ( t_Result ) )
  1985. {
  1986. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  1987. Lock () ;
  1988. WmiStatusCode t_StatusCode = Insert (
  1989. *t_WaitingSink ,
  1990. t_Iterator
  1991. ) ;
  1992. UnLock () ;
  1993. if ( t_StatusCode == e_StatusCode_Success )
  1994. {
  1995. t_Result = t_Provider->GetObjectAsync (
  1996. a_ObjectPath,
  1997. a_Flags,
  1998. a_Context,
  1999. t_WaitingSink
  2000. ) ;
  2001. if ( SUCCEEDED ( t_Result ) )
  2002. {
  2003. t_Result = t_WaitingSink->Wait ( INFINITE ) ;
  2004. if ( SUCCEEDED ( t_Result ) )
  2005. {
  2006. if ( SUCCEEDED ( t_WaitingSink->GetResult () ) )
  2007. {
  2008. t_ClassProviderFound = TRUE ;
  2009. }
  2010. else
  2011. {
  2012. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2013. {
  2014. t_Result = S_OK ;
  2015. }
  2016. else
  2017. {
  2018. }
  2019. }
  2020. }
  2021. else
  2022. {
  2023. }
  2024. }
  2025. else
  2026. {
  2027. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2028. {
  2029. t_Result = S_OK ;
  2030. }
  2031. }
  2032. WmiQueue <IWbemClassObject *,8> &t_Queue = t_WaitingSink->GetQueue () ;
  2033. CriticalSection &t_CriticalSection = t_WaitingSink->GetQueueCriticalSection () ;
  2034. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  2035. WmiStatusCode t_StatusCode = e_StatusCode_Success ;
  2036. IWbemClassObject *t_Object = NULL ;
  2037. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  2038. {
  2039. if(SUCCEEDED(t_Result))
  2040. t_Result = a_Sink->Indicate ( 1 , & t_Object ) ;
  2041. t_Object->Release () ;
  2042. t_StatusCode = t_Queue.DeQueue () ;
  2043. }
  2044. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  2045. }
  2046. else
  2047. {
  2048. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2049. }
  2050. }
  2051. t_WaitingSink->Release () ;
  2052. }
  2053. else
  2054. {
  2055. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2056. }
  2057. }
  2058. t_Provider->Release () ;
  2059. }
  2060. else
  2061. {
  2062. t_Result = S_OK ;
  2063. }
  2064. }
  2065. }
  2066. if ( SUCCEEDED ( t_Result ) )
  2067. {
  2068. if ( t_ClassProviderFound == FALSE )
  2069. {
  2070. t_Result = WBEM_E_NOT_FOUND ;
  2071. }
  2072. }
  2073. }
  2074. delete [] t_ClassName ;
  2075. }
  2076. else
  2077. {
  2078. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2079. }
  2080. }
  2081. }
  2082. t_Path->Release () ;
  2083. }
  2084. }
  2085. else
  2086. {
  2087. t_Result = WBEM_E_NOT_FOUND ;
  2088. }
  2089. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  2090. return t_Result ;
  2091. }
  2092. /******************************************************************************
  2093. *
  2094. * Name:
  2095. *
  2096. *
  2097. * Description:
  2098. *
  2099. *
  2100. *****************************************************************************/
  2101. HRESULT CAggregator_IWbemProvider :: PutClass (
  2102. IWbemClassObject *a_Object,
  2103. long a_Flags,
  2104. IWbemContext *a_Context,
  2105. IWbemCallResult **a_CallResult
  2106. )
  2107. {
  2108. return WBEM_E_NOT_AVAILABLE ;
  2109. }
  2110. /******************************************************************************
  2111. *
  2112. * Name:
  2113. *
  2114. *
  2115. * Description:
  2116. *
  2117. *
  2118. *****************************************************************************/
  2119. HRESULT CAggregator_IWbemProvider :: PutClass_Helper_Advisory (
  2120. IWbemClassObject *a_ClassObject,
  2121. long a_Flags,
  2122. IWbemContext *a_Context,
  2123. IWbemObjectSink *a_Sink
  2124. )
  2125. {
  2126. HRESULT t_Result = S_OK ;
  2127. for ( ULONG t_Index = 0 ; SUCCEEDED ( t_Result ) && ( t_Index < m_ClassProvidersCount ) ; t_Index ++ )
  2128. {
  2129. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  2130. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  2131. {
  2132. switch ( t_Registration->GetVersion () )
  2133. {
  2134. case 1:
  2135. {
  2136. }
  2137. break ;
  2138. case 2:
  2139. {
  2140. BOOL t_ProbeProvider = FALSE ;
  2141. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  2142. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  2143. if ( t_ForestCount )
  2144. {
  2145. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  2146. {
  2147. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_True ;
  2148. t_Status = EnumDeep_Evaluate (
  2149. a_ClassObject ,
  2150. a_Context ,
  2151. t_Forest [ t_FilterIndex ]
  2152. ) ;
  2153. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  2154. {
  2155. t_ProbeProvider = TRUE ;
  2156. }
  2157. }
  2158. }
  2159. else
  2160. {
  2161. t_ProbeProvider = TRUE ;
  2162. }
  2163. if ( t_ProbeProvider )
  2164. {
  2165. IWbemServices *t_Provider = NULL ;
  2166. WmiInternalContext t_InternalContext ;
  2167. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  2168. t_Result = m_Factory->GetProvider (
  2169. t_InternalContext ,
  2170. 0 ,
  2171. a_Context ,
  2172. NULL ,
  2173. m_User ,
  2174. m_Locale ,
  2175. NULL ,
  2176. m_ClassProviders [ t_Index ]->GetProviderName () ,
  2177. IID_IWbemServices ,
  2178. ( void ** ) & t_Provider
  2179. ) ;
  2180. if ( SUCCEEDED ( t_Result ) )
  2181. {
  2182. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  2183. {
  2184. CInterceptor_IWbemWaitingObjectSink_PutClassAsync *t_PuttingSink = new CInterceptor_IWbemWaitingObjectSink_PutClassAsync (
  2185. m_Allocator ,
  2186. t_Provider ,
  2187. a_Sink ,
  2188. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2189. *m_ClassProviders [ t_Index ]
  2190. ) ;
  2191. if ( t_PuttingSink )
  2192. {
  2193. t_PuttingSink->AddRef () ;
  2194. t_Result = t_PuttingSink->Initialize (
  2195. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  2196. a_ClassObject ,
  2197. a_Flags & ~WBEM_FLAG_USE_AMENDED_QUALIFIERS ,
  2198. a_Context
  2199. ) ;
  2200. if ( SUCCEEDED ( t_Result ) )
  2201. {
  2202. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2203. Lock () ;
  2204. WmiStatusCode t_StatusCode = Insert (
  2205. *t_PuttingSink ,
  2206. t_Iterator
  2207. ) ;
  2208. UnLock () ;
  2209. if ( t_StatusCode == e_StatusCode_Success )
  2210. {
  2211. t_Result = t_Provider->PutClassAsync (
  2212. a_ClassObject ,
  2213. a_Flags & ~WBEM_FLAG_USE_AMENDED_QUALIFIERS ,
  2214. a_Context,
  2215. t_PuttingSink
  2216. ) ;
  2217. if ( SUCCEEDED ( t_Result ) )
  2218. {
  2219. t_Result = t_PuttingSink->Wait ( INFINITE ) ;
  2220. if ( SUCCEEDED ( t_Result ) )
  2221. {
  2222. t_Result = t_PuttingSink->GetResult () ;
  2223. if ( FAILED ( t_Result ) )
  2224. {
  2225. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2226. {
  2227. t_Result = S_OK ;
  2228. }
  2229. }
  2230. }
  2231. }
  2232. else
  2233. {
  2234. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2235. {
  2236. t_Result = S_OK ;
  2237. }
  2238. }
  2239. }
  2240. else
  2241. {
  2242. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2243. }
  2244. WmiQueue <IWbemClassObject *,8> &t_Queue = t_PuttingSink->GetQueue () ;
  2245. CriticalSection &t_CriticalSection = t_PuttingSink->GetQueueCriticalSection () ;
  2246. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  2247. IWbemClassObject *t_Object = NULL ;
  2248. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  2249. {
  2250. t_Object->Release () ;
  2251. t_StatusCode = t_Queue.DeQueue () ;
  2252. }
  2253. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  2254. }
  2255. t_PuttingSink->Release () ;
  2256. }
  2257. else
  2258. {
  2259. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2260. }
  2261. }
  2262. t_Provider->Release () ;
  2263. }
  2264. }
  2265. }
  2266. break ;
  2267. default:
  2268. {
  2269. t_Result = WBEM_E_INVALID_PROVIDER_REGISTRATION ;
  2270. }
  2271. break ;
  2272. }
  2273. }
  2274. }
  2275. return t_Result ;
  2276. }
  2277. /******************************************************************************
  2278. *
  2279. * Name:
  2280. *
  2281. *
  2282. * Description:
  2283. *
  2284. *
  2285. *****************************************************************************/
  2286. HRESULT CAggregator_IWbemProvider :: PutClass_Helper_Put_CreateOrUpdate (
  2287. BSTR a_Class ,
  2288. IWbemClassObject *a_Object,
  2289. long a_Flags,
  2290. IWbemContext *a_Context,
  2291. IWbemObjectSink *a_Sink
  2292. )
  2293. {
  2294. HRESULT t_Result = S_OK ;
  2295. BOOL t_FoundProvider = FALSE ;
  2296. for ( ULONG t_Index = 0 ; SUCCEEDED ( t_Result ) && ( t_Index < m_ClassProvidersCount ) ; t_Index ++ )
  2297. {
  2298. BOOL t_ProbeProvider = FALSE ;
  2299. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  2300. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  2301. {
  2302. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  2303. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  2304. if ( t_ForestCount )
  2305. {
  2306. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  2307. {
  2308. QueryPreprocessor :: QuadState t_Status = Get_Evaluate (
  2309. a_Class ,
  2310. a_Context ,
  2311. t_Forest [ t_FilterIndex ]
  2312. ) ;
  2313. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  2314. {
  2315. t_ProbeProvider = TRUE ;
  2316. }
  2317. }
  2318. }
  2319. else
  2320. {
  2321. t_ProbeProvider = TRUE ;
  2322. }
  2323. }
  2324. if ( t_ProbeProvider )
  2325. {
  2326. IWbemServices *t_Provider = NULL ;
  2327. WmiInternalContext t_InternalContext ;
  2328. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  2329. t_Result = m_Factory->GetProvider (
  2330. t_InternalContext ,
  2331. 0 ,
  2332. a_Context ,
  2333. NULL ,
  2334. m_User ,
  2335. m_Locale ,
  2336. NULL ,
  2337. m_ClassProviders [ t_Index ]->GetProviderName () ,
  2338. IID_IWbemServices ,
  2339. ( void ** ) & t_Provider
  2340. ) ;
  2341. if ( SUCCEEDED ( t_Result ) )
  2342. {
  2343. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  2344. {
  2345. CInterceptor_IWbemWaitingObjectSink_PutClassAsync *t_WaitingSink = new CInterceptor_IWbemWaitingObjectSink_PutClassAsync (
  2346. m_Allocator ,
  2347. t_Provider ,
  2348. a_Sink ,
  2349. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2350. *m_ClassProviders [ t_Index ]
  2351. ) ;
  2352. if ( t_WaitingSink )
  2353. {
  2354. t_WaitingSink->AddRef () ;
  2355. t_Result = t_WaitingSink->Initialize (
  2356. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  2357. a_Object ,
  2358. a_Flags,
  2359. a_Context
  2360. ) ;
  2361. if ( SUCCEEDED ( t_Result ) )
  2362. {
  2363. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2364. Lock () ;
  2365. WmiStatusCode t_StatusCode = Insert (
  2366. *t_WaitingSink ,
  2367. t_Iterator
  2368. ) ;
  2369. UnLock () ;
  2370. if ( t_StatusCode == e_StatusCode_Success )
  2371. {
  2372. t_Result = t_Provider->PutClassAsync (
  2373. a_Object ,
  2374. a_Flags,
  2375. a_Context,
  2376. t_WaitingSink
  2377. ) ;
  2378. if ( SUCCEEDED ( t_Result ) )
  2379. {
  2380. t_Result = t_WaitingSink->Wait ( INFINITE ) ;
  2381. if ( SUCCEEDED ( t_Result ) )
  2382. {
  2383. if ( SUCCEEDED ( t_WaitingSink->GetResult () ) )
  2384. {
  2385. t_FoundProvider = TRUE ;
  2386. }
  2387. else
  2388. {
  2389. if ( ( a_Flags & ( WBEM_FLAG_CREATE_ONLY | WBEM_FLAG_UPDATE_ONLY ) ) == WBEM_FLAG_CREATE_ONLY )
  2390. {
  2391. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2392. {
  2393. t_Result = S_OK ;
  2394. }
  2395. else
  2396. {
  2397. }
  2398. }
  2399. else
  2400. {
  2401. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS )
  2402. {
  2403. t_Result = S_OK ;
  2404. }
  2405. else
  2406. {
  2407. }
  2408. }
  2409. }
  2410. }
  2411. else
  2412. {
  2413. }
  2414. }
  2415. else
  2416. {
  2417. if ( ( a_Flags & ( WBEM_FLAG_CREATE_ONLY | WBEM_FLAG_UPDATE_ONLY ) ) == WBEM_FLAG_CREATE_ONLY )
  2418. {
  2419. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2420. {
  2421. t_Result = S_OK ;
  2422. }
  2423. else
  2424. {
  2425. }
  2426. }
  2427. else
  2428. {
  2429. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS )
  2430. {
  2431. t_Result = S_OK ;
  2432. }
  2433. else
  2434. {
  2435. }
  2436. }
  2437. }
  2438. WmiQueue <IWbemClassObject *,8> &t_Queue = t_WaitingSink->GetQueue () ;
  2439. CriticalSection &t_CriticalSection = t_WaitingSink->GetQueueCriticalSection () ;
  2440. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  2441. WmiStatusCode t_StatusCode = e_StatusCode_Success ;
  2442. IWbemClassObject *t_Object = NULL ;
  2443. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  2444. {
  2445. t_Object->Release () ;
  2446. t_StatusCode = t_Queue.DeQueue () ;
  2447. }
  2448. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  2449. }
  2450. else
  2451. {
  2452. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2453. }
  2454. }
  2455. t_WaitingSink->Release () ;
  2456. }
  2457. else
  2458. {
  2459. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2460. }
  2461. }
  2462. t_Provider->Release () ;
  2463. }
  2464. }
  2465. }
  2466. if ( SUCCEEDED ( t_Result ) )
  2467. {
  2468. if ( t_FoundProvider == FALSE )
  2469. {
  2470. t_Result = WBEM_E_NOT_FOUND ;
  2471. }
  2472. }
  2473. return t_Result ;
  2474. }
  2475. /******************************************************************************
  2476. *
  2477. * Name:
  2478. *
  2479. *
  2480. * Description:
  2481. *
  2482. *
  2483. *****************************************************************************/
  2484. HRESULT CAggregator_IWbemProvider :: PutClass_Helper_Put (
  2485. IWbemClassObject *a_Object,
  2486. long a_Flags,
  2487. IWbemContext *a_Context,
  2488. IWbemObjectSink *a_Sink
  2489. )
  2490. {
  2491. VARIANT t_Variant ;
  2492. VariantInit ( & t_Variant ) ;
  2493. LONG t_VarType = 0 ;
  2494. LONG t_Flavour = 0 ;
  2495. BOOL t_FoundProvider = FALSE ;
  2496. HRESULT t_Result = a_Object->Get ( L"__Class" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  2497. if ( SUCCEEDED ( t_Result ) )
  2498. {
  2499. BOOL t_OwningRegistration = FALSE ;
  2500. for ( ULONG t_Index = 0 ; ( SUCCEEDED ( t_Result ) && ( t_Index < m_ClassProvidersCount ) ) && ( t_OwningRegistration == FALSE ) ; t_Index ++ )
  2501. {
  2502. BOOL t_ProbeProvider = FALSE ;
  2503. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  2504. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  2505. {
  2506. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  2507. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  2508. if ( t_ForestCount )
  2509. {
  2510. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  2511. {
  2512. QueryPreprocessor :: QuadState t_Status = Get_Evaluate (
  2513. t_Variant.bstrVal ,
  2514. a_Context ,
  2515. t_Forest [ t_FilterIndex ]
  2516. ) ;
  2517. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  2518. {
  2519. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  2520. {
  2521. t_FoundProvider = TRUE ;
  2522. }
  2523. t_ProbeProvider = TRUE ;
  2524. }
  2525. }
  2526. }
  2527. else
  2528. {
  2529. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  2530. {
  2531. t_FoundProvider = TRUE ;
  2532. }
  2533. t_ProbeProvider = TRUE ;
  2534. }
  2535. }
  2536. if ( t_ProbeProvider )
  2537. {
  2538. IWbemServices *t_Provider = NULL ;
  2539. WmiInternalContext t_InternalContext ;
  2540. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  2541. t_Result = m_Factory->GetProvider (
  2542. t_InternalContext ,
  2543. 0 ,
  2544. a_Context ,
  2545. NULL ,
  2546. m_User ,
  2547. m_Locale ,
  2548. NULL ,
  2549. m_ClassProviders [ t_Index ]->GetProviderName () ,
  2550. IID_IWbemServices ,
  2551. ( void ** ) & t_Provider
  2552. ) ;
  2553. if ( SUCCEEDED ( t_Result ) )
  2554. {
  2555. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  2556. {
  2557. CInterceptor_IWbemWaitingObjectSink_GetObjectAsync *t_WaitingSink = new CInterceptor_IWbemWaitingObjectSink_GetObjectAsync (
  2558. m_Allocator ,
  2559. t_Provider ,
  2560. a_Sink ,
  2561. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2562. *m_ClassProviders [ t_Index ]
  2563. ) ;
  2564. if ( t_WaitingSink )
  2565. {
  2566. t_WaitingSink->AddRef () ;
  2567. t_Result = t_WaitingSink->Initialize (
  2568. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  2569. t_Variant.bstrVal ,
  2570. a_Flags,
  2571. a_Context
  2572. ) ;
  2573. if ( SUCCEEDED ( t_Result ) )
  2574. {
  2575. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2576. Lock () ;
  2577. WmiStatusCode t_StatusCode = Insert (
  2578. *t_WaitingSink ,
  2579. t_Iterator
  2580. ) ;
  2581. UnLock () ;
  2582. if ( t_StatusCode == e_StatusCode_Success )
  2583. {
  2584. WmiStatusCode t_StatusCode = e_StatusCode_Success ;
  2585. WmiQueue <IWbemClassObject *,8> &t_Queue = t_WaitingSink->GetQueue () ;
  2586. t_Result = t_Provider->GetObjectAsync (
  2587. t_Variant.bstrVal ,
  2588. a_Flags,
  2589. a_Context,
  2590. t_WaitingSink
  2591. ) ;
  2592. if ( SUCCEEDED ( t_Result ) )
  2593. {
  2594. t_Result = t_WaitingSink->Wait ( INFINITE ) ;
  2595. if ( SUCCEEDED ( t_Result ) )
  2596. {
  2597. if ( SUCCEEDED ( t_WaitingSink->GetResult () ) )
  2598. {
  2599. t_OwningRegistration = TRUE ;
  2600. CriticalSection &t_CriticalSection = t_WaitingSink->GetQueueCriticalSection () ;
  2601. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  2602. IWbemClassObject *t_Object = NULL ;
  2603. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  2604. {
  2605. t_Object->Release () ;
  2606. t_StatusCode = t_Queue.DeQueue () ;
  2607. }
  2608. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  2609. }
  2610. else
  2611. {
  2612. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2613. {
  2614. t_Result = S_OK ;
  2615. }
  2616. }
  2617. }
  2618. }
  2619. else
  2620. {
  2621. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2622. {
  2623. t_Result = S_OK ;
  2624. }
  2625. }
  2626. CriticalSection &t_CriticalSection = t_WaitingSink->GetQueueCriticalSection () ;
  2627. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  2628. IWbemClassObject *t_Object = NULL ;
  2629. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  2630. {
  2631. t_Object->Release () ;
  2632. t_StatusCode = t_Queue.DeQueue () ;
  2633. }
  2634. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  2635. }
  2636. else
  2637. {
  2638. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2639. }
  2640. }
  2641. t_WaitingSink->Release () ;
  2642. }
  2643. else
  2644. {
  2645. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2646. }
  2647. }
  2648. t_Provider->Release () ;
  2649. }
  2650. }
  2651. }
  2652. if ( SUCCEEDED ( t_Result ) )
  2653. {
  2654. if ( t_OwningRegistration )
  2655. {
  2656. if ( ( a_Flags & ( WBEM_FLAG_CREATE_ONLY | WBEM_FLAG_UPDATE_ONLY ) ) == WBEM_FLAG_CREATE_ONLY )
  2657. {
  2658. t_Result = WBEM_E_ALREADY_EXISTS ;
  2659. }
  2660. if ( SUCCEEDED ( t_Result ) )
  2661. {
  2662. t_Result = PutClass_Helper_Put_CreateOrUpdate (
  2663. t_Variant.bstrVal ,
  2664. a_Object,
  2665. ( ( a_Flags & ( WBEM_FLAG_CREATE_ONLY | WBEM_FLAG_UPDATE_ONLY ) ) == WBEM_FLAG_CREATE_OR_UPDATE ) ? a_Flags | WBEM_FLAG_UPDATE_ONLY : a_Flags & ( ~WBEM_FLAG_CREATE_ONLY ) ,
  2666. a_Context,
  2667. a_Sink
  2668. ) ;
  2669. }
  2670. }
  2671. else
  2672. {
  2673. if ( ( a_Flags & ( WBEM_FLAG_CREATE_ONLY | WBEM_FLAG_UPDATE_ONLY ) ) == WBEM_FLAG_UPDATE_ONLY )
  2674. {
  2675. t_Result = WBEM_E_NOT_FOUND ;
  2676. }
  2677. if ( SUCCEEDED ( t_Result ) )
  2678. {
  2679. t_Result = PutClass_Helper_Put_CreateOrUpdate (
  2680. t_Variant.bstrVal ,
  2681. a_Object,
  2682. ( ( a_Flags & ( WBEM_FLAG_CREATE_ONLY | WBEM_FLAG_UPDATE_ONLY ) ) == WBEM_FLAG_CREATE_OR_UPDATE ) ? a_Flags | WBEM_FLAG_CREATE_ONLY : a_Flags & ( ~WBEM_FLAG_UPDATE_ONLY ) ,
  2683. a_Context,
  2684. a_Sink
  2685. ) ;
  2686. }
  2687. }
  2688. }
  2689. VariantClear ( & t_Variant ) ;
  2690. }
  2691. if ( SUCCEEDED ( t_Result ) )
  2692. {
  2693. if ( t_FoundProvider == FALSE )
  2694. {
  2695. t_Result = WBEM_E_NOT_FOUND ;
  2696. }
  2697. }
  2698. return t_Result ;
  2699. }
  2700. /******************************************************************************
  2701. *
  2702. * Name:
  2703. *
  2704. *
  2705. * Description:
  2706. *
  2707. *
  2708. *****************************************************************************/
  2709. HRESULT CAggregator_IWbemProvider :: PutClassAsync (
  2710. IWbemClassObject *a_Object,
  2711. long a_Flags,
  2712. IWbemContext *a_Context,
  2713. IWbemObjectSink *a_Sink
  2714. )
  2715. {
  2716. HRESULT t_Result = S_OK ;
  2717. if ( m_Initialized == 0 )
  2718. {
  2719. if ( WBEM_FLAG_ADVISORY & a_Flags )
  2720. {
  2721. a_Sink->SetStatus ( 0 , S_OK , NULL , NULL ) ;
  2722. return S_OK ;
  2723. }
  2724. else
  2725. {
  2726. a_Sink->SetStatus ( 0 , WBEM_E_NOT_FOUND , NULL , NULL ) ;
  2727. return WBEM_E_NOT_FOUND ;
  2728. }
  2729. }
  2730. if ( WBEM_FLAG_ADVISORY & a_Flags )
  2731. {
  2732. if ( m_ClassProvidersCount )
  2733. {
  2734. t_Result = PutClass_Helper_Advisory (
  2735. a_Object ,
  2736. a_Flags,
  2737. a_Context,
  2738. a_Sink
  2739. ) ;
  2740. }
  2741. }
  2742. else
  2743. {
  2744. if ( m_ClassProvidersCount )
  2745. {
  2746. t_Result = PutClass_Helper_Put (
  2747. a_Object ,
  2748. a_Flags,
  2749. a_Context,
  2750. a_Sink
  2751. ) ;
  2752. }
  2753. else
  2754. {
  2755. t_Result = WBEM_E_NOT_FOUND ;
  2756. }
  2757. }
  2758. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  2759. return t_Result ;
  2760. }
  2761. /******************************************************************************
  2762. *
  2763. * Name:
  2764. *
  2765. *
  2766. * Description:
  2767. *
  2768. *
  2769. *****************************************************************************/
  2770. HRESULT CAggregator_IWbemProvider :: DeleteClass (
  2771. const BSTR a_Class,
  2772. long a_Flags,
  2773. IWbemContext *a_Context,
  2774. IWbemCallResult **a_CallResult
  2775. )
  2776. {
  2777. return WBEM_E_NOT_AVAILABLE ;
  2778. }
  2779. /******************************************************************************
  2780. *
  2781. * Name:
  2782. *
  2783. *
  2784. * Description:
  2785. *
  2786. *
  2787. *****************************************************************************/
  2788. HRESULT CAggregator_IWbemProvider :: DeleteClass_Helper_Advisory (
  2789. IWbemClassObject *a_ClassObject ,
  2790. const BSTR a_Class,
  2791. long a_Flags,
  2792. IWbemContext *a_Context,
  2793. IWbemObjectSink *a_Sink
  2794. )
  2795. {
  2796. HRESULT t_Result = S_OK ;
  2797. for ( ULONG t_Index = 0 ; SUCCEEDED ( t_Result ) && ( t_Index < m_ClassProvidersCount ) ; t_Index ++ )
  2798. {
  2799. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  2800. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  2801. {
  2802. switch ( t_Registration->GetVersion () )
  2803. {
  2804. case 1:
  2805. {
  2806. }
  2807. break ;
  2808. case 2:
  2809. {
  2810. BOOL t_ProbeProvider = FALSE ;
  2811. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  2812. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  2813. if ( t_ForestCount )
  2814. {
  2815. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  2816. {
  2817. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_True ;
  2818. t_Status = EnumDeep_Evaluate (
  2819. a_ClassObject ,
  2820. a_Context ,
  2821. t_Forest [ t_FilterIndex ]
  2822. ) ;
  2823. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  2824. {
  2825. t_ProbeProvider = TRUE ;
  2826. }
  2827. }
  2828. }
  2829. else
  2830. {
  2831. t_ProbeProvider = TRUE ;
  2832. }
  2833. if ( t_ProbeProvider )
  2834. {
  2835. IWbemServices *t_Provider = NULL ;
  2836. WmiInternalContext t_InternalContext ;
  2837. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  2838. t_Result = m_Factory->GetProvider (
  2839. t_InternalContext ,
  2840. 0 ,
  2841. a_Context ,
  2842. NULL ,
  2843. m_User ,
  2844. m_Locale ,
  2845. NULL ,
  2846. m_ClassProviders [ t_Index ]->GetProviderName () ,
  2847. IID_IWbemServices ,
  2848. ( void ** ) & t_Provider
  2849. ) ;
  2850. if ( SUCCEEDED ( t_Result ) )
  2851. {
  2852. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  2853. {
  2854. CInterceptor_IWbemWaitingObjectSink_DeleteClassAsync *t_DeletingSink = new CInterceptor_IWbemWaitingObjectSink_DeleteClassAsync (
  2855. m_Allocator ,
  2856. t_Provider ,
  2857. a_Sink ,
  2858. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  2859. *m_ClassProviders [ t_Index ]
  2860. ) ;
  2861. if ( t_DeletingSink )
  2862. {
  2863. t_DeletingSink->AddRef () ;
  2864. t_Result = t_DeletingSink->Initialize (
  2865. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  2866. a_Class ,
  2867. a_Flags ,
  2868. a_Context
  2869. ) ;
  2870. if ( SUCCEEDED ( t_Result ) )
  2871. {
  2872. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  2873. Lock () ;
  2874. WmiStatusCode t_StatusCode = Insert (
  2875. *t_DeletingSink ,
  2876. t_Iterator
  2877. ) ;
  2878. UnLock () ;
  2879. if ( t_StatusCode == e_StatusCode_Success )
  2880. {
  2881. t_Result = t_Provider->DeleteClassAsync (
  2882. a_Class,
  2883. a_Flags & ~WBEM_FLAG_USE_AMENDED_QUALIFIERS ,
  2884. a_Context,
  2885. t_DeletingSink
  2886. ) ;
  2887. if ( SUCCEEDED ( t_Result ) )
  2888. {
  2889. t_Result = t_DeletingSink->Wait ( INFINITE ) ;
  2890. if ( SUCCEEDED ( t_Result ) )
  2891. {
  2892. t_Result = t_DeletingSink->GetResult () ;
  2893. if ( FAILED ( t_Result ) )
  2894. {
  2895. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2896. {
  2897. t_Result = S_OK ;
  2898. }
  2899. }
  2900. }
  2901. else
  2902. {
  2903. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  2904. {
  2905. t_Result = S_OK ;
  2906. }
  2907. }
  2908. }
  2909. }
  2910. else
  2911. {
  2912. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2913. }
  2914. WmiQueue <IWbemClassObject *,8> &t_Queue = t_DeletingSink->GetQueue () ;
  2915. CriticalSection &t_CriticalSection = t_DeletingSink->GetQueueCriticalSection () ;
  2916. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  2917. IWbemClassObject *t_Object = NULL ;
  2918. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  2919. {
  2920. t_Object->Release () ;
  2921. t_StatusCode = t_Queue.DeQueue () ;
  2922. }
  2923. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  2924. }
  2925. t_DeletingSink->Release () ;
  2926. }
  2927. else
  2928. {
  2929. t_Result = WBEM_E_OUT_OF_MEMORY ;
  2930. }
  2931. }
  2932. t_Provider->Release () ;
  2933. }
  2934. }
  2935. }
  2936. break ;
  2937. default:
  2938. {
  2939. t_Result = WBEM_E_INVALID_PROVIDER_REGISTRATION ;
  2940. }
  2941. break ;
  2942. }
  2943. }
  2944. }
  2945. return t_Result ;
  2946. }
  2947. /******************************************************************************
  2948. *
  2949. * Name:
  2950. *
  2951. *
  2952. * Description:
  2953. *
  2954. *
  2955. *****************************************************************************/
  2956. HRESULT CAggregator_IWbemProvider :: DeleteClass_Helper_Enum (
  2957. IWbemClassObject *a_ClassObject ,
  2958. const BSTR a_Class,
  2959. long a_Flags,
  2960. IWbemContext *a_Context,
  2961. IWbemObjectSink *a_Sink
  2962. )
  2963. {
  2964. HRESULT t_Result = S_OK ;
  2965. for ( ULONG t_Index = 0 ; SUCCEEDED ( t_Result ) && ( t_Index < m_ClassProvidersCount ) ; t_Index ++ )
  2966. {
  2967. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  2968. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  2969. {
  2970. switch ( t_Registration->GetVersion () )
  2971. {
  2972. case 1:
  2973. {
  2974. BOOL t_EnumProbeProvider = FALSE ;
  2975. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  2976. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  2977. if ( t_ForestCount )
  2978. {
  2979. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  2980. {
  2981. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_True ;
  2982. t_Status = EnumDeep_Evaluate (
  2983. a_ClassObject ,
  2984. a_Context ,
  2985. t_Forest [ t_FilterIndex ]
  2986. ) ;
  2987. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  2988. {
  2989. t_EnumProbeProvider = TRUE ;
  2990. }
  2991. }
  2992. }
  2993. else
  2994. {
  2995. t_EnumProbeProvider = TRUE ;
  2996. }
  2997. if ( t_EnumProbeProvider )
  2998. {
  2999. IWbemServices *t_Provider = NULL ;
  3000. WmiInternalContext t_InternalContext ;
  3001. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  3002. t_Result = m_Factory->GetProvider (
  3003. t_InternalContext ,
  3004. 0 ,
  3005. a_Context ,
  3006. NULL ,
  3007. m_User ,
  3008. m_Locale ,
  3009. NULL ,
  3010. m_ClassProviders [ t_Index ]->GetProviderName () ,
  3011. IID_IWbemServices ,
  3012. ( void ** ) & t_Provider
  3013. ) ;
  3014. if ( SUCCEEDED ( t_Result ) )
  3015. {
  3016. CInterceptor_IWbemWaitingObjectSink_CreateClassEnumAsync *t_EnumeratingSink = new CInterceptor_IWbemWaitingObjectSink_CreateClassEnumAsync (
  3017. m_Allocator ,
  3018. t_Provider ,
  3019. a_Sink ,
  3020. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3021. *m_ClassProviders [ t_Index ]
  3022. ) ;
  3023. if ( t_EnumeratingSink )
  3024. {
  3025. t_EnumeratingSink->AddRef () ;
  3026. t_Result = t_EnumeratingSink->Initialize (
  3027. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  3028. a_Class,
  3029. WBEM_FLAG_DEEP,
  3030. a_Context
  3031. ) ;
  3032. if ( SUCCEEDED ( t_Result ) )
  3033. {
  3034. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3035. Lock () ;
  3036. WmiStatusCode t_StatusCode = Insert (
  3037. *t_EnumeratingSink ,
  3038. t_Iterator
  3039. ) ;
  3040. UnLock () ;
  3041. if ( t_StatusCode == e_StatusCode_Success )
  3042. {
  3043. t_Result = t_Provider->CreateClassEnumAsync (
  3044. a_Class,
  3045. WBEM_FLAG_DEEP,
  3046. a_Context,
  3047. t_EnumeratingSink
  3048. ) ;
  3049. if ( SUCCEEDED ( t_Result ) )
  3050. {
  3051. t_Result = t_EnumeratingSink->Wait ( INFINITE ) ;
  3052. if ( SUCCEEDED ( t_Result ) )
  3053. {
  3054. t_Result = t_EnumeratingSink->GetResult () ;
  3055. if ( SUCCEEDED ( t_Result ) )
  3056. {
  3057. WmiQueue <IWbemClassObject *,8> &t_Queue = t_EnumeratingSink->GetQueue () ;
  3058. CriticalSection &t_CriticalSection = t_EnumeratingSink->GetQueueCriticalSection () ;
  3059. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  3060. IWbemClassObject *t_Object = NULL ;
  3061. WmiStatusCode t_StatusCode = e_StatusCode_Success ;
  3062. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  3063. {
  3064. VARIANT t_Variant ;
  3065. VariantInit ( & t_Variant ) ;
  3066. LONG t_VarType = 0 ;
  3067. LONG t_Flavour = 0 ;
  3068. t_Result = t_Object->Get ( L"__Class" , 0 , & t_Variant , & t_VarType , & t_Flavour ) ;
  3069. if ( SUCCEEDED ( t_Result ) )
  3070. {
  3071. CInterceptor_IWbemWaitingObjectSink_DeleteClassAsync *t_DeletingSink = new CInterceptor_IWbemWaitingObjectSink_DeleteClassAsync (
  3072. m_Allocator ,
  3073. t_Provider ,
  3074. a_Sink ,
  3075. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3076. *m_ClassProviders [ t_Index ]
  3077. ) ;
  3078. if ( t_DeletingSink )
  3079. {
  3080. t_DeletingSink->AddRef () ;
  3081. t_Result = t_DeletingSink->Initialize (
  3082. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  3083. t_Variant.bstrVal ,
  3084. a_Flags & ~WBEM_FLAG_USE_AMENDED_QUALIFIERS ,
  3085. a_Context
  3086. ) ;
  3087. if ( SUCCEEDED ( t_Result ) )
  3088. {
  3089. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3090. Lock () ;
  3091. WmiStatusCode t_StatusCode = Insert (
  3092. *t_DeletingSink ,
  3093. t_Iterator
  3094. ) ;
  3095. UnLock () ;
  3096. if ( t_StatusCode == e_StatusCode_Success )
  3097. {
  3098. t_Result = t_Provider->DeleteClassAsync (
  3099. t_Variant.bstrVal ,
  3100. a_Flags & ~WBEM_FLAG_USE_AMENDED_QUALIFIERS ,
  3101. a_Context,
  3102. t_DeletingSink
  3103. ) ;
  3104. if ( SUCCEEDED ( t_Result ) )
  3105. {
  3106. t_Result = t_DeletingSink->Wait ( INFINITE ) ;
  3107. if ( SUCCEEDED ( t_Result ) )
  3108. {
  3109. if ( SUCCEEDED ( t_DeletingSink->GetResult () ) )
  3110. {
  3111. }
  3112. else
  3113. {
  3114. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS )
  3115. {
  3116. t_Result = S_OK ;
  3117. }
  3118. }
  3119. }
  3120. }
  3121. else
  3122. {
  3123. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS )
  3124. {
  3125. t_Result = S_OK ;
  3126. }
  3127. }
  3128. }
  3129. else
  3130. {
  3131. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3132. }
  3133. WmiQueue <IWbemClassObject *,8> &t_Queue = t_DeletingSink->GetQueue () ;
  3134. CriticalSection &t_CriticalSection = t_DeletingSink->GetQueueCriticalSection () ;
  3135. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  3136. IWbemClassObject *t_Object = NULL ;
  3137. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  3138. {
  3139. t_Object->Release () ;
  3140. t_StatusCode = t_Queue.DeQueue () ;
  3141. }
  3142. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  3143. }
  3144. t_DeletingSink->Release () ;
  3145. }
  3146. else
  3147. {
  3148. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3149. }
  3150. VariantClear ( & t_Variant ) ;
  3151. }
  3152. else
  3153. {
  3154. t_Result = WBEM_E_CRITICAL_ERROR ;
  3155. }
  3156. t_Object->Release () ;
  3157. t_StatusCode = t_Queue.DeQueue () ;
  3158. }
  3159. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  3160. }
  3161. else
  3162. {
  3163. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  3164. {
  3165. t_Result = S_OK ;
  3166. }
  3167. }
  3168. }
  3169. }
  3170. else
  3171. {
  3172. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  3173. {
  3174. t_Result = S_OK ;
  3175. }
  3176. }
  3177. }
  3178. else
  3179. {
  3180. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3181. }
  3182. }
  3183. t_EnumeratingSink->Release () ;
  3184. }
  3185. else
  3186. {
  3187. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3188. }
  3189. t_Provider->Release () ;
  3190. }
  3191. }
  3192. }
  3193. break ;
  3194. case 2:
  3195. {
  3196. }
  3197. break ;
  3198. default:
  3199. {
  3200. t_Result = WBEM_E_INVALID_PROVIDER_REGISTRATION ;
  3201. }
  3202. break ;
  3203. }
  3204. }
  3205. }
  3206. return t_Result ;
  3207. }
  3208. /******************************************************************************
  3209. *
  3210. * Name:
  3211. *
  3212. *
  3213. * Description:
  3214. *
  3215. *
  3216. *****************************************************************************/
  3217. HRESULT CAggregator_IWbemProvider :: DeleteClass_Helper_Get (
  3218. IWbemClassObject *a_ClassObject ,
  3219. const BSTR a_Class,
  3220. long a_Flags,
  3221. IWbemContext *a_Context,
  3222. IWbemObjectSink *a_Sink
  3223. )
  3224. {
  3225. HRESULT t_Result = S_OK ;
  3226. BOOL t_ClassDeleted = FALSE ;
  3227. for ( ULONG t_Index = 0 ; SUCCEEDED ( t_Result ) && ( t_Index < m_ClassProvidersCount ) ; t_Index ++ )
  3228. {
  3229. BOOL t_EnumProbeProvider = FALSE ;
  3230. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  3231. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  3232. {
  3233. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  3234. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  3235. if ( t_ForestCount )
  3236. {
  3237. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  3238. {
  3239. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_True ;
  3240. t_Status = Get_Evaluate (
  3241. a_Class ,
  3242. a_Context ,
  3243. t_Forest [ t_FilterIndex ]
  3244. ) ;
  3245. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  3246. {
  3247. t_EnumProbeProvider = TRUE ;
  3248. }
  3249. }
  3250. }
  3251. else
  3252. {
  3253. t_EnumProbeProvider = TRUE ;
  3254. }
  3255. }
  3256. if ( t_EnumProbeProvider )
  3257. {
  3258. IWbemServices *t_Provider = NULL ;
  3259. WmiInternalContext t_InternalContext ;
  3260. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  3261. t_Result = m_Factory->GetProvider (
  3262. t_InternalContext ,
  3263. 0 ,
  3264. a_Context ,
  3265. NULL ,
  3266. m_User ,
  3267. m_Locale ,
  3268. NULL ,
  3269. m_ClassProviders [ t_Index ]->GetProviderName () ,
  3270. IID_IWbemServices ,
  3271. ( void ** ) & t_Provider
  3272. ) ;
  3273. if ( SUCCEEDED ( t_Result ) )
  3274. {
  3275. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  3276. {
  3277. CInterceptor_IWbemWaitingObjectSink_GetObjectAsync *t_GettingSink = new CInterceptor_IWbemWaitingObjectSink_GetObjectAsync (
  3278. m_Allocator ,
  3279. t_Provider ,
  3280. a_Sink ,
  3281. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3282. *m_ClassProviders [ t_Index ]
  3283. ) ;
  3284. if ( t_GettingSink )
  3285. {
  3286. t_GettingSink->AddRef () ;
  3287. t_Result = t_GettingSink->Initialize (
  3288. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  3289. a_Class,
  3290. 0 ,
  3291. a_Context
  3292. ) ;
  3293. if ( SUCCEEDED ( t_Result ) )
  3294. {
  3295. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3296. Lock () ;
  3297. WmiStatusCode t_StatusCode = Insert (
  3298. *t_GettingSink ,
  3299. t_Iterator
  3300. ) ;
  3301. UnLock () ;
  3302. if ( t_StatusCode == e_StatusCode_Success )
  3303. {
  3304. t_Result = t_Provider->GetObjectAsync (
  3305. a_Class,
  3306. 0 ,
  3307. a_Context,
  3308. t_GettingSink
  3309. ) ;
  3310. if ( SUCCEEDED ( t_Result ) )
  3311. {
  3312. t_Result = t_GettingSink->Wait ( INFINITE ) ;
  3313. if ( SUCCEEDED ( t_Result ) )
  3314. {
  3315. t_Result = t_GettingSink->GetResult () ;
  3316. if ( SUCCEEDED ( t_Result ) )
  3317. {
  3318. CInterceptor_IWbemWaitingObjectSink_DeleteClassAsync *t_DeletingSink = new CInterceptor_IWbemWaitingObjectSink_DeleteClassAsync (
  3319. m_Allocator ,
  3320. t_Provider ,
  3321. a_Sink ,
  3322. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3323. *m_ClassProviders [ t_Index ]
  3324. ) ;
  3325. if ( t_DeletingSink )
  3326. {
  3327. t_DeletingSink->AddRef () ;
  3328. t_Result = t_DeletingSink->Initialize (
  3329. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  3330. a_Class ,
  3331. a_Flags & ~WBEM_FLAG_USE_AMENDED_QUALIFIERS ,
  3332. a_Context
  3333. ) ;
  3334. if ( SUCCEEDED ( t_Result ) )
  3335. {
  3336. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3337. Lock () ;
  3338. WmiStatusCode t_StatusCode = Insert (
  3339. *t_DeletingSink ,
  3340. t_Iterator
  3341. ) ;
  3342. UnLock () ;
  3343. if ( t_StatusCode == e_StatusCode_Success )
  3344. {
  3345. t_Result = t_Provider->DeleteClassAsync (
  3346. a_Class,
  3347. a_Flags & ~WBEM_FLAG_USE_AMENDED_QUALIFIERS ,
  3348. a_Context,
  3349. t_DeletingSink
  3350. ) ;
  3351. if ( SUCCEEDED ( t_Result ) )
  3352. {
  3353. t_Result = t_DeletingSink->Wait ( INFINITE ) ;
  3354. if ( SUCCEEDED ( t_Result ) )
  3355. {
  3356. if ( SUCCEEDED ( t_DeletingSink->GetResult () ) )
  3357. {
  3358. t_ClassDeleted = TRUE ;
  3359. }
  3360. }
  3361. else
  3362. {
  3363. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS )
  3364. {
  3365. t_Result = S_OK ;
  3366. }
  3367. }
  3368. }
  3369. else
  3370. {
  3371. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS )
  3372. {
  3373. t_Result = S_OK ;
  3374. }
  3375. }
  3376. }
  3377. else
  3378. {
  3379. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3380. }
  3381. WmiQueue <IWbemClassObject *,8> &t_Queue = t_DeletingSink->GetQueue () ;
  3382. CriticalSection &t_CriticalSection = t_DeletingSink->GetQueueCriticalSection () ;
  3383. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  3384. IWbemClassObject *t_Object = NULL ;
  3385. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  3386. {
  3387. t_Object->Release () ;
  3388. t_StatusCode = t_Queue.DeQueue () ;
  3389. }
  3390. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  3391. }
  3392. t_DeletingSink->Release () ;
  3393. }
  3394. else
  3395. {
  3396. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3397. }
  3398. }
  3399. else
  3400. {
  3401. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  3402. {
  3403. t_Result = S_OK ;
  3404. }
  3405. }
  3406. }
  3407. }
  3408. else
  3409. {
  3410. if ( t_Result == WBEM_E_NOT_FOUND || t_Result == WBEM_E_INVALID_CLASS || t_Result == WBEM_E_PROVIDER_NOT_CAPABLE )
  3411. {
  3412. t_Result = S_OK ;
  3413. }
  3414. }
  3415. }
  3416. else
  3417. {
  3418. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3419. }
  3420. WmiQueue <IWbemClassObject *,8> &t_Queue = t_GettingSink->GetQueue () ;
  3421. CriticalSection &t_CriticalSection = t_GettingSink->GetQueueCriticalSection () ;
  3422. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  3423. IWbemClassObject *t_Object = NULL ;
  3424. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  3425. {
  3426. t_Object->Release () ;
  3427. t_StatusCode = t_Queue.DeQueue () ;
  3428. }
  3429. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  3430. }
  3431. t_GettingSink->Release () ;
  3432. }
  3433. else
  3434. {
  3435. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3436. }
  3437. }
  3438. t_Provider->Release () ;
  3439. }
  3440. }
  3441. }
  3442. if ( SUCCEEDED ( t_Result ) )
  3443. {
  3444. if ( t_ClassDeleted == FALSE )
  3445. {
  3446. t_Result = WBEM_E_NOT_FOUND ;
  3447. }
  3448. }
  3449. return t_Result ;
  3450. }
  3451. /******************************************************************************
  3452. *
  3453. * Name:
  3454. *
  3455. *
  3456. * Description:
  3457. *
  3458. *
  3459. *****************************************************************************/
  3460. HRESULT CAggregator_IWbemProvider :: DeleteClassAsync (
  3461. const BSTR a_Class,
  3462. long a_Flags,
  3463. IWbemContext *a_Context,
  3464. IWbemObjectSink *a_Sink
  3465. )
  3466. {
  3467. HRESULT t_Result = S_OK ;
  3468. if ( m_Initialized == 0 )
  3469. {
  3470. if ( WBEM_FLAG_ADVISORY & a_Flags )
  3471. {
  3472. a_Sink->SetStatus ( 0 , S_OK , NULL , NULL ) ;
  3473. return S_OK ;
  3474. }
  3475. else
  3476. {
  3477. a_Sink->SetStatus ( 0 , WBEM_E_NOT_FOUND , NULL , NULL ) ;
  3478. return WBEM_E_NOT_FOUND ;
  3479. }
  3480. }
  3481. IWbemClassObject *t_ClassObject = NULL ;
  3482. t_Result = m_CoreFullStub->GetObject (
  3483. a_Class ,
  3484. 0 ,
  3485. a_Context ,
  3486. & t_ClassObject ,
  3487. NULL
  3488. ) ;
  3489. if ( SUCCEEDED ( t_Result ) )
  3490. {
  3491. if ( WBEM_FLAG_ADVISORY & a_Flags )
  3492. {
  3493. t_Result = DeleteClass_Helper_Advisory (
  3494. t_ClassObject ,
  3495. a_Class,
  3496. a_Flags,
  3497. a_Context,
  3498. a_Sink
  3499. ) ;
  3500. }
  3501. else
  3502. {
  3503. t_Result = DeleteClass_Helper_Enum (
  3504. t_ClassObject ,
  3505. a_Class,
  3506. a_Flags,
  3507. a_Context,
  3508. a_Sink
  3509. ) ;
  3510. if ( SUCCEEDED ( t_Result ) )
  3511. {
  3512. t_Result = DeleteClass_Helper_Get (
  3513. t_ClassObject ,
  3514. a_Class,
  3515. a_Flags,
  3516. a_Context,
  3517. a_Sink
  3518. ) ;
  3519. }
  3520. }
  3521. t_ClassObject->Release () ;
  3522. }
  3523. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  3524. return t_Result ;
  3525. }
  3526. /******************************************************************************
  3527. *
  3528. * Name:
  3529. *
  3530. *
  3531. * Description:
  3532. *
  3533. *
  3534. *****************************************************************************/
  3535. HRESULT CAggregator_IWbemProvider :: CreateClassEnum (
  3536. const BSTR a_Superclass,
  3537. long a_Flags,
  3538. IWbemContext *a_Context,
  3539. IEnumWbemClassObject **a_Enum
  3540. )
  3541. {
  3542. return WBEM_E_NOT_AVAILABLE ;
  3543. }
  3544. /******************************************************************************
  3545. *
  3546. * Name:
  3547. *
  3548. *
  3549. * Description:
  3550. *
  3551. *
  3552. *****************************************************************************/
  3553. SCODE CAggregator_IWbemProvider :: CreateClassEnumAsync (
  3554. const BSTR a_Superclass ,
  3555. long a_Flags,
  3556. IWbemContext *a_Context,
  3557. IWbemObjectSink *a_Sink
  3558. )
  3559. {
  3560. HRESULT t_Result = S_OK ;
  3561. if ( m_Initialized == 0 )
  3562. {
  3563. a_Sink->SetStatus ( 0 , S_OK , NULL , NULL ) ;
  3564. return S_OK ;
  3565. }
  3566. if ( m_ClassProvidersCount )
  3567. {
  3568. IWbemClassObject *t_SuperclassObject = NULL ;
  3569. if ( wcscmp ( L"" , a_Superclass ) != 0 )
  3570. {
  3571. t_Result = m_CoreFullStub->GetObject (
  3572. a_Superclass ,
  3573. 0 ,
  3574. a_Context ,
  3575. & t_SuperclassObject ,
  3576. NULL
  3577. ) ;
  3578. }
  3579. if ( SUCCEEDED ( t_Result ) )
  3580. {
  3581. BOOL t_ClassProviderFound = FALSE ;
  3582. for ( ULONG t_Index = 0 ; t_Index < m_ClassProvidersCount ; t_Index ++ )
  3583. {
  3584. BOOL t_ProbeProvider = FALSE ;
  3585. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  3586. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  3587. {
  3588. if ( t_SuperclassObject )
  3589. {
  3590. WmiTreeNode **t_Forest = t_Registration->GetResultSetQuery () ;
  3591. ULONG t_ForestCount = t_Registration->GetResultSetQueryCount () ;
  3592. if ( t_ForestCount )
  3593. {
  3594. for ( ULONG t_FilterIndex = 0 ; t_FilterIndex < t_ForestCount ; t_FilterIndex ++ )
  3595. {
  3596. QueryPreprocessor :: QuadState t_Status = QueryPreprocessor :: State_True ;
  3597. if ( ( a_Flags & ( WBEM_FLAG_DEEP | WBEM_FLAG_SHALLOW ) ) == WBEM_FLAG_DEEP )
  3598. {
  3599. t_Status = EnumDeep_Evaluate (
  3600. t_SuperclassObject ,
  3601. a_Context ,
  3602. t_Forest [ t_FilterIndex ]
  3603. ) ;
  3604. }
  3605. else
  3606. {
  3607. t_Status = EnumShallow_Evaluate (
  3608. t_SuperclassObject ,
  3609. a_Context ,
  3610. t_Forest [ t_FilterIndex ]
  3611. ) ;
  3612. }
  3613. if ( ( t_Status == QueryPreprocessor :: State_True ) || ( t_Status == QueryPreprocessor :: State_Undefined ) )
  3614. {
  3615. t_ProbeProvider = TRUE ;
  3616. }
  3617. }
  3618. }
  3619. else
  3620. {
  3621. t_ProbeProvider = TRUE ;
  3622. }
  3623. }
  3624. else
  3625. {
  3626. t_ProbeProvider = TRUE ;
  3627. }
  3628. }
  3629. if ( t_ProbeProvider )
  3630. {
  3631. IWbemServices *t_Provider = NULL ;
  3632. WmiInternalContext t_InternalContext ;
  3633. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  3634. t_Result = m_Factory->GetProvider (
  3635. t_InternalContext ,
  3636. 0 ,
  3637. a_Context ,
  3638. NULL ,
  3639. m_User ,
  3640. m_Locale ,
  3641. NULL ,
  3642. m_ClassProviders [ t_Index ]->GetProviderName () ,
  3643. IID_IWbemServices ,
  3644. ( void ** ) & t_Provider
  3645. ) ;
  3646. if ( SUCCEEDED ( t_Result ) )
  3647. {
  3648. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  3649. {
  3650. CInterceptor_IWbemWaitingObjectSink_CreateClassEnumAsync *t_WaitingSink = new CInterceptor_IWbemWaitingObjectSink_CreateClassEnumAsync (
  3651. m_Allocator ,
  3652. t_Provider ,
  3653. a_Sink ,
  3654. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  3655. *m_ClassProviders [ t_Index ]
  3656. ) ;
  3657. if ( t_WaitingSink )
  3658. {
  3659. t_WaitingSink->AddRef () ;
  3660. t_Result = t_WaitingSink->Initialize (
  3661. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  3662. a_Superclass ,
  3663. a_Flags,
  3664. a_Context
  3665. ) ;
  3666. if ( SUCCEEDED ( t_Result ) )
  3667. {
  3668. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  3669. Lock () ;
  3670. WmiStatusCode t_StatusCode = Insert (
  3671. *t_WaitingSink ,
  3672. t_Iterator
  3673. ) ;
  3674. UnLock () ;
  3675. if ( t_StatusCode == e_StatusCode_Success )
  3676. {
  3677. t_ClassProviderFound = TRUE ;
  3678. t_Result = t_Provider->CreateClassEnumAsync (
  3679. a_Superclass,
  3680. a_Flags,
  3681. a_Context,
  3682. t_WaitingSink
  3683. ) ;
  3684. if ( SUCCEEDED ( t_Result ) )
  3685. {
  3686. t_Result = t_WaitingSink->Wait ( INFINITE ) ;
  3687. if ( SUCCEEDED ( t_Result ) )
  3688. {
  3689. if ( SUCCEEDED ( t_WaitingSink->GetResult () ) )
  3690. {
  3691. WmiQueue <IWbemClassObject *,8> &t_Queue = t_WaitingSink->GetQueue () ;
  3692. CriticalSection &t_CriticalSection = t_WaitingSink->GetQueueCriticalSection () ;
  3693. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  3694. WmiStatusCode t_StatusCode = e_StatusCode_Success ;
  3695. IWbemClassObject *t_Object = NULL ;
  3696. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  3697. {
  3698. if(SUCCEEDED(t_Result))
  3699. t_Result = a_Sink->Indicate ( 1 , & t_Object ) ;
  3700. t_Object->Release () ;
  3701. t_StatusCode = t_Queue.DeQueue () ;
  3702. }
  3703. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  3704. }
  3705. else
  3706. {
  3707. t_Result = S_OK ;
  3708. }
  3709. }
  3710. else
  3711. {
  3712. }
  3713. }
  3714. else
  3715. {
  3716. t_Result = S_OK ;
  3717. }
  3718. }
  3719. else
  3720. {
  3721. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3722. }
  3723. }
  3724. t_WaitingSink->Release () ;
  3725. }
  3726. else
  3727. {
  3728. t_Result = WBEM_E_OUT_OF_MEMORY ;
  3729. }
  3730. }
  3731. t_Provider->Release () ;
  3732. }
  3733. else
  3734. {
  3735. t_Result = S_OK ;
  3736. }
  3737. }
  3738. }
  3739. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  3740. }
  3741. else if ( t_Result == WBEM_E_NOT_FOUND )
  3742. {
  3743. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  3744. }
  3745. if ( t_SuperclassObject )
  3746. {
  3747. t_SuperclassObject->Release () ;
  3748. }
  3749. }
  3750. else
  3751. {
  3752. t_Result = WBEM_E_NOT_FOUND;
  3753. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  3754. }
  3755. return t_Result ;
  3756. }
  3757. /******************************************************************************
  3758. *
  3759. * Name:
  3760. *
  3761. *
  3762. * Description:
  3763. *
  3764. *
  3765. *****************************************************************************/
  3766. HRESULT CAggregator_IWbemProvider :: PutInstance (
  3767. IWbemClassObject *a_Instance,
  3768. long a_Flags,
  3769. IWbemContext *a_Context,
  3770. IWbemCallResult **a_CallResult
  3771. )
  3772. {
  3773. return WBEM_E_NOT_AVAILABLE ;
  3774. }
  3775. /******************************************************************************
  3776. *
  3777. * Name:
  3778. *
  3779. *
  3780. * Description:
  3781. *
  3782. *
  3783. *****************************************************************************/
  3784. HRESULT CAggregator_IWbemProvider :: PutInstanceAsync (
  3785. IWbemClassObject *a_Instance,
  3786. long a_Flags ,
  3787. IWbemContext *a_Context ,
  3788. IWbemObjectSink *a_Sink
  3789. )
  3790. {
  3791. HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  3792. return t_Result ;
  3793. }
  3794. /******************************************************************************
  3795. *
  3796. * Name:
  3797. *
  3798. *
  3799. * Description:
  3800. *
  3801. *
  3802. *****************************************************************************/
  3803. HRESULT CAggregator_IWbemProvider :: DeleteInstance (
  3804. const BSTR a_ObjectPath,
  3805. long a_Flags,
  3806. IWbemContext *a_Context,
  3807. IWbemCallResult **a_CallResult
  3808. )
  3809. {
  3810. return WBEM_E_NOT_AVAILABLE ;
  3811. }
  3812. /******************************************************************************
  3813. *
  3814. * Name:
  3815. *
  3816. *
  3817. * Description:
  3818. *
  3819. *
  3820. *****************************************************************************/
  3821. HRESULT CAggregator_IWbemProvider :: DeleteInstanceAsync (
  3822. const BSTR a_ObjectPath,
  3823. long a_Flags,
  3824. IWbemContext *a_Context,
  3825. IWbemObjectSink *a_Sink
  3826. )
  3827. {
  3828. HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  3829. return t_Result ;
  3830. }
  3831. /******************************************************************************
  3832. *
  3833. * Name:
  3834. *
  3835. *
  3836. * Description:
  3837. *
  3838. *
  3839. *****************************************************************************/
  3840. HRESULT CAggregator_IWbemProvider :: CreateInstanceEnum (
  3841. const BSTR a_Class,
  3842. long a_Flags,
  3843. IWbemContext *a_Context,
  3844. IEnumWbemClassObject **a_Enum
  3845. )
  3846. {
  3847. return WBEM_E_NOT_AVAILABLE ;
  3848. }
  3849. /******************************************************************************
  3850. *
  3851. * Name:
  3852. *
  3853. *
  3854. * Description:
  3855. *
  3856. *
  3857. *****************************************************************************/
  3858. HRESULT CAggregator_IWbemProvider :: CreateInstanceEnumAsync (
  3859. const BSTR a_Class ,
  3860. long a_Flags ,
  3861. IWbemContext *a_Context ,
  3862. IWbemObjectSink *a_Sink
  3863. )
  3864. {
  3865. HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  3866. return t_Result ;
  3867. }
  3868. /******************************************************************************
  3869. *
  3870. * Name:
  3871. *
  3872. *
  3873. * Description:
  3874. *
  3875. *
  3876. *****************************************************************************/
  3877. HRESULT CAggregator_IWbemProvider :: ExecQuery (
  3878. const BSTR a_QueryLanguage,
  3879. const BSTR a_Query,
  3880. long a_Flags,
  3881. IWbemContext *a_Context,
  3882. IEnumWbemClassObject **a_Enum
  3883. )
  3884. {
  3885. return WBEM_E_NOT_AVAILABLE ;
  3886. }
  3887. /******************************************************************************
  3888. *
  3889. * Name:
  3890. *
  3891. *
  3892. * Description:
  3893. *
  3894. *
  3895. *****************************************************************************/
  3896. HRESULT CAggregator_IWbemProvider :: ExecQueryAsync (
  3897. const BSTR a_QueryLanguage,
  3898. const BSTR a_Query,
  3899. long a_Flags,
  3900. IWbemContext *a_Context,
  3901. IWbemObjectSink *a_Sink
  3902. )
  3903. {
  3904. HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  3905. return t_Result ;
  3906. }
  3907. /******************************************************************************
  3908. *
  3909. * Name:
  3910. *
  3911. *
  3912. * Description:
  3913. *
  3914. *
  3915. *****************************************************************************/
  3916. HRESULT CAggregator_IWbemProvider :: ExecNotificationQuery (
  3917. const BSTR a_QueryLanguage,
  3918. const BSTR a_Query,
  3919. long a_Flags,
  3920. IWbemContext *a_Context,
  3921. IEnumWbemClassObject **a_Enum
  3922. )
  3923. {
  3924. return WBEM_E_NOT_AVAILABLE ;
  3925. }
  3926. /******************************************************************************
  3927. *
  3928. * Name:
  3929. *
  3930. *
  3931. * Description:
  3932. *
  3933. *
  3934. *****************************************************************************/
  3935. HRESULT CAggregator_IWbemProvider :: ExecNotificationQueryAsync (
  3936. const BSTR a_QueryLanguage ,
  3937. const BSTR a_Query,
  3938. long a_Flags,
  3939. IWbemContext *a_Context,
  3940. IWbemObjectSink *a_Sink
  3941. )
  3942. {
  3943. return WBEM_E_NOT_AVAILABLE ;
  3944. }
  3945. /******************************************************************************
  3946. *
  3947. * Name:
  3948. *
  3949. *
  3950. * Description:
  3951. *
  3952. *
  3953. *****************************************************************************/
  3954. HRESULT STDMETHODCALLTYPE CAggregator_IWbemProvider :: ExecMethod (
  3955. const BSTR a_ObjectPath ,
  3956. const BSTR a_MethodName ,
  3957. long a_Flags ,
  3958. IWbemContext *a_Context ,
  3959. IWbemClassObject *a_InParams ,
  3960. IWbemClassObject **a_OutParams ,
  3961. IWbemCallResult **a_CallResult
  3962. )
  3963. {
  3964. return WBEM_E_NOT_AVAILABLE ;
  3965. }
  3966. /******************************************************************************
  3967. *
  3968. * Name:
  3969. *
  3970. *
  3971. * Description:
  3972. *
  3973. *
  3974. *****************************************************************************/
  3975. HRESULT STDMETHODCALLTYPE CAggregator_IWbemProvider :: ExecMethodAsync (
  3976. const BSTR a_ObjectPath,
  3977. const BSTR a_MethodName,
  3978. long a_Flags,
  3979. IWbemContext *a_Context,
  3980. IWbemClassObject *a_InParams,
  3981. IWbemObjectSink *a_Sink
  3982. )
  3983. {
  3984. HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  3985. return t_Result ;
  3986. }
  3987. /******************************************************************************
  3988. *
  3989. * Name:
  3990. *
  3991. *
  3992. * Description:
  3993. *
  3994. *
  3995. *****************************************************************************/
  3996. HRESULT CAggregator_IWbemProvider :: Expel (
  3997. long a_Flags ,
  3998. IWbemContext *a_Context
  3999. )
  4000. {
  4001. HRESULT t_Result = S_OK ;
  4002. CWbemGlobal_IWmiProviderController *t_Controller = ServiceCacheElement :: GetController () ;
  4003. if ( t_Controller )
  4004. {
  4005. t_Controller->Shutdown ( ServiceCacheElement :: GetKey () ) ;
  4006. }
  4007. return t_Result ;
  4008. }
  4009. /******************************************************************************
  4010. *
  4011. * Name:
  4012. *
  4013. *
  4014. * Description:
  4015. *
  4016. *
  4017. *****************************************************************************/
  4018. HRESULT CAggregator_IWbemProvider :: ForceReload ()
  4019. {
  4020. return WBEM_E_NOT_AVAILABLE ;
  4021. }
  4022. /******************************************************************************
  4023. *
  4024. * Name:
  4025. *
  4026. *
  4027. * Description:
  4028. *
  4029. *
  4030. *****************************************************************************/
  4031. HRESULT CAggregator_IWbemProvider :: Shutdown (
  4032. LONG a_Flags ,
  4033. ULONG a_MaxMilliSeconds ,
  4034. IWbemContext *a_Context
  4035. )
  4036. {
  4037. HRESULT t_Result = S_OK ;
  4038. CWbemGlobal_IWmiObjectSinkController :: Shutdown () ;
  4039. return t_Result ;
  4040. }
  4041. /******************************************************************************
  4042. *
  4043. * Name:
  4044. *
  4045. *
  4046. * Description:
  4047. *
  4048. *
  4049. *****************************************************************************/
  4050. HRESULT CAggregator_IWbemProvider :: GetReferencesClasses (
  4051. LONG a_Flags ,
  4052. IWbemContext *a_Context ,
  4053. IWbemObjectSink *a_Sink
  4054. )
  4055. {
  4056. HRESULT t_Result = S_OK ;
  4057. if ( m_Initialized == 0 )
  4058. {
  4059. a_Sink->SetStatus ( 0 , S_OK , NULL , NULL ) ;
  4060. return S_OK ;
  4061. }
  4062. if ( m_ClassProvidersCount )
  4063. {
  4064. BOOL t_ClassProviderFound = FALSE ;
  4065. for ( ULONG t_Index = 0 ; t_Index < m_ClassProvidersCount ; t_Index ++ )
  4066. {
  4067. BOOL t_ProbeProvider = FALSE ;
  4068. CServerObject_ClassProviderRegistrationV1 *t_Registration = & m_ClassProviders [ t_Index ]->GetClassProviderRegistration () ;
  4069. if ( t_Registration && SUCCEEDED ( t_Registration->GetResult () ) )
  4070. {
  4071. t_ProbeProvider = t_Registration->HasReferencedSet() ;
  4072. }
  4073. if ( t_ProbeProvider )
  4074. {
  4075. IWbemServices *t_Provider = NULL ;
  4076. WmiInternalContext t_InternalContext ;
  4077. ZeroMemory ( & t_InternalContext , sizeof ( t_InternalContext ) ) ;
  4078. t_Result = m_Factory->GetProvider (
  4079. t_InternalContext ,
  4080. 0 ,
  4081. a_Context ,
  4082. NULL ,
  4083. m_User ,
  4084. m_Locale ,
  4085. NULL ,
  4086. m_ClassProviders [ t_Index ]->GetProviderName () ,
  4087. IID_IWbemServices ,
  4088. ( void ** ) & t_Provider
  4089. ) ;
  4090. if ( SUCCEEDED ( t_Result ) )
  4091. {
  4092. if ( t_Registration->InteractionType () == e_InteractionType_Pull )
  4093. {
  4094. CInterceptor_IWbemWaitingObjectSink_CreateClassEnumAsync *t_WaitingSink = new CInterceptor_IWbemWaitingObjectSink_CreateClassEnumAsync (
  4095. m_Allocator ,
  4096. t_Provider ,
  4097. a_Sink ,
  4098. ( CWbemGlobal_IWmiObjectSinkController * ) this ,
  4099. *m_ClassProviders [ t_Index ]
  4100. ) ;
  4101. if ( t_WaitingSink )
  4102. {
  4103. t_WaitingSink->AddRef () ;
  4104. t_Result = t_WaitingSink->Initialize (
  4105. m_ClassProviders [ t_Index ]->GetComRegistration ().GetSecurityDescriptor () ,
  4106. L"" ,
  4107. a_Flags,
  4108. a_Context
  4109. ) ;
  4110. if ( SUCCEEDED ( t_Result ) )
  4111. {
  4112. CWbemGlobal_IWmiObjectSinkController_Container_Iterator t_Iterator ;
  4113. Lock () ;
  4114. WmiStatusCode t_StatusCode = Insert (
  4115. *t_WaitingSink ,
  4116. t_Iterator
  4117. ) ;
  4118. UnLock () ;
  4119. if ( t_StatusCode == e_StatusCode_Success )
  4120. {
  4121. t_ClassProviderFound = TRUE ;
  4122. t_Result = t_Provider->CreateClassEnumAsync (
  4123. L"",
  4124. a_Flags,
  4125. a_Context,
  4126. t_WaitingSink
  4127. ) ;
  4128. if ( SUCCEEDED ( t_Result ) )
  4129. {
  4130. t_Result = t_WaitingSink->Wait ( INFINITE ) ;
  4131. if ( SUCCEEDED ( t_Result ) )
  4132. {
  4133. if ( SUCCEEDED ( t_WaitingSink->GetResult () ) )
  4134. {
  4135. WmiQueue <IWbemClassObject *,8> &t_Queue = t_WaitingSink->GetQueue () ;
  4136. CriticalSection &t_CriticalSection = t_WaitingSink->GetQueueCriticalSection () ;
  4137. WmiHelper :: EnterCriticalSection ( & t_CriticalSection ) ;
  4138. WmiStatusCode t_StatusCode = e_StatusCode_Success ;
  4139. IWbemClassObject *t_Object = NULL ;
  4140. while ( ( t_StatusCode = t_Queue.Top ( t_Object ) ) == e_StatusCode_Success )
  4141. {
  4142. if(SUCCEEDED(t_Result))
  4143. t_Result = a_Sink->Indicate ( 1 , & t_Object ) ;
  4144. t_Object->Release () ;
  4145. t_StatusCode = t_Queue.DeQueue () ;
  4146. }
  4147. WmiHelper :: LeaveCriticalSection ( & t_CriticalSection ) ;
  4148. }
  4149. else
  4150. {
  4151. t_Result = S_OK ;
  4152. }
  4153. }
  4154. else
  4155. {
  4156. }
  4157. }
  4158. else
  4159. {
  4160. t_Result = S_OK ;
  4161. }
  4162. }
  4163. else
  4164. {
  4165. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4166. }
  4167. }
  4168. t_WaitingSink->Release () ;
  4169. }
  4170. else
  4171. {
  4172. t_Result = WBEM_E_OUT_OF_MEMORY ;
  4173. }
  4174. }
  4175. t_Provider->Release () ;
  4176. }
  4177. else
  4178. {
  4179. t_Result = S_OK ;
  4180. }
  4181. }
  4182. }
  4183. a_Sink->SetStatus ( 0 , t_Result , NULL , NULL ) ;
  4184. }
  4185. else
  4186. {
  4187. a_Sink->SetStatus ( 0 , S_OK , NULL , NULL ) ;
  4188. }
  4189. return t_Result ;
  4190. }