mirror of
https://github.com/pbatard/rufus.git
synced 2025-06-02 07:39:54 -04:00
[core] report write errors more explicitly
* Also issue a port cycle on ERROR_NOT_READY * Also run a check for conflicting processes during write retries
This commit is contained in:
parent
b7ab196a97
commit
d4a663991b
7 changed files with 95 additions and 58 deletions
|
@ -1,6 +1,6 @@
|
|||
/******************************************************************
|
||||
Copyright (C) 2009 Henrik Carlqvist
|
||||
Modified for Rufus/Windows (C) 2011-2016 Pete Batard
|
||||
Modified for Rufus/Windows (C) 2011-2019 Pete Batard
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -47,8 +47,10 @@ int64_t write_sectors(HANDLE hDrive, uint64_t SectorSize,
|
|||
return -1;
|
||||
}
|
||||
|
||||
LastWriteError = 0;
|
||||
if(!WriteFile(hDrive, pBuf, Size, &Size, NULL))
|
||||
{
|
||||
LastWriteError = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|GetLastError();
|
||||
uprintf("write_sectors: Write error %s\n", WindowsErrorString());
|
||||
uprintf(" StartSector: 0x%08" PRIx64 ", nSectors: 0x%" PRIx64 ", SectorSize: 0x%" PRIx64 "\n", StartSector, nSectors, SectorSize);
|
||||
return -1;
|
||||
|
@ -60,7 +62,8 @@ int64_t write_sectors(HANDLE hDrive, uint64_t SectorSize,
|
|||
uprintf("Warning: Possible short write\n");
|
||||
return 0;
|
||||
}
|
||||
uprintf("write_sectors:write error\n");
|
||||
uprintf("write_sectors: Write error\n");
|
||||
LastWriteError = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;
|
||||
uprintf(" Wrote: %d, Expected: %" PRIu64 "\n", Size, nSectors*SectorSize);
|
||||
uprintf(" StartSector: 0x%08" PRIx64 ", nSectors: 0x%" PRIx64 ", SectorSize: 0x%" PRIx64 "\n", StartSector, nSectors, SectorSize);
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue