The IoReadPartitionTableEx routine reads a list of partitions on a disk having a specified sector size and creates an entry in the partition list for each recognized partition.
NTSTATUS
IoReadPartitionTableEx(
IN PDEVICE_OBJECT DeviceObject,
IN struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer
);
This routine returns a value of STATUS_SUCCESS if at least one sector table was read. Otherwise, it returns an error status value and sets the pointer at PartitionBuffer to NULL.
Declared in ntddk.h. Include ntddk.h.
IoReadPartitionTableEx must only be used by disk drivers. Other drivers should use the IOCTL_DISK_GET_DRIVE_LAYOUT_EX disk I/O request instead.
IoReadPartitionTableEx is able to read partition table information from GUID Partition Table (GPT) disks as well as legacy Master Boot Record (MBR) disks. Disk device drivers call this routine during driver initialization.
It is the responsibility of the caller to deallocate the PartitionBuffer that was allocated by this routine with ExFreePool.
Note that disk drivers also return and set partition information in response to IRP_MJ_DEVICE_CONTROL requests with the following I/O control codes:
IOCTL_DISK_GET_PARTITION_INFO_EX
IOCTL_DISK_SET_PARTITION_INFO_EX
IOCTL_DISK_GET_DRIVE_LAYOUT_EX
IOCTL_DISK_SET_DRIVE_LAYOUT_EX
IOCTL_DISK_GET_DRIVE_GEOMETRY
Callers of IoReadPartitionTableEx must be running at IRQL = PASSIVE_LEVEL.
DRIVE_LAYOUT_INFORMATION_EX, PARTITION_INFORMATION_EX,
IOCTL_DISK_GET_PARTITION_INFO_EX, IOCTL_DISK_SET_PARTITION_INFO_EX, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, IOCTL_DISK_SET_DRIVE_LAYOUT_EX, IOCTL_DISK_GET_DRIVE_GEOMETRY, IoSetPartitionInformation, IoWritePartitionTableEx