mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[FSTUB] Fix bugs from 8d2fe54188
The buffer is now PUCHAR or PVOID everywhere
This commit is contained in:
parent
8d2fe54188
commit
29615feeb6
3 changed files with 17 additions and 18 deletions
|
@ -1704,7 +1704,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
|||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Validate the MBR Signature */
|
||||
if (((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
if (*(PUINT16)&Buffer[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
{
|
||||
/* Failed */
|
||||
ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
|
||||
|
@ -1885,7 +1885,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
if (IsEzDrive && (Offset.QuadPart == 512)) Offset.QuadPart = 0;
|
||||
|
||||
/* Make sure this is a valid MBR */
|
||||
if (((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
if (*(PUINT16)&Buffer[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
{
|
||||
/* It's not, fail */
|
||||
DPRINT1("FSTUB: (IoReadPartitionTable) No 0xaa55 found in "
|
||||
|
@ -2279,7 +2279,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
if (IsEzDrive && (Offset.QuadPart == 512)) Offset.QuadPart = 0;
|
||||
|
||||
/* Make sure this is a valid MBR */
|
||||
if (((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
if (*(PUINT16)&Buffer[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
{
|
||||
/* It's not, fail */
|
||||
Status = STATUS_BAD_MASTER_BOOT_RECORD;
|
||||
|
@ -2395,7 +2395,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
PIRP Irp;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
ULONG BufferSize;
|
||||
PUSHORT Buffer;
|
||||
PUCHAR Buffer;
|
||||
PPTE Entry;
|
||||
PPARTITION_TABLE PartitionTable;
|
||||
LARGE_INTEGER Offset, NextOffset, ExtendedOffset, SectorOffset;
|
||||
|
@ -2515,7 +2515,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
if (!IsSuperFloppy)
|
||||
{
|
||||
/* Set the boot record signature */
|
||||
((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] = BOOT_RECORD_SIGNATURE;
|
||||
*(PUINT16)&Buffer[BOOT_SIGNATURE_OFFSET] = BOOT_RECORD_SIGNATURE;
|
||||
|
||||
/* By default, don't require a rewrite */
|
||||
DoRewrite = FALSE;
|
||||
|
@ -2524,10 +2524,10 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
if (!Offset.QuadPart)
|
||||
{
|
||||
/* Check if the signature doesn't match */
|
||||
if (*(PUINT32)&Buffer[PARTITION_TABLE_OFFSET] != PartitionBuffer->Signature)
|
||||
if (*(PUINT32)&Buffer[DISK_SIGNATURE_OFFSET] != PartitionBuffer->Signature)
|
||||
{
|
||||
/* Then write the signature and now we need a rewrite */
|
||||
*(PUINT32)&Buffer[PARTITION_TABLE_OFFSET] = PartitionBuffer->Signature;
|
||||
*(PUINT32)&Buffer[DISK_SIGNATURE_OFFSET] = PartitionBuffer->Signature;
|
||||
DoRewrite = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef struct _DISK_INFORMATION
|
|||
PDEVICE_OBJECT DeviceObject;
|
||||
ULONG SectorSize;
|
||||
DISK_GEOMETRY_EX DiskGeometry;
|
||||
PUSHORT Buffer;
|
||||
PUCHAR Buffer;
|
||||
ULONGLONG SectorCount;
|
||||
} DISK_INFORMATION, *PDISK_INFORMATION;
|
||||
|
||||
|
@ -122,7 +122,7 @@ NTAPI
|
|||
FstubReadSector(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG SectorSize,
|
||||
IN ULONGLONG StartingSector OPTIONAL,
|
||||
OUT PUSHORT Buffer
|
||||
OUT PVOID Buffer
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
|
@ -158,7 +158,7 @@ NTAPI
|
|||
FstubWriteSector(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG SectorSize,
|
||||
IN ULONGLONG StartingSector OPTIONAL,
|
||||
IN PUSHORT Buffer
|
||||
IN PVOID Buffer
|
||||
);
|
||||
|
||||
VOID
|
||||
|
@ -673,10 +673,9 @@ FstubDetectPartitionStyle(IN PDISK_INFORMATION Disk,
|
|||
}
|
||||
|
||||
/* Get the partition descriptor array */
|
||||
PartitionDescriptor = (PPARTITION_DESCRIPTOR)
|
||||
&(Disk->Buffer[PARTITION_TABLE_OFFSET / sizeof(Disk->Buffer[0])]);
|
||||
PartitionDescriptor = (PPARTITION_DESCRIPTOR)&Disk->Buffer[PARTITION_TABLE_OFFSET];
|
||||
/* If we have not the 0xAA55 then it's raw partition */
|
||||
if (Disk->Buffer[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
if (*(PUINT16)&Disk->Buffer[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
|
||||
{
|
||||
*PartitionStyle = PARTITION_STYLE_RAW;
|
||||
}
|
||||
|
@ -865,7 +864,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
|
|||
/* Then zero the one in EFI header. This is needed to compute header checksum */
|
||||
EFIHeader->HeaderCRC32 = 0;
|
||||
/* Compute header checksum and compare with the one present in partition table */
|
||||
if (RtlComputeCrc32(0, (PUCHAR)Disk->Buffer, sizeof(EFI_PARTITION_HEADER)) != HeaderCRC32)
|
||||
if (RtlComputeCrc32(0, Disk->Buffer, sizeof(EFI_PARTITION_HEADER)) != HeaderCRC32)
|
||||
{
|
||||
DPRINT("EFI::Not matching header checksum!\n");
|
||||
return STATUS_DISK_CORRUPT_ERROR;
|
||||
|
@ -1173,7 +1172,7 @@ NTAPI
|
|||
FstubReadSector(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG SectorSize,
|
||||
IN ULONGLONG StartingSector OPTIONAL,
|
||||
OUT PUSHORT Buffer)
|
||||
OUT PVOID Buffer)
|
||||
{
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
|
@ -1721,7 +1720,7 @@ NTAPI
|
|||
FstubWriteSector(IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG SectorSize,
|
||||
IN ULONGLONG StartingSector OPTIONAL,
|
||||
IN PUSHORT Buffer)
|
||||
IN PVOID Buffer)
|
||||
{
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
|
@ -2220,7 +2219,7 @@ IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject,
|
|||
else
|
||||
{
|
||||
/* Compute MBR checksum */
|
||||
for (i = 0, CheckSum = 0; i < BytesPerSector / sizeof(UINT32); i++)
|
||||
for (i = 0, CheckSum = 0; i < 512; i += sizeof(INT32))
|
||||
{
|
||||
CheckSum += *(PUINT32)&Buffer[i];
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ xKdUnmapVirtualAddress(
|
|||
//
|
||||
#define DISK_SIGNATURE_OFFSET 0x1B8
|
||||
#define PARTITION_TABLE_OFFSET 0x1BE
|
||||
#define BOOT_SIGNATURE_OFFSET ((0x200 / sizeof(INT16)) - 1)
|
||||
#define BOOT_SIGNATURE_OFFSET (0x200 - 2)
|
||||
|
||||
#define BOOT_RECORD_SIGNATURE 0xAA55
|
||||
#define NUM_PARTITION_TABLE_ENTRIES 4
|
||||
|
|
Loading…
Reference in a new issue