Source code of Windows XP (NT5)
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.

183 lines
5.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1998.
  5. //
  6. // File: WrapStor.hxx
  7. //
  8. // Contents: Persistent property store (external to docfile)
  9. //
  10. // Classes: CPropertyStoreWrapper
  11. //
  12. // History: 17-Mar-97 KrishnaN Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <prcstob.hxx>
  17. #include <phystr.hxx>
  18. #include <proplock.hxx>
  19. #include <rcstxact.hxx>
  20. #include <cistore.hxx>
  21. #include <prpstmgr.hxx>
  22. #include <fsciexps.hxx>
  23. class COnDiskPropertyRecord;
  24. class CBorrowed;
  25. class CCompositePropRecord;
  26. class CPropertyStoreWids;
  27. class CLockRecordForRead;
  28. class CLockRecordForWrite;
  29. class CPropertyStoreRecovery;
  30. class CPropertyIterWrapper;
  31. //+-------------------------------------------------------------------------
  32. //
  33. // Class: CPropertyStoreWrapper
  34. //
  35. // Purpose: Persistent property store
  36. //
  37. // History: 17-Mar-97 KrishnaN Created
  38. // 01-Nov-98 KLam Removed class wrapper stuff
  39. // Added cbDiskSpaceToLeave to constructor
  40. //
  41. //--------------------------------------------------------------------------
  42. class CPropertyStoreWrapper : public PPropertyStore
  43. {
  44. public:
  45. CPropertyStoreWrapper ( ICiCAdviseStatus *pAdviseStatus,
  46. ULONG ulMaxPropStoreMappedCachePrimary,
  47. ULONG ulMaxPropStoreMappedCacheSecondary,
  48. ULONG cbDiskSpaceToLeave );
  49. // FastInit will create a CiStorage internally in the specified directory
  50. SCODE FastInit( WCHAR const * pwszDirectory);
  51. SCODE LongInit( BOOL & fWasDirty,
  52. ULONG & cInconsistencies,
  53. T_UpdateDoc pfnUpdateCallback,
  54. void const *pUserData );
  55. inline SCODE IsDirty( BOOL &fIsDirty ) const;
  56. SCODE Empty();
  57. //
  58. // Schema manipulation
  59. //
  60. inline SCODE CanStore( PROPID pid, BOOL &fCanStore );
  61. SCODE Size( PROPID pid, unsigned * pusSize );
  62. SCODE Type( PROPID pid, PULONG pulType );
  63. SCODE BeginTransaction( PULONG_PTR pulReturn);
  64. SCODE Setup( PROPID pid, ULONG vt, DWORD cbMaxLen,
  65. ULONG_PTR ulToken, BOOL fCanBeModified = TRUE,
  66. DWORD dwStoreLevel = PRIMARY_STORE);
  67. SCODE EndTransaction( ULONG_PTR ulToken, BOOL fCommit,
  68. PROPID pidFixedPrimary,
  69. PROPID pidFixedSecondary );
  70. //
  71. // Property storage/retrieval.
  72. //
  73. SCODE WriteProperty( WORKID wid, PROPID pid,
  74. CStorageVariant const & var,
  75. BOOL &fExists);
  76. inline SCODE WritePropertyInNewRecord( PROPID pid, CStorageVariant const & var, WORKID *pwid );
  77. SCODE ReadProperty( WORKID wid, PROPID pid,
  78. PROPVARIANT * pbData, unsigned * pcb,
  79. BOOL &fExists);
  80. SCODE ReadProperty( WORKID wid, PROPID pid, PROPVARIANT & var,
  81. BYTE * pbExtra, unsigned * pcbExtra,
  82. BOOL &fExists);
  83. SCODE ReadProperty( HPropRecord, PROPID pid, PROPVARIANT & var,
  84. BYTE * pbExtra, unsigned * pcbExtra, BOOL &fExists );
  85. SCODE ReadProperty( HPropRecord, PROPID pid, PROPVARIANT * pbData,
  86. unsigned * pcb, BOOL &fExists);
  87. SCODE ReadProperty( WORKID wid, PROPID pid, PROPVARIANT & var,
  88. BOOL &fExists);
  89. SCODE OpenRecord( WORKID wid, BYTE * pb, HPropRecord &hRec);
  90. SCODE CloseRecord( HPropRecord hRec );
  91. //
  92. // Special path/wid support
  93. //
  94. inline SCODE MaxWorkId(WORKID &wid);
  95. SCODE DeleteRecord( WORKID wid );
  96. inline SCODE CountRecordsInUse(ULONG &ulRecInUse) const;
  97. SCODE Shutdown();
  98. SCODE Flush();
  99. //
  100. // Save/Load
  101. //
  102. SCODE Save( WCHAR const * pwszDirectory,
  103. IProgressNotify * pProgressNotify,
  104. ICiEnumWorkids * pEnumWorkids,
  105. BOOL * pfAbort,
  106. IEnumString ** ppFileList);
  107. SCODE Load( WCHAR const * pwszDestDir, // dest dir
  108. IEnumString * pFileList, // list of files to copy
  109. IProgressNotify * pProgressNotify,
  110. BOOL fCallerOwnsFiles,
  111. BOOL * pfAbort );
  112. //
  113. // Get/Set of parameters.
  114. //
  115. SCODE GetParameter(VARIANT &var, DWORD eParamType);
  116. SCODE SetParameter(VARIANT var, DWORD eParamType);
  117. // Miscellaneous
  118. SCODE GetTotalSizeInKB(ULONG * pSize);
  119. //
  120. // Facilitate destruction
  121. //
  122. ULONG AddRef();
  123. ULONG Release();
  124. private:
  125. virtual ~CPropertyStoreWrapper ();
  126. friend CPropertyIterWrapper;
  127. friend SCODE CreatePropertyStoreIter( PPropertyStore * pPropStore,
  128. PPropertyStoreIter ** ppPropStoreIter );
  129. CPropStoreManager * _GetCPropertyStore() { return _pPropStoreMgr; };
  130. CiStorage * _pStorage;
  131. CPropStoreManager * _pPropStoreMgr;
  132. XInterface<ICiCAdviseStatus> _xAdviseStatus;
  133. LONG _lRefCount;
  134. };