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.

288 lines
9.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Net Library System
  4. // Copyright (C) Microsoft Corporation, 1996 - 1997.
  5. //
  6. // File: fsciexps.hxx
  7. //
  8. // Contents: Objects provided by the FileSystem CI client to
  9. // Olympus. These are :
  10. //
  11. // 1. Property Store.
  12. // 2. Property Store iterator.
  13. // 3. User mode security cache.
  14. //
  15. // History: 4-07-97 srikants Created
  16. // 4-07-97 KrishnaN Added property store declaration
  17. //
  18. //----------------------------------------------------------------------------
  19. #pragma once
  20. //+---------------------------------------------------------------------------
  21. //
  22. // Class: PPropertyStore
  23. //
  24. // Purpose: The property store.
  25. //
  26. // History: 4-07-97 KrishnaN Created
  27. //
  28. // Notes: This interface exposes a HPropRecord instead of the CI
  29. // specific CPropRecord.
  30. //
  31. //----------------------------------------------------------------------------
  32. class CStorageVariant;
  33. class CFullPropSpec;
  34. typedef void (CALLBACK * T_UpdateDoc)(WORKID wid, BOOL fDelete, void const *pUserData);
  35. typedef HANDLE HPropRecord;
  36. // the sizes of CPropRecord and CCompositeRecord are smaller
  37. // than the values specified here. We just want to be sure
  38. // we allocate something larger than the actual size.
  39. unsigned const sizeof_CPropRecord = 100;
  40. unsigned const sizeof_CCompositePropRecord = 200;
  41. //
  42. // The following constants enable SetParameter and GetParameter to be generic
  43. // and at the same time allow for control of individual params. Currently
  44. // both the params should be accompanied by VT_UI4 datatype.
  45. //
  46. #define PSPARAM_PRIMARY_MAPPEDCACHESIZE 0
  47. #define PSPARAM_PRIMARY_BACKUPSIZE 1
  48. #define PSPARAM_SECONDARY_MAPPEDCACHESIZE 2
  49. #define PSPARAM_SECONDARY_BACKUPSIZE 3
  50. #define PRIMARY_STORE 0
  51. #define SECONDARY_STORE 1
  52. #define INVALID_STORE_LEVEL 0xFFFFFFFF
  53. class PPropertyStore
  54. {
  55. public:
  56. virtual ~PPropertyStore() {}
  57. //
  58. // This method internally fabricates a CiStorage from the pwszDirectory.
  59. //
  60. virtual SCODE FastInit( WCHAR const * pwszDirectory) = 0;
  61. virtual SCODE LongInit( BOOL & fWasDirty, ULONG & cInconsistencies,
  62. T_UpdateDoc pfnUpdateCallback, void const *pUserData ) = 0;
  63. virtual SCODE IsDirty( BOOL &fIsDirty ) const = 0;
  64. virtual SCODE Empty() = 0;
  65. //
  66. // Schema manipulation
  67. //
  68. virtual SCODE CanStore( PROPID pid, BOOL &fCanStore ) = 0;
  69. virtual SCODE Size( PROPID pid, unsigned * pusSize ) = 0;
  70. virtual SCODE Type( PROPID pid, PULONG pulType ) = 0;
  71. virtual SCODE BeginTransaction( PULONG_PTR pulReturn) = 0;
  72. virtual SCODE Setup( PROPID pid, ULONG vt, DWORD cbMaxLen,
  73. ULONG_PTR ulToken, BOOL fCanBeModified = TRUE,
  74. DWORD dwStoreLevel = PRIMARY_STORE) = 0;
  75. virtual SCODE EndTransaction( ULONG_PTR ulToken, BOOL fCommit,
  76. PROPID pidFixedPrimary,
  77. PROPID pidFixedSecondary ) = 0;
  78. //
  79. // Property storage/retrieval.
  80. //
  81. virtual SCODE WriteProperty( WORKID wid, PROPID pid,
  82. CStorageVariant const & var,
  83. BOOL &fExists) = 0;
  84. virtual SCODE WritePropertyInNewRecord( PROPID pid,
  85. CStorageVariant const & var, WORKID *pwid ) = 0;
  86. virtual SCODE ReadProperty( WORKID wid, PROPID pid,
  87. PROPVARIANT * pbData, unsigned * pcb,
  88. BOOL &fExists) = 0;
  89. virtual SCODE ReadProperty( WORKID wid, PROPID pid, PROPVARIANT & var,
  90. BYTE * pbExtra, unsigned * pcbExtra,
  91. BOOL &fExists) = 0;
  92. virtual SCODE ReadProperty( HPropRecord, PROPID pid, PROPVARIANT & var,
  93. BYTE * pbExtra, unsigned * pcbExtra, BOOL &fExists ) = 0;
  94. virtual SCODE ReadProperty( HPropRecord, PROPID pid, PROPVARIANT * pbData,
  95. unsigned * pcb, BOOL &fExists) = 0;
  96. virtual SCODE ReadProperty( WORKID wid, PROPID pid, PROPVARIANT & var,
  97. BOOL &fExists) = 0;
  98. virtual SCODE OpenRecord( WORKID wid, BYTE * pb, HPropRecord &hRec) = 0;
  99. virtual SCODE CloseRecord( HPropRecord hRec ) = 0;
  100. //
  101. // Special path/wid support
  102. //
  103. virtual SCODE MaxWorkId(WORKID &wid) = 0;
  104. virtual SCODE DeleteRecord( WORKID wid ) = 0;
  105. virtual SCODE CountRecordsInUse(ULONG &ulRecInUse) const = 0;
  106. virtual SCODE Shutdown() = 0;
  107. virtual SCODE Flush() = 0;
  108. //
  109. // Property Save/Load
  110. //
  111. virtual SCODE Save( WCHAR const * pwszDirectory,
  112. IProgressNotify * pProgressNotify,
  113. ICiEnumWorkids * pEnumWorkids,
  114. BOOL * pfAbort,
  115. IEnumString ** ppFileList) = 0;
  116. virtual SCODE Load( WCHAR const * pwszDestinationDirectory, // dest dir
  117. IEnumString * pFileList, // list of files to copy
  118. IProgressNotify * pProgressNotify,
  119. BOOL fCallerOwnsFiles,
  120. BOOL * pfAbort ) = 0;
  121. //
  122. // Enables parametrization of the property store
  123. //
  124. virtual SCODE SetParameter(VARIANT var, DWORD eParamType) = 0;
  125. virtual SCODE GetParameter(VARIANT &var, DWORD eParamType) = 0;
  126. // Miscellaneous
  127. virtual SCODE GetTotalSizeInKB(ULONG * pSize) = 0;
  128. //
  129. // Enables refcounting. Final Release causes delete.
  130. //
  131. virtual ULONG AddRef() = 0;
  132. virtual ULONG Release() = 0;
  133. };
  134. //+---------------------------------------------------------------------------
  135. //
  136. // Class: PPropertyStoreIter
  137. //
  138. // Purpose: An iterator for the property store.
  139. //
  140. // History: 4-07-97 srikants Created
  141. //
  142. // Notes:
  143. //
  144. //----------------------------------------------------------------------------
  145. class PPropertyStore;
  146. class PPropertyStoreIter
  147. {
  148. public:
  149. virtual ULONG AddRef() = 0;
  150. virtual ULONG Release() = 0;
  151. virtual SCODE GetWorkId(WORKID &wid) = 0;
  152. virtual SCODE GetNextWorkId(WORKID &wid) = 0;
  153. };
  154. typedef ULONG SDID;
  155. //+---------------------------------------------------------------------------
  156. //
  157. // Class: PSecurityStore
  158. //
  159. // Purpose: A table for doing SecurityDescriptor to SDID mapping and
  160. // doing access checks based on the SDID.
  161. //
  162. // History: 4-07-97 srikants Created
  163. //
  164. //----------------------------------------------------------------------------
  165. class PSecurityStore
  166. {
  167. public:
  168. virtual ~PSecurityStore() {}
  169. virtual ULONG AddRef() = 0;
  170. virtual ULONG Release() = 0;
  171. // Initialize data from the given directory location.
  172. virtual SCODE Init( WCHAR const * pwszDirectory ) = 0;
  173. // Load data from the files produced by "Save". The first parameter
  174. // is the target directory for loading.
  175. virtual SCODE Load( WCHAR const * pwszDestinationDirectory, // dest dir
  176. IEnumString * pFileList, // list of files to copy
  177. IProgressNotify * pProgressNotify,
  178. BOOL fCallerOwnsFiles,
  179. BOOL * pfAbort ) = 0;
  180. // Make a copy of the security store. This can potentially be shipped
  181. // to a different machine.
  182. virtual SCODE Save( WCHAR const * pwszSaveDir,
  183. BOOL * pfAbort,
  184. IEnumString ** ppFileList,
  185. IProgressNotify * pProgressEnum ) = 0;
  186. // Empty the contents of the security store.
  187. virtual SCODE Empty() = 0;
  188. // Look up the 4byte SDID of the given security descriptor.
  189. virtual SCODE LookupSDID( PSECURITY_DESCRIPTOR pSD, ULONG cbSD,
  190. SDID & sdid ) = 0;
  191. // Tests if the given token has access to the document with the given
  192. // SDID.
  193. virtual SCODE AccessCheck( SDID sdid,
  194. HANDLE hToken,
  195. ACCESS_MASK am,
  196. BOOL & fGranted ) = 0;
  197. // Obtains the security descriptor associated with the given SDID.
  198. virtual SCODE GetSecurityDescriptor(
  199. SDID sdid,
  200. PSECURITY_DESCRIPTOR pSD,
  201. ULONG cbSDIn,
  202. ULONG & cbSDOut ) = 0;
  203. virtual SCODE Shutdown() = 0;
  204. };
  205. //
  206. // DLL exports for creating the various objects.
  207. //
  208. extern "C" {
  209. // Creates a property store. Needs ICiAdviseStatus
  210. SCODE CreatePropertyStore( ICiCAdviseStatus *pAdviseStatus,
  211. ULONG ulMaxPropertyStoreMappedCache,
  212. PPropertyStore **ppPropertyStore );
  213. // Creates a property store iterator given a property store.
  214. SCODE CreatePropertyStoreIter( PPropertyStore * pPropStore,
  215. PPropertyStoreIter ** ppPropStoreIter );
  216. // Creates a security store.
  217. SCODE CreateSecurityStore( ICiCAdviseStatus * pAdviseStatus,
  218. PSecurityStore ** ppSecurityStore );
  219. } // extern "C"
  220. #define CREATE_PROPERTY_STORE_PROC_A "CreatePropertyStore"
  221. #define CREATE_PROPERTY_STORE_PROC_W L"CreatePropertyStore"
  222. #define CREATE_PROPERTY_STORE_ITER_PROC_A "CreatePropertyStoreIter"
  223. #define CREATE_PROPERTY_STORE_ITER_PROC_W L"CreatePropertyStoreIter"
  224. #define CREATE_SECURITY_STORE_PROC_A "CreateSecurityStore"
  225. #define CREATE_SECURITY_STORE_PROC_W L"CreateSecurityStore"