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.

333 lines
9.5 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1995, Microsoft Corporation
  4. //
  5. // File: cdfsvol.hxx
  6. //
  7. // Contents: Class to abstract a Dfs Volume object and all the
  8. // administration operations that can be performed on a
  9. // volume object.
  10. //
  11. // Classes: CDfsVolume
  12. //
  13. // Functions:
  14. //
  15. // History: 05/10/93 Sudk Created.
  16. // 12/19/95 Milans Ported to NT.
  17. //
  18. //-----------------------------------------------------------------------------
  19. #ifndef _CDFSVOL_HXX_
  20. #define _CDFSVOL_HXX_
  21. #include "svclist.hxx"
  22. #include "crecover.hxx"
  23. #include "recon.hxx"
  24. #define VolumeOffLine() ((_State == DFS_VOLUME_STATE_OFFLINE) || \
  25. (_Deleted == TRUE))
  26. #define VolumeDeleted() (_Deleted == TRUE)
  27. extern const GUID CLSID_CDfsVolume;
  28. //+-------------------------------------------------------------------------
  29. //
  30. // Class: CDfsVolume
  31. //
  32. // Synopsis: DfsVol runtime class - This is the class that represents
  33. // volumes in the Dfs namespace. This is the primary way to
  34. // manipulate volumes and to perform administrative operations on
  35. // them.
  36. //
  37. // For SUR, this class has been completely de-OLEized. However,
  38. // most of the methods are modeled after OLE methods of standard
  39. // interfaces.
  40. //
  41. // History: 05/10/93 SudK Created.
  42. // 12/19/95 Milans Converted to NT.
  43. //
  44. //--------------------------------------------------------------------------
  45. class CDfsVolume : public CReference
  46. {
  47. friend DWORD InitializeVolumeObject(
  48. PWSTR pwszVolName,
  49. BOOLEAN bInitVol,
  50. BOOLEAN SyncRemoteServerName);
  51. friend NTSTATUS DfsManagerHandleKnowledgeInconsistency(
  52. PBYTE Buffer,
  53. ULONG cbMessage);
  54. public:
  55. CDfsVolume(void);
  56. ~CDfsVolume();
  57. //
  58. // IPersist Methods
  59. //
  60. DWORD GetClassID(LPCLSID lpClassID);
  61. //
  62. // IPersistStorage Methods
  63. //
  64. DWORD InitNew(CStorage *pStg);
  65. DWORD Load(CStorage *pStg);
  66. DWORD Save(CStorage *pStgSave, BOOL fSameAsLoad);
  67. //
  68. // IPersistFile Methods
  69. //
  70. DWORD Load(LPCTSTR lpszFileName, DWORD grfMode);
  71. DWORD Save(LPCTSTR lpszFileName, BOOL fRemember);
  72. //
  73. // IDfsVolume Methods.
  74. //
  75. DWORD AddReplica(
  76. PDFS_REPLICA_INFO pReplicaInfo,
  77. ULONG fCreateOptions);
  78. DWORD RemoveReplica(
  79. PDFS_REPLICA_INFO pReplicaInfo,
  80. ULONG fDeleteOptions);
  81. DWORD Delete(
  82. ULONG fDeleteOptions);
  83. DWORD SetComment(
  84. LPWSTR pwszComment);
  85. DWORD GetNetInfo(
  86. DWORD Level,
  87. LPDFS_INFO_3 pInfo,
  88. LPDWORD pcbInfo);
  89. DWORD Move(
  90. LPWSTR pwszNewPrefix);
  91. DWORD Rename(
  92. LPWSTR oldPrefix,
  93. LPWSTR newPrefix);
  94. DWORD CreateChild(
  95. LPWSTR pwszPrefix,
  96. ULONG ulVolType,
  97. PDFS_REPLICA_INFO pReplicaInfo,
  98. LPWSTR pwszComment,
  99. ULONG fCreateOptions);
  100. DWORD GetObjectID(
  101. LPGUID idVolume);
  102. //
  103. // The following methods should probably be in a private interface??
  104. //
  105. DWORD CreateObject(
  106. LPWSTR pwszVolObjName,
  107. LPWSTR pwszPrefix,
  108. ULONG ulVolType,
  109. PDFS_REPLICA_INFO pReplicaInfo,
  110. LPWSTR pwszComment,
  111. GUID *pUid);
  112. DWORD GetReplicaSetID(
  113. GUID *guidRsid);
  114. DWORD SetReplicaSetID(
  115. GUID *guidRsid);
  116. DWORD AddReplicaToObj(
  117. PDFS_REPLICA_INFO pReplicaInfo);
  118. DWORD RemoveReplicaFromObj(
  119. LPWSTR pwszMachineName);
  120. DWORD ChangeStorageID(
  121. LPWSTR pwszMachineName,
  122. LPWSTR pwszNetStorageId);
  123. DWORD SetReplicaState(
  124. LPWSTR pwszMachineName,
  125. LPWSTR pwszShareName,
  126. ULONG fState);
  127. DWORD SetVolumeState(
  128. ULONG fState);
  129. DWORD SetVolumeTimeout(
  130. ULONG Timeout);
  131. //
  132. // IDfsUpdate overrides
  133. //
  134. DWORD ModifyEntryPath(
  135. LPWSTR oldPrefix,
  136. LPWSTR newPrefix );
  137. //
  138. // Not part of any interface.
  139. //
  140. DWORD InitializePkt(HANDLE PktHandle);
  141. DWORD UpdatePktEntry(HANDLE PktHandle);
  142. DWORD FixServiceKnowledge(
  143. LPWSTR PrincipalName);
  144. DWORD CreateChildX(
  145. LPWSTR childName,
  146. LPWSTR pwszPrefix,
  147. ULONG fVolType,
  148. LPWSTR pwszComment,
  149. CDfsVolume **ppChild);
  150. BOOLEAN IsValidService(
  151. LPWSTR wszServer);
  152. DWORD SyncWithRemoteServerNameInDs(void);
  153. private:
  154. CStorage *_pStorage;
  155. PWSTR _pwzFileName;
  156. PWSTR _pwszParentName;
  157. DWORD _dwRotRegistration;
  158. DFS_PKT_ENTRY_ID _peid;
  159. PWSTR _pwszComment;
  160. ULONG _EntryType;
  161. ULONG _State;
  162. ULONG _Timeout;
  163. ULONG _RecoveryState;
  164. CDfsService *_pRecoverySvc;
  165. ULONG _Deleted;
  166. ULONG _Version;
  167. CRecover _Recover;
  168. CDfsServiceList _DfsSvcList;
  169. FILETIME _ftEntryPath;
  170. FILETIME _ftState;
  171. FILETIME _ftComment;
  172. WCHAR _FileNameBuffer[MAX_PATH+1];
  173. WCHAR _ParentNameBuffer[MAX_PATH+1];
  174. WCHAR _EntryPathBuffer[MAX_PATH+1];
  175. WCHAR _ShortPathBuffer[MAX_PATH+1];
  176. DWORD CreateChildPartition(
  177. PWCHAR Name,
  178. ULONG Type,
  179. PWCHAR EntryPath,
  180. PWCHAR pwszComment,
  181. GUID *pUid,
  182. PDFS_REPLICA_INFO pReplInfo,
  183. CDfsVolume **NewIDfsVol);
  184. BOOL IsValidChildName(
  185. PWCHAR pwszChildPrefix,
  186. GUID *pidChild);
  187. BOOL NotLeafVolume();
  188. DWORD GetParent(
  189. CDfsVolume **parent);
  190. DWORD GetVersion(
  191. ULONG *pVersion);
  192. DWORD SetVersion(
  193. BOOL bCreate);
  194. DWORD GetIdProps(
  195. ULONG *pdwType,
  196. PWCHAR *ppwszEntryPath,
  197. PWCHAR *ppwszShortPath,
  198. PWCHAR *ppwszComment,
  199. GUID *pGuid,
  200. ULONG *pdwVolumeState,
  201. ULONG *pdwTimeout,
  202. FILETIME *pftPathTime,
  203. FILETIME *pftStateTime,
  204. FILETIME *pftCommentTime);
  205. DWORD SetIdProps(
  206. ULONG Type,
  207. ULONG State,
  208. PWCHAR pwszPrefix,
  209. PWCHAR pwszShortPath,
  210. GUID &Guid,
  211. PWCHAR pwszComment,
  212. ULONG Timeout,
  213. FILETIME ftPrefix,
  214. FILETIME ftState,
  215. FILETIME ftComment,
  216. BOOLEAN bCreate);
  217. DWORD DeleteObject();
  218. DWORD DeletePktEntry(
  219. PDFS_PKT_ENTRY_ID peid);
  220. DWORD CreateSubordinatePktEntry(
  221. HANDLE pktHandle,
  222. PDFS_PKT_ENTRY_ID peid,
  223. BOOLEAN withService);
  224. DWORD SetParentPath(void);
  225. DWORD GetDfsVolumeFromStg(
  226. DFSMSTATDIR *rgelt,
  227. CDfsVolume **pDfsVol);
  228. DWORD RecoverFromFailure(void);
  229. DWORD RecoverFromCreation(
  230. ULONG OperStage);
  231. DWORD RecoverFromAddService(
  232. ULONG OperStage);
  233. DWORD RecoverFromRemoveService(
  234. ULONG OperStage);
  235. DWORD RecoverFromDelete(
  236. ULONG OperStage);
  237. DWORD RecoverFromMove(
  238. ULONG OperStage);
  239. DWORD ModifyLocalEntryPath(
  240. PWCHAR newEntryPath,
  241. FILETIME ftEntryPath,
  242. BOOL fUpdatePkt);
  243. DWORD ReconcileIdProps(
  244. PDFS_ID_PROPS pIdProps );
  245. DWORD ReconcileSvcList(
  246. const ULONG cSvcs,
  247. CDfsService *pSvcList );
  248. DWORD UpgradeObject();
  249. DWORD SaveShortName();
  250. DWORD LoadNoRegister(
  251. LPCTSTR lpszFileName,
  252. DWORD grfMode);
  253. };
  254. #endif