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:
		
							parent
							
								
									165127d221
								
							
						
					
					
						commit
						a6769e4fb2
					
				
					 3 changed files with 16 additions and 10 deletions
				
			
		|  | @ -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
 | 		// 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.
 | 		//'linux' but '$linux'... and we have to add a workaround for that.
 | ||||||
| 		// Finally, newer Arch and derivatives added an extra "search --label ..." command
 | 		// 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" }; | 		static const char* grub_token[] = { "linux", "linuxefi", "$linux", "search" }; | ||||||
| 		iso_label = replace_char(img_report.label, ' ', "\\x20"); | 		iso_label = replace_char(img_report.label, ' ', "\\x20"); | ||||||
| 		usb_label = replace_char(img_report.usb_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); | 				uprintf("  Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label); | ||||||
| 				modified = TRUE; | 				modified = TRUE; | ||||||
| 			} | 			} | ||||||
| 			//
 |  | ||||||
| 			// Since version 8.2, and https://github.com/rhinstaller/anaconda/commit/a7661019546ec1d8b0935f9cb0f151015f2e1d95,
 | 			// 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
 | 			// 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.
 | 			// 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 ? | 			if (img_report.rh8_derivative && (replace_in_token_data(src, props->is_grub_cfg ? | ||||||
| 				"linuxefi" : "append", "inst.stage2", "inst.repo", TRUE) != NULL)) { | 				"linuxefi" : "append", "inst.stage2", "inst.repo", TRUE) != NULL)) { | ||||||
| 				uprintf("  Patched %s: '%s' ➔ '%s'\n", src, "inst.stage2", "inst.repo"); | 				uprintf("  Patched %s: '%s' ➔ '%s'\n", src, "inst.stage2", "inst.repo"); | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -75,6 +75,7 @@ static BOOL img_provided = FALSE; | ||||||
| static BOOL user_notified = FALSE; | static BOOL user_notified = FALSE; | ||||||
| static BOOL relaunch = FALSE; | static BOOL relaunch = FALSE; | ||||||
| static BOOL dont_display_image_name = FALSE; | static BOOL dont_display_image_name = FALSE; | ||||||
|  | static BOOL dont_process_dbt_devnodes = FALSE; | ||||||
| static BOOL user_changed_label = FALSE; | static BOOL user_changed_label = FALSE; | ||||||
| static BOOL user_deleted_rufus_dir = FALSE; | static BOOL user_deleted_rufus_dir = FALSE; | ||||||
| static BOOL app_changed_label = FALSE; | static BOOL app_changed_label = FALSE; | ||||||
|  | @ -1276,6 +1277,10 @@ DWORD WINAPI ImageScanThread(LPVOID param) | ||||||
| 	uint8_t arch; | 	uint8_t arch; | ||||||
| 	char tmp_path[MAX_PATH], tmp_str[64]; | 	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) | 	if (image_path == NULL) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	PrintInfoDebug(0, MSG_202); | 	PrintInfoDebug(0, MSG_202); | ||||||
|  | @ -1414,6 +1419,7 @@ DWORD WINAPI ImageScanThread(LPVOID param) | ||||||
| 
 | 
 | ||||||
| out: | out: | ||||||
| 	dont_display_image_name = FALSE; | 	dont_display_image_name = FALSE; | ||||||
|  | 	dont_process_dbt_devnodes = FALSE; | ||||||
| 	PrintInfo(0, MSG_210); | 	PrintInfo(0, MSG_210); | ||||||
| 	ExitThread(0); | 	ExitThread(0); | ||||||
| } | } | ||||||
|  | @ -2791,7 +2797,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				return (INT_PTR)TRUE; | 				return (INT_PTR)TRUE; | ||||||
| 			case DBT_DEVNODES_CHANGED: | 			case DBT_DEVNODES_CHANGED: | ||||||
| 				// If it's been more than a second since last device refresh, arm a refresh timer
 | 				// 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(); | 					LastRefresh = GetTickCount64(); | ||||||
| 					SetTimer(hMainDialog, TID_REFRESH_TIMER, 1000, RefreshTimer); | 					SetTimer(hMainDialog, TID_REFRESH_TIMER, 1000, RefreshTimer); | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 3.21.1944" | CAPTION "Rufus 3.21.1945" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -396,8 +396,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,21,1944,0 |  FILEVERSION 3,21,1945,0 | ||||||
|  PRODUCTVERSION 3,21,1944,0 |  PRODUCTVERSION 3,21,1945,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -415,13 +415,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://rufus.ie" |             VALUE "Comments", "https://rufus.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "3.21.1944" |             VALUE "FileVersion", "3.21.1945" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||||
|             VALUE "OriginalFilename", "rufus-3.21.exe" |             VALUE "OriginalFilename", "rufus-3.21.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.21.1944" |             VALUE "ProductVersion", "3.21.1945" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue