26#define MaxDriveNumber 0xFF
30#define XBOX_SIGNATURE_SECTOR 3
31#define XBOX_SIGNATURE ('B' | ('R' << 8) | ('F' << 16) | ('R' << 24))
34#define FATX_DATA_PARTITION 1
66 TRACE(
"Dumping partition table for drive 0x%x:\n", DriveNumber);
67 TRACE(
"Boot record logical start sector = %d\n", LogicalSectorNumber);
72 TRACE(
"-------------------------------------------\n");
74 TRACE(
"BootIndicator: 0x%x\n", BootRecord->PartitionTable[
Index].BootIndicator);
75 TRACE(
"StartHead: 0x%x\n", BootRecord->PartitionTable[
Index].StartHead);
76 TRACE(
"StartSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[
Index].StartSector);
77 TRACE(
"StartCylinder: 0x%x\n", BootRecord->PartitionTable[
Index].StartCylinder);
78 TRACE(
"SystemIndicator: 0x%x\n", BootRecord->PartitionTable[
Index].SystemIndicator);
79 TRACE(
"EndHead: 0x%x\n", BootRecord->PartitionTable[
Index].EndHead);
80 TRACE(
"EndSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[
Index].EndSector);
81 TRACE(
"EndCylinder: 0x%x\n", BootRecord->PartitionTable[
Index].EndCylinder);
82 TRACE(
"SectorCountBeforePartition: 0x%x\n", BootRecord->PartitionTable[
Index].SectorCountBeforePartition);
83 TRACE(
"PartitionSectorCount: 0x%x\n", BootRecord->PartitionTable[
Index].PartitionSectorCount);
87 return (BootRecord->MasterBootRecordMagic == 0xaa55);
139 ULONG BootablePartitionCount = 0;
140 ULONG CurrentPartitionNumber;
145 *ActivePartition = 0;
153 CurrentPartitionNumber = 0;
162 CurrentPartitionNumber++;
167 BootablePartitionCount++;
168 *ActivePartition = CurrentPartitionNumber;
172 ThisPartitionTableEntry,
179 if (BootablePartitionCount == 0)
181 ERR(
"No bootable (active) partitions found.\n");
184 else if (BootablePartitionCount != 1)
186 ERR(
"Too many bootable (active) partitions found.\n");
201 ULONG ExtendedPartitionNumber;
202 ULONG ExtendedPartitionOffset;
204 ULONG CurrentPartitionNumber;
213 CurrentPartitionNumber = 0;
222 CurrentPartitionNumber++;
237 ExtendedPartitionNumber =
PartitionNumber - CurrentPartitionNumber - 1;
244 ExtendedPartitionOffset = 0;
256 if (ExtendedPartitionOffset == 0)
319 ULONG PartitionCount = 0;
345 if (PartitionCount == 1 && GPTProtect)
357 TRACE(
"Drive 0x%X partition type Xbox-BRFR\n", DriveNumber);
363 TRACE(
"Drive 0x%X partition type unknown\n", DriveNumber);
380 FIXME(
"DiskGetBootPartitionEntry() unimplemented for GPT\n");
383 case PARTITION_STYLE_RAW:
385 FIXME(
"DiskGetBootPartitionEntry() unimplemented for RAW\n");
388 case PARTITION_STYLE_BRFR:
399 ERR(
"Drive 0x%X partition type = %d, should not happen!\n", DriveNumber,
DiskPartitionType[DriveNumber]);
420 FIXME(
"DiskGetPartitionEntry() unimplemented for GPT\n");
423 case PARTITION_STYLE_RAW:
425 FIXME(
"DiskGetPartitionEntry() unimplemented for RAW\n");
428 case PARTITION_STYLE_BRFR:
434 ERR(
"Drive 0x%X partition type = %d, should not happen!\n", DriveNumber,
DiskPartitionType[DriveNumber]);
#define XBOX_SIGNATURE_SECTOR
static BOOLEAN DiskReadBootRecord(IN UCHAR DriveNumber, IN ULONGLONG LogicalSectorNumber, OUT PMASTER_BOOT_RECORD BootRecord)
#define FATX_DATA_PARTITION
static BOOLEAN DiskGetBrfrPartitionEntry(IN UCHAR DriveNumber, IN ULONG PartitionNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
BOOLEAN DiskGetPartitionEntry(IN UCHAR DriveNumber, IN ULONG PartitionNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
static BOOLEAN DiskGetActivePartitionEntry(IN UCHAR DriveNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry, OUT PULONG ActivePartition)
static struct @154 XboxPartitions[]
static PARTITION_STYLE DiskPartitionType[MaxDriveNumber+1]
static BOOLEAN DiskGetFirstPartitionEntry(IN PMASTER_BOOT_RECORD MasterBootRecord, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
static BOOLEAN DiskGetMbrPartitionEntry(IN UCHAR DriveNumber, IN ULONG PartitionNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
BOOLEAN DiskGetBootPartitionEntry(IN UCHAR DriveNumber, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry, OUT PULONG BootPartition)
static BOOLEAN DiskGetFirstExtendedPartitionEntry(IN PMASTER_BOOT_RECORD MasterBootRecord, OUT PPARTITION_TABLE_ENTRY PartitionTableEntry)
ULONG PartitionSectorCount
ULONG SectorCountBeforePartition
VOID DiskDetectPartitionType(IN UCHAR DriveNumber)
#define DBG_DEFAULT_CHANNEL(ch)
#define PARTITION_ENTRY_UNUSED
#define PARTITION_EXTENDED
#define PARTITION_XINT13_EXTENDED
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
enum _PARTITION_STYLE PARTITION_STYLE
PARTITION_TABLE_ENTRY PartitionTable[4]
ULONG SectorCountBeforePartition
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ ULONG _In_ ULONG PartitionNumber