]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Optimization for Ventoy2Disk.exe
authorlongpanda <admin@ventoy.net>
Wed, 20 Oct 2021 09:27:06 +0000 (17:27 +0800)
committerlongpanda <admin@ventoy.net>
Wed, 20 Oct 2021 09:27:06 +0000 (17:27 +0800)
INSTALL/Ventoy2Disk.exe
Ventoy2Disk/Ventoy2Disk/DiskService_vds.c
Ventoy2Disk/Ventoy2Disk/PhyDrive.c

index 6a7051329f219758120f639a450b8c289c7f49c7..008d3d3db611670fbd90af6899ee598fb06ba28b 100644 (file)
Binary files a/INSTALL/Ventoy2Disk.exe and b/INSTALL/Ventoy2Disk.exe differ
index 38800c69721440992455d7f47b71279c040d09d5..7fd3f111f7575c65ef342f3450b6ca168f0aef2e 100644 (file)
@@ -383,6 +383,7 @@ STATIC BOOL VDS_CallBack_DeletePartition(void *pInterface, VDS_DISK_PROP *pDiskP
     hr = IVdsAdvancedDisk_QueryPartitions(pAdvancedDisk, &prop_array, &prop_array_size);\r
     if (hr == S_OK) \r
     {\r
+               r = TRUE;\r
         for (i = 0; i < prop_array_size; i++) \r
         {\r
             if (PartNumber == 0 || PartNumber == prop_array[i].ulPartitionNumber)\r
@@ -402,21 +403,25 @@ STATIC BOOL VDS_CallBack_DeletePartition(void *pInterface, VDS_DISK_PROP *pDiskP
             {\r
                 r = FALSE;\r
                 VDS_SET_ERROR(hr);\r
-                Log("Could not delete partitions: %u", LASTERR);\r
+                Log("Could not delete partitions: 0x%x", LASTERR);\r
+                               break;\r
             }\r
             else \r
             {\r
                 Log("Delete this partitions success");\r
             }\r
         }\r
-        r = TRUE;\r
     }\r
     else \r
     {\r
         Log("No partition to delete on disk '%S'", pDiskProp->pwszName);\r
         r = TRUE;\r
     }\r
-    CoTaskMemFree(prop_array);\r
+\r
+       if (prop_array)\r
+       {\r
+               CoTaskMemFree(prop_array);\r
+       }\r
 \r
     return r;\r
 }\r
index a916d155a345dd7f78ca9bb3f0d4fb4bd6a69c9a..570f28eac03dae330382f20c16b90914dfd995df 100644 (file)
@@ -1657,7 +1657,9 @@ int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle, int TryId)
 \r
     if (!VDS_DeleteAllPartitions(pPhyDrive->PhyDrive))\r
     {\r
-        Log("Notice: Could not delete partitions: %u", GetLastError());\r
+        Log("Notice: Could not delete partitions: 0x%x", GetLastError());\r
+               rc = 1;\r
+               goto End;\r
     }\r
 \r
     Log("Deleting all partitions ......................... OK");\r