HalExamineMBR function

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(
  PDEVICE_OBJECT DeviceObject,
  ULONG          SectorSize,
  ULONG          MBRTypeIdentifier,
  PVOID          *Buffer
);

Parameters

DeviceObject

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

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.

MBRTypeIdentifier

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

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

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

See Also

ExFreePool

PARTITION_INFORMATION