mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-12 11:28:26 -06:00
Windows: Add option to block TRIM command on system encryption SSD drives.
This commit is contained in:
@@ -11109,6 +11109,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
||||
uint16 bootLoaderVersion = 0;
|
||||
BOOL bPasswordCacheEnabled = (driverConfig & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD)? TRUE : FALSE;
|
||||
BOOL bPimCacheEnabled = (driverConfig & TC_DRIVER_CONFIG_CACHE_BOOT_PIM)? TRUE : FALSE;
|
||||
BOOL bBlockSysEncTrimEnabled = (driverConfig & VC_DRIVER_CONFIG_BLOCK_SYS_TRIM)? TRUE : FALSE;
|
||||
|
||||
if (!BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig, &customUserMessage, &bootLoaderVersion))
|
||||
{
|
||||
@@ -11150,6 +11151,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
||||
CheckDlgButton (hwndDlg, IDC_BOOT_LOADER_CACHE_PASSWORD, bPasswordCacheEnabled ? BST_CHECKED : BST_UNCHECKED);
|
||||
EnableWindow (GetDlgItem (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM), bPasswordCacheEnabled);
|
||||
CheckDlgButton (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton (hwndDlg, IDC_BLOCK_SYSENC_TRIM, bBlockSysEncTrimEnabled ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
catch (Exception &e)
|
||||
{
|
||||
@@ -11261,10 +11263,12 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
||||
{
|
||||
BOOL bPasswordCacheEnabled = IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PASSWORD);
|
||||
BOOL bPimCacheEnabled = IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM);
|
||||
BOOL bBlockSysEncTrimEnabled = IsDlgButtonChecked (hwndDlg, IDC_BLOCK_SYSENC_TRIM);
|
||||
BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim, prop.pkcs5);
|
||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD, bPasswordCacheEnabled);
|
||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? TRUE : FALSE);
|
||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_EVIL_MAID_ATTACK_DETECTION, IsDlgButtonChecked (hwndDlg, IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION));
|
||||
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_BLOCK_SYS_TRIM, bBlockSysEncTrimEnabled);
|
||||
}
|
||||
catch (Exception &e)
|
||||
{
|
||||
|
||||
@@ -285,26 +285,28 @@ BEGIN
|
||||
LTEXT "",IDT_PKCS11_LIB_HELP,16,63,286,65
|
||||
END
|
||||
|
||||
IDD_EFI_SYSENC_SETTINGS DIALOGEX 0, 0, 374, 165
|
||||
IDD_EFI_SYSENC_SETTINGS DIALOGEX 0, 0, 375, 182
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "VeraCrypt - System Encryption Settings"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,68,339,10
|
||||
DEFPUSHBUTTON "OK",IDOK,255,141,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,313,141,50,14
|
||||
GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,8,7,355,45
|
||||
GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,7,53,355,44
|
||||
CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM,
|
||||
"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,16,83,340,10
|
||||
CONTROL "Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk)",IDC_DISABLE_BOOT_LOADER_PIM_PROMPT,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,20,339,9
|
||||
CONTROL "Do not request Hash algorithm in the pre-boot authentication screen",IDC_DISABLE_BOOT_LOADER_HASH_PROMPT,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,35,339,9
|
||||
PUSHBUTTON "Display EFI Platform Information",IDC_SHOW_PLATFORMINFO,187,112,173,14
|
||||
PUSHBUTTON "Edit Boot Loader Configuration",IDC_EDIT_DCSPROP,10,112,173,14
|
||||
GROUPBOX "Advanced Options",IDT_ADVANCED_OPTIONS,7,99,355,36
|
||||
GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,7,53,355,61
|
||||
CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,68,339,10
|
||||
CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM,
|
||||
"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,16,83,340,10
|
||||
CONTROL "Block TRIM command on system partition/drive",IDC_BLOCK_SYSENC_TRIM,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,98,340,10
|
||||
GROUPBOX "Advanced Options",IDT_ADVANCED_OPTIONS,7,116,355,36
|
||||
PUSHBUTTON "Edit Boot Loader Configuration",IDC_EDIT_DCSPROP,10,129,173,14
|
||||
PUSHBUTTON "Display EFI Platform Information",IDC_SHOW_PLATFORMINFO,187,129,173,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,313,158,50,14
|
||||
DEFPUSHBUTTON "OK",IDOK,255,158,50,14
|
||||
END
|
||||
|
||||
IDD_PERFORMANCE_SETTINGS DIALOGEX 0, 0, 371, 253
|
||||
@@ -389,7 +391,7 @@ BEGIN
|
||||
CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,76,10
|
||||
END
|
||||
|
||||
IDD_SYSENC_SETTINGS DIALOGEX 0, 0, 370, 286
|
||||
IDD_SYSENC_SETTINGS DIALOGEX 0, 0, 371, 297
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "VeraCrypt - System Encryption Settings"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
@@ -397,22 +399,24 @@ BEGIN
|
||||
CONTROL "Do not &show any texts in the pre-boot authentication screen (except the below custom message)",IDC_DISABLE_BOOT_LOADER_OUTPUT,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,20,339,9
|
||||
EDITTEXT IDC_CUSTOM_BOOT_LOADER_MESSAGE,18,50,216,14,ES_AUTOHSCROLL
|
||||
CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,192,339,10
|
||||
CONTROL "Allow pre-boot &authentication to be bypassed by pressing the Esc key (enables boot manager)",IDC_ALLOW_ESC_PBA_BYPASS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,222,340,10
|
||||
DEFPUSHBUTTON "OK",IDOK,257,262,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,313,262,50,14
|
||||
LTEXT "Display this custom message in the pre-boot authentication screen (24 characters maximum):",IDT_CUSTOM_BOOT_LOADER_MESSAGE,18,39,337,8
|
||||
GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,8,7,355,165
|
||||
GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,8,177,355,75
|
||||
LTEXT "",IDC_CUSTOM_BOOT_LOADER_MESSAGE_HELP,18,72,337,73
|
||||
CONTROL "Disable ""Evil Maid"" attack detection",IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,237,340,10
|
||||
CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM,
|
||||
"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,18,207,340,10
|
||||
CONTROL "Do not request PIM in the pre-boot authentication screen (PIM value is stored unencrypted on disk)",IDC_DISABLE_BOOT_LOADER_PIM_PROMPT,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,157,339,9
|
||||
CONTROL "&Cache pre-boot authentication password in driver memory (for mounting of non-system volumes)",IDC_BOOT_LOADER_CACHE_PASSWORD,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,192,339,10
|
||||
CONTROL "Include PIM when caching pre-boot authentication password",IDC_BOOT_LOADER_CACHE_PIM,
|
||||
"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,18,207,340,10
|
||||
CONTROL "Allow pre-boot &authentication to be bypassed by pressing the Esc key (enables boot manager)",IDC_ALLOW_ESC_PBA_BYPASS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,222,340,10
|
||||
CONTROL "Disable ""Evil Maid"" attack detection",IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,237,340,10
|
||||
CONTROL "Block TRIM command on system partition/drive",IDC_BLOCK_SYSENC_TRIM,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,251,340,10
|
||||
PUSHBUTTON "Cancel",IDCANCEL,314,273,50,14
|
||||
DEFPUSHBUTTON "OK",IDOK,257,273,50,14
|
||||
LTEXT "Display this custom message in the pre-boot authentication screen (24 characters maximum):",IDT_CUSTOM_BOOT_LOADER_MESSAGE,18,39,337,8
|
||||
GROUPBOX "Boot Loader Screen Options",IDT_BOOT_LOADER_SCREEN_OPTIONS,9,7,355,165
|
||||
GROUPBOX "Security Options",IDT_SECURITY_OPTIONS,9,177,355,92
|
||||
LTEXT "",IDC_CUSTOM_BOOT_LOADER_MESSAGE_HELP,18,72,337,73
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -486,9 +490,9 @@ BEGIN
|
||||
IDD_EFI_SYSENC_SETTINGS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 367
|
||||
RIGHTMARGIN, 368
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 155
|
||||
BOTTOMMARGIN, 172
|
||||
END
|
||||
|
||||
IDD_PERFORMANCE_SETTINGS, DIALOG
|
||||
@@ -518,9 +522,9 @@ BEGIN
|
||||
IDD_SYSENC_SETTINGS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 363
|
||||
RIGHTMARGIN, 364
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 276
|
||||
BOTTOMMARGIN, 287
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
@@ -188,6 +188,7 @@
|
||||
#define IDC_EDIT_DCSPROP 1165
|
||||
#define IDT_ADVANCED_OPTIONS 1166
|
||||
#define IDC_ALLOW_TRIM_NONSYS_SSD 1167
|
||||
#define IDC_BLOCK_SYSENC_TRIM 1168
|
||||
#define IDM_HELP 40001
|
||||
#define IDM_ABOUT 40002
|
||||
#define IDM_UNMOUNT_VOLUME 40003
|
||||
@@ -264,7 +265,7 @@
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 120
|
||||
#define _APS_NEXT_COMMAND_VALUE 40069
|
||||
#define _APS_NEXT_CONTROL_VALUE 1168
|
||||
#define _APS_NEXT_CONTROL_VALUE 1169
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user