mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05:00
Prevent recursive weirdnesses happening when the user selects a
system-tray menu option while a passphrase prompt is active. [originally from svn r1170]
This commit is contained in:
parent
dbe881a163
commit
3bc9118bc4
16
pageant.c
16
pageant.c
@ -168,6 +168,8 @@ static int CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HWND passphrase_box;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dialog-box function for the passphrase box.
|
* Dialog-box function for the passphrase box.
|
||||||
*/
|
*/
|
||||||
@ -179,6 +181,7 @@ static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
passphrase_box = hwnd;
|
||||||
/*
|
/*
|
||||||
* Centre the window.
|
* Centre the window.
|
||||||
*/
|
*/
|
||||||
@ -324,6 +327,7 @@ static void add_keyfile(char *filename)
|
|||||||
int dlgret;
|
int dlgret;
|
||||||
dlgret = DialogBoxParam(instance, MAKEINTRESOURCE(210),
|
dlgret = DialogBoxParam(instance, MAKEINTRESOURCE(210),
|
||||||
NULL, PassphraseProc, (LPARAM) & pps);
|
NULL, PassphraseProc, (LPARAM) & pps);
|
||||||
|
passphrase_box = NULL;
|
||||||
if (!dlgret) {
|
if (!dlgret) {
|
||||||
if (comment)
|
if (comment)
|
||||||
sfree(comment);
|
sfree(comment);
|
||||||
@ -1017,6 +1021,11 @@ static int CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||||||
case 101: /* add key */
|
case 101: /* add key */
|
||||||
if (HIWORD(wParam) == BN_CLICKED ||
|
if (HIWORD(wParam) == BN_CLICKED ||
|
||||||
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
||||||
|
if (passphrase_box) {
|
||||||
|
MessageBeep(MB_ICONERROR);
|
||||||
|
SetForegroundWindow(passphrase_box);
|
||||||
|
break;
|
||||||
|
}
|
||||||
prompt_add_keyfile();
|
prompt_add_keyfile();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1091,6 +1100,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
switch (wParam & ~0xF) { /* low 4 bits reserved to Windows */
|
switch (wParam & ~0xF) { /* low 4 bits reserved to Windows */
|
||||||
case IDM_CLOSE:
|
case IDM_CLOSE:
|
||||||
|
if (passphrase_box)
|
||||||
|
SendMessage(passphrase_box, WM_CLOSE, 0, 0);
|
||||||
SendMessage(hwnd, WM_CLOSE, 0, 0);
|
SendMessage(hwnd, WM_CLOSE, 0, 0);
|
||||||
break;
|
break;
|
||||||
case IDM_VIEWKEYS:
|
case IDM_VIEWKEYS:
|
||||||
@ -1108,6 +1119,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDM_ADDKEY:
|
case IDM_ADDKEY:
|
||||||
|
if (passphrase_box) {
|
||||||
|
MessageBeep(MB_ICONERROR);
|
||||||
|
SetForegroundWindow(passphrase_box);
|
||||||
|
break;
|
||||||
|
}
|
||||||
prompt_add_keyfile();
|
prompt_add_keyfile();
|
||||||
break;
|
break;
|
||||||
case IDM_ABOUT:
|
case IDM_ABOUT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user