mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-28 14:03:29 +01:00
Windows: Correctly display the password edit "black dot" instead of a '*' when showing it then hiding it.
This commit is contained in:
parent
8c0fadc068
commit
cfb591a9e9
@ -88,6 +88,8 @@ HFONT hUserUnderlineBoldFont = NULL;
|
|||||||
|
|
||||||
HFONT WindowTitleBarFont;
|
HFONT WindowTitleBarFont;
|
||||||
|
|
||||||
|
WCHAR EditPasswordChar = 0;
|
||||||
|
|
||||||
int ScreenDPI = USER_DEFAULT_SCREEN_DPI;
|
int ScreenDPI = USER_DEFAULT_SCREEN_DPI;
|
||||||
double DPIScaleFactorX = 1;
|
double DPIScaleFactorX = 1;
|
||||||
double DPIScaleFactorY = 1;
|
double DPIScaleFactorY = 1;
|
||||||
@ -873,7 +875,7 @@ static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam
|
|||||||
return 1;
|
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);
|
HWND hwndCtrl = GetDlgItem (hwndDlg, ctrlId);
|
||||||
|
|
||||||
SetWindowLongPtr (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtr (hwndCtrl, GWLP_WNDPROC));
|
SetWindowLongPtrW (hwndCtrl, GWLP_USERDATA, (LONG_PTR) GetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC));
|
||||||
SetWindowLongPtr (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) BootPwdFieldProc);
|
SetWindowLongPtrW (hwndCtrl, GWLP_WNDPROC, (LONG_PTR) BootPwdFieldProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -10851,3 +10853,25 @@ void SetPim (HWND hwndDlg, UINT ctrlId, int pim)
|
|||||||
SetDlgItemText (hwndDlg, ctrlId, "");
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -491,6 +491,7 @@ BOOL LaunchWindowsIsoBurner (HWND hwnd, const char *isoPath);
|
|||||||
BOOL IsApplicationInstalled (const char *appName);
|
BOOL IsApplicationInstalled (const char *appName);
|
||||||
int GetPim (HWND hwndDlg, UINT ctrlId);
|
int GetPim (HWND hwndDlg, UINT ctrlId);
|
||||||
void SetPim (HWND hwndDlg, UINT ctrlId, int pim);
|
void SetPim (HWND hwndDlg, UINT ctrlId, int pim);
|
||||||
|
void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id, UINT edit2Id);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -534,10 +534,13 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE);
|
if (GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD))
|
||||||
|
{
|
||||||
|
// simulate hiding password
|
||||||
|
SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE);
|
||||||
|
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0);
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, 0);
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);
|
}
|
||||||
|
|
||||||
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, FALSE);
|
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, FALSE);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
||||||
@ -614,11 +617,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD)
|
if (lw == IDC_SHOW_PASSWORD)
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD),
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, 0);
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5409,16 +5409,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD && nCurPageNo == PASSWORD_PAGE)
|
if (lw == IDC_SHOW_PASSWORD && nCurPageNo == PASSWORD_PAGE)
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD),
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, IDC_VERIFY);
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_VERIFY),
|
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_VERIFY), NULL, TRUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5509,11 +5500,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD_SINGLE)
|
if (lw == IDC_SHOW_PASSWORD_SINGLE)
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD_DIRECT),
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD_SINGLE, IDC_PASSWORD_DIRECT, 0);
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD_SINGLE) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD_DIRECT), NULL, TRUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2314,26 +2314,13 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD_CHPWD_ORI)
|
if (lw == IDC_SHOW_PASSWORD_CHPWD_ORI)
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_OLD_PASSWORD),
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_ORI, IDC_OLD_PASSWORD, 0);
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_ORI) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_OLD_PASSWORD), NULL, TRUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD_CHPWD_NEW)
|
if (lw == IDC_SHOW_PASSWORD_CHPWD_NEW)
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD),
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_NEW, IDC_PASSWORD, IDC_VERIFY);
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_NEW) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_VERIFY),
|
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_NEW) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_VERIFY), NULL, TRUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2660,10 +2647,13 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE);
|
if (GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD))
|
||||||
|
{
|
||||||
|
// simulate hiding password
|
||||||
|
SetCheckBox (hwndDlg, IDC_SHOW_PASSWORD, FALSE);
|
||||||
|
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), EM_SETPASSWORDCHAR, '*', 0);
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, 0);
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);
|
}
|
||||||
|
|
||||||
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, FALSE);
|
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, FALSE);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
||||||
@ -2745,11 +2735,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD)
|
if (lw == IDC_SHOW_PASSWORD)
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD),
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD, IDC_PASSWORD, 0);
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD), NULL, TRUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3274,11 +3260,7 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD_MO)
|
if (lw == IDC_SHOW_PASSWORD_MO)
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL),
|
HandleShowPasswordFieldAction (hwndDlg, IDC_SHOW_PASSWORD_MO, IDC_PASSWORD_PROT_HIDVOL, 0);
|
||||||
EM_SETPASSWORDCHAR,
|
|
||||||
GetCheckBox (hwndDlg, IDC_SHOW_PASSWORD_MO) ? 0 : '*',
|
|
||||||
0);
|
|
||||||
InvalidateRect (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), NULL, TRUE);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user