mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-24 19:54:25 -04:00
[misc] fix log potentially not being saved on exit
* Also ensures that if the user deleted the directory we don't recreate it for the log. * Also fix typos and Coverity warnings.
This commit is contained in:
parent
9dc045a701
commit
deee38d4e5
5 changed files with 20 additions and 14 deletions
|
@ -739,10 +739,12 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi
|
|||
goto out;
|
||||
CHECK_FOR_USER_CANCEL;
|
||||
liFilePointer.QuadPart = DiskSize - (LONGLONG)SectorSize * MAX_SECTORS_TO_CLEAR;
|
||||
SetFilePointerEx(hPhysicalDrive, liFilePointer, &liFilePointer, FILE_BEGIN);
|
||||
// Windows seems to be an ass about keeping a lock on a backup GPT,
|
||||
// so we try to be lenient about not being able to clear it.
|
||||
WriteFileWithRetry(hPhysicalDrive, pZeroBuf, SectorSize * MAX_SECTORS_TO_CLEAR, NULL, WRITE_RETRIES);
|
||||
if (SetFilePointerEx(hPhysicalDrive, liFilePointer, &liFilePointer, FILE_BEGIN)) {
|
||||
IGNORE_RETVAL(WriteFileWithRetry(hPhysicalDrive, pZeroBuf,
|
||||
SectorSize * MAX_SECTORS_TO_CLEAR, NULL, WRITE_RETRIES));
|
||||
}
|
||||
r = TRUE;
|
||||
|
||||
out:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue