📄 ntdddisk.h
字号:
ULONG PartitionNumber;
UCHAR PartitionType;
BOOLEAN BootIndicator;
BOOLEAN RecognizedPartition;
BOOLEAN RewritePartition;
} PARTITION_INFORMATION, *PPARTITION_INFORMATION;
//
// The following structure is used to change the partition type of a
// specified disk partition using an IOCTL_DISK_SET_PARTITION_INFO
// request.
//
typedef struct _SET_PARTITION_INFORMATION {
UCHAR PartitionType;
} SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
//
// The following structures is returned on an IOCTL_DISK_GET_DRIVE_LAYOUT
// request and given as input to an IOCTL_DISK_SET_DRIVE_LAYOUT request.
//
typedef struct _DRIVE_LAYOUT_INFORMATION {
ULONG PartitionCount;
ULONG Signature;
PARTITION_INFORMATION PartitionEntry[1];
} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
//
// The following structure is passed in on an IOCTL_DISK_VERIFY request.
// The offset and length parameters are both given in bytes.
//
typedef struct _VERIFY_INFORMATION {
LARGE_INTEGER StartingOffset;
ULONG Length;
} VERIFY_INFORMATION, *PVERIFY_INFORMATION;
//
// The following structure is passed in on an IOCTL_DISK_REASSIGN_BLOCKS
// request.
//
typedef struct _REASSIGN_BLOCKS {
USHORT Reserved;
USHORT Count;
ULONG BlockNumber[1];
} REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
#if(_WIN32_WINNT >= 0x500)
//
// Support for GUID Partition Table (GPT) disks.
//
//
// There are currently two ways a disk can be partitioned. With a traditional
// AT-style master boot record (PARTITION_STYLE_MBR) and with a new, GPT
// partition table (PARTITION_STYLE_GPT). RAW is for an unrecognizable
// partition style. There are a very limited number of things you can
// do with a RAW partititon.
//
typedef enum _PARTITION_STYLE {
PARTITION_STYLE_MBR,
PARTITION_STYLE_GPT,
PARTITION_STYLE_RAW
} PARTITION_STYLE;
//
// The following structure defines information in a GPT partition that is
// not common to both GPT and MBR partitions.
//
typedef struct _PARTITION_INFORMATION_GPT {
GUID PartitionType; // Partition type. See table 16-3.
GUID PartitionId; // Unique GUID for this partition.
ULONG64 Attributes; // See table 16-4.
WCHAR Name [36]; // Partition Name in Unicode.
} PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT;
//
// The following are GPT partition attributes applicable for any
// partition type. These attributes are not OS-specific
//
#define GPT_ATTRIBUTE_PLATFORM_REQUIRED (0x0000000000000001)
//
// The following are GPT partition attributes applicable when the
// PartitionType is PARTITION_BASIC_DATA_GUID.
//
#define GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER (0x8000000000000000)
#define GPT_BASIC_DATA_ATTRIBUTE_HIDDEN (0x4000000000000000)
#define GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY (0x1000000000000000)
//
// The following structure defines information in an MBR partition that is not
// common to both GPT and MBR partitions.
//
typedef struct _PARTITION_INFORMATION_MBR {
UCHAR PartitionType;
BOOLEAN BootIndicator;
BOOLEAN RecognizedPartition;
ULONG HiddenSectors;
} PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
//
// The structure SET_PARTITION_INFO_EX is used with the ioctl
// IOCTL_SET_PARTITION_INFO_EX to set information about a specific
// partition. Note that for MBR partitions, you can only set the partition
// signature, whereas GPT partitions allow setting of all fields that
// you can get.
//
typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR;
typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT;
typedef struct _SET_PARTITION_INFORMATION_EX {
PARTITION_STYLE PartitionStyle;
union {
SET_PARTITION_INFORMATION_MBR Mbr;
SET_PARTITION_INFORMATION_GPT Gpt;
};
} SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX;
//
// The structure CREATE_DISK_GPT with the ioctl IOCTL_DISK_CREATE_DISK
// to initialize an virgin disk with an empty GPT partition table.
//
typedef struct _CREATE_DISK_GPT {
GUID DiskId; // Unique disk id for the disk.
ULONG MaxPartitionCount; // Maximim number of partitions allowable.
} CREATE_DISK_GPT, *PCREATE_DISK_GPT;
//
// The structure CREATE_DISK_MBR with the ioctl IOCTL_DISK_CREATE_DISK
// to initialize an virgin disk with an empty MBR partition table.
//
typedef struct _CREATE_DISK_MBR {
ULONG Signature;
} CREATE_DISK_MBR, *PCREATE_DISK_MBR;
typedef struct _CREATE_DISK {
PARTITION_STYLE PartitionStyle;
union {
CREATE_DISK_MBR Mbr;
CREATE_DISK_GPT Gpt;
};
} CREATE_DISK, *PCREATE_DISK;
//
// The structure GET_LENGTH_INFORMATION is used with the ioctl
// IOCTL_DISK_GET_LENGTH_INFO to obtain the length, in bytes, of the
// disk, partition, or volume.
//
typedef struct _GET_LENGTH_INFORMATION {
LARGE_INTEGER Length;
} GET_LENGTH_INFORMATION, *PGET_LENGTH_INFORMATION;
//
// The PARTITION_INFORMATION_EX structure is used with the
// IOCTL_DISK_GET_DRIVE_LAYOUT_EX, IOCTL_DISK_SET_DRIVE_LAYOUT_EX,
// IOCTL_DISK_GET_PARTITION_INFO_EX and IOCTL_DISK_GET_PARTITION_INFO_EX calls.
//
typedef struct _PARTITION_INFORMATION_EX {
PARTITION_STYLE PartitionStyle;
LARGE_INTEGER StartingOffset;
LARGE_INTEGER PartitionLength;
ULONG PartitionNumber;
BOOLEAN RewritePartition;
union {
PARTITION_INFORMATION_MBR Mbr;
PARTITION_INFORMATION_GPT Gpt;
};
} PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX;
//
// GPT specific drive layout information.
//
typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
GUID DiskId;
LARGE_INTEGER StartingUsableOffset;
LARGE_INTEGER UsableLength;
ULONG MaxPartitionCount;
} DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
//
// MBR specific drive layout information.
//
typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
ULONG Signature;
} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
//
// The structure DRIVE_LAYOUT_INFORMATION_EX is used with the
// IOCTL_SET_DRIVE_LAYOUT_EX and IOCTL_GET_DRIVE_LAYOUT_EX calls.
//
typedef struct _DRIVE_LAYOUT_INFORMATION_EX {
ULONG PartitionStyle;
ULONG PartitionCount;
union {
DRIVE_LAYOUT_INFORMATION_MBR Mbr;
DRIVE_LAYOUT_INFORMATION_GPT Gpt;
};
PARTITION_INFORMATION_EX PartitionEntry[1];
} DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX;
#endif // (_WIN32_WINNT >= 0x0500)
#if(_WIN32_WINNT >= 0x0500)
//
// The DISK_GEOMETRY_EX structure is returned on issuing an
// IOCTL_DISK_GET_DRIVE_GEOMETRY_EX ioctl.
//
typedef enum _DETECTION_TYPE {
DetectNone,
DetectInt13,
DetectExInt13
} DETECTION_TYPE;
typedef struct _DISK_INT13_INFO {
USHORT DriveSelect;
ULONG MaxCylinders;
USHORT SectorsPerTrack;
USHORT MaxHeads;
USHORT NumberDrives;
} DISK_INT13_INFO, *PDISK_INT13_INFO;
typedef struct _DISK_EX_INT13_INFO {
USHORT ExBufferSize;
USHORT ExFlags;
ULONG ExCylinders;
ULONG ExHeads;
ULONG ExSectorsPerTrack;
ULONG64 ExSectorsPerDrive;
USHORT ExSectorSize;
USHORT ExReserved;
} DISK_EX_INT13_INFO, *PDISK_EX_INT13_INFO;
typedef struct _DISK_DETECTION_INFO {
ULONG SizeOfDetectInfo;
DETECTION_TYPE DetectionType;
union {
struct {
//
// If DetectionType == DETECTION_INT13 then we have just the Int13
// information.
//
DISK_INT13_INFO Int13;
//
// If DetectionType == DETECTION_EX_INT13, then we have the
// extended int 13 information.
//
DISK_EX_INT13_INFO ExInt13; // If DetectionType == DetectExInt13
};
};
} DISK_DETECTION_INFO, *PDISK_DETECTION_INFO;
typedef struct _DISK_PARTITION_INFO {
ULONG SizeOfPartitionInfo;
PARTITION_STYLE PartitionStyle; // PartitionStyle = RAW, GPT or MBR
union {
struct { // If PartitionStyle == MBR
ULONG Signature; // MBR Signature
ULONG CheckSum; // MBR CheckSum
} Mbr;
struct { // If PartitionStyle == GPT
GUID DiskId;
} Gpt;
};
} DISK_PARTITION_INFO, *PDISK_PARTITION_INFO;
//
// The Geometry structure is a variable length structure composed of a
// DISK_GEOMETRY_EX structure followed by a DISK_PARTITION_INFO structure
// followed by a DISK_DETECTION_DATA structure.
//
#define DiskGeometryGetPartition(Geometry)\
((PDISK_PARTITION_INFO)((Geometry)+1))
#define DiskGeometryGetDetect(Geometry)\
((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry)+\
DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
typedef struct _DISK_GEOMETRY_EX {
DISK_GEOMETRY Geometry; // Standard disk geometry: may be faked by driver.
LARGE_INTEGER DiskSize; // Must always be correct
UCHAR Data[1]; // Partition, Detect info
} DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX;
#endif // (_WIN32_WINNT > 0x0500)
#if(_WIN32_WINNT >= 0x0400)
//
// IOCTL_DISK_CONTROLLER_NUMBER returns the controller and disk
// number for the handle. This is used to determine if a disk
// is attached to the primary or secondary IDE controller.
//
typedef struct _DISK_CONTROLLER_NUMBER {
ULONG ControllerNumber;
ULONG DiskNumber;
} DISK_CONTROLLER_NUMBER, *PDISK_CONTROLLER_NUMBER;
#endif /* _WIN32_WINNT >= 0x0400 */
#if(_WIN32_WINNT >= 0x0500)
//
// IOCTL_DISK_SET_CACHE allows the caller to get or set the state of the disk
// read/write caches.
//
// If the structure is provided as the input buffer for the ioctl the read &
// write caches will be enabled or disabled depending on the parameters
// provided.
//
// If the structure is provided as an output buffer for the ioctl the state
// of the read & write caches will be returned. If both input and outut buffers
// are provided the output buffer will contain the cache state BEFORE any
// changes are made
//
typedef enum {
EqualPriority,
KeepPrefetchedData,
KeepReadData
} DISK_CACHE_RETENTION_PRIORITY;
typedef enum _DISK_WRITE_CACHE_STATE {
DiskWriteCacheNormal,
DiskWriteCacheForceDisable,
DiskWriteCacheDisableNotSupported
} DISK_WRITE_CACHE_STATE, *PDISK_WRITE_CACHE_STATE;
typedef struct _DISK_CACHE_INFORMATION {
//
// on return indicates that the device is capable of saving any parameters
// in non-volatile storage. On send indicates that the device should
// save the state in non-volatile storage.
//
BOOLEAN ParametersSavable;
//
// Indicates whether the write and read caches are enabled.
//
BOOLEAN ReadCacheEnabled;
BOOLEAN WriteCacheEnabled;
//
// Controls the likelyhood of data remaining in the cache depending on how
// it got there. Data cached from a READ or WRITE operation may be given
// higher, lower or equal priority to data entered into the cache for other
// means (like prefetch)
//
DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority;
DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority;
//
// Requests for a larger number of blocks than this may have prefetching
// disabled. If this value is set to 0 prefetch will be disabled.
//
USHORT DisablePrefetchTransferLength;
//
// If TRUE then ScalarPrefetch (below) will be valid. If FALSE then
// the minimum and maximum values should be treated as a block count
// (BlockPrefetch)
//
BOOLEAN PrefetchScalar;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -