Bewerken

Delen via


IoReadPartitionTable function (ntddk.h)

The IoReadPartitionTable routine is obsolete and is provided only to support existing drivers. New drivers must use IoReadPartitionTableEx. IoReadPartitionTable 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 IoReadPartitionTable(
  [in]  PDEVICE_OBJECT            DeviceObject,
  [in]  ULONG                     SectorSize,
  [in]  BOOLEAN                   ReturnRecognizedPartitions,
  [out] _DRIVE_LAYOUT_INFORMATION **PartitionBuffer
);

Parameters

[in] DeviceObject

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

[in] SectorSize

Specifies the size of the sectors on the disk.

[in] ReturnRecognizedPartitions

Indicates whether only recognized partitions or all partition entries should be returned.

[out] PartitionBuffer

Pointer to an uninitialized address. If successful, IoReadPartitionTable 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 and sets the pointer at PartitionBuffer to NULL.

Remarks

IoReadPartitionTable must only be used by disk drivers. Other drivers should use the IOCTL_DISK_GET_DRIVE_LAYOUT disk I/O request instead.

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.

The algorithm used by this routine is determined by the Boolean value ReturnRecognizedPartitions:

  • Read each partition table and, for each valid and recognized partition found, fill in an element in an array of PARTITION_INFORMATION entries. The array of partition information entries is pointed to by the PartitionEntry member of a DRIVE_LAYOUT_INFORMATION structure. The DRIVE_LAYOUT_INFORMATION structure is found at the location pointed to by PartitionBuffer. Extended partitions are located in order to find other partition tables, but no entries are built for them.
Read each partition table and, for each and every entry, fill in a partition information entry. Extended partitions are located to find each partition on the disk; entries are built for these as well.

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), IrqlIoPassive5(wdm), PowerIrpDDis(wdm)

See also

IOCTL_DISK_GET_DRIVE_LAYOUT

IOCTL_DISK_GET_PARTITION_INFO

IOCTL_DISK_SET_DRIVE_LAYOUT

IoSetPartitionInformation

IoWritePartitionTable