Bewerken

Delen via


HalExamineMBR function (ntddk.h)

The HalExamineMBR routine reads the master boot record (MBR) of a disk and returns data from the MBR if the MBR is of the type specified by the caller.

Syntax

void HalExamineMBR(
  [in]  PDEVICE_OBJECT DeviceObject,
  [in]  ULONG          SectorSize,
  [in]  ULONG          MBRTypeIdentifier,
  [out] PVOID          *Buffer
);

Parameters

[in] DeviceObject

A pointer to the device object for the device being examined.

[in] SectorSize

The minimum number of bytes that an I/O operation can fetch from the device being examined. If this value is less than 512, HalExamineMBR reads 512 bytes to ensure that it reads an entire partition table.

[in] MBRTypeIdentifier

MBR partition type identifier. This parameter specifies the type of MBR that may be on the disk. For more information, see Remarks.

[out] Buffer

A pointer to a location to which HalExamineMBR writes a pointer to a buffer that contains data from the MBR. The layout of the buffer depends on the MBR partition type. HalExamineMBR allocates the storage for this buffer. The caller must deallocate this buffer as soon as possible by calling the ExFreePool routine.

HalExamineMBR sets *Buffer = NULL if the MBR partition type of the disk does not match that specified by MBRTypeIdentifier or if there is an error.

Return value

None

Remarks

For a list of system-defined MBR partition type identifiers, see the table in PARTITION_INFORMATION. These identifiers are defined in the Ntdddisk.h header file.

Requirements

Requirement Value
Minimum supported client Available starting with Windows XP.
Target Platform Universal
Header ntddk.h (include Ntddk.h)
IRQL PASSIVE_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), PowerIrpDDis(wdm)

See also

ExFreePool

PARTITION_INFORMATION