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.

213 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. spdisk.h
  5. Abstract:
  6. Public header file for disk support module in text setup.
  7. Author:
  8. Ted Miller (tedm) 27-Aug-1993
  9. Revision History:
  10. --*/
  11. #ifndef _SPDISK_
  12. #define _SPDISK_
  13. //
  14. // The following will be TRUE if hard disks have been determined
  15. // successfully (ie, if SpDetermineHardDisks was successfully called).
  16. //
  17. extern BOOLEAN HardDisksDetermined;
  18. NTSTATUS
  19. SpDetermineHardDisks(
  20. IN PVOID SifHandle
  21. );
  22. NTSTATUS
  23. SpOpenPartition(
  24. IN PWSTR DiskDevicePath,
  25. IN ULONG PartitionNumber,
  26. OUT HANDLE *Handle,
  27. IN BOOLEAN NeedWriteAccess
  28. );
  29. #define SpOpenPartition0(path,handle,write) SpOpenPartition((path),0,(handle),(write))
  30. NTSTATUS
  31. SpReadWriteDiskSectors(
  32. IN HANDLE Handle,
  33. IN ULONGLONG SectorNumber,
  34. IN ULONG SectorCount,
  35. IN ULONG BytesPerSector,
  36. IN OUT PVOID AlignedBuffer,
  37. IN BOOLEAN Write
  38. );
  39. ULONG
  40. SpArcDevicePathToDiskNumber(
  41. IN PWSTR ArcPath
  42. );
  43. #define DISK_DEVICE_NAME_BASE L"\\device\\harddisk"
  44. //
  45. // Define enumerated type for possible states a hard disk can be in.
  46. //
  47. typedef enum {
  48. DiskOnLine,
  49. DiskOffLine
  50. } DiskStatus;
  51. //
  52. // Int13 hooker types.
  53. //
  54. typedef enum {
  55. NoHooker = 0,
  56. HookerEZDrive,
  57. HookerOnTrackDiskManager,
  58. HookerMax
  59. } Int13HookerType;
  60. //
  61. // Define per-disk structure used internally to track hard disks.
  62. //
  63. typedef struct _HARD_DISK {
  64. //
  65. // Cylinder count we got back from the i/o system.
  66. //
  67. ULONGLONG CylinderCount;
  68. //
  69. // Path in the NT namespace of the device.
  70. //
  71. WCHAR DevicePath[(sizeof(DISK_DEVICE_NAME_BASE)+sizeof(L"000"))/sizeof(WCHAR)];
  72. //
  73. // Geometry information.
  74. //
  75. DISK_GEOMETRY Geometry;
  76. ULONG SectorsPerCylinder;
  77. ULONGLONG DiskSizeSectors;
  78. ULONG DiskSizeMB;
  79. //
  80. // Characteristics of the device (remoavable, etc).
  81. //
  82. ULONG Characteristics;
  83. //
  84. // Status of the device.
  85. //
  86. DiskStatus Status;
  87. //
  88. // Human-readable description of the disk device.
  89. //
  90. WCHAR Description[256];
  91. //
  92. // If the disk is a scsi disk, then the shortname of the
  93. // scsi miniport driver is stored here. If this string
  94. // is empty, then the disk is not a scsi disk.
  95. //
  96. WCHAR ScsiMiniportShortname[24];
  97. //
  98. // scsi-style ARC path of the disk device if possible for the disk.
  99. // Empty string if not. This is used to translate between scsi-style ARC
  100. // NT names because the 'firmware' cannot see scsi devices without BIOSes
  101. // and so they do not appear in the arc disk info passed by the osloader.
  102. // (IE, there are no arc names in the system for such disks).
  103. //
  104. WCHAR ArcPath[128];
  105. //
  106. // Int13 hooker support (ie, EZDrive).
  107. //
  108. Int13HookerType Int13Hooker;
  109. //
  110. // This tells us whether the disk is PCMCIA or not.
  111. //
  112. BOOLEAN PCCard;
  113. //
  114. // Contains the signature of the disk. This is used during the
  115. // identification of FT partitions, on the upgrade case.
  116. //
  117. ULONG Signature;
  118. //
  119. // MBR type: formatted for PC/AT or NEC98.
  120. //
  121. UCHAR FormatType;
  122. //
  123. // Wether the disk completely free
  124. //
  125. BOOLEAN NewDisk;
  126. //
  127. // The drive information we read
  128. //
  129. DRIVE_LAYOUT_INFORMATION_EX DriveLayout;
  130. #if 0
  131. //
  132. // Number of partition tables (are different between PC/AT and NEC98).
  133. //
  134. USHORT MaxPartitionTables;
  135. #endif //0
  136. } HARD_DISK, *PHARD_DISK;
  137. #define DISK_FORMAT_TYPE_UNKNOWN 0x00
  138. #define DISK_FORMAT_TYPE_PCAT 0x01
  139. #define DISK_FORMAT_TYPE_NEC98 0x02
  140. #define DISK_FORMAT_TYPE_GPT 0x03
  141. #define DISK_FORMAT_TYPE_RAW 0x04
  142. #define DISK_TAG_TYPE_UNKNOWN L"[Unknown]"
  143. #define DISK_TAG_TYPE_PCAT L"[MBR]"
  144. #define DISK_TAG_TYPE_NEC98 L"[NEC98]"
  145. #define DISK_TAG_TYPE_GPT L"[GPT]"
  146. #define DISK_TAG_TYPE_RAW L"[Raw]"
  147. #define DISK_TAG_START_CHAR L'['
  148. extern WCHAR *DiskTags[];
  149. VOID
  150. SpAppendDiskTag(
  151. IN PHARD_DISK Disk
  152. );
  153. //
  154. // These two globals track the hard disks attached to the computer.
  155. //
  156. extern PHARD_DISK HardDisks;
  157. extern ULONG HardDiskCount;
  158. //
  159. // These flags get set to TRUE if we find any disks owned
  160. // by ATDISK or ABIOSDSK.
  161. //
  162. extern BOOLEAN AtDisksExist,AbiosDisksExist;
  163. #endif // ndef _SPDISK_