[NTOS:FSTUB] Clear the whole partition table in FstubCreateDiskRaw (#9124)

FstubCreateDiskRaw is supposed to wipe the MBR when it makes a RAW disk.
Before this fix, that function only cleared the first of the 4 partition entries, so one entry (16 bytes) instead of the whole table (64).
As a consequence, the wiped MBR written back to disk still had entries 2, 3 and 4 sitting there with old data, and those came back as ghost/garbage partitions.
This commit is contained in:
Ahmed Arif
2026-06-08 00:14:11 +02:00
committed by GitHub
parent 823647a38b
commit b1f04786e1
+1 -1
View File
@@ -487,7 +487,7 @@ FstubCreateDiskRaw(IN PDEVICE_OBJECT DeviceObject)
/* Only zero useful stuff */
MasterBootRecord = (PMASTER_BOOT_RECORD)Disk->Buffer;
MasterBootRecord->Signature = 0;
RtlZeroMemory(MasterBootRecord->PartitionTable, sizeof(PARTITION_TABLE_ENTRY));
RtlZeroMemory(MasterBootRecord->PartitionTable, sizeof(PARTITION_TABLE_ENTRY) * NUM_PARTITION_TABLE_ENTRIES);
MasterBootRecord->MasterBootRecordMagic = 0;
/* Write back that destroyed MBR */