Optimization for Ventoy2Disk.exe

This commit is contained in:
longpanda 2021-10-20 17:27:06 +08:00
parent 9cfd05811b
commit ee104bfa97
3 changed files with 11 additions and 4 deletions

Binary file not shown.

View 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);
if (hr == S_OK)
{
r = TRUE;
for (i = 0; i < prop_array_size; i++)
{
if (PartNumber == 0 || PartNumber == prop_array[i].ulPartitionNumber)
@ -402,21 +403,25 @@ STATIC BOOL VDS_CallBack_DeletePartition(void *pInterface, VDS_DISK_PROP *pDiskP
{
r = FALSE;
VDS_SET_ERROR(hr);
Log("Could not delete partitions: %u", LASTERR);
Log("Could not delete partitions: 0x%x", LASTERR);
break;
}
else
{
Log("Delete this partitions success");
}
}
r = TRUE;
}
else
{
Log("No partition to delete on disk '%S'", pDiskProp->pwszName);
r = TRUE;
}
CoTaskMemFree(prop_array);
if (prop_array)
{
CoTaskMemFree(prop_array);
}
return r;
}

View File

@ -1657,7 +1657,9 @@ int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle, int TryId)
if (!VDS_DeleteAllPartitions(pPhyDrive->PhyDrive))
{
Log("Notice: Could not delete partitions: %u", GetLastError());
Log("Notice: Could not delete partitions: 0x%x", GetLastError());
rc = 1;
goto End;
}
Log("Deleting all partitions ......................... OK");