[core] add log progress report when writing an image/zeroing a drive

* Also simplify a nonsensical condition in format_ext
This commit is contained in:
Pete Batard 2020-11-13 17:58:56 +00:00
parent 0e43c5f2ea
commit 460ab5dd73
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
3 changed files with 14 additions and 8 deletions

View File

@ -1480,6 +1480,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
LARGE_INTEGER li;
DWORD i, rSize, wSize, xSize, BufSize;
uint64_t wb, target_size = hSourceImage?img_report.image_size:SelectedDrive.DiskSize;
uint64_t cur_value, last_value = UINT64_MAX;
int64_t bled_ret;
uint8_t* buffer = NULL;
uint32_t zero_data, *cmp_buffer = NULL;
@ -1525,7 +1526,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
goto out;
}
} else {
uprintf(hSourceImage?"Writing Image...":fast_zeroing?"Fast-zeroing drive...":"Zeroing drive...");
uprintf(hSourceImage?"Writing Image:":fast_zeroing?"Fast-zeroing drive:":"Zeroing drive:");
// Our buffer size must be a multiple of the sector size and *ALIGNED* to the sector size
BufSize = ((DD_BUFFER_SIZE + SelectedDrive.SectorSize - 1) / SelectedDrive.SectorSize) * SelectedDrive.SectorSize;
buffer = (uint8_t*)_mm_malloc(BufSize, SelectedDrive.SectorSize);
@ -1553,8 +1554,13 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
// With Windows' default optimizations, sync read + sync write for sequential operations
// will be as fast, if not faster, than whatever async scheme you can come up with.
rSize = BufSize;
for (wb = 0, wSize = 0; wb < (uint64_t)SelectedDrive.DiskSize; wb += wSize) {
for (wb = 0, wSize = 0; wb < target_size; wb += wSize) {
UpdateProgressWithInfo(OP_FORMAT, hSourceImage ? MSG_261 : fast_zeroing ? MSG_306 : MSG_286, wb, target_size);
cur_value = (wb * min(80, target_size)) / target_size;
if (cur_value != last_value) {
last_value = cur_value;
uprintfs("+");
}
if (hSourceImage != NULL) {
s = ReadFile(hSourceImage, buffer, BufSize, &rSize, NULL);
if (!s) {

View File

@ -190,7 +190,7 @@ errcode_t ext2fs_print_progress(int64_t cur_value, int64_t max_value)
return 0;
UpdateProgressWithInfo(OP_FORMAT, MSG_217, (uint64_t)((ext2_percent_start * max_value) + (ext2_percent_share * cur_value)), max_value);
cur_value = (int64_t)(((float)cur_value / (float)max_value) * min(ext2_max_marker, (float)max_value));
if ((cur_value < last_value) || (cur_value > last_value)) {
if (cur_value != last_value) {
last_value = cur_value;
uprintfs("+");
}

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.13.1725"
CAPTION "Rufus 3.13.1726"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,13,1725,0
PRODUCTVERSION 3,13,1725,0
FILEVERSION 3,13,1726,0
PRODUCTVERSION 3,13,1726,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.13.1725"
VALUE "FileVersion", "3.13.1726"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.13.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.13.1725"
VALUE "ProductVersion", "3.13.1726"
END
END
BLOCK "VarFileInfo"