Skip to content

Commit 182715e

Browse files
committed
[DISKPART] Prevent EFI- and MSR-Partitions from accidental deletion
1 parent bf8741d commit 182715e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

base/system/diskpart/delete.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,14 @@ DeleteGptPartition(
173173
List->SystemPartition = NULL;
174174
}
175175
#endif
176-
#if 0
177-
if ((bOverride == FALSE) && (IsKnownPartition(CurrentPartition) == FALSE))
176+
177+
if ((bOverride == FALSE) &&
178+
((memcmp(&CurrentPartition->Gpt.PartitionType, &PARTITION_SYSTEM_GUID, sizeof(GUID)) == 0) ||
179+
(memcmp(&CurrentPartition->Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID, sizeof(GUID)) == 0)))
178180
{
179181
ConResPuts(StdOut, IDS_DELETE_PARTITION_FAIL);
180182
return;
181183
}
182-
#endif
183184

184185
#ifdef DUMP_PARTITION_LIST
185186
DumpPartitionList(CurrentDisk);

0 commit comments

Comments
 (0)