From 09afb91c897e8617b632a6c8cbaab0a98e21549b Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 1 Sep 2018 00:47:40 +0200 Subject: Windows: extended Windows defragmenter workaround to Windows 8.1 --- src/Driver/Ntdriver.c | 6 +++--- src/Mount/Mount.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c index e8fb2824..5243b34c 100644 --- a/src/Driver/Ntdriver.c +++ b/src/Driver/Ntdriver.c @@ -1264,9 +1264,9 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: Dump ("ProcessVolumeDeviceControlIrp (IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS)\n"); - // Vista's and Windows 10 filesystem defragmenter fails if IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS does not succeed. + // Vista's, Windows 8.1 and later filesystem defragmenter fails if IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS does not succeed. if (!(OsMajorVersion == 6 && OsMinorVersion == 0) - && !(OsMajorVersion == 10 && AllowWindowsDefrag && Extension->bRawDevice) + && !(IsOSAtLeast (WIN_8_1) && AllowWindowsDefrag && Extension->bRawDevice) ) { Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; @@ -1277,7 +1277,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION VOLUME_DISK_EXTENTS *extents = (VOLUME_DISK_EXTENTS *) Irp->AssociatedIrp.SystemBuffer; - if (OsMajorVersion == 10) + if (IsOSAtLeast (WIN_8_1)) { // Windows 10 filesystem defragmenter works only if we report an extent with a real disk number // So in the case of a VeraCrypt disk based volume, we use the disk number diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index b2646017..7b42bc4b 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -10896,10 +10896,10 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM CheckDlgButton (hwndDlg, IDC_ENABLE_HARDWARE_ENCRYPTION, (driverConfig & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION) ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton (hwndDlg, IDC_ENABLE_EXTENDED_IOCTL_SUPPORT, (driverConfig & TC_DRIVER_CONFIG_ENABLE_EXTENDED_IOCTL) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton (hwndDlg, IDC_ALLOW_TRIM_NONSYS_SSD, (driverConfig & VC_DRIVER_CONFIG_ALLOW_NONSYS_TRIM) ? BST_CHECKED : BST_UNCHECKED); - // checkbox for Windows Defragmenter only usuable on Windows 10 - // on previous version, we can not control Windows defragmenter so + // checkbox for Windows Defragmenter only usuable starting from Windows 8.1 + // on previous versions, we can not control Windows defragmenter so // this settings is always checked. - if (CurrentOSMajor >= 10) + if (IsOSAtLeast (WIN_8_1)) CheckDlgButton (hwndDlg, IDC_ALLOW_WINDOWS_DEFRAG, (driverConfig & VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG) ? BST_CHECKED : BST_UNCHECKED); else { @@ -11002,7 +11002,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION, disableHW); SetDriverConfigurationFlag (TC_DRIVER_CONFIG_ENABLE_EXTENDED_IOCTL, enableExtendedIOCTL); SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_NONSYS_TRIM, allowTrimCommand); - if (CurrentOSMajor >= 10) + if (IsOSAtLeast (WIN_8_1)) SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ALLOW_WINDOWS_DEFRAG, allowWindowsDefrag); DWORD bytesReturned; -- cgit v1.2.3