From 76c64d49ea96719bf1a5d185053619001b0aa533 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 24 Sep 2023 01:26:02 +0200 Subject: Windows: Add tooltip message and help button for new option to disable memory protection Also a dedicated page in the documentation was added for it. --- src/Mount/Mount.c | 24 ++++++++++++++++++++++++ src/Mount/Mount.rc | 3 ++- src/Mount/Resource.h | 6 +++--- 3 files changed, 29 insertions(+), 4 deletions(-) (limited to 'src/Mount') diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 28418a44..76de34b6 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -11574,6 +11574,7 @@ void NotifyService (DWORD dwNotifyCmd) static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + static HWND hDisableMemProtectionTooltipWnd = NULL; WORD lw = LOWORD (wParam); switch (msg) @@ -11652,9 +11653,24 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_HW_ACCELERATION); ToHyperlink (hwndDlg, IDC_MORE_INFO_ON_THREAD_BASED_PARALLELIZATION); + + hDisableMemProtectionTooltipWnd = CreateToolTip (IDC_DISABLE_MEMORY_PROTECTION, hwndDlg, "DISABLE_MEMORY_PROTECTION_WARNING"); + // make IDC_DISABLE_MEMORY_PROTECTION control fit the text so that the tooltip is shown only when mouse is over the text + AccommodateCheckBoxTextWidth(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION); + // make the help button adjacent to the checkbox + MakeControlsContiguous(hwndDlg, IDC_DISABLE_MEMORY_PROTECTION, IDC_DISABLE_MEMORY_PROTECTION_HELP); } return 0; + // handle message to destroy hDisableMemProtectionTooltipWnd when the dialog is closed + case WM_DESTROY: + if (hDisableMemProtectionTooltipWnd) + { + DestroyWindow (hDisableMemProtectionTooltipWnd); + hDisableMemProtectionTooltipWnd = NULL; + } + break; + case WM_COMMAND: switch (lw) @@ -11852,10 +11868,18 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM BOOL originalDisableMemoryProtection = !ReadMemoryProtectionConfig(); if (disableMemoryProtection != originalDisableMemoryProtection) { + if (disableMemoryProtection) + { + Warning ("DISABLE_MEMORY_PROTECTION_WARNING", hwndDlg); + } + Warning ("SETTING_REQUIRES_REBOOT", hwndDlg); } } return 1; + case IDC_DISABLE_MEMORY_PROTECTION_HELP: + Applink ("memoryprotection"); + return 1; case IDC_BENCHMARK: Benchmark (hwndDlg); return 1; diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc index 9e823493..553914b5 100644 --- a/src/Mount/Mount.rc +++ b/src/Mount/Mount.rc @@ -345,8 +345,9 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,237,335,10 CONTROL "Activate encryption of keys and passwords stored in RAM",IDC_ENABLE_RAM_ENCRYPTION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,250,337,10 - CONTROL "Disable memory protection in VeraCrypt",IDC_DISABLE_MEMORY_PROTECTION, + CONTROL "Disable memory protection for Accessibility tools compatibility",IDC_DISABLE_MEMORY_PROTECTION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,263,339,10 + PUSHBUTTON "?",IDC_DISABLE_MEMORY_PROTECTION_HELP,364,259,7,14 PUSHBUTTON "&Benchmark",IDC_BENCHMARK,7,279,59,14 DEFPUSHBUTTON "OK",IDOK,257,279,50,14 PUSHBUTTON "Cancel",IDCANCEL,314,279,50,14 diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h index 0b778b4c..fef9da49 100644 --- a/src/Mount/Resource.h +++ b/src/Mount/Resource.h @@ -198,8 +198,8 @@ #define IDC_FORCE_NEXT_BOOT_VERACRYPT 1176 #define IDC_FORCE_VERACRYPT_BOOT_ENTRY 1177 #define IDC_FORCE_VERACRYPT_FIRST_BOOT_ENTRY 1178 -#define IDC_ENABLE_EMV_SUPPORT 1179 -#define IDT_EMV_OPTIONS 1180 +#define IDC_ENABLE_EMV_SUPPORT 1179 +#define IDT_EMV_OPTIONS 1180 #define IDM_HELP 40001 #define IDM_ABOUT 40002 #define IDM_UNMOUNT_VOLUME 40003 @@ -277,7 +277,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 120 #define _APS_NEXT_COMMAND_VALUE 40070 -#define _APS_NEXT_CONTROL_VALUE 1179 +#define _APS_NEXT_CONTROL_VALUE 1181 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3