[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

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;
}