Bewerken

Delen via


IoReadPartitionTableEx function (ntddk.h)

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,
       _DRIVE_LAYOUT_INFORMATION_EX **DriveLayout
);

Parameters

[in] DeviceObject

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

DriveLayout

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

Requirement Value
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), PowerIrpDDis(wdm)

See also

DRIVE_LAYOUT_INFORMATION_EX

IOCTL_DISK_GET_DRIVE_GEOMETRY

IOCTL_DISK_GET_DRIVE_LAYOUT_EX

IOCTL_DISK_GET_PARTITION_INFO_EX

IOCTL_DISK_SET_DRIVE_LAYOUT_EX

IOCTL_DISK_SET_PARTITION_INFO_EX

IoSetPartitionInformation

IoWritePartitionTableEx

PARTITION_INFORMATION_EX