]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - Ventoy2Disk/Ventoy2Disk/PhyDrive.c
Fix bug for VTOY_DEFAULT_IMAGE in TreeView mode when VTOY_DEFAULT_SEARCH_ROOT was...
[Ventoy.git] / Ventoy2Disk / Ventoy2Disk / PhyDrive.c
index 2db6e0e7e00ed58424bed5250dad7218fb95a00c..ec266eecd8caf17b1b16443c670e8d0a4fc30499 100644 (file)
@@ -1852,24 +1852,26 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive)
 \r
     if (!TryWritePart2(hDrive, StartSector))\r
     {\r
-        ForceMBR = TRUE;\r
-        Log("Try write failed, now delete partition 2...");\r
+               if (pPhyDrive->PartStyle == 0)\r
+               {\r
+                       ForceMBR = TRUE;\r
+                       Log("Try write failed, now delete partition 2...");\r
 \r
-        CHECK_CLOSE_HANDLE(hDrive);\r
+                       CHECK_CLOSE_HANDLE(hDrive);\r
 \r
-        Log("Now delete partition 2...");\r
-        DeletePartitions(pPhyDrive->PhyDrive, TRUE);\r
+                       Log("Now delete partition 2...");\r
+                       DeletePartitions(pPhyDrive->PhyDrive, TRUE);\r
 \r
-        hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE);\r
-        if (hDrive == INVALID_HANDLE_VALUE)\r
-        {\r
-            Log("Failed to GetPhysicalHandle for write.");\r
-            rc = 1;\r
-            goto End;\r
-        }\r
+                       hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE);\r
+                       if (hDrive == INVALID_HANDLE_VALUE)\r
+                       {\r
+                               Log("Failed to GetPhysicalHandle for write.");\r
+                               rc = 1;\r
+                               goto End;\r
+                       }\r
+               }\r
     }\r
 \r
-\r
     PROGRESS_BAR_SET_POS(PT_FORMAT_PART2);\r
 \r
     Log("Write Ventoy to disk ............................ ");\r