[DISKPART] Use the MBR_MAGIC to check for a valid MBR

This commit is contained in:
Eric Kohl 2024-12-01 21:32:53 +01:00
parent 8972448127
commit 647d351278

View file

@ -37,6 +37,8 @@
#define PARTITION_TBL_SIZE 4
#define MBR_MAGIC 0xAA55
#include <pshpack1.h>
typedef struct _PARTITION
@ -870,7 +872,7 @@ AddDiskToList(
DiskEntry->BiosFound = FALSE;
/* Check if this disk has a valid MBR */
if (Mbr->BootCode[0] == 0 && Mbr->BootCode[1] == 0)
if (Mbr->Magic != MBR_MAGIC)
DiskEntry->NoMbr = TRUE;
else
DiskEntry->NoMbr = FALSE;