Hardware Dev Center

IoReadPartitionTableEx routine

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.

Syntax


NTSTATUS IoReadPartitionTableEx(
  _In_  PDEVICE_OBJECT                      DeviceObject,
  _Out_ struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer
);

Parameters

DeviceObject [in]

Pointer to the device object for the disk whose partitions are to be read.

PartitionBuffer [out]

Pointer to an uninitialized address. If successful, IoReadPartitionTableEx allocates the memory for this buffer from nonpaged pool and returns the drive layout information in it.

Return value

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.

Remarks

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

Requirements

Target platform

Universal

Header

Ntddk.h (include Ntddk.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

PASSIVE_LEVEL

DDI compliance rules

HwStorPortProhibitedDDIs

See also

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

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft