diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-08-27 02:01:19 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-08-27 02:18:47 +0200 |
commit | cfb591a9e9f79c993f1a9ec4fd1fab03c68a04f4 (patch) | |
tree | 89a95dfff224a34f5590a7a40b52dca58aa6f58b /src/Common | |
parent | 8c0fadc06828690a0fc1ef904a05a684974cd18b (diff) | |
download | VeraCrypt-cfb591a9e9f79c993f1a9ec4fd1fab03c68a04f4.tar.gz VeraCrypt-cfb591a9e9f79c993f1a9ec4fd1fab03c68a04f4.zip |
Windows: Correctly display the password edit "black dot" instead of a '*' when showing it then hiding it.
Diffstat (limited to 'src/Common')
-rw-r--r-- | src/Common/Dlgcode.c | 30 | ||||
-rw-r--r-- | src/Common/Dlgcode.h | 1 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index ead50a73..4f15447a 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -88,6 +88,8 @@ HFONT hUserUnderlineBoldFont = NULL; HFONT WindowTitleBarFont;
+WCHAR EditPasswordChar = 0;
+
int ScreenDPI = USER_DEFAULT_SCREEN_DPI;
double DPIScaleFactorX = 1;
double DPIScaleFactorY = 1;
@@ -873,7 +875,7 @@ static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam return 1;
}
- return CallWindowProc (wp, hwnd, message, wParam, lParam);
+ return CallWindowProcW (wp, hwnd, message, wParam, lParam);
}
@@ -884,8 +886,8 @@ void ToBootPwdField (HWND hwndDlg, UINT ctrlId) {
HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
- SetWindowLongPtr (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtr (hwndCtrl, GWLP_WNDPROC));
- SetWindowLongPtr (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) BootPwdFieldProc);
+ SetWindowLongPtrW (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC));
+ SetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) BootPwdFieldProc);
}
@@ -10851,3 +10853,25 @@ void SetPim (HWND hwndDlg, UINT ctrlId, int pim) SetDlgItemText (hwndDlg, ctrlId, "");
}
+void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id, UINT edit2Id)
+{
+ if ((EditPasswordChar == 0) && GetCheckBox (hwndDlg, checkBoxId))
+ {
+ EditPasswordChar = (WCHAR) SendMessageW (GetDlgItem (hwndDlg, edit1Id), EM_GETPASSWORDCHAR, 0, 0);
+ }
+
+ SendMessageW (GetDlgItem (hwndDlg, edit1Id),
+ EM_SETPASSWORDCHAR,
+ GetCheckBox (hwndDlg, checkBoxId) ? 0 : EditPasswordChar,
+ 0);
+ InvalidateRect (GetDlgItem (hwndDlg, edit1Id), NULL, TRUE);
+
+ if (edit2Id)
+ {
+ SendMessageW (GetDlgItem (hwndDlg, edit2Id),
+ EM_SETPASSWORDCHAR,
+ GetCheckBox (hwndDlg, checkBoxId) ? 0 : EditPasswordChar,
+ 0);
+ InvalidateRect (GetDlgItem (hwndDlg, edit2Id), NULL, TRUE);
+ }
+}
\ No newline at end of file diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index fa7a2b38..544b8e6e 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -491,6 +491,7 @@ BOOL LaunchWindowsIsoBurner (HWND hwnd, const char *isoPath); BOOL IsApplicationInstalled (const char *appName);
int GetPim (HWND hwndDlg, UINT ctrlId);
void SetPim (HWND hwndDlg, UINT ctrlId, int pim);
+void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id, UINT edit2Id);
#ifdef __cplusplus
}
|