@ -664,6 +664,9 @@ GenericPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
else
else
SetForegroundWindow ( hwndDlg ) ;
SetForegroundWindow ( hwndDlg ) ;
/* disable OK button by default - not disabled in resources */
EnableWindow ( GetDlgItem ( hwndDlg , IDOK ) , FALSE ) ;
break ;
break ;
case WM_COMMAND :
case WM_COMMAND :
@ -672,6 +675,15 @@ GenericPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
char * fmt ;
char * fmt ;
switch ( LOWORD ( wParam ) )
switch ( LOWORD ( wParam ) )
{
{
case ID_EDT_RESPONSE :
if ( HIWORD ( wParam ) = = EN_UPDATE )
{
/* enable OK if response is non-empty */
BOOL enableOK = GetWindowTextLength ( ( HWND ) lParam ) ;
EnableWindow ( GetDlgItem ( hwndDlg , IDOK ) , enableOK ) ;
}
break ;
case IDOK :
case IDOK :
if ( GetDlgItemTextW ( hwndDlg , ID_EDT_RESPONSE , password , _countof ( password ) )
if ( GetDlgItemTextW ( hwndDlg , ID_EDT_RESPONSE , password , _countof ( password ) )
& & ! validate_input ( password , L " \n " ) )
& & ! validate_input ( password , L " \n " ) )
@ -782,6 +794,9 @@ PrivKeyPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
ForceForegroundWindow ( hwndDlg ) ;
ForceForegroundWindow ( hwndDlg ) ;
else
else
SetForegroundWindow ( hwndDlg ) ;
SetForegroundWindow ( hwndDlg ) ;
/* disable OK button by default - not disabled in resources */
EnableWindow ( GetDlgItem ( hwndDlg , IDOK ) , FALSE ) ;
break ;
break ;
case WM_COMMAND :
case WM_COMMAND :
@ -799,6 +814,15 @@ PrivKeyPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
}
}
break ;
break ;
case ID_EDT_PASSPHRASE :
if ( HIWORD ( wParam ) = = EN_UPDATE )
{
/* enable OK if response is non-empty */
BOOL enableOK = GetWindowTextLength ( ( HWND ) lParam ) ;
EnableWindow ( GetDlgItem ( hwndDlg , IDOK ) , enableOK ) ;
}
break ;
case IDOK :
case IDOK :
if ( GetDlgItemTextW ( hwndDlg , ID_EDT_PASSPHRASE , passphrase , _countof ( passphrase ) ) )
if ( GetDlgItemTextW ( hwndDlg , ID_EDT_PASSPHRASE , passphrase , _countof ( passphrase ) ) )
{
{