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.

1123 lines
24 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. Cache.H
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _Server_Cache_H
  9. #define _Server_Cache_H
  10. #include <PssException.h>
  11. #include <Allocator.h>
  12. #include <Algorithms.h>
  13. #include <TPQueue.h>
  14. #include <BasicTree.h>
  15. #include <Cache.h>
  16. #include <CGlobals.h>
  17. #include <lockst.h>
  18. #include "ProvRegInfo.h"
  19. /******************************************************************************
  20. *
  21. * Name:
  22. *
  23. *
  24. * Description:
  25. *
  26. *
  27. *****************************************************************************/
  28. class AutoFreeString
  29. {
  30. private:
  31. BSTR m_String ;
  32. protected:
  33. public:
  34. AutoFreeString ( BSTR a_String = NULL )
  35. {
  36. m_String = a_String ;
  37. }
  38. ~AutoFreeString ()
  39. {
  40. SysFreeString ( m_String ) ;
  41. }
  42. const BSTR Get () const
  43. {
  44. return m_String ;
  45. }
  46. BSTR Take ()
  47. {
  48. BSTR t_Str = m_String ;
  49. m_String = NULL ;
  50. return t_Str ;
  51. }
  52. AutoFreeString &operator= ( BSTR a_String )
  53. {
  54. SysFreeString ( m_String ) ;
  55. m_String = a_String ;
  56. return *this ;
  57. }
  58. } ;
  59. /******************************************************************************
  60. *
  61. * Name:
  62. *
  63. *
  64. * Description:
  65. *
  66. *
  67. *****************************************************************************/
  68. class HostCacheKey
  69. {
  70. public:
  71. enum HostDesignation
  72. {
  73. e_HostDesignation_Shared
  74. };
  75. enum IdentityDesignation
  76. {
  77. e_IdentityDesignation_LocalSystem ,
  78. e_IdentityDesignation_LocalService ,
  79. e_IdentityDesignation_NetworkService ,
  80. e_IdentityDesignation_User
  81. } ;
  82. HostDesignation m_HostDesignation ;
  83. BSTR m_Group ;
  84. IdentityDesignation m_IdentityDesignation ;
  85. BSTR m_Identity ;
  86. public:
  87. HostCacheKey () :
  88. m_Identity ( NULL ) ,
  89. m_Group ( NULL ) ,
  90. m_HostDesignation ( e_HostDesignation_Shared ) ,
  91. m_IdentityDesignation ( e_IdentityDesignation_LocalSystem )
  92. {
  93. }
  94. HostCacheKey (
  95. const HostCacheKey &a_Key
  96. ) : m_Identity ( NULL ) ,
  97. m_Group ( NULL ) ,
  98. m_HostDesignation ( a_Key.m_HostDesignation ) ,
  99. m_IdentityDesignation ( a_Key.m_IdentityDesignation )
  100. {
  101. AutoFreeString t_Group ;
  102. AutoFreeString t_Identity ;
  103. if ( a_Key.m_Group )
  104. {
  105. t_Group = SysAllocString ( a_Key.m_Group ) ;
  106. if ( t_Group.Get () == NULL )
  107. {
  108. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  109. }
  110. }
  111. if ( a_Key.m_Identity )
  112. {
  113. t_Identity = SysAllocString ( a_Key.m_Identity ) ;
  114. if ( t_Identity.Get () == NULL )
  115. {
  116. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  117. }
  118. }
  119. m_Identity = t_Identity.Take () ;
  120. m_Group = t_Group.Take () ;
  121. }
  122. HostCacheKey (
  123. HostDesignation a_HostDesignation ,
  124. const wchar_t *a_Group ,
  125. IdentityDesignation a_IdentityDesignation ,
  126. const wchar_t *a_Identity
  127. ) : m_Identity ( NULL ) ,
  128. m_Group ( NULL ) ,
  129. m_HostDesignation ( a_HostDesignation ) ,
  130. m_IdentityDesignation ( a_IdentityDesignation )
  131. {
  132. AutoFreeString t_Group ;
  133. AutoFreeString t_Identity ;
  134. if ( a_Group )
  135. {
  136. t_Group = SysAllocString ( a_Group ) ;
  137. if ( t_Group.Get () == NULL )
  138. {
  139. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  140. }
  141. }
  142. if ( a_Identity )
  143. {
  144. t_Identity = SysAllocString ( a_Identity ) ;
  145. if ( t_Identity.Get () == NULL )
  146. {
  147. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  148. }
  149. }
  150. m_Identity = t_Identity.Take () ;
  151. m_Group = t_Group.Take () ;
  152. }
  153. ~HostCacheKey ()
  154. {
  155. if ( m_Group )
  156. {
  157. SysFreeString ( m_Group ) ;
  158. }
  159. if ( m_Identity )
  160. {
  161. SysFreeString ( m_Identity ) ;
  162. }
  163. }
  164. HostCacheKey &operator= ( const HostCacheKey &a_Key )
  165. {
  166. m_HostDesignation = a_Key.m_HostDesignation ;
  167. m_IdentityDesignation = a_Key.m_IdentityDesignation ;
  168. if ( m_Group )
  169. {
  170. SysFreeString ( m_Group ) ;
  171. }
  172. if ( a_Key.m_Group )
  173. {
  174. m_Group = SysAllocString ( a_Key.m_Group ) ;
  175. if ( m_Group == NULL )
  176. {
  177. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  178. }
  179. }
  180. else
  181. {
  182. m_Group = NULL ;
  183. }
  184. if ( m_Identity )
  185. {
  186. SysFreeString ( m_Identity ) ;
  187. }
  188. if ( a_Key.m_Identity )
  189. {
  190. m_Identity = SysAllocString ( a_Key.m_Identity ) ;
  191. if ( m_Identity == NULL )
  192. {
  193. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  194. }
  195. }
  196. else
  197. {
  198. m_Identity = NULL ;
  199. }
  200. return *this ;
  201. }
  202. LONG Compare ( const HostCacheKey &a_Key ) const
  203. {
  204. if ( m_HostDesignation == a_Key.m_HostDesignation )
  205. {
  206. if ( m_HostDesignation == e_HostDesignation_Shared )
  207. {
  208. LONG t_Compare = _wcsicmp ( m_Group , a_Key.m_Group ) ;
  209. if ( t_Compare == 0 )
  210. {
  211. }
  212. else
  213. {
  214. return t_Compare ;
  215. }
  216. }
  217. if ( m_IdentityDesignation == a_Key.m_IdentityDesignation )
  218. {
  219. if ( m_IdentityDesignation == e_IdentityDesignation_User )
  220. {
  221. return _wcsicmp ( m_Identity , a_Key.m_Identity ) ;
  222. }
  223. else
  224. {
  225. return 0 ;
  226. }
  227. }
  228. else
  229. {
  230. return m_IdentityDesignation == a_Key.m_IdentityDesignation ? 0 : ( m_IdentityDesignation < a_Key.m_IdentityDesignation ) ? -1 : 1 ;
  231. }
  232. }
  233. else
  234. {
  235. return m_HostDesignation == a_Key.m_HostDesignation ? 0 : ( m_HostDesignation < a_Key.m_HostDesignation ) ? -1 : 1 ;
  236. }
  237. }
  238. } ;
  239. /******************************************************************************
  240. *
  241. * Name:
  242. *
  243. *
  244. * Description:
  245. *
  246. *
  247. *****************************************************************************/
  248. extern LONG CompareElement ( const HostCacheKey &a_Arg1 , const HostCacheKey &a_Arg2 ) ;
  249. /******************************************************************************
  250. *
  251. * Name:
  252. *
  253. *
  254. * Description:
  255. *
  256. *
  257. *****************************************************************************/
  258. class BindingFactoryCacheKey
  259. {
  260. public:
  261. BSTR m_Namespace ;
  262. public:
  263. BindingFactoryCacheKey () :
  264. m_Namespace ( NULL )
  265. {
  266. }
  267. BindingFactoryCacheKey (
  268. const BindingFactoryCacheKey &a_Key
  269. ) : m_Namespace ( NULL )
  270. {
  271. AutoFreeString t_Namespace ;
  272. if ( a_Key.m_Namespace )
  273. {
  274. t_Namespace = SysAllocString ( a_Key.m_Namespace ) ;
  275. if ( t_Namespace.Get () == NULL )
  276. {
  277. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  278. }
  279. }
  280. m_Namespace = t_Namespace.Take () ;
  281. }
  282. BindingFactoryCacheKey (
  283. const wchar_t *a_Namespace
  284. ) : m_Namespace ( NULL )
  285. {
  286. AutoFreeString t_Namespace ;
  287. if ( a_Namespace )
  288. {
  289. t_Namespace = SysAllocString ( a_Namespace ) ;
  290. if ( t_Namespace.Get () == NULL )
  291. {
  292. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  293. }
  294. }
  295. m_Namespace = t_Namespace.Take () ;
  296. }
  297. ~BindingFactoryCacheKey ()
  298. {
  299. if ( m_Namespace )
  300. {
  301. SysFreeString ( m_Namespace ) ;
  302. }
  303. }
  304. BindingFactoryCacheKey &operator= ( const BindingFactoryCacheKey &a_Key )
  305. {
  306. if ( m_Namespace )
  307. {
  308. SysFreeString ( m_Namespace ) ;
  309. }
  310. if ( a_Key.m_Namespace )
  311. {
  312. m_Namespace = SysAllocString ( a_Key.m_Namespace ) ;
  313. if ( m_Namespace == NULL )
  314. {
  315. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  316. }
  317. }
  318. else
  319. {
  320. m_Namespace = NULL ;
  321. }
  322. return *this ;
  323. }
  324. LONG CompareNamespace ( const BSTR a_Namespace ) const
  325. {
  326. if ( m_Namespace && a_Namespace )
  327. {
  328. return _wcsicmp ( m_Namespace , a_Namespace ) ;
  329. }
  330. else
  331. {
  332. return m_Namespace == a_Namespace ? 0 : ( m_Namespace < a_Namespace ) ? -1 : 1 ;
  333. }
  334. }
  335. LONG Compare ( const BindingFactoryCacheKey &a_Key ) const
  336. {
  337. return CompareNamespace ( a_Key.m_Namespace ) ;
  338. }
  339. } ;
  340. /******************************************************************************
  341. *
  342. * Name:
  343. *
  344. *
  345. * Description:
  346. *
  347. *
  348. *****************************************************************************/
  349. extern LONG CompareElement ( const BindingFactoryCacheKey &a_Arg1 , const BindingFactoryCacheKey &a_Arg2 ) ;
  350. /******************************************************************************
  351. *
  352. * Name:
  353. *
  354. *
  355. * Description:
  356. *
  357. *
  358. *****************************************************************************/
  359. extern LONG CompareElement ( const GUID &a_Arg1 , const GUID &a_Arg2 ) ;
  360. /******************************************************************************
  361. *
  362. * Name:
  363. *
  364. *
  365. * Description:
  366. *
  367. *
  368. *****************************************************************************/
  369. class ProviderCacheKey
  370. {
  371. public:
  372. BSTR m_Provider ;
  373. ULONG m_Hosting ;
  374. BSTR m_Group ;
  375. BSTR m_User ;
  376. BSTR m_Locale ;
  377. bool m_Raw ;
  378. GUID *m_TransactionIdentifier ;
  379. public:
  380. ProviderCacheKey () :
  381. m_User ( NULL ) ,
  382. m_Locale ( NULL ) ,
  383. m_Raw ( false ) ,
  384. m_Provider ( NULL ) ,
  385. m_Hosting ( 0 ) ,
  386. m_Group ( NULL ) ,
  387. m_TransactionIdentifier ( NULL )
  388. {
  389. }
  390. ProviderCacheKey (
  391. const ProviderCacheKey &a_Key
  392. ) : m_User ( NULL ) ,
  393. m_Locale ( NULL ) ,
  394. m_TransactionIdentifier ( NULL ) ,
  395. m_Raw ( a_Key.m_Raw ) ,
  396. m_Hosting ( a_Key.m_Hosting ) ,
  397. m_Group ( NULL ) ,
  398. m_Provider ( NULL )
  399. {
  400. AutoFreeString t_User ;
  401. AutoFreeString t_Locale ;
  402. AutoFreeString t_Provider ;
  403. AutoFreeString t_Group ;
  404. if ( a_Key.m_User )
  405. {
  406. t_User = SysAllocString ( a_Key.m_User ) ;
  407. if ( t_User.Get () == NULL )
  408. {
  409. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  410. }
  411. }
  412. if ( a_Key.m_Locale )
  413. {
  414. t_Locale = SysAllocString ( a_Key.m_Locale ) ;
  415. if ( t_Locale.Get () == NULL )
  416. {
  417. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  418. }
  419. }
  420. if ( a_Key.m_Provider )
  421. {
  422. t_Provider = SysAllocString ( a_Key.m_Provider ) ;
  423. if ( t_Provider.Get () == NULL )
  424. {
  425. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  426. }
  427. }
  428. if ( a_Key.m_Group )
  429. {
  430. t_Group = SysAllocString ( a_Key.m_Group ) ;
  431. if ( t_Group.Get () == NULL )
  432. {
  433. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  434. }
  435. }
  436. if ( a_Key.m_TransactionIdentifier )
  437. {
  438. m_TransactionIdentifier = new GUID ;
  439. if ( m_TransactionIdentifier == NULL )
  440. {
  441. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  442. }
  443. *m_TransactionIdentifier = *a_Key.m_TransactionIdentifier ;
  444. }
  445. m_User = t_User.Take () ;
  446. m_Locale = t_Locale.Take () ;
  447. m_Provider = t_Provider.Take () ;
  448. m_Group = t_Group.Take () ;
  449. }
  450. ProviderCacheKey (
  451. const wchar_t *a_Provider ,
  452. const ULONG a_Hosting ,
  453. const wchar_t *a_Group ,
  454. const bool a_Raw ,
  455. GUID *a_TransactionIdentifier ,
  456. const wchar_t *a_User ,
  457. const wchar_t *a_Locale
  458. ) :
  459. m_Raw ( a_Raw ) ,
  460. m_Provider ( NULL ) ,
  461. m_Group ( NULL ) ,
  462. m_Hosting ( a_Hosting ) ,
  463. m_TransactionIdentifier ( NULL ) ,
  464. m_User ( NULL ) ,
  465. m_Locale ( NULL )
  466. {
  467. AutoFreeString t_User ;
  468. AutoFreeString t_Locale ;
  469. AutoFreeString t_Provider ;
  470. AutoFreeString t_Group ;
  471. if ( a_User )
  472. {
  473. t_User = SysAllocString ( a_User ) ;
  474. if ( t_User.Get () == NULL )
  475. {
  476. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  477. }
  478. }
  479. if ( a_Locale )
  480. {
  481. t_Locale = SysAllocString ( a_Locale ) ;
  482. if ( t_Locale.Get () == NULL )
  483. {
  484. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  485. }
  486. }
  487. if ( a_Provider )
  488. {
  489. t_Provider = SysAllocString ( a_Provider ) ;
  490. if ( t_Provider.Get () == NULL )
  491. {
  492. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  493. }
  494. }
  495. if ( a_Group )
  496. {
  497. t_Group = SysAllocString ( a_Group ) ;
  498. if ( t_Group.Get () == NULL )
  499. {
  500. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  501. }
  502. }
  503. if ( a_TransactionIdentifier )
  504. {
  505. m_TransactionIdentifier = new GUID ;
  506. if ( m_TransactionIdentifier == NULL )
  507. {
  508. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  509. }
  510. *m_TransactionIdentifier = *a_TransactionIdentifier ;
  511. }
  512. m_User = t_User.Take () ;
  513. m_Locale = t_Locale.Take () ;
  514. m_Provider = t_Provider.Take () ;
  515. m_Group = t_Group.Take () ;
  516. }
  517. ~ProviderCacheKey ()
  518. {
  519. if ( m_User )
  520. {
  521. SysFreeString ( m_User ) ;
  522. }
  523. if ( m_Locale )
  524. {
  525. SysFreeString ( m_Locale ) ;
  526. }
  527. if ( m_Provider )
  528. {
  529. SysFreeString ( m_Provider ) ;
  530. }
  531. if ( m_Group )
  532. {
  533. SysFreeString ( m_Group ) ;
  534. }
  535. if ( m_TransactionIdentifier )
  536. {
  537. delete m_TransactionIdentifier ;
  538. }
  539. }
  540. ProviderCacheKey &operator= ( const ProviderCacheKey &a_Key )
  541. {
  542. m_Raw = a_Key.m_Raw ;
  543. m_Hosting = a_Key.m_Hosting ;
  544. if ( m_User )
  545. {
  546. SysFreeString ( m_User ) ;
  547. }
  548. if ( a_Key.m_User )
  549. {
  550. m_User = SysAllocString ( a_Key.m_User ) ;
  551. if ( m_User == NULL )
  552. {
  553. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  554. }
  555. }
  556. else
  557. {
  558. m_User = NULL ;
  559. }
  560. if ( m_Locale )
  561. {
  562. SysFreeString ( m_Locale ) ;
  563. }
  564. if ( a_Key.m_Locale )
  565. {
  566. m_Locale = SysAllocString ( a_Key.m_Locale ) ;
  567. if ( m_Locale == NULL )
  568. {
  569. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  570. }
  571. }
  572. else
  573. {
  574. m_Locale = NULL ;
  575. }
  576. if ( m_Provider )
  577. {
  578. SysFreeString ( m_Provider ) ;
  579. }
  580. if ( a_Key.m_Provider )
  581. {
  582. m_Provider = SysAllocString ( a_Key.m_Provider ) ;
  583. if ( m_Provider == NULL )
  584. {
  585. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  586. }
  587. }
  588. else
  589. {
  590. m_Provider = NULL ;
  591. }
  592. if ( m_Group )
  593. {
  594. SysFreeString ( m_Group ) ;
  595. }
  596. if ( a_Key.m_Group )
  597. {
  598. m_Group = SysAllocString ( a_Key.m_Group ) ;
  599. if ( m_Group == NULL )
  600. {
  601. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  602. }
  603. }
  604. else
  605. {
  606. m_Group = NULL ;
  607. }
  608. if ( m_TransactionIdentifier )
  609. {
  610. delete m_TransactionIdentifier ;
  611. }
  612. if ( a_Key.m_TransactionIdentifier )
  613. {
  614. m_TransactionIdentifier = new GUID ;
  615. if ( m_TransactionIdentifier == NULL )
  616. {
  617. throw Wmi_Heap_Exception ( Wmi_Heap_Exception :: E_ALLOCATION_ERROR ) ;
  618. }
  619. *m_TransactionIdentifier = *a_Key.m_TransactionIdentifier ;
  620. }
  621. else
  622. {
  623. m_TransactionIdentifier = NULL ;
  624. }
  625. return *this ;
  626. }
  627. LONG CompareUser ( const BSTR a_User ) const
  628. {
  629. if ( m_User && a_User )
  630. {
  631. return _wcsicmp ( m_User , a_User ) ;
  632. }
  633. else
  634. {
  635. return m_User == a_User ? 0 : ( m_User < a_User ) ? -1 : 1 ;
  636. }
  637. }
  638. LONG CompareLocale ( const BSTR a_Locale ) const
  639. {
  640. if ( m_Locale && a_Locale )
  641. {
  642. return _wcsicmp ( m_Locale , a_Locale ) ;
  643. }
  644. else
  645. {
  646. return m_Locale == a_Locale ? 0 : ( m_Locale < a_Locale ) ? -1 : 1 ;
  647. }
  648. }
  649. LONG CompareProvider ( const BSTR a_Provider ) const
  650. {
  651. if ( m_Provider && a_Provider )
  652. {
  653. return _wcsicmp ( m_Provider , a_Provider ) ;
  654. }
  655. else
  656. {
  657. return m_Provider == a_Provider ? 0 : ( m_Provider < a_Provider ) ? -1 : 1 ;
  658. }
  659. }
  660. LONG CompareGroup ( const BSTR a_Group ) const
  661. {
  662. if ( m_Group && a_Group )
  663. {
  664. return _wcsicmp ( m_Group , a_Group ) ;
  665. }
  666. else
  667. {
  668. return m_Group == a_Group ? 0 : ( m_Group < a_Group ) ? -1 : 1 ;
  669. }
  670. }
  671. LONG CompareHosting ( const DWORD a_Hosting ) const
  672. {
  673. return m_Hosting == a_Hosting ? 0 : ( m_Hosting < a_Hosting ) ? -1 : 1 ;
  674. }
  675. LONG CompareTransaction ( const GUID *a_TransactionIdentifier ) const
  676. {
  677. if ( m_TransactionIdentifier && a_TransactionIdentifier )
  678. {
  679. return CompareElement ( *m_TransactionIdentifier , *a_TransactionIdentifier ) ;
  680. }
  681. else
  682. {
  683. return m_TransactionIdentifier == a_TransactionIdentifier ? 0 : ( m_TransactionIdentifier < a_TransactionIdentifier ) ? -1 : 1 ;
  684. }
  685. }
  686. LONG Compare ( const ProviderCacheKey &a_Key ) const
  687. {
  688. LONG t_CompareProvider = CompareProvider ( a_Key.m_Provider ) ;
  689. if ( t_CompareProvider == 0 )
  690. {
  691. LONG t_CompareHosting = CompareHosting ( a_Key.m_Hosting ) ;
  692. if ( t_CompareHosting == 0 )
  693. {
  694. LONG t_CompareGroup = CompareGroup ( a_Key.m_Group ) ;
  695. if ( t_CompareGroup == 0 )
  696. {
  697. LONG t_CompareUser = CompareUser ( a_Key.m_User ) ;
  698. if ( t_CompareUser == 0 )
  699. {
  700. LONG t_CompareLocale = CompareLocale ( a_Key.m_Locale ) ;
  701. if ( t_CompareLocale == 0 )
  702. {
  703. if ( m_Raw == a_Key.m_Raw )
  704. {
  705. return CompareElement ( m_TransactionIdentifier , a_Key.m_TransactionIdentifier ) ;
  706. }
  707. else
  708. {
  709. return m_Raw - a_Key.m_Raw ;
  710. }
  711. }
  712. else
  713. {
  714. return t_CompareLocale ;
  715. }
  716. }
  717. else
  718. {
  719. return t_CompareUser ;
  720. }
  721. }
  722. else
  723. {
  724. return t_CompareGroup ;
  725. }
  726. }
  727. else
  728. {
  729. return t_CompareHosting ;
  730. }
  731. }
  732. else
  733. {
  734. return t_CompareProvider ;
  735. }
  736. }
  737. } ;
  738. /******************************************************************************
  739. *
  740. * Name:
  741. *
  742. *
  743. * Description:
  744. *
  745. *
  746. *****************************************************************************/
  747. extern LONG CompareElement ( const ProviderCacheKey &a_Arg1 , const ProviderCacheKey &a_Arg2 ) ;
  748. /******************************************************************************
  749. *
  750. * Name:
  751. *
  752. *
  753. * Description:
  754. *
  755. *
  756. *****************************************************************************/
  757. typedef WmiAvlTree <GUID,GUID> CWbemGlobal_ComServerTagContainer ;
  758. typedef WmiAvlTree <GUID,GUID> :: Iterator CWbemGlobal_ComServerTagContainer_Iterator ;
  759. /******************************************************************************
  760. *
  761. * Name:
  762. *
  763. *
  764. * Description:
  765. *
  766. *
  767. *****************************************************************************/
  768. class CServerObject_HostInterceptor ;
  769. typedef WmiCacheController <HostCacheKey> CWbemGlobal_IWmiHostController ;
  770. typedef CWbemGlobal_IWmiHostController :: Cache CWbemGlobal_IWmiHostController_Cache ;
  771. typedef CWbemGlobal_IWmiHostController :: Cache_Iterator CWbemGlobal_IWmiHostController_Cache_Iterator ;
  772. typedef CWbemGlobal_IWmiHostController :: WmiCacheElement HostCacheElement ;
  773. /******************************************************************************
  774. *
  775. * Name:
  776. *
  777. *
  778. * Description:
  779. *
  780. *
  781. *****************************************************************************/
  782. class CServerObject_InterceptorProviderRefresherManager ;
  783. typedef WmiCacheController <void *> CWbemGlobal_IWbemRefresherMgrController ;
  784. typedef CWbemGlobal_IWbemRefresherMgrController :: Cache CWbemGlobal_IWbemRefresherMgrController_Cache ;
  785. typedef CWbemGlobal_IWbemRefresherMgrController :: Cache_Iterator CWbemGlobal_IWbemRefresherMgrController_Cache_Iterator ;
  786. typedef CWbemGlobal_IWbemRefresherMgrController :: WmiCacheElement RefresherManagerCacheElement ;
  787. /******************************************************************************
  788. *
  789. * Name:
  790. *
  791. *
  792. * Description:
  793. *
  794. *
  795. *****************************************************************************/
  796. class CServerObject_BindingFactory ;
  797. typedef WmiCacheController <BindingFactoryCacheKey> CWbemGlobal_IWmiFactoryController ;
  798. typedef CWbemGlobal_IWmiFactoryController :: Cache CWbemGlobal_IWmiFactoryController_Cache ;
  799. typedef CWbemGlobal_IWmiFactoryController :: Cache_Iterator CWbemGlobal_IWmiFactoryController_Cache_Iterator ;
  800. typedef CWbemGlobal_IWmiFactoryController :: WmiCacheElement BindingFactoryCacheElement ;
  801. /******************************************************************************
  802. *
  803. * Name:
  804. *
  805. *
  806. * Description:
  807. *
  808. *
  809. *****************************************************************************/
  810. class CInterceptor_IWbemProvider ;
  811. typedef WmiCacheController <ProviderCacheKey> CWbemGlobal_IWmiProviderController ;
  812. typedef CWbemGlobal_IWmiProviderController :: Cache CWbemGlobal_IWmiProviderController_Cache ;
  813. typedef CWbemGlobal_IWmiProviderController :: Cache_Iterator CWbemGlobal_IWmiProviderController_Cache_Iterator ;
  814. typedef CWbemGlobal_IWmiProviderController :: WmiCacheElement ServiceCacheElement ;
  815. /******************************************************************************
  816. *
  817. * Name:
  818. *
  819. *
  820. * Description:
  821. *
  822. *
  823. *****************************************************************************/
  824. class CServerObject_ProviderSubSystem ;
  825. typedef WmiContainerController <void *> CWbemGlobal_IWmiProvSubSysController ;
  826. typedef CWbemGlobal_IWmiProvSubSysController :: Container CWbemGlobal_IWmiProvSubSysController_Container ;
  827. typedef CWbemGlobal_IWmiProvSubSysController :: Container_Iterator CWbemGlobal_IWmiProvSubSysController_Container_Iterator ;
  828. typedef CWbemGlobal_IWmiProvSubSysController :: WmiContainerElement ProvSubSysContainerElement ;
  829. /******************************************************************************
  830. *
  831. * Name:
  832. *
  833. *
  834. * Description:
  835. *
  836. *
  837. *****************************************************************************/
  838. class CInterceptor_IWbemSyncProvider ;
  839. typedef WmiContainerController <GUID> CWbemGlobal_IWbemSyncProviderController ;
  840. typedef CWbemGlobal_IWbemSyncProviderController :: Container CWbemGlobal_IWbemSyncProvider_Container ;
  841. typedef CWbemGlobal_IWbemSyncProviderController :: Container_Iterator CWbemGlobal_IWbemSyncProvider_Container_Iterator ;
  842. typedef CWbemGlobal_IWbemSyncProviderController :: WmiContainerElement SyncProviderContainerElement ;
  843. /******************************************************************************
  844. *
  845. * Name:
  846. *
  847. *
  848. * Description:
  849. *
  850. *
  851. *****************************************************************************/
  852. typedef WmiContainerController <DWORD> CWbemGlobal_HostedProviderController ;
  853. typedef CWbemGlobal_HostedProviderController :: Container CWbemGlobal_HostedProviderController_Container ;
  854. typedef CWbemGlobal_HostedProviderController :: Container_Iterator CWbemGlobal_HostedProviderController_Container_Iterator ;
  855. typedef CWbemGlobal_HostedProviderController :: WmiContainerElement HostedProviderContainerElement ;
  856. /******************************************************************************
  857. *
  858. * Name:
  859. *
  860. *
  861. * Description:
  862. *
  863. *
  864. *****************************************************************************/
  865. class HostController : public CWbemGlobal_IWmiHostController
  866. {
  867. private:
  868. protected:
  869. public:
  870. HostController ( WmiAllocator &a_Allocator ) ;
  871. WmiStatusCode StrobeBegin ( const ULONG &a_Period ) ;
  872. } ;
  873. /******************************************************************************
  874. *
  875. * Name:
  876. *
  877. *
  878. * Description:
  879. *
  880. *
  881. *****************************************************************************/
  882. class RefresherManagerController : public CWbemGlobal_IWbemRefresherMgrController
  883. {
  884. private:
  885. protected:
  886. public:
  887. RefresherManagerController ( WmiAllocator &a_Allocator ) ;
  888. WmiStatusCode StrobeBegin ( const ULONG &a_Period ) ;
  889. } ;
  890. /******************************************************************************
  891. *
  892. * Name:
  893. *
  894. *
  895. * Description:
  896. *
  897. *
  898. *****************************************************************************/
  899. class CInterceptor_IWbemProvider ;
  900. class ProviderController : public HostedProviderContainerElement
  901. {
  902. public:
  903. typedef WmiBasicTree <CInterceptor_IWbemProvider *,CInterceptor_IWbemProvider *> Container ;
  904. typedef Container :: Iterator Container_Iterator ;
  905. private:
  906. CriticalSection m_CriticalSection ;
  907. Container m_Container ;
  908. public:
  909. ProviderController (
  910. WmiAllocator &a_Allocator ,
  911. CWbemGlobal_HostedProviderController *a_Controller ,
  912. DWORD a_ProcessIdentifier
  913. ) ;
  914. virtual ~ProviderController () ;
  915. virtual STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  916. virtual STDMETHODIMP_( ULONG ) AddRef () ;
  917. virtual STDMETHODIMP_( ULONG ) Release () ;
  918. virtual WmiStatusCode Initialize () ;
  919. virtual WmiStatusCode UnInitialize () ;
  920. virtual WmiStatusCode Lock () ;
  921. virtual WmiStatusCode UnLock () ;
  922. virtual WmiStatusCode Insert (
  923. CInterceptor_IWbemProvider *a_Element ,
  924. Container_Iterator &a_Iterator
  925. ) ;
  926. virtual WmiStatusCode Find ( CInterceptor_IWbemProvider * const &a_Key , Container_Iterator &a_Iterator ) ;
  927. virtual WmiStatusCode Delete ( CInterceptor_IWbemProvider *const & a_Key ) ;
  928. virtual WmiStatusCode Shutdown () ;
  929. WmiStatusCode GetContainer ( Container *&a_Container )
  930. {
  931. a_Container = & m_Container ;
  932. return e_StatusCode_Success ;
  933. }
  934. } ;
  935. #endif _Server_Cache_H