From 647d351278bbfc806980ac1043dfe08e42e2d3c3 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 1 Dec 2024 21:32:53 +0100 Subject: [PATCH] [DISKPART] Use the MBR_MAGIC to check for a valid MBR --- base/system/diskpart/partlist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/system/diskpart/partlist.c b/base/system/diskpart/partlist.c index dbd0ef0e24a..167858cfbb9 100644 --- a/base/system/diskpart/partlist.c +++ b/base/system/diskpart/partlist.c @@ -37,6 +37,8 @@ #define PARTITION_TBL_SIZE 4 +#define MBR_MAGIC 0xAA55 + #include 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;