Windows: Fix regression that caused the system encryption wizard to crash when displaying password field.

This commit is contained in:
Mounir IDRASSI 2018-08-16 01:08:37 +02:00
parent c2b69b248c
commit 558746c482
No known key found for this signature in database
GPG Key ID: DD0C382D5FCFB8FC
2 changed files with 10 additions and 5 deletions

View File

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

View File

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