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.

120 lines
3.7 KiB

  1. /********************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. ContentStoreMgr.h
  5. Abstract:
  6. Content Store manager
  7. Revision History:
  8. DerekM created 07/12/99
  9. Dmassare rewrote 12/15/1999
  10. ********************************************************************/
  11. #if !defined(__INCLUDED___PCH___CONTENTSTOREMGR_H___)
  12. #define __INCLUDED___PCH___CONTENTSTOREMGR_H___
  13. #include <MPC_main.h>
  14. #include <MPC_trace.h>
  15. #include <MPC_COM.h>
  16. #include <MPC_utils.h>
  17. #include <MPC_xml.h>
  18. #include <MPC_logging.h>
  19. #include <MPC_streams.h>
  20. class CPCHContentStore : public MPC::NamedMutexWithState // Hungarian: cs
  21. {
  22. struct SharedState
  23. {
  24. DWORD dwRevision;
  25. DWORD dwSize;
  26. };
  27. struct Entry
  28. {
  29. MPC::wstring szURL;
  30. MPC::wstring szOwnerID;
  31. MPC::wstring szOwnerName;
  32. bool operator<( /*[in]*/ const Entry& en ) const;
  33. int compare ( /*[in]*/ LPCWSTR wszSearch ) const;
  34. };
  35. class CompareEntry
  36. {
  37. public:
  38. bool operator()( /*[in]*/ const Entry& entry, /*[in]*/ const LPCWSTR wszURL ) const;
  39. };
  40. typedef std::vector<Entry> EntryVec;
  41. typedef EntryVec::iterator EntryIter;
  42. typedef EntryVec::const_iterator EntryIterConst;
  43. DWORD m_dwLastRevision;
  44. EntryVec m_vecData;
  45. MPC::NamedMutexWithState* m_mapData;
  46. DWORD m_dwDataLen;
  47. bool m_fDirty;
  48. bool m_fSorted;
  49. bool m_fMaster;
  50. void Sort ();
  51. void Cleanup();
  52. void Map_Release ();
  53. HRESULT Map_Generate();
  54. HRESULT Map_Read ();
  55. HRESULT SaveDirect( /*[in]*/ MPC::Serializer& stream );
  56. HRESULT LoadDirect( /*[in]*/ MPC::Serializer& stream );
  57. HRESULT Load ();
  58. HRESULT Save ();
  59. SharedState* State();
  60. HRESULT Find( /*[in]*/ LPCWSTR wszURL, /*[in]*/ LPCWSTR wszVendorID, /*[out]*/ EntryIter& it );
  61. public:
  62. CPCHContentStore( /*[in]*/ bool fMaster );
  63. ~CPCHContentStore();
  64. ////////////////////////////////////////////////////////////////////////////////
  65. static CPCHContentStore* s_GLOBAL;
  66. static HRESULT InitializeSystem( /*[in]*/ bool fMaster );
  67. static void FinalizeSystem ( );
  68. ////////////////////////////////////////////////////////////////////////////////
  69. HRESULT Acquire( );
  70. HRESULT Release( /*[in]*/ bool fSave = false );
  71. HRESULT Add ( /*[in]*/ LPCWSTR wszURL, /*[in]*/ LPCWSTR wszVendorID, /*[in]*/ LPCWSTR wszVendorName );
  72. HRESULT Remove ( /*[in]*/ LPCWSTR wszURL, /*[in]*/ LPCWSTR wszVendorID, /*[in]*/ LPCWSTR wszVendorName );
  73. HRESULT IsTrusted( /*[in]*/ LPCWSTR wszURL, /*[out]*/ bool& fTrusted , /*[out]*/ MPC::wstring *pszVendorID = NULL, /*[in]*/ bool fUseStore = true );
  74. };
  75. /////////////////////////////////////////////////////////////////////////////
  76. // error codes
  77. #define E_PCH_PROVIDERID_DO_NOT_MATCH _HRESULT_TYPEDEF_(0x80062001)
  78. #define E_PCH_CONTENT_STORE_NOT_INITIALIZED _HRESULT_TYPEDEF_(0x80062002)
  79. #define E_PCH_URI_EXISTS _HRESULT_TYPEDEF_(0x80062003)
  80. #define E_PCH_URI_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x80062004)
  81. #define E_PCH_CONTENT_STORE_IN_MODIFY_MODE _HRESULT_TYPEDEF_(0x80062005)
  82. #define E_PCH_CONTENT_STORE_IN_LOOKUP_MODE _HRESULT_TYPEDEF_(0x80062006)
  83. #endif // !defined(__INCLUDED___PCH___CONTENTSTOREMGR_H___)