From 7221dee4d1bb2391c11e5aba8ce57c6f700e8930 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 19 Apr 2018 16:02:07 +0100 Subject: [PATCH] [core] disable file indexing by default * File indexing is too much of an annoyance on removable drives anyway and this should help with perf and access issues * Alt-Q cheat mode is now changed to re-enable file indexing * Also fix a rogue 'else' in the code --- src/format.c | 13 ++++++------- src/rufus.c | 13 +++++++------ src/rufus.rc | 10 +++++----- src/settings.h | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/format.c b/src/format.c index 5fe0dadd..00c1d05c 100644 --- a/src/format.c +++ b/src/format.c @@ -61,7 +61,7 @@ static int task_number = 0; extern const int nb_steps[FS_MAX]; extern uint32_t dur_mins, dur_secs; static int fs_index = 0, wintogo_index = -1; -extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, disable_file_indexing, write_as_image; +extern BOOL force_large_fat32, enable_ntfs_compression, lock_drive, zero_drive, enable_file_indexing, write_as_image; uint8_t *grub2_buf = NULL; long grub2_len; static BOOL WritePBR(HANDLE hLogicalDrive); @@ -1911,13 +1911,12 @@ DWORD WINAPI FormatThread(void* param) } 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 + // Disable file indexing, unless it was force-enabled by the user + if ((!enable_file_indexing) && ((fs == FS_NTFS) || (fs == FS_UDF) || (fs == FS_REFS))) { + uprintf("Disabling file indexing..."); + if (!SetFileAttributesA(guid_volume, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)) uprintf("Could not disable file indexing: %s", WindowsErrorString()); - } else + } // 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. diff --git a/src/rufus.c b/src/rufus.c index 0249b07f..2ef273eb 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -114,7 +114,7 @@ BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, dis 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 advanced_mode_device, advanced_mode_format, 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, disable_file_indexing, large_drive = FALSE, write_as_image = FALSE; +BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_indexing, large_drive = FALSE, write_as_image = FALSE; int dialog_showing = 0; uint16_t rufus_version[3], embedded_sl_version[2]; char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; @@ -3842,7 +3842,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine allow_dual_uefi_bios = ReadSettingBool(SETTING_ENABLE_WIN_DUAL_EFI_BIOS); force_large_fat32 = ReadSettingBool(SETTING_FORCE_LARGE_FAT32_FORMAT); enable_vmdk = ReadSettingBool(SETTING_ENABLE_VMDK_DETECTION); - disable_file_indexing = ReadSettingBool(SETTING_DISABLE_FILE_INDEXING); + enable_file_indexing = ReadSettingBool(SETTING_ENABLE_FILE_INDEXING); // Initialize the global scaling, in case we need it before we initialize the dialog hDC = GetDC(NULL); @@ -4114,11 +4114,12 @@ relaunch: SaveISO(); continue; } - // Alt-Q => Disable file indexing (for file systems that support it) + // Alt-Q => Enable file indexing (for file systems that support it) + // For multiple reasons, file indexing is disabled by default 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); + enable_file_indexing = !enable_file_indexing; + WriteSettingBool(SETTING_ENABLE_FILE_INDEXING, enable_file_indexing); + PrintStatusTimeout(lmprintf(MSG_290), !enable_file_indexing); continue; } // Alt-R => Remove all the registry keys that may have been created by Rufus diff --git a/src/rufus.rc b/src/rufus.rc index 6757e9a0..7407998a 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -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.0.1254" +CAPTION "Rufus 3.0.1255" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -371,8 +371,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,1254,0 - PRODUCTVERSION 3,0,1254,0 + FILEVERSION 3,0,1255,0 + PRODUCTVERSION 3,0,1255,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -389,13 +389,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.0.1254" + VALUE "FileVersion", "3.0.1255" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.0.1254" + VALUE "ProductVersion", "3.0.1255" END END BLOCK "VarFileInfo" diff --git a/src/settings.h b/src/settings.h index 73cebf08..2e1bddc9 100644 --- a/src/settings.h +++ b/src/settings.h @@ -45,7 +45,7 @@ extern char* ini_file; #define SETTING_ENABLE_WIN_DUAL_EFI_BIOS "EnableWindowsDualUefiBiosMode" #define SETTING_FORCE_LARGE_FAT32_FORMAT "ForceLargeFat32Formatting" #define SETTING_ENABLE_VMDK_DETECTION "EnableVmdkDetection" -#define SETTING_DISABLE_FILE_INDEXING "DisableFileIndexing" +#define SETTING_ENABLE_FILE_INDEXING "EnableFileIndexing"