From f15052e68d43bdad8d8a125a3601ff8cedcf5a3d Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 8 Sep 2023 09:38:51 +0200 Subject: [PATCH] Windows: Add link in keyfiles dialog to documentation page for risks of third-party file extensions usage. --- src/Common/Common.rc | 20 +++++++++++--------- src/Common/Dlgcode.c | 12 ++++++++++++ src/Common/Keyfiles.c | 7 +++++++ src/Common/Language.xml | 1 + src/Common/Resource.h | 3 ++- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/Common/Common.rc b/src/Common/Common.rc index aa1ca18f..cbd401d8 100644 --- a/src/Common/Common.rc +++ b/src/Common/Common.rc @@ -100,7 +100,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,67,297,10 END -IDD_KEYFILES DIALOGEX 0, 0, 363, 251 +IDD_KEYFILES DIALOGEX 0, 0, 363, 264 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - Keyfiles" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -111,17 +111,18 @@ BEGIN PUSHBUTTON "Add &Token Files...",IDC_TOKEN_FILES_ADD,151,132,65,14 PUSHBUTTON "&Remove",IDC_KEYREMOVE,227,132,61,14 PUSHBUTTON "Remove &All",IDC_KEYREMOVEALL,299,132,61,14 - CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,232,100,11 - PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,237,230,123,14 + CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,244,100,11 + PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,237,243,123,14 DEFPUSHBUTTON "OK",IDOK,290,8,70,14 PUSHBUTTON "Cancel",IDCANCEL,290,25,70,14 LTEXT "",IDT_KEYFILES_NOTE,10,161,346,41,0,WS_EX_TRANSPARENT LTEXT "WARNING: If you lose a keyfile or if any bit of its first 1024 kilobytes changes, it will be impossible to mount volumes that use the keyfile!",IDT_KEYFILE_WARNING,290,44,69,85,0,WS_EX_TRANSPARENT CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,154,361,1,WS_EX_STATICEDGE - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,209,361,1,WS_EX_STATICEDGE - LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,111,233,124,10,SS_NOTIFY + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,224,361,1,WS_EX_STATICEDGE + LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,111,245,124,10,SS_NOTIFY CONTROL "Try first to mount with an empty password",IDC_KEYFILES_TRY_EMPTY_PASSWORD, - "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,217,310,10 + "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,229,310,10 + RTEXT "Important information on using third-party file extensions",IDC_LINK_KEYFILES_EXTENSIONS_WARNING,161,210,195,8,SS_NOTIFY END IDD_LANGUAGE DIALOGEX 0, 0, 209, 183 @@ -211,7 +212,7 @@ BEGIN CONTROL "",IDC_INFO_BOX_TEXT,"RichEdit20W",ES_MULTILINE | ES_READONLY | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,5,6,361,188 END -IDD_KEYFILE_GENERATOR DIALOGEX 0, 0, 357, 369 +IDD_KEYFILE_GENERATOR DIALOGEX 0, 0, 357, 385 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - Keyfile Generator" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -236,6 +237,7 @@ BEGIN RTEXT "Keyfiles size:",IDT_KEYFILES_SIZE,9,300,110,8 CONTROL "",IDC_ENTROPY_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,18,255,321,12 GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,6,244,344,29 + RTEXT "Important information on using third-party file extensions",IDC_LINK_KEYFILES_EXTENSIONS_WARNING,7,370,346,8,SS_NOTIFY END IDD_MULTI_CHOICE_DLG DIALOGEX 0, 0, 167, 322 @@ -386,7 +388,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 345 TOPMARGIN, 7 - BOTTOMMARGIN, 244 + BOTTOMMARGIN, 257 END IDD_LANGUAGE, DIALOG @@ -425,7 +427,7 @@ BEGIN BEGIN LEFTMARGIN, 7 TOPMARGIN, 7 - BOTTOMMARGIN, 365 + BOTTOMMARGIN, 381 END IDD_MULTI_CHOICE_DLG, DIALOG diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 2c9b3599..3dd508fa 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -6800,6 +6800,8 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP SetWindowText(GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE), L"64"); // set the maximum length of the keyfile base name to (TC_MAX_PATH - 1) SendMessage (GetDlgItem (hwndDlg, IDC_KEYFILES_BASE_NAME), EM_SETLIMITTEXT, (WPARAM) (TC_MAX_PATH - 1), 0); + + ToHyperlink (hwndDlg, IDC_LINK_KEYFILES_EXTENSIONS_WARNING); return 1; } @@ -6887,6 +6889,12 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem (hwndDlg, IDC_KEYFILES_SIZE_UNIT), !GetCheckBox (hwndDlg, IDC_KEYFILES_RANDOM_SIZE)); } + if (lw == IDC_LINK_KEYFILES_EXTENSIONS_WARNING) + { + Applink ("keyfilesextensions"); + return 1; + } + if (lw == IDC_GENERATE_AND_SAVE_KEYFILE) { wchar_t szNumber[16] = {0}; @@ -10957,6 +10965,10 @@ void Applink (const char *dest) { StringCbCopyW (page, sizeof (page),L"Keyfiles.html"); } + else if (strcmp(dest, "keyfilesextensions") == 0) + { + StringCbCopyW (page, sizeof (page),L"Avoid%20Third-Party%20File%20Extensions.html"); + } else if (strcmp(dest, "introcontainer") == 0) { StringCbCopyW (page, sizeof (page),L"Creating%20New%20Volumes.html"); diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c index 04319e09..d10daa06 100644 --- a/src/Common/Keyfiles.c +++ b/src/Common/Keyfiles.c @@ -484,6 +484,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa SetWindowTextW(GetDlgItem(hwndDlg, IDT_KEYFILES_NOTE), GetString ("KEYFILES_NOTE")); ToHyperlink (hwndDlg, IDC_LINK_KEYFILES_INFO); + ToHyperlink (hwndDlg, IDC_LINK_KEYFILES_EXTENSIONS_WARNING); } return 1; @@ -627,6 +628,12 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa return 1; } + if (lw == IDC_LINK_KEYFILES_EXTENSIONS_WARNING) + { + Applink ("keyfilesextensions"); + return 1; + } + if (lw == IDOK) { param->EnableKeyFiles = IsButtonChecked (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE)); diff --git a/src/Common/Language.xml b/src/Common/Language.xml index abda8e24..3b2a1a90 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -1632,6 +1632,7 @@ Unmounting volume ...\n Extending file system ...\n Warning: The system partition you attempted to mount was not fully encrypted. As a safety measure to prevent potential corruption or unwanted modifications, volume '%s' was mounted as read-only. + Important information on using third-party file extensions diff --git a/src/Common/Resource.h b/src/Common/Resource.h index c9142ece..a099c655 100644 --- a/src/Common/Resource.h +++ b/src/Common/Resource.h @@ -225,6 +225,7 @@ #define IDD_TEXT_EDIT_DLG 5141 #define IDC_DISABLE_MOUNT_MANAGER 5142 #define IDC_KEYFILES_SIZE_UNIT 5143 +#define IDC_LINK_KEYFILES_EXTENSIONS_WARNING 5144 // Next default values for new objects // @@ -233,7 +234,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 578 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 5144 +#define _APS_NEXT_CONTROL_VALUE 5145 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif