From 182715ed507dba1aa597881a15cc43fe73408e77 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 15 Dec 2025 20:11:59 +0100 Subject: [PATCH] [DISKPART] Prevent EFI- and MSR-Partitions from accidental deletion --- base/system/diskpart/delete.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/base/system/diskpart/delete.c b/base/system/diskpart/delete.c index 304eed72be9..580fccd6d42 100644 --- a/base/system/diskpart/delete.c +++ b/base/system/diskpart/delete.c @@ -173,13 +173,14 @@ DeleteGptPartition( List->SystemPartition = NULL; } #endif -#if 0 - if ((bOverride == FALSE) && (IsKnownPartition(CurrentPartition) == FALSE)) + + if ((bOverride == FALSE) && + ((memcmp(&CurrentPartition->Gpt.PartitionType, &PARTITION_SYSTEM_GUID, sizeof(GUID)) == 0) || + (memcmp(&CurrentPartition->Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID, sizeof(GUID)) == 0))) { ConResPuts(StdOut, IDS_DELETE_PARTITION_FAIL); return; } -#endif #ifdef DUMP_PARTITION_LIST DumpPartitionList(CurrentDisk);