https://git.reactos.org/?p=reactos.git;a=commitdiff;h=647d351278bbfc806980a…
commit 647d351278bbfc806980ac1043dfe08e42e2d3c3
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Dec 1 21:32:53 2024 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Dec 1 21:32:53 2024 +0100
[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 <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;