Add back support for function pointers override in HalDispatchTable structure

Fixes detection of Xbox disk partitioning

svn path=/trunk/; revision=31211
This commit is contained in:
Hervé Poussineau 2007-12-14 11:32:18 +00:00
parent 5a3101d17b
commit 03629687b8
3 changed files with 136 additions and 43 deletions

View file

@ -395,7 +395,8 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
return(Status); return(Status);
} }
VOID FASTCALL VOID
FASTCALL
xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock, xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PSTRING NtDeviceName, IN PSTRING NtDeviceName,
OUT PUCHAR NtSystemPath, OUT PUCHAR NtSystemPath,
@ -1205,17 +1206,12 @@ Cleanup:
return; return;
} }
/* PUBLIC FUNCTIONS **********************************************************/
/*
* @implemented
*/
VOID VOID
FASTCALL FASTCALL
HalExamineMBR(IN PDEVICE_OBJECT DeviceObject, xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize, IN ULONG SectorSize,
IN ULONG MbrTypeIdentifier, IN ULONG MbrTypeIdentifier,
OUT PVOID *MbrBuffer) OUT PVOID *MbrBuffer)
{ {
LARGE_INTEGER Offset; LARGE_INTEGER Offset;
PUCHAR Buffer; PUCHAR Buffer;
@ -1316,15 +1312,12 @@ HalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
} }
} }
/*
* @implemented
*/
NTSTATUS NTSTATUS
FASTCALL FASTCALL
IoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize, IN ULONG SectorSize,
IN BOOLEAN ReturnRecognizedPartitions, IN BOOLEAN ReturnRecognizedPartitions,
IN OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer) IN OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
{ {
KEVENT Event; KEVENT Event;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
@ -1746,15 +1739,12 @@ IoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
return Status; return Status;
} }
/*
* @implemented
*/
NTSTATUS NTSTATUS
FASTCALL FASTCALL
IoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize, IN ULONG SectorSize,
IN ULONG PartitionNumber, IN ULONG PartitionNumber,
IN ULONG PartitionType) IN ULONG PartitionType)
{ {
PIRP Irp; PIRP Irp;
KEVENT Event; KEVENT Event;
@ -1937,16 +1927,13 @@ IoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
return Status; return Status;
} }
/*
* @implemented
*/
NTSTATUS NTSTATUS
FASTCALL FASTCALL
IoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize, IN ULONG SectorSize,
IN ULONG SectorsPerTrack, IN ULONG SectorsPerTrack,
IN ULONG NumberOfHeads, IN ULONG NumberOfHeads,
IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer) IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
{ {
KEVENT Event; KEVENT Event;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
@ -2229,6 +2216,74 @@ IoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
return Status; return Status;
} }
/* PUBLIC FUNCTIONS **********************************************************/
/*
* @implemented
*/
VOID
FASTCALL
HalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG MbrTypeIdentifier,
OUT PVOID *MbrBuffer)
{
HalDispatchTable.HalExamineMBR(DeviceObject,
SectorSize,
MbrTypeIdentifier,
MbrBuffer);
}
/*
* @implemented
*/
NTSTATUS
FASTCALL
IoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN BOOLEAN ReturnRecognizedPartitions,
IN OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
{
return HalIoReadPartitionTable(DeviceObject,
SectorSize,
ReturnRecognizedPartitions,
PartitionBuffer);
}
/*
* @implemented
*/
NTSTATUS
FASTCALL
IoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG PartitionNumber,
IN ULONG PartitionType)
{
return HalIoSetPartitionInformation(DeviceObject,
SectorSize,
PartitionNumber,
PartitionType);
}
/*
* @implemented
*/
NTSTATUS
FASTCALL
IoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG SectorsPerTrack,
IN ULONG NumberOfHeads,
IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
{
return HalIoWritePartitionTable(DeviceObject,
SectorSize,
SectorsPerTrack,
NumberOfHeads,
PartitionBuffer);
}
/* /*
* @implemented * @implemented
*/ */
@ -2239,11 +2294,10 @@ IoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
OUT PUCHAR NtSystemPath, OUT PUCHAR NtSystemPath,
OUT PSTRING NtSystemPathString) OUT PSTRING NtSystemPathString)
{ {
/* Call our deprecated function for now */ HalIoAssignDriveLetters(LoaderBlock,
xHalIoAssignDriveLetters(LoaderBlock, NtDeviceName,
NtDeviceName, NtSystemPath,
NtSystemPath, NtSystemPathString);
NtSystemPathString); }
}
/* EOF */ /* EOF */

View file

@ -21,11 +21,11 @@ HAL_DISPATCH HalDispatchTable =
(pHalSetSystemInformation)NULL, (pHalSetSystemInformation)NULL,
(pHalQueryBusSlots)NULL, (pHalQueryBusSlots)NULL,
0, 0,
(pHalExamineMBR)HalExamineMBR, xHalExamineMBR,
(pHalIoAssignDriveLetters)IoAssignDriveLetters, xHalIoAssignDriveLetters,
(pHalIoReadPartitionTable)IoReadPartitionTable, xHalIoReadPartitionTable,
(pHalIoSetPartitionInformation)IoSetPartitionInformation, xHalIoSetPartitionInformation,
(pHalIoWritePartitionTable)IoWritePartitionTable, xHalIoWritePartitionTable,
(pHalHandlerForBus)NULL, (pHalHandlerForBus)NULL,
(pHalReferenceBusHandler)NULL, (pHalReferenceBusHandler)NULL,
(pHalReferenceBusHandler)NULL, (pHalReferenceBusHandler)NULL,

View file

@ -8,6 +8,45 @@
#ifndef _HAL_ #ifndef _HAL_
#define _HAL_ #define _HAL_
//
// Default implementations of HAL dispatch table
//
VOID
FASTCALL
xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG MbrTypeIdentifier,
OUT PVOID *MbrBuffer);
VOID
FASTCALL
xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PSTRING NtDeviceName,
OUT PUCHAR NtSystemPath,
OUT PSTRING NtSystemPathString);
NTSTATUS
FASTCALL
xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN BOOLEAN ReturnRecognizedPartitions,
IN OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer);
NTSTATUS
FASTCALL
xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG PartitionNumber,
IN ULONG PartitionType);
NTSTATUS
FASTCALL
xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG SectorsPerTrack,
IN ULONG NumberOfHeads,
IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer);
// //
// Various offsets in the boot record // Various offsets in the boot record
// //