mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] refactor the "operation in progress" detection
* Remove unused iso_op_in_progress and use a single op_in_progress that gets set when we disable the controls. * Also fix an issue where Ctrl-L was being processed as Alt-L due yet another completely backwards Windows behaviour where the message that is meant to indicating whether Alt is pressed is also sometimes used to indicate that another key is being pressed if the dialog doesn't have keyboard focus...
This commit is contained in:
parent
af95de8198
commit
21351b9fbe
5 changed files with 303 additions and 310 deletions
|
@ -641,7 +641,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
|
|||
do {
|
||||
for (i=0; (i<30) && (!force_update_check); i++)
|
||||
Sleep(500);
|
||||
} while ((!force_update_check) && ((iso_op_in_progress || format_op_in_progress || (dialog_showing>0))));
|
||||
} while ((!force_update_check) && ((op_in_progress || (dialog_showing > 0))));
|
||||
if (!force_update_check) {
|
||||
if ((ReadSetting32(SETTING_UPDATE_INTERVAL) == -1)) {
|
||||
vuprintf("Check for updates disabled, as per settings.");
|
||||
|
@ -829,7 +829,7 @@ out:
|
|||
// Start the new download after cleanup
|
||||
if (found_new_version) {
|
||||
// User may have started an operation while we were checking
|
||||
while ((!force_update_check) && (iso_op_in_progress || format_op_in_progress || (dialog_showing > 0))) {
|
||||
while ((!force_update_check) && (op_in_progress || (dialog_showing > 0))) {
|
||||
Sleep(15000);
|
||||
}
|
||||
DownloadNewVersion();
|
||||
|
@ -994,7 +994,6 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
// Download the ISO and report errors if any
|
||||
SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0);
|
||||
FormatStatus = 0;
|
||||
format_op_in_progress = TRUE;
|
||||
SendMessage(hMainDialog, UM_TIMER_START, 0, 0);
|
||||
if (DownloadToFileOrBuffer(url, img_save.ImagePath, NULL, hMainDialog, TRUE) == 0) {
|
||||
SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0);
|
||||
|
@ -1011,7 +1010,6 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
image_path = safe_strdup(img_save.ImagePath);
|
||||
PostMessage(hMainDialog, UM_SELECT_ISO, 0, 0);
|
||||
}
|
||||
format_op_in_progress = FALSE;
|
||||
safe_free(img_save.ImagePath);
|
||||
}
|
||||
}
|
||||
|
|
77
src/rufus.c
77
src/rufus.c
|
@ -103,7 +103,7 @@ HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hL
|
|||
HWND hLogDialog = NULL, hProgress = NULL, hDiskID;
|
||||
HANDLE dialog_handle = NULL;
|
||||
BOOL is_x86_32, use_own_c32[NB_OLD_C32] = { FALSE, FALSE }, mbr_selected_by_user = FALSE;
|
||||
BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE, has_uefi_csm;
|
||||
BOOL op_in_progress = TRUE, right_to_left_mode = FALSE, has_uefi_csm;
|
||||
BOOL enable_HDDs = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE;
|
||||
BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug;
|
||||
BOOL use_fake_units, preserve_timestamps = FALSE, fast_zeroing = FALSE, app_changed_size = FALSE;
|
||||
|
@ -791,6 +791,8 @@ static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes)
|
|||
// Toggle controls according to operation
|
||||
static void EnableControls(BOOL enable, BOOL remove_checkboxes)
|
||||
{
|
||||
op_in_progress = !enable;
|
||||
|
||||
// The following only get disabled on format/checksum and otherwise remain enabled,
|
||||
// even if no device or image are selected
|
||||
EnableWindow(hDeviceList, enable);
|
||||
|
@ -1074,7 +1076,6 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
|
||||
if (image_path == NULL)
|
||||
goto out;
|
||||
format_op_in_progress = TRUE;
|
||||
PrintInfoDebug(0, MSG_202);
|
||||
user_notified = FALSE;
|
||||
EnableControls(FALSE, FALSE);
|
||||
|
@ -1158,7 +1159,6 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
|
||||
out:
|
||||
dont_display_image_name = FALSE;
|
||||
format_op_in_progress = FALSE;
|
||||
PrintInfo(0, MSG_210);
|
||||
ExitThread(0);
|
||||
}
|
||||
|
@ -1727,9 +1727,10 @@ static void SaveVHD(void)
|
|||
EXT_DECL(img_ext, filename, __VA_GROUP__("*.vhd"), __VA_GROUP__(lmprintf(MSG_095)));
|
||||
ULARGE_INTEGER free_space;
|
||||
|
||||
if (DriveIndex >= 0)
|
||||
if ((DriveIndex < 0) || (format_thid != NULL))
|
||||
return;
|
||||
|
||||
static_sprintf(filename, "%s.vhd", DriveLabel.String[DriveIndex]);
|
||||
if ((DriveIndex != CB_ERR) && (!format_op_in_progress) && (format_thid == NULL)) {
|
||||
img_save.Type = IMG_SAVE_TYPE_VHD;
|
||||
img_save.DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, DriveIndex);
|
||||
img_save.ImagePath = FileDialog(TRUE, NULL, &img_ext, 0);
|
||||
|
@ -1739,7 +1740,6 @@ static void SaveVHD(void)
|
|||
// Reset all progress bars
|
||||
SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0);
|
||||
FormatStatus = 0;
|
||||
format_op_in_progress = TRUE;
|
||||
free_space.QuadPart = 0;
|
||||
if ((GetVolumePathNameA(img_save.ImagePath, path, sizeof(path)))
|
||||
&& (GetDiskFreeSpaceExA(path, &free_space, NULL, NULL))
|
||||
|
@ -1758,7 +1758,6 @@ static void SaveVHD(void)
|
|||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD);
|
||||
safe_free(img_save.ImagePath);
|
||||
PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0);
|
||||
format_op_in_progress = FALSE;
|
||||
}
|
||||
} else {
|
||||
if (free_space.QuadPart == 0) {
|
||||
|
@ -1770,8 +1769,6 @@ static void SaveVHD(void)
|
|||
}
|
||||
safe_free(img_save.ImagePath);
|
||||
PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0);
|
||||
format_op_in_progress = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1782,7 +1779,7 @@ static void SaveISO(void)
|
|||
char filename[33] = "disc_image.iso";
|
||||
EXT_DECL(img_ext, filename, __VA_GROUP__("*.iso"), __VA_GROUP__(lmprintf(MSG_036)));
|
||||
|
||||
if ((format_op_in_progress) || (format_thid != NULL))
|
||||
if (op_in_progress || (format_thid != NULL))
|
||||
return;
|
||||
|
||||
img_save.Type = IMG_SAVE_TYPE_ISO;
|
||||
|
@ -1803,7 +1800,6 @@ static void SaveISO(void)
|
|||
return;
|
||||
SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0);
|
||||
FormatStatus = 0;
|
||||
format_op_in_progress = TRUE;
|
||||
// Disable all controls except cancel
|
||||
EnableControls(FALSE, FALSE);
|
||||
InitProgress(TRUE);
|
||||
|
@ -1817,7 +1813,6 @@ static void SaveISO(void)
|
|||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD);
|
||||
safe_free(img_save.ImagePath);
|
||||
PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0);
|
||||
format_op_in_progress = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1979,7 +1974,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
no_confirmation_on_cancel = FALSE;
|
||||
return (INT_PTR)TRUE;
|
||||
} else if (format_op_in_progress) {
|
||||
} else if (op_in_progress) {
|
||||
// User might be trying to cancel during preliminary checks
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED;
|
||||
PrintInfo(0, MSG_201);
|
||||
|
@ -2228,7 +2223,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
}
|
||||
FormatStatus = 0;
|
||||
format_op_in_progress = FALSE;
|
||||
if (CreateThread(NULL, 0, ISOScanThread, NULL, 0, NULL) == NULL) {
|
||||
uprintf("Unable to start ISO scanning thread");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD);
|
||||
|
@ -2261,7 +2255,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
FormatStatus = 0;
|
||||
LastWriteError = 0;
|
||||
StrArrayClear(&BlockingProcess);
|
||||
format_op_in_progress = TRUE;
|
||||
no_confirmation_on_cancel = FALSE;
|
||||
SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0);
|
||||
selection_default = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
|
@ -2286,7 +2279,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case IDC_HASH:
|
||||
if ((format_thid == NULL) && (image_path != NULL)) {
|
||||
FormatStatus = 0;
|
||||
format_op_in_progress = TRUE;
|
||||
no_confirmation_on_cancel = TRUE;
|
||||
SendMessage(hMainDialog, UM_PROGRESS_INIT, 0, 0);
|
||||
// Disable all controls except cancel
|
||||
|
@ -2301,7 +2293,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
uprintf("Unable to start checksum thread");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD);
|
||||
PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0);
|
||||
format_op_in_progress = FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2373,7 +2364,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case DBT_CUSTOMEVENT: // Sent by our timer refresh function or for card reader media change
|
||||
LastRefresh = GetTickCount64();
|
||||
KillTimer(hMainDialog, TID_REFRESH_TIMER);
|
||||
if (!format_op_in_progress) {
|
||||
if (!op_in_progress) {
|
||||
queued_hotplug_event = FALSE;
|
||||
GetDevices((DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList)));
|
||||
user_changed_label = FALSE;
|
||||
|
@ -2564,7 +2555,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case WM_CLIENTSHUTDOWN:
|
||||
case WM_QUERYENDSESSION:
|
||||
case WM_ENDSESSION:
|
||||
if (format_op_in_progress) {
|
||||
if (op_in_progress) {
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
if (message == WM_CLOSE) {
|
||||
|
@ -2692,7 +2683,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
if (format_thid != NULL)
|
||||
break;
|
||||
aborted_start:
|
||||
format_op_in_progress = FALSE;
|
||||
EnableControls(TRUE, FALSE);
|
||||
zero_drive = FALSE;
|
||||
if (queued_hotplug_event)
|
||||
|
@ -2781,7 +2771,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
FormatStatus = 0;
|
||||
LastWriteError = 0;
|
||||
format_op_in_progress = FALSE;
|
||||
return (INT_PTR)TRUE;
|
||||
|
||||
}
|
||||
|
@ -3243,27 +3232,51 @@ relaunch:
|
|||
|
||||
// Do our own event processing and process "magic" commands
|
||||
while(GetMessage(&msg, NULL, 0, 0)) {
|
||||
static BOOL ctrl_without_focus = FALSE;
|
||||
BOOL no_focus = (msg.message == WM_SYSKEYDOWN) && !(msg.lParam & 0x20000000);
|
||||
// ** ***** **** ** **********
|
||||
// .,ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
|
||||
// Sigh... The things one need to do to detect standalone use of the 'Alt' key.
|
||||
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam != VK_MENU))
|
||||
alt_command = TRUE;
|
||||
else if (GetAsyncKeyState(VK_MENU))
|
||||
else if (GetKeyState(VK_MENU) & 0x8000)
|
||||
alt_pressed = TRUE;
|
||||
|
||||
// Ctrl-A => Select the log data
|
||||
if ( (IsWindowVisible(hLogDialog)) && (GetKeyState(VK_CONTROL) & 0x8000) &&
|
||||
(msg.message == WM_KEYDOWN) && (msg.wParam == 'A') ) {
|
||||
if ((IsWindowVisible(hLogDialog)) && (GetKeyState(VK_CONTROL) & 0x8000) &&
|
||||
(msg.message == WM_KEYDOWN) && (msg.wParam == 'A')) {
|
||||
// Might also need ES_NOHIDESEL property if you want to select when not active
|
||||
Edit_SetSel(hLog, 0, -1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Detecting Ctrl combination keypress while an operation is in progress is a super-mess
|
||||
// because Windows considers that our dialog doesn't have keyboard focus (WHYYYYYY?!?!?)
|
||||
// and therefore first sends a WM_SYSKEYDOWN (i.e. the message that is supposed to tell
|
||||
// you that Alt is being pressed, because why not also use it for a COMPLETELY DIFFERENT
|
||||
// FRIGGING KEY!!!) with bit 29 of msg.lParam cleared, along with the code for the Ctrl
|
||||
// key and *THEN* a subsequent message (still using WM_SYSKEYDOWN without Alt) with the
|
||||
// other key. So we need to detect both the messages in sequence...
|
||||
if (no_focus && (msg.wParam == VK_CONTROL))
|
||||
ctrl_without_focus = op_in_progress;
|
||||
|
||||
// Ctrl-L => Open/Close the log
|
||||
if ((GetKeyState(VK_CONTROL) & 0x8000) && (msg.message == WM_KEYDOWN) && (msg.wParam == 'L')) {
|
||||
if ((ctrl_without_focus || ((GetKeyState(VK_CONTROL) & 0x8000) && (msg.message == WM_KEYDOWN)))
|
||||
&& (msg.wParam == 'L')) {
|
||||
ctrl_without_focus = FALSE;
|
||||
SendMessage(hMainDialog, WM_COMMAND, IDC_LOG, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (no_focus && (msg.wParam != VK_CONTROL))
|
||||
ctrl_without_focus = FALSE;
|
||||
|
||||
if (no_focus)
|
||||
continue;
|
||||
|
||||
// The following cheat modes should not be enacted when an operation is in progress
|
||||
if (!op_in_progress) {
|
||||
// Alt-. => Enable USB enumeration debug
|
||||
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == VK_OEM_PERIOD)) {
|
||||
usb_debug = !usb_debug;
|
||||
|
@ -3319,7 +3332,7 @@ relaunch:
|
|||
enable_HDDs = !enable_HDDs;
|
||||
PrintStatusTimeout(lmprintf(MSG_253), enable_HDDs);
|
||||
GetDevices(0);
|
||||
CheckDlgButton(hMainDialog, IDC_LIST_USB_HDD, enable_HDDs?BST_CHECKED:BST_UNCHECKED);
|
||||
CheckDlgButton(hMainDialog, IDC_LIST_USB_HDD, enable_HDDs ? BST_CHECKED : BST_UNCHECKED);
|
||||
continue;
|
||||
}
|
||||
// Alt-I => Toggle ISO support
|
||||
|
@ -3352,6 +3365,11 @@ relaunch:
|
|||
}
|
||||
// Alt-L => Force Large FAT32 format to be used on < 32 GB drives
|
||||
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'L')) {
|
||||
uprintf("DAFUQ!?!? LPARAM = 0x%08X", msg.lParam);
|
||||
|
||||
if ((msg.message == WM_SYSKEYDOWN) && !(msg.lParam & 0x20000000)) {
|
||||
uprintf("KIDDING ME?!?!.");
|
||||
}
|
||||
force_large_fat32 = !force_large_fat32;
|
||||
WriteSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT, force_large_fat32);
|
||||
PrintStatusTimeout(lmprintf(MSG_254), force_large_fat32);
|
||||
|
@ -3379,7 +3397,7 @@ relaunch:
|
|||
}
|
||||
// Alt-R => Remove all the registry keys that may have been created by Rufus
|
||||
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) {
|
||||
PrintStatus(2000, DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_248:MSG_249);
|
||||
PrintStatus(2000, DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME) ? MSG_248 : MSG_249);
|
||||
// Also try to delete the upper key (company name) if it's empty (don't care about the result)
|
||||
DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME);
|
||||
continue;
|
||||
|
@ -3470,7 +3488,7 @@ relaunch:
|
|||
CheckDlgButton(hMainDialog, IDC_LIST_USB_HDD, enable_HDDs ? BST_CHECKED : BST_UNCHECKED);
|
||||
PrintStatusTimeout(lmprintf(MSG_287), list_non_usb_removable_drives);
|
||||
uprintf("%sListing of non-USB removable drives %s",
|
||||
(list_non_usb_removable_drives)?"CAUTION: ":"", (list_non_usb_removable_drives)?"enabled":"disabled");
|
||||
(list_non_usb_removable_drives) ? "CAUTION: " : "", (list_non_usb_removable_drives) ? "enabled" : "disabled");
|
||||
if (list_non_usb_removable_drives)
|
||||
uprintf("By using this unofficial cheat mode you forfeit ANY RIGHT to complain if you lose valuable data!");
|
||||
GetDevices(0);
|
||||
|
@ -3484,10 +3502,11 @@ relaunch:
|
|||
PrintStatusTimeout(lmprintf(MSG_259), force_update);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Standalone 'Alt' key toggles progress report between percent, rate (if available)
|
||||
// and remaining time (if availabe)
|
||||
if (alt_pressed && !GetAsyncKeyState(VK_MENU)) {
|
||||
if (alt_pressed && !(GetKeyState(VK_MENU) & 0x8000)) {
|
||||
alt_pressed = FALSE;
|
||||
if (!alt_command)
|
||||
update_progress_type = (update_progress_type + 1) % UPT_MAX;
|
||||
|
|
|
@ -444,7 +444,7 @@ extern HWND hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel,
|
|||
extern HWND hInfo, hProgress, hDiskID;
|
||||
extern WORD selected_langid;
|
||||
extern DWORD FormatStatus, DownloadStatus, MainThreadId, LastWriteError;
|
||||
extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode;
|
||||
extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, op_in_progress, right_to_left_mode;
|
||||
extern BOOL allow_dual_uefi_bios, large_drive, usb_debug;
|
||||
extern int64_t iso_blocking_status;
|
||||
extern uint8_t image_options;
|
||||
|
@ -481,7 +481,6 @@ extern const char* StrError(DWORD error_code, BOOL use_default_locale);
|
|||
extern char* GuidToString(const GUID* guid);
|
||||
extern char* SizeToHumanReadable(uint64_t size, BOOL copy_to_log, BOOL fake_units);
|
||||
extern char* TimestampToHumanReadable(uint64_t ts);
|
||||
extern char* RateToHumanReadable(uint64_t transferred, uint64_t total);
|
||||
extern HWND MyCreateDialog(HINSTANCE hInstance, int Dialog_ID, HWND hWndParent, DLGPROC lpDialogFunc);
|
||||
extern INT_PTR MyDialogBox(HINSTANCE hInstance, int Dialog_ID, HWND hWndParent, DLGPROC lpDialogFunc);
|
||||
extern void CenterDialog(HWND hDlg, HWND hParent);
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -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.7.1563"
|
||||
CAPTION "Rufus 3.7.1564"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -394,8 +394,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,1563,0
|
||||
PRODUCTVERSION 3,7,1563,0
|
||||
FILEVERSION 3,7,1564,0
|
||||
PRODUCTVERSION 3,7,1564,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -413,13 +413,13 @@ BEGIN
|
|||
VALUE "Comments", "https://akeo.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "3.7.1563"
|
||||
VALUE "FileVersion", "3.7.1564"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus-3.7.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "3.7.1563"
|
||||
VALUE "ProductVersion", "3.7.1564"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
23
src/stdio.c
23
src/stdio.c
|
@ -695,29 +695,6 @@ char* TimestampToHumanReadable(uint64_t ts)
|
|||
return str;
|
||||
}
|
||||
|
||||
// TODO: Add granularity
|
||||
char* RateToHumanReadable(uint64_t transferred, uint64_t total)
|
||||
{
|
||||
const uint64_t refresh_rate = 1000;
|
||||
static uint64_t start_time, last_refresh = 0;
|
||||
uint64_t current_time, rate;
|
||||
if (total == 0) {
|
||||
// init
|
||||
start_time = GetTickCount64();
|
||||
last_refresh = start_time;
|
||||
} else {
|
||||
current_time = GetTickCount64();
|
||||
if (current_time <= start_time)
|
||||
return NULL;
|
||||
rate = (transferred * 1000) / (current_time - start_time);
|
||||
if (current_time > last_refresh + refresh_rate) {
|
||||
last_refresh = current_time;
|
||||
uprintf("%s/s", SizeToHumanReadable(rate, FALSE, FALSE));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Convert custom error code to messages
|
||||
const char* _StrError(DWORD error_code)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue