Skip to content

Commit

Permalink
Don't delete partition when update in GPT partition style.
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Jul 24, 2020
1 parent d063dbb commit f9763a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Binary file modified INSTALL/Ventoy2Disk.exe
Binary file not shown.
28 changes: 15 additions & 13 deletions Ventoy2Disk/Ventoy2Disk/PhyDrive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ............................ ");
Expand Down

0 comments on commit f9763a4

Please sign in to comment.