1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] disable button and add a countdown when launching update

* Also disable Launch button while we do so
* Also add new <Ctrl>-<Alt>-<Y> cheat mode
* Also terminate update thread before exiting if running
* Also set version to rufus-next
This commit is contained in:
Pete Batard 2019-04-01 16:37:43 +01:00
parent f5fb5586c6
commit 2a1c57c750
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
10 changed files with 57 additions and 34 deletions

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for rufus 3.5.
# Generated by GNU Autoconf 2.69 for rufus 3.6.
#
# Report bugs to <https://github.com/pbatard/rufus/issues>.
#
@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='3.5'
PACKAGE_STRING='rufus 3.5'
PACKAGE_VERSION='3.6'
PACKAGE_STRING='rufus 3.6'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.ie'
@ -1228,7 +1228,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures rufus 3.5 to adapt to many kinds of systems.
\`configure' configures rufus 3.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1294,7 +1294,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rufus 3.5:";;
short | recursive ) echo "Configuration of rufus 3.6:";;
esac
cat <<\_ACEOF
@ -1385,7 +1385,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rufus configure 3.5
rufus configure 3.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1440,7 +1440,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by rufus $as_me 3.5, which was
It was created by rufus $as_me 3.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2303,7 +2303,7 @@ fi
# Define the identity of the package.
PACKAGE='rufus'
VERSION='3.5'
VERSION='3.6'
cat >>confdefs.h <<_ACEOF
@ -4481,7 +4481,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by rufus $as_me 3.5, which was
This file was extended by rufus $as_me 3.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -4535,7 +4535,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
rufus config.status 3.5
rufus config.status 3.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [3.5], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AC_INIT([rufus], [3.6], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4])

View file

@ -8,7 +8,7 @@
for an interesting struggle, when you also happen to have a comma in one of the fields... -->
<Identity
Name="Rufus"
Version="3.5.1497.0"
Version="3.6.1505.0"
ProcessorArchitecture="@ARCH@"
Publisher='CN=Akeo Consulting, O=Akeo Consulting, STREET=24 Grey Rock, L=Milford, S=Co. Donegal, PostalCode=F92 D667, C=IE' />
<Properties>

View file

@ -1,6 +1,6 @@
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set VERSION=3.5
set VERSION=3.6
del /q *.appx >NUL 2>&1
del /q *.appxbundle >NUL 2>&1

View file

@ -47,12 +47,12 @@
DWORD DownloadStatus;
BYTE* fido_script = NULL;
HANDLE update_check_thread = NULL;
extern loc_cmd* selected_locale;
extern HANDLE dialog_handle;
extern BOOL force_update, is_x86_32, close_fido_cookie_prompts;
extern BOOL is_x86_32, close_fido_cookie_prompts;
static DWORD error_code, fido_len = 0;
static BOOL update_check_in_progress = FALSE;
static BOOL force_update_check = FALSE;
/*
@ -645,7 +645,6 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
PF_INIT_OR_OUT(HttpSendRequestA, WinInet);
PF_INIT_OR_OUT(HttpQueryInfoA, WinInet);
update_check_in_progress = TRUE;
verbose = ReadSetting32(SETTING_VERBOSE_UPDATES);
// Without this the FileDialog will produce error 0x8001010E when compiled for Vista or later
IGNORE_RETVAL(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED));
@ -852,7 +851,7 @@ out:
PostMessage(hMainDialog, UM_NO_UPDATE, 0, 0);
}
force_update_check = FALSE;
update_check_in_progress = FALSE;
update_check_thread = NULL;
ExitThread(0);
}
@ -862,9 +861,11 @@ out:
BOOL CheckForUpdates(BOOL force)
{
force_update_check = force;
if (update_check_in_progress)
if (update_check_thread != NULL)
return FALSE;
if (CreateThread(NULL, 0, CheckForUpdatesThread, NULL, 0, NULL) == NULL) {
update_check_thread = CreateThread(NULL, 0, CheckForUpdatesThread, NULL, 0, NULL);
if (update_check_thread == NULL) {
uprintf("Unable to start update check thread");
return FALSE;
}

View file

@ -634,8 +634,8 @@ LONG ValidateSignature(HWND hDlg, const char* path)
r = TRUST_E_TIME_STAMP;
}
}
if (r != ERROR_SUCCESS)
MessageBoxExU(hDlg, lmprintf(MSG_300), lmprintf(MSG_299), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
if ((r != ERROR_SUCCESS) && (force_update < 2))
MessageBoxExU(hDlg, lmprintf(MSG_300), lmprintf(MSG_299), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
break;
case TRUST_E_NOSIGNATURE:
// Should already have been reported, but since we have a custom message for it...

View file

@ -75,6 +75,7 @@ static char szTimer[12] = "00:00:00";
static unsigned int timer;
static char uppercase_select[2][64], uppercase_start[64], uppercase_close[64], uppercase_cancel[64];
extern HANDLE update_check_thread;
extern BOOL enable_iso, enable_joliet, enable_rockridge;
extern BYTE* fido_script;
extern HWND hFidoDlg;
@ -103,7 +104,7 @@ 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 enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE;
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;
BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_indexing, large_drive = FALSE;
@ -112,6 +113,7 @@ uint64_t persistence_size = 0;
float fScale = 1.0f;
int dialog_showing = 0, selection_default = BT_IMAGE, windows_to_go_selection = 0, persistence_unit_selection = -1;
int default_fs, fs, bt, pt, tt; // file system, boot type, partition type, target type
int force_update = 0;
char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH];
char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
char embedded_sl_version_ext[2][32];
@ -3348,7 +3350,7 @@ relaunch:
// This will set the reported current version of Rufus to 0.0.0.0 when performing an update
// check, so that it always succeeds. This is useful for translators.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'Y')) {
force_update = !force_update;
force_update = (force_update > 0) ? 0 : 1;
PrintStatusTimeout(lmprintf(MSG_259), force_update);
continue;
}
@ -3391,6 +3393,14 @@ relaunch:
continue;
}
// Ctrl-Alt-Y => Force update check to be successful and ignore timestamp errors
if ((msg.message == WM_KEYDOWN) && (msg.wParam == 'Y') &&
(GetKeyState(VK_CONTROL) & 0x8000) && (GetKeyState(VK_MENU) & 0x8000)) {
force_update = (force_update > 0) ? 0 : 2;
PrintStatusTimeout(lmprintf(MSG_259), force_update);
continue;
}
// Let the system handle dialog messages (e.g. those from the tab key)
if (!IsDialogMessage(hDlg, &msg) && !IsDialogMessage(hLogDialog, &msg)) {
TranslateMessage(&msg);
@ -3411,6 +3421,9 @@ out:
ReleaseMutex(hogmutex);
safe_closehandle(hogmutex);
}
// Kill the update check thread if running
if (update_check_thread != NULL)
TerminateThread(update_check_thread, 1);
if ((!external_loc_file) && (loc_file[0] != 0))
DeleteFileU(loc_file);
DestroyAllTooltips();

View file

@ -454,7 +454,7 @@ extern uint16_t rufus_version[3], embedded_sl_version[2];
extern size_t ubuffer_pos;
extern const int nb_steps[FS_MAX];
extern float fScale;
extern int nWindowsVersion, nWindowsBuildNumber, dialog_showing;
extern int nWindowsVersion, nWindowsBuildNumber, dialog_showing, force_update;
extern int fs, bt, pt, tt;
extern unsigned long syslinux_ldlinux_len[2];
extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12];

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.5.1504"
CAPTION "Rufus 3.6.1505"
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,5,1504,0
PRODUCTVERSION 3,5,1504,0
FILEVERSION 3,6,1505,0
PRODUCTVERSION 3,6,1505,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.5.1504"
VALUE "FileVersion", "3.6.1505"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus-3.5.exe"
VALUE "OriginalFilename", "rufus-3.6.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.5.1504"
VALUE "ProductVersion", "3.6.1505"
END
END
BLOCK "VarFileInfo"

View file

@ -1629,6 +1629,7 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
static HFONT hyperlink_font = NULL;
static HANDLE hThread = NULL;
HWND hNotes;
LONG err;
DWORD exit_code;
STARTUPINFOA si;
PROCESS_INFORMATION pi;
@ -1694,12 +1695,20 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR
}
hThread = NULL;
Sleep(1000); // Add a delay on account of antivirus scanners
EnableWindow(GetDlgItem(hDlg, IDC_DOWNLOAD), FALSE);
// Add a 1.5 sec delay, with coundown, on account of antivirus scanners
SetWindowTextA(GetDlgItem(hDlg, IDC_DOWNLOAD), "3");
Sleep(500);
SetWindowTextA(GetDlgItem(hDlg, IDC_DOWNLOAD), "2");
Sleep(500);
SetWindowTextA(GetDlgItem(hDlg, IDC_DOWNLOAD), "1");
Sleep(500);
SetWindowTextU(GetDlgItem(hDlg, IDC_DOWNLOAD), lmprintf(MSG_142));
if (ValidateSignature(hDlg, filepath) != NO_ERROR) {
// Unconditionally delete the download and disable the "Launch" control
err = ValidateSignature(hDlg, filepath);
if ((err != NO_ERROR) && ((force_update < 2) || (err != TRUST_E_TIME_STAMP))) {
// Unconditionally delete the download
DeleteFileU(filepath);
EnableWindow(GetDlgItem(hDlg, IDC_DOWNLOAD), FALSE);
break;
}