[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 PARTITION_TBL_SIZE 4
#define MBR_MAGIC 0xAA55
#include <pshpack1.h> #include <pshpack1.h>
typedef struct _PARTITION typedef struct _PARTITION
@ -870,7 +872,7 @@ AddDiskToList(
DiskEntry->BiosFound = FALSE; DiskEntry->BiosFound = FALSE;
/* Check if this disk has a valid MBR */ /* 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; DiskEntry->NoMbr = TRUE;
else else
DiskEntry->NoMbr = FALSE; DiskEntry->NoMbr = FALSE;