Fixed some hal dispatch table issues.

Improved HalExamineMBR() to detect disk managers.

svn path=/trunk/; revision=4200
This commit is contained in:
Eric Kohl 2003-02-26 14:14:47 +00:00
parent 991196c35e
commit 64e0e82479
12 changed files with 214 additions and 131 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.6 2002/10/02 19:32:57 ekohl Exp $ # $Id: Makefile,v 1.7 2003/02/26 14:14:03 ekohl Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
@ -50,7 +50,6 @@ HAL_OBJECTS = \
halinit.o \ halinit.o \
isa.o \ isa.o \
kdbg.o \ kdbg.o \
mbr.o \
mca.o \ mca.o \
misc.o \ misc.o \
mp.o \ mp.o \

View file

@ -1,4 +1,4 @@
/* $Id: bus.c,v 1.5 2002/12/09 19:44:44 hbirr Exp $ /* $Id: bus.c,v 1.6 2003/02/26 14:14:03 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -16,7 +16,7 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/pool.h> #include <hal.h>
#include <bus.h> #include <bus.h>
#define NDEBUG #define NDEBUG
@ -40,6 +40,7 @@ HalpNoAdjustResourceList(PBUS_HANDLER BusHandler,
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
static NTSTATUS STDCALL static NTSTATUS STDCALL
HalpNoAssignSlotResources(PBUS_HANDLER BusHandler, HalpNoAssignSlotResources(PBUS_HANDLER BusHandler,
ULONG BusNumber, ULONG BusNumber,
@ -53,6 +54,7 @@ HalpNoAssignSlotResources(PBUS_HANDLER BusHandler,
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
static ULONG STDCALL static ULONG STDCALL
HalpNoBusData(PBUS_HANDLER BusHandler, HalpNoBusData(PBUS_HANDLER BusHandler,
ULONG BusNumber, ULONG BusNumber,
@ -64,6 +66,7 @@ HalpNoBusData(PBUS_HANDLER BusHandler,
return 0; return 0;
} }
static ULONG STDCALL static ULONG STDCALL
HalpNoGetInterruptVector(PBUS_HANDLER BusHandler, HalpNoGetInterruptVector(PBUS_HANDLER BusHandler,
ULONG BusNumber, ULONG BusNumber,
@ -75,6 +78,7 @@ HalpNoGetInterruptVector(PBUS_HANDLER BusHandler,
return 0; return 0;
} }
static ULONG STDCALL static ULONG STDCALL
HalpNoTranslateBusAddress(PBUS_HANDLER BusHandler, HalpNoTranslateBusAddress(PBUS_HANDLER BusHandler,
ULONG BusNumber, ULONG BusNumber,
@ -130,58 +134,59 @@ HalpAllocateBusHandler(INTERFACE_TYPE InterfaceType,
VOID VOID
HalpInitBusHandlers(VOID) HalpInitBusHandlers(VOID)
{ {
PBUS_HANDLER BusHandler; PBUS_HANDLER BusHandler;
/* general preparations */ /* General preparations */
KeInitializeSpinLock(&HalpBusHandlerSpinLock); KeInitializeSpinLock(&HalpBusHandlerSpinLock);
InitializeListHead(&HalpBusHandlerList); InitializeListHead(&HalpBusHandlerList);
/* Initialize hal dispatch tables */
HalQuerySystemInformation = HalpQuerySystemInformation;
/* initialize hal dispatch tables */
#if 0 #if 0
HalSetSystemInformation = HalpSetSystemInformation;
HalQueryBusSlots = HalpQueryBusSlots;
HalDispatchTable->HalQueryBusSlots = HaliQueryBusSlots;
#endif #endif
/* add system bus handler */ /* Add system bus handler */
BusHandler = HalpAllocateBusHandler(Internal, BusHandler = HalpAllocateBusHandler(Internal,
ConfigurationSpaceUndefined, ConfigurationSpaceUndefined,
0); 0);
if (BusHandler == NULL) if (BusHandler == NULL)
return; return;
BusHandler->GetInterruptVector = BusHandler->GetInterruptVector =
(pGetInterruptVector)HalpGetSystemInterruptVector; (pGetInterruptVector)HalpGetSystemInterruptVector;
BusHandler->TranslateBusAddress = BusHandler->TranslateBusAddress =
(pTranslateBusAddress)HalpTranslateSystemBusAddress; (pTranslateBusAddress)HalpTranslateSystemBusAddress;
/* add cmos bus handler */ /* Add cmos bus handler */
BusHandler = HalpAllocateBusHandler(InterfaceTypeUndefined, BusHandler = HalpAllocateBusHandler(InterfaceTypeUndefined,
Cmos, Cmos,
0); 0);
if (BusHandler == NULL) if (BusHandler == NULL)
return; return;
BusHandler->GetBusData = (pGetSetBusData)HalpGetCmosData; BusHandler->GetBusData = (pGetSetBusData)HalpGetCmosData;
BusHandler->SetBusData = (pGetSetBusData)HalpSetCmosData; BusHandler->SetBusData = (pGetSetBusData)HalpSetCmosData;
/* add isa bus handler */ /* Add isa bus handler */
BusHandler = HalpAllocateBusHandler(Isa, BusHandler = HalpAllocateBusHandler(Isa,
ConfigurationSpaceUndefined, ConfigurationSpaceUndefined,
0); 0);
if (BusHandler == NULL) if (BusHandler == NULL)
return; return;
BusHandler->GetInterruptVector = BusHandler->GetInterruptVector =
(pGetInterruptVector)HalpGetIsaInterruptVector; (pGetInterruptVector)HalpGetIsaInterruptVector;
BusHandler->TranslateBusAddress = BusHandler->TranslateBusAddress =
(pTranslateBusAddress)HalpTranslateIsaBusAddress; (pTranslateBusAddress)HalpTranslateIsaBusAddress;
/* Add MicroChannel bus handler */
/* add MicroChannel bus handler */
BusHandler = HalpAllocateBusHandler(MicroChannel, BusHandler = HalpAllocateBusHandler(MicroChannel,
Pos, Pos,
0); 0);
if (BusHandler == NULL) if (BusHandler == NULL)
return; return;
BusHandler->GetBusData = (pGetSetBusData)HalpGetMicroChannelData; BusHandler->GetBusData = (pGetSetBusData)HalpGetMicroChannelData;
} }

