mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Also, fix the MBR checksum calculation (missing ~CheckSum + 1), to fix the calculation in accordance with how MS calculates the MBR checksums (and what we do as well in https://github.com/reactos/reactos/blob/master/base/setup/lib/utils/partlist.c#L1581 https://github.com/reactos/reactos/blob/master/boot/freeldr/freeldr/arch/i386/hwdisk.c#L291 ).
This commit is contained in:
parent
fd053237cb
commit
3d980c4a2c
1 changed files with 6 additions and 5 deletions
|
@ -909,7 +909,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
|
|||
Status = FstubReadSector(Disk->DeviceObject,
|
||||
Disk->SectorSize,
|
||||
EFIHeader->PartitionEntryLBA + i,
|
||||
(PUSHORT)Sector);
|
||||
Sector);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(Sector, TAG_FSTUB);
|
||||
|
@ -929,7 +929,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
|
|||
Status = FstubReadSector(Disk->DeviceObject,
|
||||
Disk->SectorSize,
|
||||
EFIHeader->PartitionEntryLBA + i,
|
||||
(PUSHORT)Sector);
|
||||
Sector);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(Sector, TAG_FSTUB);
|
||||
|
@ -2189,7 +2189,7 @@ IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = FstubReadSector(DeviceObject,
|
||||
BytesPerSector,
|
||||
0ULL,
|
||||
(PUSHORT)Buffer);
|
||||
Buffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
|
@ -2208,7 +2208,7 @@ IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = FstubReadSector(DeviceObject,
|
||||
BytesPerSector,
|
||||
1ULL,
|
||||
(PUSHORT)Buffer);
|
||||
Buffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
|
@ -2245,10 +2245,11 @@ IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject,
|
|||
else
|
||||
{
|
||||
/* Compute MBR checksum */
|
||||
for (i = 0, CheckSum = 0; i < 512; i += sizeof(INT32))
|
||||
for (i = 0, CheckSum = 0; i < 512; i += sizeof(UINT32))
|
||||
{
|
||||
CheckSum += *(PUINT32)&Buffer[i];
|
||||
}
|
||||
CheckSum = ~CheckSum + 1;
|
||||
|
||||
/* Set partition table style to MBR and return signature (offset 440) and checksum */
|
||||
Signature->PartitionStyle = PARTITION_STYLE_MBR;
|
||||
|
|
Loading…
Reference in a new issue