mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[cmp] propagate decompression errors from bled
* If, for example, you have a truncated gz-compressed file and try to write it to disk, bled_uncompress_with_handles() will return an error. Previously, this was not reported back to the user. * Closes #1040
This commit is contained in:
parent
293440b2e9
commit
88631806da
2 changed files with 14 additions and 7 deletions
11
src/format.c
11
src/format.c
|
@ -1531,6 +1531,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
|
||||||
LARGE_INTEGER li;
|
LARGE_INTEGER li;
|
||||||
DWORD rSize, wSize, BufSize;
|
DWORD rSize, wSize, BufSize;
|
||||||
uint64_t wb, target_size = hSourceImage?img_report.image_size:SelectedDrive.DiskSize;
|
uint64_t wb, target_size = hSourceImage?img_report.image_size:SelectedDrive.DiskSize;
|
||||||
|
int64_t bled_ret;
|
||||||
uint8_t *buffer = NULL;
|
uint8_t *buffer = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1541,10 +1542,16 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
|
||||||
LastRefresh = 0;
|
LastRefresh = 0;
|
||||||
|
|
||||||
if (img_report.compression_type != BLED_COMPRESSION_NONE) {
|
if (img_report.compression_type != BLED_COMPRESSION_NONE) {
|
||||||
uprintf("Writing Compressed Image...");
|
uprintf("Writing compressed image...");
|
||||||
bled_init(_uprintf, update_progress, &FormatStatus);
|
bled_init(_uprintf, update_progress, &FormatStatus);
|
||||||
bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type);
|
bled_ret = bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type);
|
||||||
bled_exit();
|
bled_exit();
|
||||||
|
if ((bled_ret < 0) && (SCODE_CODE(FormatStatus) != ERROR_CANCELLED)) {
|
||||||
|
// Unfortunately, different compression backends return different negative error codes
|
||||||
|
uprintf("Could not write compressed image: %" PRIi64, bled_ret);
|
||||||
|
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_WRITE_FAULT;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uprintf(hSourceImage?"Writing Image...":"Zeroing drive...");
|
uprintf(hSourceImage?"Writing Image...":"Zeroing drive...");
|
||||||
// Our buffer size must be a multiple of the sector size and *ALIGNED* to the sector size
|
// Our buffer size must be a multiple of the sector size and *ALIGNED* to the sector size
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 2.18.1204"
|
CAPTION "Rufus 2.18.1205"
|
||||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||||
|
@ -366,8 +366,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 2,18,1204,0
|
FILEVERSION 2,18,1205,0
|
||||||
PRODUCTVERSION 2,18,1204,0
|
PRODUCTVERSION 2,18,1205,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -384,13 +384,13 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "2.18.1204"
|
VALUE "FileVersion", "2.18.1205"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus.exe"
|
VALUE "OriginalFilename", "rufus.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "2.18.1204"
|
VALUE "ProductVersion", "2.18.1205"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue