30 *pPartitionTableEntry = &MasterBootRecord->PartitionTable[
Index];
51 *pPartitionTableEntry = &MasterBootRecord->PartitionTable[
Index];
66 PartitionEntry->StartingOffset.QuadPart = (
ULONGLONG)PartitionTableEntry->SectorCountBeforePartition *
SectorSize;
67 PartitionEntry->PartitionLength.QuadPart = (
ULONGLONG)PartitionTableEntry->PartitionSectorCount *
SectorSize;
68 PartitionEntry->HiddenSectors = 0;
70 PartitionEntry->PartitionType = PartitionTableEntry->SystemIndicator;
71 PartitionEntry->BootIndicator = (PartitionTableEntry->BootIndicator == 0x80);
72 PartitionEntry->RecognizedPartition =
TRUE;
73 PartitionEntry->RewritePartition =
FALSE;
84 ULONG BootablePartitionCount = 0;
85 ULONG CurrentPartitionNumber;
96 CurrentPartitionNumber = 0;
105 CurrentPartitionNumber++;
110 BootablePartitionCount++;
111 *ActivePartition = CurrentPartitionNumber;
124 if (BootablePartitionCount == 0)
126 ERR(
"No bootable (active) partitions found.\n");
129 else if (BootablePartitionCount != 1)
131 ERR(
"Too many bootable (active) partitions found.\n");
147 ULONG ExtendedPartitionNumber;
148 ULONG ExtendedPartitionOffset;
150 ULONG CurrentPartitionNumber;
162 CurrentPartitionNumber = 0;
171 CurrentPartitionNumber++;
187 ExtendedPartitionNumber =
PartitionNumber - CurrentPartitionNumber - 1;
194 ExtendedPartitionOffset = 0;
199 ULONG SectorCountBeforePartition;
207 if (ExtendedPartitionOffset == 0)
BOOLEAN DiskReadBootRecord(IN UCHAR DriveNumber, IN ULONGLONG LogicalSectorNumber, OUT PMASTER_BOOT_RECORD BootRecord)
BOOLEAN DiskGetMbrPartitionEntry(_In_ UCHAR DriveNumber, _In_ ULONG SectorSize, _In_ ULONG PartitionNumber, _Out_ PPARTITION_INFORMATION PartitionEntry)
static BOOLEAN DiskGetFirstExtendedPartitionEntry(_In_ PMASTER_BOOT_RECORD MasterBootRecord, _Out_ PPARTITION_TABLE_ENTRY *pPartitionTableEntry)
static BOOLEAN DiskGetFirstPartitionEntry(_In_ PMASTER_BOOT_RECORD MasterBootRecord, _Out_ PPARTITION_TABLE_ENTRY *pPartitionTableEntry)
static VOID DiskMbrPartitionTableEntryToInformation(_Out_ PPARTITION_INFORMATION PartitionEntry, _In_ PPARTITION_TABLE_ENTRY PartitionTableEntry, _In_ ULONG PartitionNumber, _In_ ULONG SectorSize)
BOOLEAN DiskGetActivePartitionEntry(_In_ UCHAR DriveNumber, _In_ ULONG SectorSize, _Out_opt_ PPARTITION_INFORMATION PartitionEntry, _Out_ PULONG ActivePartition)
#define PARTITION_ENTRY_UNUSED
#define PARTITION_EXTENDED
#define PARTITION_XINT13_EXTENDED
PARTITION_TABLE_ENTRY PartitionTable[4]
ULONG SectorCountBeforePartition
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ ULONG _In_ ULONG PartitionNumber