View file

@ -1,4 +1,4 @@
/* $Id: drive.c,v 1.3 2002/09/08 10:22:24 chorns Exp $ /* $Id: drive.c,v 1.4 2003/02/26 14:14:03 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -22,10 +22,10 @@ IoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
OUT PUCHAR NtSystemPath, OUT PUCHAR NtSystemPath,
OUT PSTRING NtSystemPathString) OUT PSTRING NtSystemPathString)
{ {
HalDispatchTable.HalIoAssignDriveLetters(LoaderBlock, HalIoAssignDriveLetters(LoaderBlock,
NtDeviceName, NtDeviceName,
NtSystemPath, NtSystemPath,
NtSystemPathString); NtSystemPathString);
} }
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: halinit.c,v 1.3 2002/09/08 10:22:24 chorns Exp $ /* $Id: halinit.c,v 1.4 2003/02/26 14:14:03 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -14,7 +14,6 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <roscfg.h> #include <roscfg.h>
#include <hal.h> #include <hal.h>
#include <internal/ntoskrnl.h>
#ifdef MP #ifdef MP
#include <mps.h> #include <mps.h>
@ -58,8 +57,8 @@ HalInitSystem (ULONG BootPhase,
} }
else if (BootPhase == 1) else if (BootPhase == 1)
{ {
HalpInitBusHandlers (); HalpInitBusHandlers();
HalpCalibrateStallExecution (); HalpCalibrateStallExecution();
/* Enumerate the devices on the motherboard */ /* Enumerate the devices on the motherboard */
HalpStartEnumerator(); HalpStartEnumerator();

View file

@ -45,4 +45,12 @@ struct _ADAPTER_OBJECT {
BOOLEAN Inuse; BOOLEAN Inuse;
}; };
/* sysinfo.c */
NTSTATUS STDCALL
HalpQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass,
IN ULONG BufferSize,
IN OUT PVOID Buffer,
OUT PULONG ReturnedLength);
#endif /* __INTERNAL_HAL_HAL_H */ #endif /* __INTERNAL_HAL_HAL_H */

View file

