if (partitionTableEntry->PartitionType != MBRTypeIdentifier) {
//
// The partition type isn't what the caller cares about.
//
ExFreePool(readBuffer);
} else {
if (partitionTableEntry->PartitionType == 0x54) {
//
// Rather than allocate a new piece of memory to return
// the data - just use the memory allocated for the buffer.
// We can assume the caller will delete this shortly.
//
Partition type 0x55 is used by a driver which hooks the BIOS disk
interrupt and translates disk geometry so that DOS can use the
entire disk. The driver keeps your partitions inside the 0x55
partition. Linux detects the situation and uses them from there.
Apparently Linux also fools fdisk into reading and writing the
virtual MBR inside the 0x55 partition.
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.
-------------------------------
VOID
HalExamineMBR(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG MBRTypeIdentifier,
OUT PVOID * Buffer,
);
Parameters
DeviceObject
Pointer to the device object for the device being examined.
SectorSize
Specifies 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
Specifies the type of MBR that may be on the disk.
Buffer
Pointer to a buffer that returns data from the MBR. The layout of the buffer depends on the MBRTypeIdentifier. The caller must deallocate this buffer as soon as possible with ExFreePool. This routine returns NULL in Buffer if the MBRTypeIdentifier of the disk does not match that specified by the caller or if there is an error.