IOCTL_DISK_GET_PARTITION_INFO - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntdddisk.h

// CTL_CODE(0x0007, 0x001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DISK_GET_PARTITION_INFO 0x00074004

View the official Windows Driver Kit DDI reference
// winioctl.h

// CTL_CODE(0x0007, 0x001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DISK_GET_PARTITION_INFO 0x00074004

View the official Win32 API reference

NtDoc

No description available.

Windows Driver Kit DDI reference (ni-ntdddisk-ioctl_disk_get_partition_info)

IOCTL_DISK_GET_PARTITION_INFO IOCTL

Description

Returns information about the type, size, and nature of a disk partition. (Floppy drivers need not handle this request.)

Parameters

Major code

Input buffer

None.

Input buffer length

None.

Output buffer

The driver returns the PARTITION_INFORMATION data in the buffer at Irp->AssociatedIrp.SystemBuffer.

Output buffer length

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size, in bytes, of the buffer, which must be >= sizeof(PARTITION_INFORMATION).

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.

See also

PARTITION_INFORMATION


Win32 API reference (ni-winioctl-ioctl_disk_get_partition_info)

IOCTL_DISK_GET_PARTITION_INFO IOCTL

Description

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

[!NOTE] IOCTL_DISK_GET_PARTITION_INFO is superseded by IOCTL_DISK_GET_PARTITION_INFO_EX, which retrieves partition information for AT and Extensible Firmware Interface (EFI) partitions.

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

BOOL DeviceIoControl(
  (HANDLE) hDevice,                 // handle to a partition
  IOCTL_DISK_GET_PARTITION_INFO,    // dwIoControlCode
  NULL,                             // lpInBuffer
  0,                                // nInBufferSize
  (LPVOID) lpOutBuffer,             // output buffer
  (DWORD) nOutBufferSize,           // size of output buffer
  (LPDWORD) lpBytesReturned,        // number of bytes returned
  (LPOVERLAPPED) lpOverlapped       // OVERLAPPED structure
);

Parameters

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 control code is only supported on MBR-formatted disks.

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.

See also