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
void HalpXboxInitPartIo(void)
#define STATUS_INSUFFICIENT_RESOURCES
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 PARTITION_SIGNATURE
NTSTATUS(FASTCALL * pHalIoWritePartitionTable)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ ULONG SectorsPerTrack, _In_ ULONG NumberOfHeads, _In_ struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer)
static struct @1488 XboxPartitions[]
static VOID FASTCALL HalpXboxExamineMBR(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG MBRTypeIdentifier, OUT PVOID *Buffer)
#define XBOX_PARTITION_COUNT
_In_ ULONG _In_ ULONG _In_ ULONG NumberOfHeads
static NTSTATUS FASTCALL HalpXboxIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG SectorsPerTrack, IN ULONG NumberOfHeads, IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
_In_ ULONG _In_ ULONG PartitionNumber
struct _PARTITION_INFORMATION PARTITION_INFORMATION
static pHalIoSetPartitionInformation NtoskrnlIoSetPartitionInformation
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
#define HalIoReadPartitionTable
_In_ PDEVICE_OBJECT DeviceObject
#define HalIoSetPartitionInformation
NTSTATUS(FASTCALL * pHalIoReadPartitionTable)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ BOOLEAN ReturnRecognizedPartitions, _Out_ struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer)
_In_ ULONG _In_ ULONG SectorsPerTrack
NTSTATUS(FASTCALL * pHalIoSetPartitionInformation)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ ULONG PartitionNumber, _In_ ULONG PartitionType)
static NTSTATUS HalpXboxReadSector(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN PLARGE_INTEGER SectorOffset, OUT PVOID Sector)
_In_ PVOID _In_ ULONG Event
_In_ ULONG _In_ BOOLEAN _Out_ struct _DRIVE_LAYOUT_INFORMATION ** PartitionBuffer
#define HalIoWritePartitionTable
#define XBOX_SIGNATURE_SECTOR
#define NT_SUCCESS(StatCode)
#define STATUS_ACCESS_DENIED
static pHalExamineMBR NtoskrnlExamineMBR
#define ExAllocatePoolWithTag(hernya, size, tag)
_In_ ULONG _In_ BOOLEAN ReturnRecognizedPartitions
VOID(FASTCALL * pHalExamineMBR)(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SectorSize, _In_ ULONG MBRTypeIdentifier, _Out_ PVOID *Buffer)
static NTSTATUS FASTCALL HalpXboxIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType)
static const WCHAR Cleanup[]
_In_ ULONG _In_ ULONG Offset
static pHalIoWritePartitionTable NtoskrnlIoWritePartitionTable
#define KeInitializeEvent(pEvt, foo, foo2)
_In_ ULONG _In_ ULONG MBRTypeIdentifier
struct _DRIVE_LAYOUT_INFORMATION * PDRIVE_LAYOUT_INFORMATION
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
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 ExFreePoolWithTag(_P, _T)
static pHalIoReadPartitionTable NtoskrnlIoReadPartitionTable