mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed wrong MBR declaration.
svn path=/trunk/; revision=4219
This commit is contained in:
parent
95cee3fcfb
commit
87364d1ef4
1 changed files with 17 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: xhaldrv.c,v 1.26 2003/02/26 14:12:43 ekohl Exp $
|
/* $Id: xhaldrv.c,v 1.27 2003/03/01 00:00:32 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -50,9 +50,7 @@ typedef struct _PARTITION_TABLE
|
||||||
|
|
||||||
typedef struct _MBR
|
typedef struct _MBR
|
||||||
{
|
{
|
||||||
UCHAR MbrBootCode[442]; /* 0x000 */
|
UCHAR MbrBootCode[446]; /* 0x000 */
|
||||||
ULONG Signature; /* 0x1B8 */
|
|
||||||
USHORT Unused; /* 0x1BC */
|
|
||||||
PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
|
PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
|
||||||
USHORT Magic; /* 0x1FE */
|
USHORT Magic; /* 0x1FE */
|
||||||
} PACKED MBR, *PMBR;
|
} PACKED MBR, *PMBR;
|
||||||
|
@ -178,6 +176,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
IO_STATUS_BLOCK StatusBlock;
|
IO_STATUS_BLOCK StatusBlock;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
|
PUCHAR Sector;
|
||||||
PULONG Shift;
|
PULONG Shift;
|
||||||
PMBR Mbr;
|
PMBR Mbr;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
|
@ -191,9 +190,9 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
if (SectorSize > 4096)
|
if (SectorSize > 4096)
|
||||||
SectorSize = 4096;
|
SectorSize = 4096;
|
||||||
|
|
||||||
Mbr = (PMBR)ExAllocatePool(PagedPool,
|
Sector = (PUCHAR)ExAllocatePool(PagedPool,
|
||||||
SectorSize);
|
SectorSize);
|
||||||
if (Mbr == NULL)
|
if (Sector == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KeInitializeEvent(&Event,
|
KeInitializeEvent(&Event,
|
||||||
|
@ -204,7 +203,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
Offset.QuadPart = 0;
|
Offset.QuadPart = 0;
|
||||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
Mbr,
|
Sector,
|
||||||
SectorSize,
|
SectorSize,
|
||||||
&Offset,
|
&Offset,
|
||||||
&Event,
|
&Event,
|
||||||
|
@ -224,34 +223,37 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("xHalExamineMBR failed (Status = 0x%08lx)\n",
|
DPRINT1("Reading MBR failed (Status 0x%08lx)\n",
|
||||||
Status);
|
Status);
|
||||||
ExFreePool(Mbr);
|
ExFreePool(Sector);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mbr = (PMBR)Sector;
|
||||||
|
|
||||||
if (Mbr->Magic != PARTITION_MAGIC)
|
if (Mbr->Magic != PARTITION_MAGIC)
|
||||||
{
|
{
|
||||||
DPRINT("xHalExamineMBR: invalid MBR magic value\n");
|
DPRINT1("Invalid MBR magic value\n");
|
||||||
ExFreePool(Mbr);
|
ExFreePool(Sector);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mbr->Partition[0].PartitionType != MBRTypeIdentifier)
|
if (Mbr->Partition[0].PartitionType != MBRTypeIdentifier)
|
||||||
{
|
{
|
||||||
DPRINT("xHalExamineMBR: invalid MBRTypeIdentifier\n");
|
DPRINT1("Invalid MBRTypeIdentifier\n");
|
||||||
ExFreePool(Mbr);
|
ExFreePool(Sector);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mbr->Partition[0].PartitionType == 0x54)
|
if (Mbr->Partition[0].PartitionType == 0x54)
|
||||||
{
|
{
|
||||||
/* Found 'Ontrack Disk Manager'. Shift all sectors by 63 */
|
/* Found 'Ontrack Disk Manager'. Shift all sectors by 63 */
|
||||||
|
DPRINT1("Found 'Ontrack Disk Manager'!\n");
|
||||||
Shift = (PULONG)Mbr;
|
Shift = (PULONG)Mbr;
|
||||||
*Shift = 63;
|
*Shift = 63;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Buffer = (PVOID)Mbr;
|
*Buffer = (PVOID)Sector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue