VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-10-07 04:06:50 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-10-07 12:55:58 +0200
commitf3c91cb05c9a3ba2651438f576d707f7a48d507b (patch)
tree6e7f4b7ae134247357109a86f6540b3a4bca523e /src/Common
parent13058fd638eaddf4ecdd52e902f3bf7254b5c45c (diff)
downloadVeraCrypt-f3c91cb05c9a3ba2651438f576d707f7a48d507b.tar.gz
VeraCrypt-f3c91cb05c9a3ba2651438f576d707f7a48d507b.zip
Windows: Don’t try to mount using empty password when default keyfile configured or keyfile specified in command line. Add option in default keyfiles dialog to restore the old behavior.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Common.rc12
-rw-r--r--src/Common/Keyfiles.c25
-rw-r--r--src/Common/Language.xml1
-rw-r--r--src/Common/Resource.h3
4 files changed, 35 insertions, 6 deletions
diff --git a/src/Common/Common.rc b/src/Common/Common.rc
index 3f80805f..233abd7a 100644
--- a/src/Common/Common.rc
+++ b/src/Common/Common.rc
@@ -98,7 +98,7 @@ BEGIN
EDITTEXT IDC_VOLUME_LABEL,112,67,150,14,ES_AUTOHSCROLL
END
-IDD_KEYFILES DIALOGEX 0, 0, 345, 237
+IDD_KEYFILES DIALOGEX 0, 0, 345, 251
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
@@ -109,15 +109,17 @@ BEGIN
PUSHBUTTON "Add &Token Files...",IDC_TOKEN_FILES_ADD,139,132,65,14
PUSHBUTTON "&Remove",IDC_KEYREMOVE,209,132,61,14
PUSHBUTTON "Remove &All",IDC_KEYREMOVEALL,275,132,61,14
- CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,219,83,11
- PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,213,217,123,14
+ CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,232,83,11
+ PUSHBUTTON "&Generate Random Keyfile...",IDC_GENERATE_KEYFILE,213,230,123,14
DEFPUSHBUTTON "OK",IDOK,279,8,59,14
PUSHBUTTON "Cancel",IDCANCEL,279,25,59,14
LTEXT "",IDT_KEYFILES_NOTE,10,161,324,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,279,44,58,85,0,WS_EX_TRANSPARENT
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,154,343,1,WS_EX_STATICEDGE
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,209,343,1,WS_EX_STATICEDGE
- LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,96,220,108,10,SS_NOTIFY
+ LTEXT "More information on keyfiles",IDC_LINK_KEYFILES_INFO,96,233,108,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,205,10
END
IDD_LANGUAGE DIALOGEX 0, 0, 209, 183
@@ -362,7 +364,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 330
TOPMARGIN, 7
- BOTTOMMARGIN, 230
+ BOTTOMMARGIN, 244
END
IDD_LANGUAGE, DIALOG
diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c
index 549ffe6e..428821b5 100644
--- a/src/Common/Keyfiles.c
+++ b/src/Common/Keyfiles.c
@@ -26,6 +26,9 @@
#include "Common/resource.h"
#include "Platform/Finally.h"
#include "Platform/ForEach.h"
+#ifdef TCMOUNT
+#include "Mount/Mount.h"
+#endif
#include <Strsafe.h>
@@ -465,6 +468,17 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
LoadKeyList (hwndDlg, param->FirstKeyFile);
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, param->EnableKeyFiles);
+
+#ifdef TCMOUNT
+ if ( (origParam.EnableKeyFiles == defaultKeyFilesParam.EnableKeyFiles)
+ && (origParam.FirstKeyFile == defaultKeyFilesParam.FirstKeyFile)
+ )
+ {
+ /* default keyfile dialog case */
+ SetCheckBox (hwndDlg, IDC_KEYFILES_TRY_EMPTY_PASSWORD, bTryEmptyPasswordWhenKeyfileUsed);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_KEYFILES_TRY_EMPTY_PASSWORD), SW_SHOW);
+ }
+#endif
SetWindowTextW(GetDlgItem(hwndDlg, IDT_KEYFILES_NOTE), GetString ("KEYFILES_NOTE"));
@@ -586,6 +600,17 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lw == IDOK)
{
param->EnableKeyFiles = IsButtonChecked (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE));
+
+#ifdef TCMOUNT
+ if (IsWindowVisible (GetDlgItem (hwndDlg, IDC_KEYFILES_TRY_EMPTY_PASSWORD)))
+ {
+ bTryEmptyPasswordWhenKeyfileUsed = IsButtonChecked (GetDlgItem (hwndDlg, IDC_KEYFILES_TRY_EMPTY_PASSWORD));
+
+ WaitCursor ();
+ SaveSettings (hwndDlg);
+ NormalCursor ();
+ }
+#endif
EndDialog (hwndDlg, IDOK);
return 1;
}
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index b5943716..d0a65dd7 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -45,6 +45,7 @@
<control lang="en" key="IDC_HIDVOL_WIZ_MODE_FULL">Normal mode</control>
<control lang="en" key="IDC_KB">&amp;KB</control>
<control lang="en" key="IDC_KEYFILES_ENABLE">U&amp;se keyfiles</control>
+ <control lang="en" key="IDC_KEYFILES_TRY_EMPTY_PASSWORD">Try first to mount with an empty password</control>
<control lang="en" key="IDC_KEYFILES_RANDOM_SIZE">Random size ( 64 &lt;-&gt; 1048576 )</control>
<control lang="en" key="IDC_KEY_FILES">&amp;Keyfiles...</control>
<control lang="en" key="IDC_LINK_HASH_INFO">Information on hash algorithms</control>
diff --git a/src/Common/Resource.h b/src/Common/Resource.h
index dfad1274..0c536eb8 100644
--- a/src/Common/Resource.h
+++ b/src/Common/Resource.h
@@ -194,6 +194,7 @@
#define IDC_PIM_ENABLE 5132
#define IDC_VOLUME_LABEL 5133
#define IDT_VOLUME_LABEL 5134
+#define IDC_KEYFILES_TRY_EMPTY_PASSWORD 5135
// Next default values for new objects
//
@@ -202,7 +203,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 542
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 5135
+#define _APS_NEXT_CONTROL_VALUE 5136
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif