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

[core] don't process DBT_DEVNODES_CHANGED when scanning an image

* Since 8814944c35 we may mount an ISO for the lookup of the Windows version,
  which produces DBT_DEVNODES_CHANGED messages being issued when the virtual DVD is being created or removed
* This in turn leads to unwanted device refreshes.
* This patch makes sure we ignore DBT_DEVNODES_CHANGED while scanning.
* Also improve comments in iso.c.
This commit is contained in:
Pete Batard 2022-11-16 16:50:53 +00:00
parent 165127d221
commit a6769e4fb2
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 16 additions and 10 deletions

View file

@ -368,8 +368,7 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
// line to their grub.cfg, which means that their kernel option token is no longer
//'linux' but '$linux'... and we have to add a workaround for that.
// Finally, newer Arch and derivatives added an extra "search --label ..." command
// in GRUB which we need to cater for in supplement to the kernel line.
// in their GRUB conf, which we need to cater for in supplement of the kernel line.
static const char* grub_token[] = { "linux", "linuxefi", "$linux", "search" };
iso_label = replace_char(img_report.label, ' ', "\\x20");
usb_label = replace_char(img_report.usb_label, ' ', "\\x20");
@ -385,11 +384,9 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
uprintf(" Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label);
modified = TRUE;
}
//
// Since version 8.2, and https://github.com/rhinstaller/anaconda/commit/a7661019546ec1d8b0935f9cb0f151015f2e1d95,
// Red Hat derivatives have changed their CD-ROM detection policy which leads to the installation source
// not being found. So we need to use 'inst.repo' instead of 'inst.stage2' in the kernel options.
//
if (img_report.rh8_derivative && (replace_in_token_data(src, props->is_grub_cfg ?
"linuxefi" : "append", "inst.stage2", "inst.repo", TRUE) != NULL)) {
uprintf(" Patched %s: '%s' ➔ '%s'\n", src, "inst.stage2", "inst.repo");

View file

@ -75,6 +75,7 @@ static BOOL img_provided = FALSE;
static BOOL user_notified = FALSE;
static BOOL relaunch = FALSE;
static BOOL dont_display_image_name = FALSE;
static BOOL dont_process_dbt_devnodes = FALSE;
static BOOL user_changed_label = FALSE;
static BOOL user_deleted_rufus_dir = FALSE;
static BOOL app_changed_label = FALSE;
@ -1276,6 +1277,10 @@ DWORD WINAPI ImageScanThread(LPVOID param)
uint8_t arch;
char tmp_path[MAX_PATH], tmp_str[64];
// We may mount an ISO during the lookup of the Windows version, which
// produces DBT_DEVNODES_CHANGED messages that lead to unwanted device
// refreshes. So make sure to ignore DBT_DEVNODES_CHANGED while scanning.
dont_process_dbt_devnodes = TRUE;
if (image_path == NULL)
goto out;
PrintInfoDebug(0, MSG_202);
@ -1414,6 +1419,7 @@ DWORD WINAPI ImageScanThread(LPVOID param)
out:
dont_display_image_name = FALSE;
dont_process_dbt_devnodes = FALSE;
PrintInfo(0, MSG_210);
ExitThread(0);
}
@ -2791,7 +2797,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
return (INT_PTR)TRUE;
case DBT_DEVNODES_CHANGED:
// If it's been more than a second since last device refresh, arm a refresh timer
if (GetTickCount64() > LastRefresh + 1000) {
if (dont_process_dbt_devnodes) {
// This ensures we don't get unwanted refreshes while scanning an image.
LastRefresh = GetTickCount64();
} else if (GetTickCount64() > LastRefresh + 1000) {
LastRefresh = GetTickCount64();
SetTimer(hMainDialog, TID_REFRESH_TIMER, 1000, RefreshTimer);
}

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.21.1944"
CAPTION "Rufus 3.21.1945"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -396,8 +396,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,21,1944,0
PRODUCTVERSION 3,21,1944,0
FILEVERSION 3,21,1945,0
PRODUCTVERSION 3,21,1945,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -415,13 +415,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.21.1944"
VALUE "FileVersion", "3.21.1945"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.21.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.21.1944"
VALUE "ProductVersion", "3.21.1945"
END
END
BLOCK "VarFileInfo"