mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] add a cheat mode to disable file indexing after format
* New cheat mode is Alt-Q, and gets preserved between sessions * Only for file systems that support it (NTFS, UDF and ReFS)
This commit is contained in:
		
							parent
							
								
									d9a928f5bc
								
							
						
					
					
						commit
						5d3be6ca51
					
				
					 7 changed files with 50 additions and 9 deletions
				
			
		|  | @ -551,6 +551,7 @@ t MSG_286 "Zeroing drive: %0.1f%% completed" | ||||||
| t MSG_287 "Detection of non-USB removable drives" | t MSG_287 "Detection of non-USB removable drives" | ||||||
| t MSG_288 "Missing elevated privileges" | t MSG_288 "Missing elevated privileges" | ||||||
| t MSG_289 "This application can only run with elevated privileges" | t MSG_289 "This application can only run with elevated privileges" | ||||||
|  | t MSG_290 "File Indexing" | ||||||
| 
 | 
 | ||||||
| ################################################################################ | ################################################################################ | ||||||
| ############################# TRANSLATOR END COPY ############################## | ############################# TRANSLATOR END COPY ############################## | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -61,7 +61,7 @@ static int task_number = 0; | ||||||
| extern const int nb_steps[FS_MAX]; | extern const int nb_steps[FS_MAX]; | ||||||
| extern uint32_t dur_mins, dur_secs; | extern uint32_t dur_mins, dur_secs; | ||||||
| static int fs_index = 0; | static int fs_index = 0; | ||||||
| extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive; | extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, disable_file_indexing; | ||||||
| uint8_t *grub2_buf = NULL; | uint8_t *grub2_buf = NULL; | ||||||
| long grub2_len; | long grub2_len; | ||||||
| static BOOL WritePBR(HANDLE hLogicalDrive); | static BOOL WritePBR(HANDLE hLogicalDrive); | ||||||
|  | @ -1811,6 +1811,14 @@ DWORD WINAPI FormatThread(void* param) | ||||||
| 	} | 	} | ||||||
| 	CHECK_FOR_USER_CANCEL; | 	CHECK_FOR_USER_CANCEL; | ||||||
| 
 | 
 | ||||||
|  | 	// Disable file indexing if the option was selected by the user
 | ||||||
|  | 	if ((disable_file_indexing) && ((fs == FS_NTFS) || (fs == FS_UDF) || (fs == FS_REFS))) { | ||||||
|  | 		if (SetFileAttributesA(guid_volume, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)) | ||||||
|  | 			uprintf("File indexing has been set to: Disabled"); | ||||||
|  | 		else | ||||||
|  | 			uprintf("Could not disable file indexing: %s", WindowsErrorString()); | ||||||
|  | 	} else | ||||||
|  | 
 | ||||||
| 	// Refresh the drive label - This is needed as Windows may have altered it from
 | 	// Refresh the drive label - This is needed as Windows may have altered it from
 | ||||||
| 	// the name we proposed, and we require an exact label, to patch config files.
 | 	// the name we proposed, and we require an exact label, to patch config files.
 | ||||||