@ -1,25 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/hal/x86/mbr.c
* PURPOSE: Functions for reading the master boot record (MBR)
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* Created 22/05/98
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
VOID HalExamineMBR(PDEVICE_OBJECT DeviceObject,
ULONG SectorSize,
ULONG MBRTypeIdentifier,
PVOID Buffer)
{
UNIMPLEMENTED;
}

View file

@ -11,13 +11,66 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <hal.h>
#include <bus.h>
#define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
VOID HalQuerySystemInformation() /* FUNCTIONS ****************************************************************/
NTSTATUS STDCALL
HalpQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass,
IN ULONG BufferSize,
IN OUT PVOID Buffer,
OUT PULONG ReturnedLength)
{
ULONG DataLength;
NTSTATUS Status;
DPRINT1("HalpQuerySystemInformation() called\n");
*ReturnedLength = 0;
DataLength = 0;
switch(InformationClass)
{
#if 0
case HalInstalledBusInformation:
Status = HalpQueryBusInformation(BufferSize,
Buffer,
ReturnedLength);
break;
#endif
default:
DataLength = 0;
Status = STATUS_INVALID_LEVEL;
break;
}
if (DataLength != 0)
{
if (DataLength > BufferSize)
DataLength = BufferSize;
// RtlCopyMemory();
*ReturnedLength = DataLength;
}
return(Status);
}
#if 0
NTSTATUS
HalpSetSystemInformation(VOID)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
} }
#endif
/* EOF */

View file

