[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
This commit is contained in:
Pete Batard 2018-04-19 16:02:07 +01:00
parent 2c7e7030a3
commit 7221dee4d1
4 changed files with 19 additions and 19 deletions

View file

@ -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.