| 	if (!GetVolumeInformationU(drive_name, img_report.usb_label, ARRAYSIZE(img_report.usb_label), | 	if (!GetVolumeInformationU(drive_name, img_report.usb_label, ARRAYSIZE(img_report.usb_label), | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| /*
 | /*
 | ||||||
|  * Rufus: The Reliable USB Formatting Utility |  * Rufus: The Reliable USB Formatting Utility | ||||||
|  * Localization tables - autogenerated from resource.h |  * Localization tables - autogenerated from resource.h | ||||||
|  * Copyright © 2013-2015 Pete Batard <pete@akeo.ie> |  * Copyright © 2013-2016 Pete Batard <pete@akeo.ie> | ||||||
|  * |  * | ||||||
|  * This program is free software: you can redistribute it and/or modify |  * This program is free software: you can redistribute it and/or modify | ||||||
|  * it under the terms of the GNU General Public License as published by |  * it under the terms of the GNU General Public License as published by | ||||||
|  | @ -399,6 +399,16 @@ const loc_control_id control_id[] = { | ||||||
| 	LOC_CTRL(MSG_287), | 	LOC_CTRL(MSG_287), | ||||||
| 	LOC_CTRL(MSG_288), | 	LOC_CTRL(MSG_288), | ||||||
| 	LOC_CTRL(MSG_289), | 	LOC_CTRL(MSG_289), | ||||||
|  | 	LOC_CTRL(MSG_290), | ||||||
|  | 	LOC_CTRL(MSG_291), | ||||||
|  | 	LOC_CTRL(MSG_292), | ||||||
|  | 	LOC_CTRL(MSG_293), | ||||||
|  | 	LOC_CTRL(MSG_294), | ||||||
|  | 	LOC_CTRL(MSG_295), | ||||||
|  | 	LOC_CTRL(MSG_296), | ||||||
|  | 	LOC_CTRL(MSG_297), | ||||||
|  | 	LOC_CTRL(MSG_298), | ||||||
|  | 	LOC_CTRL(MSG_299), | ||||||
| 	LOC_CTRL(MSG_MAX), | 	LOC_CTRL(MSG_MAX), | ||||||
| 	LOC_CTRL(IDOK), | 	LOC_CTRL(IDOK), | ||||||
| 	LOC_CTRL(IDCANCEL), | 	LOC_CTRL(IDCANCEL), | ||||||
|  |  | ||||||
|  | @ -437,7 +437,17 @@ | ||||||
| #define MSG_287                         3287 | #define MSG_287                         3287 | ||||||
| #define MSG_288                         3288 | #define MSG_288                         3288 | ||||||
| #define MSG_289                         3289 | #define MSG_289                         3289 | ||||||
| #define MSG_MAX                         3290 | #define MSG_290                         3290 | ||||||
|  | #define MSG_291                         3291 | ||||||
|  | #define MSG_292                         3292 | ||||||
|  | #define MSG_293                         3293 | ||||||
|  | #define MSG_294                         3294 | ||||||
|  | #define MSG_295                         3295 | ||||||
|  | #define MSG_296                         3296 | ||||||
|  | #define MSG_297                         3297 | ||||||
|  | #define MSG_298                         3298 | ||||||
|  | #define MSG_299                         3299 | ||||||
|  | #define MSG_MAX                         3300 | ||||||
| 
 | 
 | ||||||
| // Next default values for new objects
 | // Next default values for new objects
 | ||||||
| // 
 | // 
 | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -109,7 +109,7 @@ BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, tog | ||||||
| BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE; | BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE; | ||||||
| BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE; | BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE; | ||||||
| BOOL advanced_mode, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug, use_fake_units, preserve_timestamps; | BOOL advanced_mode, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug, use_fake_units, preserve_timestamps; | ||||||
| BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE; | BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, disable_file_indexing; | ||||||
| int dialog_showing = 0, lang_button_id = 0; | int dialog_showing = 0, lang_button_id = 0; | ||||||
| uint16_t rufus_version[3], embedded_sl_version[2]; | uint16_t rufus_version[3], embedded_sl_version[2]; | ||||||
| char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; | char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; | ||||||
|  | @ -2964,6 +2964,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 	allow_dual_uefi_bios = ReadSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS); | 	allow_dual_uefi_bios = ReadSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS); | ||||||
| 	force_large_fat32 = ReadSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT); | 	force_large_fat32 = ReadSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT); | ||||||
| 	enable_vmdk = ReadSettingBool(SETTING_ENABLE_VMDK_DETECTION); | 	enable_vmdk = ReadSettingBool(SETTING_ENABLE_VMDK_DETECTION); | ||||||
|  | 	disable_file_indexing = ReadSettingBool(SETTING_DISABLE_FILE_INDEXING); | ||||||
| 
 | 
 | ||||||
| 	// Initialize the global scaling, in case we need it before we initialize the dialog
 | 	// Initialize the global scaling, in case we need it before we initialize the dialog
 | ||||||
| 	hDC = GetDC(NULL); | 	hDC = GetDC(NULL); | ||||||
|  | @ -3112,6 +3113,8 @@ relaunch: | ||||||
| 
 | 
 | ||||||
| 	// Do our own event processing and process "magic" commands
 | 	// Do our own event processing and process "magic" commands
 | ||||||
| 	while(GetMessage(&msg, NULL, 0, 0)) { | 	while(GetMessage(&msg, NULL, 0, 0)) { | ||||||
|  | 		// ** *****  **** *  ******** *
 | ||||||
|  | 		// .,ABCDEFGHIJKLMNOPQRSTUVWXYZ
 | ||||||
| 
 | 
 | ||||||
| 		// Ctrl-A => Select the log data
 | 		// Ctrl-A => Select the log data
 | ||||||
| 		if ( (IsWindowVisible(hLogDlg)) && (GetKeyState(VK_CONTROL) & 0x8000) && | 		if ( (IsWindowVisible(hLogDlg)) && (GetKeyState(VK_CONTROL) & 0x8000) && | ||||||
|  | @ -3220,6 +3223,14 @@ relaunch: | ||||||
| 			PrintStatusTimeout(lmprintf(MSG_260), enable_ntfs_compression); | 			PrintStatusTimeout(lmprintf(MSG_260), enable_ntfs_compression); | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
|  | 		// Alt-Q => Disable file indexing (for file systems that support it)
 | ||||||
|  | 		if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'Q')) { | ||||||
|  | 			disable_file_indexing = !disable_file_indexing; | ||||||
|  | 			WriteSettingBool(SETTING_DISABLE_FILE_INDEXING, disable_file_indexing); | ||||||
|  | 			PrintStatusTimeout(lmprintf(MSG_290), !disable_file_indexing); | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		// Alt-R => Remove all the registry keys that may have been created by Rufus
 | 		// Alt-R => Remove all the registry keys that may have been created by Rufus
 | ||||||
| 		if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) { | 		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); | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 376 | IDD_DIALOG DIALOGEX 12, 12, 242, 376 | ||||||
| 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 2.11.988" | CAPTION "Rufus 2.11.989" | ||||||
| FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -320,8 +320,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,11,988,0 |  FILEVERSION 2,11,989,0 | ||||||
|  PRODUCTVERSION 2,11,988,0 |  PRODUCTVERSION 2,11,989,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -338,13 +338,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" |             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "2.11.988" |             VALUE "FileVersion", "2.11.989" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus.exe" |             VALUE "OriginalFilename", "rufus.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "2.11.988" |             VALUE "ProductVersion", "2.11.989" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -43,6 +43,7 @@ extern char* ini_file; | ||||||
| #define SETTING_ENABLE_WIN_DUAL_EFI_BIOS    "EnableWindowsDualUefiBiosMode" | #define SETTING_ENABLE_WIN_DUAL_EFI_BIOS    "EnableWindowsDualUefiBiosMode" | ||||||
| #define SETTING_FORCE_LARGE_FAT32_FORMAT    "ForceLargeFat32Formatting" | #define SETTING_FORCE_LARGE_FAT32_FORMAT    "ForceLargeFat32Formatting" | ||||||
| #define SETTING_ENABLE_VMDK_DETECTION       "EnableVmdkDetection" | #define SETTING_ENABLE_VMDK_DETECTION       "EnableVmdkDetection" | ||||||
|  | #define SETTING_DISABLE_FILE_INDEXING       "DisableFileIndexing" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue