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.

207 lines
4.7 KiB

  1. //
  2. // This structure is header information for a partition blob.
  3. // It is padded to sector length when written.
  4. //
  5. #define PARTITION_IMAGE_SIGNATURE 0x52ab4cf9L
  6. typedef struct _PARTITION_IMAGE {
  7. //
  8. // Signature
  9. //
  10. ULONG Signature;
  11. //
  12. // Size of the this structure
  13. //
  14. UINT Size;
  15. //
  16. // Number of sectors at the start of the partition
  17. // that are not part of a cluster. This is also the
  18. // start sector number of the cluster area.
  19. //
  20. ULONG NonClusterSectors;
  21. //
  22. // Total number of clusters in the cluster area of the volume,
  23. // used and unused.
  24. //
  25. ULONG ClusterCount;
  26. //
  27. // Number of sectors in the original partition containing the volume.
  28. //
  29. ULONG TotalSectorCount;
  30. //
  31. // The last used cluster on the volume.
  32. //
  33. ULONG LastUsedCluster;
  34. //
  35. // The number of (used) clusters in the image
  36. //
  37. ULONG UsedClusterCount;
  38. //
  39. // Start sectors for relocation of cluster bitmap and boot partition.
  40. // Valid when the PARTIMAGE_RELOCATE_xxx flags are set (see below).
  41. // Filled in by makemast.exe when the image is transferred to disk.
  42. //
  43. ULONG BitmapRelocationStart;
  44. ULONG BootRelocationStart;
  45. //
  46. // Number of sectors in a cluster.
  47. //
  48. BYTE SectorsPerCluster;
  49. //
  50. // System id byte of the partition, for the partition table.
  51. //
  52. BYTE SystemId;
  53. //
  54. // Flags
  55. //
  56. UINT Flags;
  57. //
  58. // CRC32 for the file
  59. //
  60. ULONG CRC;
  61. //
  62. // Reserved Sector count for FAT32 ONLY
  63. //
  64. USHORT Fat32ReservedSectors;
  65. //
  66. // Adjusted sector count for FAT32 ONLY
  67. //
  68. ULONG Fat32AdjustedSectorCount;
  69. //
  70. // Original FAT table size for FAT32 ONLY
  71. //
  72. ULONG Fat32OriginalFatTableSectCount;
  73. //
  74. // Adjusted FAT table size for FAT32 ONLY
  75. //
  76. ULONG Fat32AdjustedFatTableEntryCount;
  77. } PARTITION_IMAGE, *PPARTITION_IMAGE, _far *FPPARTITION_IMAGE;
  78. //
  79. // These flags indicate that there's not enough free space at the end
  80. // of the volume for the boot partition and/or cluster bitmap and thus
  81. // these two things will have to be relocated to free space within
  82. // the volume before we start the restore process.
  83. //
  84. #define PARTIMAGE_RELOCATE_BITMAP 0x0001
  85. #define PARTIMAGE_RELOCATE_BOOT 0x0002
  86. //
  87. // This structure is written onto physical sector 1 (just past the mbr)
  88. // on a master disk. It a) indicates that the disk is a master disk and
  89. // b) gives information about each partition image available to the
  90. // end-user. It is also padded to sector length when written.
  91. //
  92. #define MAX_PARTITION_IMAGES 10
  93. typedef struct _MASTER_DISK {
  94. //
  95. // Signature
  96. //
  97. ULONG Signature;
  98. //
  99. // Size of this structure
  100. //
  101. UINT Size;
  102. //
  103. // State info
  104. //
  105. UINT State;
  106. //
  107. // Start sector of the MPK boot partition. We could get this
  108. // from the MBR also but we stash it here for verification and
  109. // convenience.
  110. //
  111. ULONG StartupPartitionStartSector;
  112. ULONG StartupPartitionSectorCount;
  113. //
  114. // Count of partition images
  115. //
  116. UINT ImageCount;
  117. //
  118. // LBA sector numbers of start of each image
  119. //
  120. ULONG ImageStartSector[MAX_PARTITION_IMAGES];
  121. //
  122. // State-dependent information.
  123. //
  124. UINT SelectedLanguage;
  125. UINT SelectionOrdinal;
  126. ULONG ClusterBitmapStart;
  127. ULONG NonClusterSectorsDone;
  128. ULONG ForwardXferSectorCount;
  129. ULONG ReverseXferSectorCount;
  130. //
  131. // Geometry information used when the master disk was created.
  132. // At end-user time this geometry must match.
  133. //
  134. USHORT OriginalHeads;
  135. BYTE OriginalSectorsPerTrack;
  136. //
  137. // Used for preserving EISA/hiber partitions at the beginning and end of disks.
  138. // These are filled in by makemast when it figures out where the partition restores
  139. // can go.
  140. //
  141. ULONG FreeSpaceStart;
  142. // currently this field is unused, as we do not support preserving partitions
  143. // at the end of the disk, since this is where the MPK partition goes
  144. ULONG FreeSpaceEnd;
  145. } MASTER_DISK, *PMASTER_DISK, _far *FPMASTER_DISK;
  146. #define MASTER_DISK_SIGNATURE 0x98fc2304L
  147. //
  148. // Master disk states. Note that these *must* be in sequence order.
  149. //
  150. #define MDS_NONE 0
  151. #define MDS_GOT_LANGUAGE 10
  152. #define MDS_GOT_OS_CHOICE 20
  153. #define MDS_CACHED_IMAGE_HEADER 30
  154. #define MDS_REMOVED_OTHERS 40
  155. #define MDS_RELOCATED_BITMAP 50
  156. #define MDS_RELOCATED_BOOT 53
  157. #define MDS_RELOCATED_BOOT_MBR 57
  158. #define MDS_DID_NONCLUSTER_DATA 60
  159. #define MDS_DID_XFER_FORWARD 63
  160. #define MDS_DID_XFER_REVERSE 67
  161. #define MDS_UPDATED_BPB 70
  162. #define MDS_UPDATED_MBR 80
  163. BOOL
  164. _far
  165. IsMasterDisk(
  166. IN UINT DiskId,
  167. OUT FPVOID IoBuffer
  168. );