From 44609d13981449390b45f52c75407970a8d151c2 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 7 Feb 2026 14:44:05 +0100 Subject: [PATCH] [DISKPART] Ignore non-mounted GPT partitions in DismountVolume --- base/system/diskpart/partlist.c | 37 ++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/base/system/diskpart/partlist.c b/base/system/diskpart/partlist.c index cce4e857a28..a7f738ae296 100644 --- a/base/system/diskpart/partlist.c +++ b/base/system/diskpart/partlist.c @@ -2887,20 +2887,33 @@ DismountVolume( WCHAR Buffer[MAX_PATH]; /* Check whether the partition is valid and was mounted by the system */ - if (!PartEntry->IsPartitioned || - IsContainerPartition(PartEntry->Mbr.PartitionType) || - !IsRecognizedPartition(PartEntry->Mbr.PartitionType) || - PartEntry->FormatState == UnknownFormat || - // NOTE: If FormatState == Unformatted but *FileSystem != 0 this means - // it has been usually mounted with RawFS and thus needs to be dismounted. -/* !*PartEntry->FileSystem || */ - PartEntry->PartitionNumber == 0) + if (PartEntry->DiskEntry->PartitionStyle == PARTITION_STYLE_MBR) { - /* The partition is not mounted, so just return success */ - return STATUS_SUCCESS; - } + if (!PartEntry->IsPartitioned || + IsContainerPartition(PartEntry->Mbr.PartitionType) || + !IsRecognizedPartition(PartEntry->Mbr.PartitionType) || + PartEntry->FormatState == UnknownFormat || + // NOTE: If FormatState == Unformatted but *FileSystem != 0 this means + // it has been usually mounted with RawFS and thus needs to be dismounted. +/* !*PartEntry->FileSystem || */ + PartEntry->PartitionNumber == 0) + { + /* The partition is not mounted, so just return success */ + return STATUS_SUCCESS; + } - ASSERT(PartEntry->Mbr.PartitionType != PARTITION_ENTRY_UNUSED); + ASSERT(PartEntry->Mbr.PartitionType != PARTITION_ENTRY_UNUSED); + } + else if (PartEntry->DiskEntry->PartitionStyle == PARTITION_STYLE_GPT) + { + if (!PartEntry->IsPartitioned || + IsEqualGUID(&PartEntry->Gpt.PartitionType, &PARTITION_ENTRY_UNUSED_GUID) || + (PartEntry->FormatState == UnknownFormat)) + { + /* The partition is not mounted, so just return success */ + return STATUS_SUCCESS; + } + } /* Open the volume */ StringCchPrintfW(Buffer, ARRAYSIZE(Buffer),