VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Common/Dlgcode.c9
-rw-r--r--src/Format/Tcformat.c6
2 files changed, 10 insertions, 5 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 88713ac1..3fd6e768 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -1310,10 +1310,15 @@ static LRESULT CALLBACK NormalPwdFieldProc (HWND hwnd, UINT message, WPARAM wPar
void ToNormalPwdField (HWND hwndDlg, UINT ctrlId)
{
HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
+ WNDPROC originalwp = (WNDPROC) GetWindowLongPtrW (hwndCtrl, GWLP_USERDATA);
SendMessage (hwndCtrl, EM_LIMITTEXT, MAX_PASSWORD, 0);
- SetWindowLongPtrW (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC));
- SetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) NormalPwdFieldProc);
+ // only change WNDPROC if not changed already
+ if (!originalwp)
+ {
+ SetWindowLongPtrW (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC));
+ SetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) NormalPwdFieldProc);
+ }
}
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index 54379715..2f8b9b2f 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -4301,6 +4301,9 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
hPasswordInputField = GetDlgItem (hwndDlg, IDC_PASSWORD);
hVerifyPasswordInputField = GetDlgItem (hwndDlg, IDC_VERIFY);
+ ToNormalPwdField (hwndDlg, IDC_PASSWORD);
+ ToNormalPwdField (hwndDlg, IDC_VERIFY);
+
if (SysEncInEffect ())
{
ToBootPwdField (hwndDlg, IDC_PASSWORD);
@@ -4345,9 +4348,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
StringCbCopyW (str, sizeof(str), GetString ("PASSWORD_HELP"));
}
- ToNormalPwdField (hwndDlg, IDC_PASSWORD);
- ToNormalPwdField (hwndDlg, IDC_VERIFY);
-
SetPassword (hwndDlg, IDC_PASSWORD, szRawPassword);
SetPassword (hwndDlg, IDC_VERIFY, szVerify);