From 70215e3682345243301d410fc0072f294006403c Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 27 May 2015 00:12:46 +0200 Subject: Windows: GUI modifications around PIN field --- src/Common/Common.rc | 17 ++++++++++------- src/Common/Dlgcode.c | 18 ++++++++++++++++++ src/Common/Dlgcode.h | 1 + src/Common/Language.xml | 4 ++++ src/Common/Resource.h | 5 ++++- src/ExpandVolume/WinMain.cpp | 18 ++---------------- src/ExpandVolume/resource.h | 14 +++++--------- src/Format/Format.rc | 2 +- src/Format/Resource.h | 6 +----- src/Mount/Mount.c | 29 +++++++++++++---------------- src/Mount/Resource.h | 11 ++++------- 11 files changed, 63 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/Common/Common.rc b/src/Common/Common.rc index 1fba8899..d296e7b0 100644 --- a/src/Common/Common.rc +++ b/src/Common/Common.rc @@ -65,7 +65,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,248,190,50,14 END -IDD_MOUNT_OPTIONS DIALOGEX 0, 0, 277, 204 +IDD_MOUNT_OPTIONS DIALOGEX 0, 0, 277, 224 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VeraCrypt - Mount Options" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -78,18 +78,21 @@ BEGIN CONTROL "&Protect hidden volume against damage caused by writing to outer volume",IDC_PROTECT_HIDDEN_VOL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,86,252,10 EDITTEXT IDC_PASSWORD_PROT_HIDVOL,112,104,151,14,ES_PASSWORD | ES_AUTOHSCROLL - CONTROL "&Display password",IDC_SHOW_PASSWORD_MO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,146,90,10 - CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE_HIDVOL_PROT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,159,90,10 - PUSHBUTTON "&Keyfiles...",IDC_KEYFILES_HIDVOL_PROT,203,148,60,14 - LTEXT "What is hidden volume protection?",IDC_LINK_HIDVOL_PROTECTION_INFO,16,174,247,10,SS_NOTIFY + CONTROL "&Display password",IDC_SHOW_PASSWORD_MO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,165,90,10 + CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE_HIDVOL_PROT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,178,90,10 + PUSHBUTTON "&Keyfiles...",IDC_KEYFILES_HIDVOL_PROT,203,167,60,14 + LTEXT "What is hidden volume protection?",IDC_LINK_HIDVOL_PROTECTION_INFO,16,193,247,10,SS_NOTIFY DEFPUSHBUTTON "OK",IDOK,211,7,60,14 PUSHBUTTON "Cancel",IDCANCEL,211,24,60,14 RTEXT "P&assword to hidden volume:\n(if empty, cache is used)",IDT_HIDDEN_PROT_PASSWD,15,103,91,17,0,WS_EX_RIGHT - GROUPBOX "Hidden Volume Protection",IDT_HIDDEN_VOL_PROTECTION,6,72,265,120 + GROUPBOX "Hidden Volume Protection",IDT_HIDDEN_VOL_PROTECTION,6,72,265,139 CONTROL "Use backup header embedded in &volume if available",IDC_USE_EMBEDDED_HEADER_BAK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,39,257,11 COMBOBOX IDC_PKCS5_PRF_ID,112,125,91,90,CBS_DROPDOWNLIST | WS_TABSTOP RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,15,126,91,17 + EDITTEXT IDC_PIN,112,145,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Volume PIN:",IDT_PIN,15,148,91,17 + LTEXT "(Empty or 0 for default iterations)",IDC_PIN_HELP,158,148,112,8 END IDD_KEYFILES DIALOGEX 0, 0, 345, 237 @@ -348,7 +351,7 @@ BEGIN BEGIN LEFTMARGIN, 7 TOPMARGIN, 7 - BOTTOMMARGIN, 198 + BOTTOMMARGIN, 218 END IDD_KEYFILES, DIALOG diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 5cf6dbaf..c9d01290 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -984,6 +984,11 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam // Version SendMessage (GetDlgItem (hwndDlg, IDT_ABOUT_VERSION), WM_SETFONT, (WPARAM) hUserBoldFont, 0); StringCbPrintfA (szTmp, sizeof(szTmp), "VeraCrypt %s", VERSION_STRING); +#ifdef _WIN64 + StringCbCatA (szTmp, sizeof(szTmp), " (64-bit)"); +#else + StringCbCatA (szTmp, sizeof(szTmp), " (32-bit)"); +#endif #if (defined(_DEBUG) || defined(DEBUG)) StringCbCatA (szTmp, sizeof(szTmp), " (debug)"); #endif @@ -10716,3 +10721,16 @@ int GetPin (HWND hwndDlg, UINT ctrlId) } return pin; } + +void SetPin (HWND hwndDlg, UINT ctrlId, int pin) +{ + if (pin > 0) + { + char szTmp[MAX_PIN + 1]; + StringCbPrintfA (szTmp, sizeof(szTmp), "%d", pin); + SetDlgItemText (hwndDlg, ctrlId, szTmp); + } + else + SetDlgItemText (hwndDlg, ctrlId, ""); +} + diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 1fd12d40..7dee2db5 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -481,6 +481,7 @@ BOOL IsWindowsIsoBurnerAvailable (); BOOL LaunchWindowsIsoBurner (HWND hwnd, const char *isoPath); BOOL IsApplicationInstalled (const char *appName); int GetPin (HWND hwndDlg, UINT ctrlId); +void SetPin (HWND hwndDlg, UINT ctrlId, int pin); #ifdef __cplusplus } diff --git a/src/Common/Language.xml b/src/Common/Language.xml index 9ae289d9..e1cdcde7 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -86,6 +86,8 @@ Current pool content (partial) Pass Password: + Volume PIN: + Volume PIN: Progress: Random Pool: Select this option if there is only one operating system installed on this computer (even if it has multiple users). @@ -143,6 +145,8 @@ Mount Opti&ons... Mount volume as read-&only Keyfiles... + (Empty or 0 for default iterations) + (Empty or 0 for default iterations) Enabled Cache passwords in driver memory Auto-dismount volume after no data has been read/written to it for diff --git a/src/Common/Resource.h b/src/Common/Resource.h index 4b8c2df5..9cc7b9e2 100644 --- a/src/Common/Resource.h +++ b/src/Common/Resource.h @@ -188,6 +188,9 @@ #define IDC_WAIT_PROGRESS_BAR 5126 #define IDC_PKCS5_PRF_ID 5127 #define IDT_PKCS5_PRF 5128 +#define IDT_PIN 5129 +#define IDC_PIN 5130 +#define IDC_PIN_HELP 5131 // Next default values for new objects // @@ -196,7 +199,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 542 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 5129 +#define _APS_NEXT_CONTROL_VALUE 5132 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index f8b3234c..0dc135b1 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -447,14 +447,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_PIN), EM_LIMITTEXT, MAX_PIN, 0); - if (*pin >= 0) - { - /* display the given PIN */ - char szTmp[MAX_PIN + 1]; - StringCbPrintfA(szTmp, sizeof(szTmp), "%d", *pin); - - SetDlgItemText (hwndDlg, IDC_PIN, szTmp); - } + SetPin (hwndDlg, IDC_PIN, *pin); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); @@ -554,14 +547,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), FALSE); - if (*pin >= 0) - { - /* display the given PIN */ - char szTmp[MAX_PIN + 1]; - StringCbPrintfA(szTmp, sizeof(szTmp), "%d", *pin); - - SetDlgItemText (hwndDlg, IDC_PIN, szTmp); - } + SetPin (hwndDlg, IDC_PIN, *pin); bPrebootPasswordDlgMode = TRUE; } diff --git a/src/ExpandVolume/resource.h b/src/ExpandVolume/resource.h index 29a451db..bf96b1ca 100644 --- a/src/ExpandVolume/resource.h +++ b/src/ExpandVolume/resource.h @@ -63,16 +63,12 @@ #define IDC_SIZEDLG_TITLE 1111 #define IDC_INIT_NEWSPACE 1112 #define IDC_INFOEXPAND 1113 -#define IDC_EDIT1 1114 #define IDC_BOX_STATUS 1114 #define IDC_TRUECRYPT_MODE 1140 -#define IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT 1141 -#define IDT_PIN 1142 -#define IDC_PIN 1143 -#define IDC_PIN_HELP 1144 -#define IDT_OLD_PIN 1145 -#define IDC_OLD_PIN 1146 -#define IDC_OLD_PIN_HELP 1147 +#define IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT 1141 +#define IDT_OLD_PIN 1142 +#define IDC_OLD_PIN 1143 +#define IDC_OLD_PIN_HELP 1144 #define IDM_HELP 40001 #define IDM_ABOUT 40002 #define IDM_UNMOUNT_VOLUME 40003 @@ -144,7 +140,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 120 #define _APS_NEXT_COMMAND_VALUE 40064 -#define _APS_NEXT_CONTROL_VALUE 1148 +#define _APS_NEXT_CONTROL_VALUE 1145 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/Format/Format.rc b/src/Format/Format.rc index c4e50fdd..aab29605 100644 --- a/src/Format/Format.rc +++ b/src/Format/Format.rc @@ -123,7 +123,7 @@ BEGIN RTEXT "Password:",IDT_PASSWORD,1,6,50,8 RTEXT "&Confirm:",IDT_CONFIRM,1,23,50,8 LTEXT "",IDC_BOX_HELP,0,79,225,89 - RTEXT "Volume Pin:",IDT_PIN,1,38,50,8 + RTEXT "Volume PIN:",IDT_PIN,1,38,50,8 LTEXT "(Empty or 0 for default iterations)",IDC_PIN_HELP,97,38,126,8 END diff --git a/src/Format/Resource.h b/src/Format/Resource.h index 2dc03faa..4cb2e579 100644 --- a/src/Format/Resource.h +++ b/src/Format/Resource.h @@ -140,10 +140,6 @@ #define IDC_DEVICE_TRANSFORM_MODE_INPLACE 1102 #define IDC_DRIVE_LETTER_LIST 1103 #define IDT_DRIVE_LETTER 1104 -#define IDT_PIN 1105 -#define IDC_PIN 1106 -#define IDC_PIN_HELP 1107 -#define IDC_EDIT1 1108 // Next default values for new objects // @@ -152,7 +148,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 133 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1109 +#define _APS_NEXT_CONTROL_VALUE 1105 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 7f8cbca2..ef116199 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -2390,14 +2390,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0); SendMessage (GetDlgItem (hwndDlg, IDC_PIN), EM_LIMITTEXT, MAX_PIN, 0); - if (*pin > 0) - { - /* display the given PIN */ - char szTmp[MAX_PIN + 1]; - StringCbPrintfA(szTmp, sizeof(szTmp), "%d", *pin); - - SetDlgItemText (hwndDlg, IDC_PIN, szTmp); - } + SetPin (hwndDlg, IDC_PIN, *pin); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); @@ -2499,14 +2492,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES), FALSE); - if (*pin >= 0) - { - /* display the given PIN */ - char szTmp[MAX_PIN + 1]; - StringCbPrintfA(szTmp, sizeof(szTmp), "%d", *pin); - - SetDlgItemText (hwndDlg, IDC_PIN, szTmp); - } + SetPin (hwndDlg, IDC_PIN, *pin); bPrebootPasswordDlgMode = TRUE; } @@ -3026,13 +3012,19 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE_HIDVOL_PROT), protect); EnableWindow (GetDlgItem (hwndDlg, IDT_PKCS5_PRF), protect); EnableWindow (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), protect); + EnableWindow (GetDlgItem (hwndDlg, IDT_PIN), protect); + EnableWindow (GetDlgItem (hwndDlg, IDC_PIN), protect); + EnableWindow (GetDlgItem (hwndDlg, IDC_PIN_HELP), protect); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE_HIDVOL_PROT, hidVolProtKeyFilesParam.EnableKeyFiles); SendDlgItemMessage (hwndDlg, IDC_PASSWORD_PROT_HIDVOL, EM_LIMITTEXT, MAX_PASSWORD, 0); + SendDlgItemMessage (hwndDlg, IDC_PIN, EM_LIMITTEXT, MAX_PIN, 0); if (mountOptions->ProtectedHidVolPassword.Length > 0) SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), (LPSTR) mountOptions->ProtectedHidVolPassword.Text); + + SetPin (hwndDlg, IDC_PIN, mountOptions->ProtectedHidVolPin); ToHyperlink (hwndDlg, IDC_LINK_HIDVOL_PROTECTION_INFO); @@ -3127,6 +3119,8 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mountOptions->ProtectedHidVolPkcs5Prf = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); + + mountOptions->ProtectedHidVolPin = GetPin (hwndDlg, IDC_PIN); } // Cleanup @@ -3165,6 +3159,9 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE_HIDVOL_PROT), protect); EnableWindow (GetDlgItem (hwndDlg, IDT_PKCS5_PRF), protect); EnableWindow (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), protect); + EnableWindow (GetDlgItem (hwndDlg, IDT_PIN), protect); + EnableWindow (GetDlgItem (hwndDlg, IDC_PIN), protect); + EnableWindow (GetDlgItem (hwndDlg, IDC_PIN_HELP), protect); return 1; } diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h index 857ef197..05109fcc 100644 --- a/src/Mount/Resource.h +++ b/src/Mount/Resource.h @@ -163,12 +163,9 @@ #define IDC_PKCS5_OLD_PRF_ID 1139 #define IDC_TRUECRYPT_MODE 1140 #define IDC_PREF_TEMP_CACHE_ON_MULTIPLE_MOUNT 1141 -#define IDT_PIN 1142 -#define IDC_PIN 1143 -#define IDC_PIN_HELP 1144 -#define IDT_OLD_PIN 1145 -#define IDC_OLD_PIN 1146 -#define IDC_OLD_PIN_HELP 1147 +#define IDT_OLD_PIN 1142 +#define IDC_OLD_PIN 1143 +#define IDC_OLD_PIN_HELP 1144 #define IDM_HELP 40001 #define IDM_ABOUT 40002 #define IDM_UNMOUNT_VOLUME 40003 @@ -244,7 +241,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 119 #define _APS_NEXT_COMMAND_VALUE 40068 -#define _APS_NEXT_CONTROL_VALUE 1148 +#define _APS_NEXT_CONTROL_VALUE 1145 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3