IOCTL_DISK_GET_PARTITION_INFO_EX IOCTL

Retrieves extended information about the type, size, and nature of a disk partition.

To perform this operation, call the DeviceIoControl function with the following parameters.

C++
BOOL DeviceIoControl(
  (HANDLE) hDevice,                 // handle to a partition
  IOCTL_DISK_GET_PARTITION_INFO_EX, // dwIoControlCodeNULL,                             // lpInBuffer0,                                // nInBufferSize(LPVOID) lpOutBuffer,             // output buffer
  (DWORD) nOutBufferSize,           // size of output buffer
  (LPDWORD) lpBytesReturned,        // number of bytes returned
  (LPOVERLAPPED) lpOverlapped       // OVERLAPPED structure
);

Major Code

IRP_MJ_DEVICE_CONTROL

Input Buffer

Input Buffer Length

Output Buffer

Output Buffer Length

Input / Output Buffer

Input / Output Buffer Length

Status Block

Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.

Otherwise, Status to the appropriate error condition as a NTSTATUS code.

For more information, see NTSTATUS Values.

Remarks

The IOCTL_DISK_GET_PARTITION_INFO_EX control code is supported on basic disks. It is only supported on dynamic disks that are boot or system disks, or have retained entries in the partition table. The DiskPart.exe command RETAIN can be used to do this for other dynamic simple partitions.

The disk support can be summarized as follows.

Disk type IOCTL_DISK_GET_PARTITION_INFO IOCTL_DISK_GET_PARTITION_INFO_EX
Basic master boot record (MBR) Yes Yes
Basic GUID partition table (GPT) No Yes
Dynamic MBR boot/system Yes Yes
Dynamic MBR data Yes No
Dynamic GPT boot/system No Yes
Dynamic GPT data No No
 

Currently, GPT is supported only on 64-bit systems.

If the partition is on a disk formatted as type master boot record (MBR), partition size totals are limited. For more information, see the Remarks section of IOCTL_DISK_SET_DRIVE_LAYOUT.

Requirements

   
Windows version Windows XP [desktop apps only] Windows Server 2003 [desktop apps only]
Header winioctl.h (include Windows.h)

See Also

DeviceIoControl

Disk Management Control Codes

File System Recognition

IOCTL_DISK_SET_PARTITION_INFO_EX

PARTITION_INFORMATION_EX