@ -1,6 +1,6 @@
#ifndef __INCLUDE_DDK_HALFUNCS_H #ifndef __INCLUDE_DDK_HALFUNCS_H
#define __INCLUDE_DDK_HALFUNCS_H #define __INCLUDE_DDK_HALFUNCS_H
/* $Id: halfuncs.h,v 1.3 2002/09/08 10:47:44 chorns Exp $ */ /* $Id: halfuncs.h,v 1.4 2003/02/26 14:11:41 ekohl Exp $ */
VOID STDCALL VOID STDCALL
HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters); HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters);
@ -70,12 +70,16 @@ HalEndSystemInterrupt(KIRQL Irql,
ULONG Unknown2); ULONG Unknown2);
/* Is this function really exported ?? */ /*
VOID * HalExamineMBR() is not exported explicitly.
HalExamineMBR(PDEVICE_OBJECT DeviceObject, * It is exported by the HalDispatchTable.
ULONG SectorSize, *
ULONG MBRTypeIdentifier, * VOID
PVOID Buffer); * HalExamineMBR(PDEVICE_OBJECT DeviceObject,
* ULONG SectorSize,
* ULONG MBRTypeIdentifier,
* PVOID Buffer);
*/
BOOLEAN STDCALL BOOLEAN STDCALL
HalFlushCommonBuffer(ULONG Unknown1, HalFlushCommonBuffer(ULONG Unknown1,
@ -150,9 +154,13 @@ HalQueryDisplayParameters(PULONG DispSizeX,
VOID STDCALL VOID STDCALL
HalQueryRealTimeClock(PTIME_FIELDS Time); HalQueryRealTimeClock(PTIME_FIELDS Time);
/* Is this function really exported ?? */ /*
VOID * HalQuerySystemInformation() is not exported explicitly.
HalQuerySystemInformation(VOID); * It is exported by the HalDispatchTable.
*
* VOID
* HalQuerySystemInformation(VOID);
*/
ULONG STDCALL ULONG STDCALL
HalReadDmaCounter(PADAPTER_OBJECT AdapterObject); HalReadDmaCounter(PADAPTER_OBJECT AdapterObject);

View file

@ -1,4 +1,4 @@
/* $Id: haltypes.h,v 1.8 2002/11/24 18:26:40 robd Exp $ /* $Id: haltypes.h,v 1.9 2003/02/26 14:11:41 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -430,14 +430,29 @@ typedef struct _HAL_DISPATCH
pHalReferenceBusHandler HalDereferenceBusHandler; pHalReferenceBusHandler HalDereferenceBusHandler;
} HAL_DISPATCH, *PHAL_DISPATCH; } HAL_DISPATCH, *PHAL_DISPATCH;
#define HAL_DISPATCH_VERSION 1
#ifdef __NTOSKRNL__ #ifdef __NTOSKRNL__
extern HAL_DISPATCH EXPORTED HalDispatchTable; extern HAL_DISPATCH EXPORTED HalDispatchTable;
#define HALDISPATCH (&HalDispatchTable)
#else #else
extern HAL_DISPATCH IMPORTED HalDispatchTable; extern PHAL_DISPATCH IMPORTED HalDispatchTable;
#define HALDISPATCH ((PHAL_DISPATCH)&HalDispatchTable)
#endif #endif
#define HAL_DISPATCH_VERSION 1
#define HalDispatchTableVersion HALDISPATCH->Version
#define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation
#define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation
#define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots
#define HalDeviceControl HALDISPATCH->HalDeviceControl
#define HalExamineMBR HALDISPATCH->HalExamineMBR
#define HalIoAssignDriveLetters HALDISPATCH->HalIoAssignDriveLetters
#define HalIoReadPartitionTable HALDISPATCH->HalIoReadPartitionTable
#define HalIoSetPartitionInformation HALDISPATCH->HalIoSetPartitionInformation
#define HalIoWritePartitionTable HALDISPATCH->HalIoWritePartitionTable
#define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus
#define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler
#define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler
/* Hal private dispatch table */ /* Hal private dispatch table */
@ -446,15 +461,15 @@ typedef struct _HAL_PRIVATE_DISPATCH
ULONG Version; ULONG Version;
} HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH; } HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH;
#define HAL_PRIVATE_DISPATCH_VERSION 1
#ifdef __NTOSKRNL__ #ifdef __NTOSKRNL__
extern HAL_PRIVATE_DISPATCH EXPORTED HalPrivateDispatchTable; extern HAL_PRIVATE_DISPATCH EXPORTED HalPrivateDispatchTable;
#else #else
extern HAL_PRIVATE_DISPATCH IMPORTED HalPrivateDispatchTable; extern PHAL_PRIVATE_DISPATCH IMPORTED HalPrivateDispatchTable;
#endif #endif
#define HAL_PRIVATE_DISPATCH_VERSION 1
/* /*

View file

@ -1,4 +1,4 @@
/* $Id: parttab.c,v 1.3 2002/09/08 10:23:25 chorns Exp $ /* $Id: parttab.c,v 1.4 2003/02/26 14:12:43 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -25,10 +25,10 @@ IoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
BOOLEAN ReturnRecognizedPartitions, BOOLEAN ReturnRecognizedPartitions,
PDRIVE_LAYOUT_INFORMATION *PartitionBuffer) PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
{ {
return HalDispatchTable.HalIoReadPartitionTable(DeviceObject, return(HalIoReadPartitionTable(DeviceObject,
SectorSize, SectorSize,
ReturnRecognizedPartitions, ReturnRecognizedPartitions,
PartitionBuffer); PartitionBuffer));
} }
@ -38,10 +38,10 @@ IoSetPartitionInformation(PDEVICE_OBJECT DeviceObject,
ULONG PartitionNumber, ULONG PartitionNumber,
ULONG PartitionType) ULONG PartitionType)
{ {
return HalDispatchTable.HalIoSetPartitionInformation(DeviceObject, return(HalIoSetPartitionInformation(DeviceObject,
SectorSize, SectorSize,
PartitionNumber, PartitionNumber,
PartitionType); PartitionType));
} }
@ -52,11 +52,11 @@ IoWritePartitionTable(PDEVICE_OBJECT DeviceObject,
ULONG NumberOfHeads, ULONG NumberOfHeads,
PDRIVE_LAYOUT_INFORMATION PartitionBuffer) PDRIVE_LAYOUT_INFORMATION PartitionBuffer)
{ {
return HalDispatchTable.HalIoWritePartitionTable(DeviceObject, return(HalIoWritePartitionTable(DeviceObject,
SectorSize, SectorSize,
SectorsPerTrack, SectorsPerTrack,
NumberOfHeads, NumberOfHeads,
PartitionBuffer); PartitionBuffer));
} }
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: xhaldisp.c,v 1.7 2002/09/08 10:23:26 chorns Exp $ /* $Id: xhaldisp.c,v 1.8 2003/02/26 14:12:43 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -42,8 +42,11 @@ HAL_PRIVATE_DISPATCH EXPORTED HalPrivateDispatchTable =
// HalHandlerForConfigSpace // HalHandlerForConfigSpace
// HalCompleteDeviceControl // HalCompleteDeviceControl
// HalRegisterBusHandler // HalRegisterBusHandler
// any more?? // ??
// ??
// ??
// ??
// ??
}; };
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: xhaldrv.c,v 1.25 2002/09/08 10:23:26 chorns Exp $ /* $Id: xhaldrv.c,v 1.26 2003/02/26 14:12:43 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -40,13 +40,23 @@ typedef struct _PARTITION
unsigned char EndingCylinder; unsigned char EndingCylinder;
unsigned int StartingBlock; unsigned int StartingBlock;
unsigned int SectorCount; unsigned int SectorCount;
} PARTITION, *PPARTITION; } PACKED PARTITION, *PPARTITION;
typedef struct _PARTITION_TABLE typedef struct _PARTITION_TABLE
{ {
PARTITION Partition[PARTITION_TBL_SIZE]; PARTITION Partition[PARTITION_TBL_SIZE];
unsigned short Magic; unsigned short Magic;
} PARTITION_TABLE, *PPARTITION_TABLE; } PACKED PARTITION_TABLE, *PPARTITION_TABLE;
typedef struct _MBR
{
UCHAR MbrBootCode[442]; /* 0x000 */
ULONG Signature; /* 0x1B8 */
USHORT Unused; /* 0x1BC */
PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
USHORT Magic; /* 0x1FE */
} PACKED MBR, *PMBR;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -168,11 +178,12 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
KEVENT Event; KEVENT Event;
IO_STATUS_BLOCK StatusBlock; IO_STATUS_BLOCK StatusBlock;
LARGE_INTEGER Offset; LARGE_INTEGER Offset;
PUCHAR LocalBuffer; PULONG Shift;
PMBR Mbr;
PIRP Irp; PIRP Irp;
NTSTATUS Status; NTSTATUS Status;
DPRINT("xHalExamineMBR()\n"); DPRINT1("xHalExamineMBR()\n");
*Buffer = NULL; *Buffer = NULL;
if (SectorSize < 512) if (SectorSize < 512)
@ -180,20 +191,20 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
if (SectorSize > 4096) if (SectorSize > 4096)
SectorSize = 4096; SectorSize = 4096;
LocalBuffer = (PUCHAR)ExAllocatePool(PagedPool, Mbr = (PMBR)ExAllocatePool(PagedPool,
SectorSize); SectorSize);
if (LocalBuffer == NULL) if (Mbr == NULL)
return; return;
KeInitializeEvent(&Event, KeInitializeEvent(&Event,
NotificationEvent, NotificationEvent,
FALSE); FALSE);
/* Read MBR (Master Boot Record) */
Offset.QuadPart = 0; Offset.QuadPart = 0;
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ, Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
DeviceObject, DeviceObject,
LocalBuffer, Mbr,
SectorSize, SectorSize,
&Offset, &Offset,
&Event, &Event,
@ -215,25 +226,32 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
{ {
DPRINT("xHalExamineMBR failed (Status = 0x%08lx)\n", DPRINT("xHalExamineMBR failed (Status = 0x%08lx)\n",
Status); Status);
ExFreePool(LocalBuffer); ExFreePool(Mbr);
return; return;
} }
if (LocalBuffer[0x1FE] != 0x55 || LocalBuffer[0x1FF] != 0xAA) if (Mbr->Magic != PARTITION_MAGIC)
{ {
DPRINT("xHalExamineMBR: invalid MBR signature\n"); DPRINT("xHalExamineMBR: invalid MBR magic value\n");
ExFreePool(LocalBuffer); ExFreePool(Mbr);
return; return;
} }
if (LocalBuffer[0x1C2] != MBRTypeIdentifier) if (Mbr->Partition[0].PartitionType != MBRTypeIdentifier)
{ {
DPRINT("xHalExamineMBR: invalid MBRTypeIdentifier\n"); DPRINT("xHalExamineMBR: invalid MBRTypeIdentifier\n");
ExFreePool(LocalBuffer); ExFreePool(Mbr);
return; return;
} }
*Buffer = (PVOID)LocalBuffer; if (Mbr->Partition[0].PartitionType == 0x54)
{
/* Found 'Ontrack Disk Manager'. Shift all sectors by 63 */
Shift = (PULONG)Mbr;
*Shift = 63;
}
*Buffer = (PVOID)Mbr;
} }