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.

350 lines
9.0 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. Module Name:
  4. ondisk.hxx
  5. Abstract:
  6. This header file defines support for manipulating the on disk
  7. structures.
  8. Author:
  9. Norbert Kusters 15-July-1996
  10. Notes:
  11. Revision History:
  12. --*/
  13. extern "C" {
  14. #include <ondisk.h>
  15. }
  16. class FT_LOGICAL_DISK_INFORMATION;
  17. typedef FT_LOGICAL_DISK_INFORMATION* PFT_LOGICAL_DISK_INFORMATION;
  18. class FT_LOGICAL_DISK_INFORMATION : public FT_BASE_CLASS {
  19. public:
  20. NTSTATUS
  21. Initialize(
  22. IN PROOT_EXTENSION RootExtension,
  23. IN OUT PDEVICE_OBJECT WholeDiskPdo
  24. );
  25. NTSTATUS
  26. Write(
  27. );
  28. PFT_LOGICAL_DISK_DESCRIPTION
  29. GetFirstLogicalDiskDescription(
  30. );
  31. PFT_LOGICAL_DISK_DESCRIPTION
  32. GetNextLogicalDiskDescription(
  33. IN PFT_LOGICAL_DISK_DESCRIPTION CurrentDiskDescription
  34. );
  35. PFT_LOGICAL_DISK_DESCRIPTION
  36. AddLogicalDiskDescription(
  37. IN PFT_LOGICAL_DISK_DESCRIPTION LogicalDiskDescription
  38. );
  39. ULONG
  40. QueryDiskDescriptionFreeSpace(
  41. );
  42. VOID
  43. DeleteLogicalDiskDescription(
  44. IN PFT_LOGICAL_DISK_DESCRIPTION LogicalDiskDescription
  45. );
  46. BOOLEAN
  47. AddReplaceLog(
  48. IN FT_LOGICAL_DISK_ID ReplacedMemberLogicalDiskId,
  49. IN FT_LOGICAL_DISK_ID NewMemberLogicalDiskId,
  50. IN ULONG NumberOfChangedDiskIds,
  51. IN PFT_LOGICAL_DISK_ID OldLogicalDiskIds,
  52. IN PFT_LOGICAL_DISK_ID NewLogicalDiskIds
  53. );
  54. BOOLEAN
  55. ClearReplaceLog(
  56. );
  57. BOOLEAN
  58. BackOutReplaceOperation(
  59. );
  60. BOOLEAN
  61. BackOutReplaceOperationIf(
  62. IN PFT_LOGICAL_DISK_INFORMATION LogicalDiskInformation
  63. );
  64. ULONGLONG
  65. GetGptAttributes(
  66. );
  67. NTSTATUS
  68. SetGptAttributes(
  69. IN ULONGLONG GptAttributes
  70. );
  71. PROOT_EXTENSION
  72. GetRootExtension(
  73. ) { return _rootExtension; };
  74. PDEVICE_OBJECT
  75. GetWholeDisk(
  76. ) { return _wholeDisk; };
  77. PDEVICE_OBJECT
  78. GetWholeDiskPdo(
  79. ) { return _wholeDiskPdo; };
  80. ULONG
  81. QueryDiskNumber(
  82. ) { return _diskNumber; };
  83. ULONG
  84. QuerySectorSize(
  85. ) { return _sectorSize; };
  86. ~FT_LOGICAL_DISK_INFORMATION(
  87. );
  88. private:
  89. PROOT_EXTENSION _rootExtension;
  90. PDEVICE_OBJECT _wholeDisk;
  91. PDEVICE_OBJECT _wholeDiskPdo;
  92. ULONG _diskNumber;
  93. ULONG _sectorSize;
  94. LARGE_INTEGER _byteOffset;
  95. ULONG _length;
  96. PVOID _diskBuffer;
  97. BOOLEAN _isDiskSuitableForFtOnDisk;
  98. };
  99. class FT_LOGICAL_DISK_INFORMATION_SET : public FT_BASE_CLASS {
  100. public:
  101. NTSTATUS
  102. Initialize(
  103. );
  104. NTSTATUS
  105. AddLogicalDiskInformation(
  106. IN PFT_LOGICAL_DISK_INFORMATION LogicalDiskInformation,
  107. OUT PBOOLEAN ChangedLogicalDiskIds
  108. );
  109. NTSTATUS
  110. RemoveLogicalDiskInformation(
  111. IN PDEVICE_OBJECT WholeDiskPdo
  112. );
  113. BOOLEAN
  114. IsDiskInSet(
  115. IN PDEVICE_OBJECT WholeDiskPdo
  116. );
  117. PFT_LOGICAL_DISK_DESCRIPTION
  118. GetLogicalDiskDescription(
  119. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  120. IN ULONG InstanceNumber
  121. );
  122. PFT_LOGICAL_DISK_DESCRIPTION
  123. GetParentLogicalDiskDescription(
  124. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  125. OUT PULONG DiskInformationNumber = NULL
  126. );
  127. PFT_LOGICAL_DISK_DESCRIPTION
  128. GetParentLogicalDiskDescription(
  129. IN PFT_LOGICAL_DISK_DESCRIPTION LogicalDiskDescription,
  130. IN ULONG DiskInformationNumber
  131. );
  132. ULONG
  133. QueryNumberOfRootLogicalDiskIds(
  134. );
  135. FT_LOGICAL_DISK_ID
  136. QueryRootLogicalDiskId(
  137. IN ULONG Index
  138. );
  139. FT_LOGICAL_DISK_ID
  140. QueryRootLogicalDiskIdForContainedPartition(
  141. IN ULONG DiskNumber,
  142. IN LONGLONG Offset
  143. );
  144. FT_LOGICAL_DISK_ID
  145. QueryPartitionLogicalDiskId(
  146. IN ULONG DiskNumber,
  147. IN LONGLONG Offset
  148. );
  149. USHORT
  150. QueryNumberOfMembersInLogicalDisk(
  151. IN FT_LOGICAL_DISK_ID LogicalDiskId
  152. );
  153. FT_LOGICAL_DISK_ID
  154. QueryMemberLogicalDiskId(
  155. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  156. IN USHORT MemberNumber
  157. );
  158. FT_LOGICAL_DISK_TYPE
  159. QueryLogicalDiskType(
  160. IN FT_LOGICAL_DISK_ID LogicalDiskId
  161. );
  162. BOOLEAN
  163. QueryFtPartitionInformation(
  164. IN FT_LOGICAL_DISK_ID PartitionLogicalDiskId,
  165. OUT PLONGLONG Offset,
  166. OUT PDEVICE_OBJECT* WholeDisk,
  167. OUT PULONG DiskNumber,
  168. OUT PULONG SectorSize,
  169. OUT PLONGLONG PartitionSize
  170. );
  171. PVOID
  172. GetConfigurationInformation(
  173. IN FT_LOGICAL_DISK_ID LogicalDiskId
  174. );
  175. PVOID
  176. GetStateInformation(
  177. IN FT_LOGICAL_DISK_ID LogicalDiskId
  178. );
  179. BOOLEAN
  180. IsLogicalDiskComplete(
  181. IN FT_LOGICAL_DISK_ID LogicalDiskId
  182. );
  183. UCHAR
  184. QueryDriveLetter(
  185. IN FT_LOGICAL_DISK_ID LogicalDiskId
  186. );
  187. NTSTATUS
  188. SetDriveLetter(
  189. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  190. IN UCHAR DriveLetter
  191. );
  192. NTSTATUS
  193. WriteStateInformation(
  194. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  195. IN PVOID LogicalDiskState,
  196. IN USHORT LogicalDiskStateSize
  197. );
  198. NTSTATUS
  199. CreatePartitionLogicalDisk(
  200. IN ULONG DiskNumber,
  201. IN LONGLONG Offset,
  202. IN LONGLONG PartitionSize,
  203. OUT PFT_LOGICAL_DISK_ID NewLogicalDiskId
  204. );
  205. NTSTATUS
  206. AddNewLogicalDisk(
  207. IN FT_LOGICAL_DISK_TYPE NewLogicalDiskType,
  208. IN USHORT NumberOfMembers,
  209. IN PFT_LOGICAL_DISK_ID ArrayOfMembers,
  210. IN USHORT ConfigurationInformationSize,
  211. IN PVOID ConfigurationInformation,
  212. IN USHORT StateInformationSize,
  213. IN PVOID StateInformation,
  214. OUT PFT_LOGICAL_DISK_ID NewLogicalDiskId
  215. );
  216. NTSTATUS
  217. BreakLogicalDisk(
  218. IN FT_LOGICAL_DISK_ID LogicalDiskId
  219. );
  220. NTSTATUS
  221. ReplaceLogicalDiskMember(
  222. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  223. IN USHORT MemberNumberToReplace,
  224. IN FT_LOGICAL_DISK_ID NewMemberLogicalDiskId,
  225. OUT PFT_LOGICAL_DISK_ID NewLogicalDiskId
  226. );
  227. NTSTATUS
  228. MigrateRegistryInformation(
  229. IN PDEVICE_OBJECT Partition,
  230. IN ULONG DiskNumber,
  231. IN LONGLONG Offset
  232. );
  233. VOID
  234. DeleteFtRegistryInfo(
  235. IN FT_LOGICAL_DISK_ID LogicalDiskId
  236. );
  237. PFT_LOGICAL_DISK_INFORMATION
  238. FindLogicalDiskInformation(
  239. IN PDEVICE_OBJECT WholeDiskPdo
  240. );
  241. ~FT_LOGICAL_DISK_INFORMATION_SET(
  242. );
  243. private:
  244. BOOLEAN
  245. ReallocRootLogicalDiskIds(
  246. IN ULONG NewNumberOfEntries
  247. );
  248. VOID
  249. RecomputeArrayOfRootLogicalDiskIds(
  250. );
  251. BOOLEAN
  252. ComputeNewParentLogicalDiskIds(
  253. IN FT_LOGICAL_DISK_ID LogicalDiskId,
  254. OUT PULONG NumLogicalDiskIds,
  255. OUT PFT_LOGICAL_DISK_ID* OldLogicalDiskIds,
  256. OUT PFT_LOGICAL_DISK_ID* NewLogicalDiskIds
  257. );
  258. BOOLEAN
  259. GetDiskDescription(
  260. IN PDISK_CONFIG_HEADER Registry,
  261. IN PDISK_PARTITION DiskPartition,
  262. IN PFT_LOGICAL_DISK_DESCRIPTION CheckDiskDescription,
  263. OUT PFT_LOGICAL_DISK_DESCRIPTION* DiskDescription
  264. );
  265. ULONG
  266. DiskNumberFromSignature(
  267. IN ULONG Signature
  268. );
  269. ULONG _numberOfLogicalDiskInformations;
  270. PFT_LOGICAL_DISK_INFORMATION* _arrayOfLogicalDiskInformations;
  271. ULONG _numberOfRootLogicalDisksIds;
  272. PFT_LOGICAL_DISK_ID _arrayOfRootLogicalDiskIds;
  273. };
  274. typedef FT_LOGICAL_DISK_INFORMATION_SET* PFT_LOGICAL_DISK_INFORMATION_SET;