17#define XBOX_SIGNATURE_SECTOR 3
18#define XBOX_SIGNATURE ('B' | ('R' << 8) | ('F' << 16) | ('R' << 24))
19#define PARTITION_SIGNATURE 0xaa55
43#define XBOX_PARTITION_COUNT (sizeof(XboxPartitions) / sizeof(XboxPartitions[0]))
59 DPRINT(
"HalpXboxReadSector(%p %lu 0x%08x%08x %p)\n",
93 DPRINT(
"Reading sector failed (Status 0x%08lx)\n",
Status);
110 DPRINT(
"HalpXboxDeviceHasXboxPartitioning(%p %lu %p)\n",
113 HasXboxPartitioning);
129 if (HasMBRPartitioning)
131 *HasXboxPartitioning =
FALSE;
142 DPRINT(
"Signature 0x%02x 0x%02x 0x%02x 0x%02x\n",
143 *((
UCHAR *) SectorData), *((
UCHAR *) SectorData + 1), *((
UCHAR *) SectorData + 2), *((
UCHAR *) SectorData + 3));
149 DPRINT(
"%s partitioning found\n", *HasXboxPartitioning ?
"Xbox" :
"MBR");
164 DPRINT(
"HalpXboxExamineMBR(%p %lu %lx %p)\n",
178 if (!HasXboxPartitioning)
180 DPRINT(
"Delegating to standard MBR code\n");
200 DPRINT(
"HalpXboxIoReadPartitionTable(%p %lu %x %p)\n",
212 if (!HasXboxPartitioning)
214 DPRINT(
"Delegating to standard MBR code\n");
232 PartInfo = (*PartitionBuffer)->PartitionEntry + Part;
243 DPRINT(
" %ld: nr: %d boot: %1x type: %x start: 0x%I64x count: 0x%I64x rec: %d\n",
265 DPRINT(
"HalpXboxIoSetPartitionInformation(%p %lu %lu %lu)\n",
277 if (!HasXboxPartitioning)
279 DPRINT(
"Delegating to standard MBR code\n");
285 DPRINT1(
"Xbox partitions are fixed, can't change them\n");
299 DPRINT(
"HalpXboxIoWritePartitionTable(%p %lu %lu %lu %p)\n",
312 if (!HasXboxPartitioning)
314 DPRINT(
"Delegating to standard MBR code\n");
321 DPRINT1(
"Xbox partitions are fixed, can't change them\n");
325#define HalExamineMBR HALDISPATCH->HalExamineMBR
326#define HalIoReadPartitionTable HALDISPATCH->HalIoReadPartitionTable
327#define HalIoSetPartitionInformation HALDISPATCH->HalIoSetPartitionInformation
328#define HalIoWritePartitionTable HALDISPATCH->HalIoWritePartitionTable
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define ExFreePoolWithTag(_P, _T)
struct _DRIVE_LAYOUT_INFORMATION * PDRIVE_LAYOUT_INFORMATION
struct _PARTITION_INFORMATION PARTITION_INFORMATION
_In_ ULONG _In_ ULONG Offset
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
#define XBOX_SIGNATURE_SECTOR
void HalpXboxInitPartIo(void)
static pHalIoWritePartitionTable NtoskrnlIoWritePartitionTable
static NTSTATUS HalpXboxReadSector(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN PLARGE_INTEGER SectorOffset, OUT PVOID Sector)
static NTSTATUS FASTCALL HalpXboxDeviceHasXboxPartitioning(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, OUT BOOLEAN *HasXboxPartitioning)
static NTSTATUS FASTCALL HalpXboxIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN BOOLEAN ReturnRecognizedPartitions, OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
#define XBOX_PARTITION_COUNT
static VOID FASTCALL HalpXboxExamineMBR(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG MBRTypeIdentifier, OUT PVOID *Buffer)
static struct @1543 XboxPartitions[]
#define HalIoWritePartitionTable
static NTSTATUS FASTCALL HalpXboxIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType)
#define HalIoSetPartitionInformation
#define HalIoReadPartitionTable
static NTSTATUS FASTCALL HalpXboxIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG SectorsPerTrack, IN ULONG NumberOfHeads, IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
#define PARTITION_SIGNATURE
static pHalExamineMBR NtoskrnlExamineMBR
static pHalIoReadPartitionTable NtoskrnlIoReadPartitionTable
static pHalIoSetPartitionInformation NtoskrnlIoSetPartitionInformation
#define STATUS_ACCESS_DENIED
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ ULONG _In_ ULONG MBRTypeIdentifier
NTSTATUS(FASTCALL * pHalIoSetPartitionInformation)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ ULONG PartitionNumber, _In_ ULONG PartitionType)
NTSTATUS(FASTCALL * pHalIoWritePartitionTable)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ ULONG SectorsPerTrack, _In_ ULONG NumberOfHeads, _In_ struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer)
NTSTATUS(FASTCALL * pHalIoReadPartitionTable)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ BOOLEAN ReturnRecognizedPartitions, _Out_ struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer)
VOID(FASTCALL * pHalExamineMBR)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ ULONG MBRTypeIdentifier, _Out_ PVOID *Buffer)
_In_ ULONG _In_ ULONG _In_ ULONG NumberOfHeads
_In_ ULONG _In_ BOOLEAN ReturnRecognizedPartitions
_In_ ULONG _In_ ULONG SectorsPerTrack
_In_ ULONG _In_ BOOLEAN _Out_ struct _DRIVE_LAYOUT_INFORMATION ** PartitionBuffer
_In_ ULONG _In_ ULONG PartitionNumber