From: longpanda Date: Fri, 24 Jul 2020 15:23:40 +0000 (+0800) Subject: Don't delete partition when update in GPT partition style. X-Git-Tag: v1.0.17~2 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/commitdiff_plain/f9763a44b2c4bfd115faf2670639faca4e9735de?ds=sidebyside Don't delete partition when update in GPT partition style. --- diff --git a/INSTALL/Ventoy2Disk.exe b/INSTALL/Ventoy2Disk.exe index 5a6fb29..20dee82 100644 Binary files a/INSTALL/Ventoy2Disk.exe and b/INSTALL/Ventoy2Disk.exe differ diff --git a/Ventoy2Disk/Ventoy2Disk/PhyDrive.c b/Ventoy2Disk/Ventoy2Disk/PhyDrive.c index 2db6e0e..ec266ee 100644 --- a/Ventoy2Disk/Ventoy2Disk/PhyDrive.c +++ b/Ventoy2Disk/Ventoy2Disk/PhyDrive.c @@ -1852,24 +1852,26 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive) if (!TryWritePart2(hDrive, StartSector)) { - ForceMBR = TRUE; - Log("Try write failed, now delete partition 2..."); + if (pPhyDrive->PartStyle == 0) + { + ForceMBR = TRUE; + Log("Try write failed, now delete partition 2..."); - CHECK_CLOSE_HANDLE(hDrive); + CHECK_CLOSE_HANDLE(hDrive); - Log("Now delete partition 2..."); - DeletePartitions(pPhyDrive->PhyDrive, TRUE); + Log("Now delete partition 2..."); + DeletePartitions(pPhyDrive->PhyDrive, TRUE); - hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE); - if (hDrive == INVALID_HANDLE_VALUE) - { - Log("Failed to GetPhysicalHandle for write."); - rc = 1; - goto End; - } + hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE); + if (hDrive == INVALID_HANDLE_VALUE) + { + Log("Failed to GetPhysicalHandle for write."); + rc = 1; + goto End; + } + } } - PROGRESS_BAR_SET_POS(PT_FORMAT_PART2); Log("Write Ventoy to disk ............................ ");