1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

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.

This commit is contained in:
Mounir IDRASSI
2015-10-07 04:06:50 +02:00
parent 13058fd638
commit f3c91cb05c
6 changed files with 88 additions and 24 deletions

View File

@@ -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;
}