1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

winpgnt: add a help button to async passphrase prompt.

Suggested by Jacob: if this dialog box is going to pop up
_unexpectedly_ - perhaps when people have momentarily forgotten
they're even running Pageant, or at least forgotten they added a key
encrypted,, or maybe haven't found out yet that their IT installed it
- then it could usefully come with a help button that pops up further
explanation of what the dialog box means, and from which you can find
your way to the rest of the help.
This commit is contained in:
Simon Tatham 2021-04-22 19:58:53 +01:00
parent 16a59b5972
commit f5a962fb34
3 changed files with 11 additions and 3 deletions

View File

@ -247,7 +247,7 @@ available (not just the ones downstream of the place you added it).
\H{pageant-deferred-decryption} Loading keys without decrypting them \H{pageant-deferred-decryption} Loading keys without decrypting them
You can also add keys to Pageant \e{without} decrypting them. The key You can add keys to Pageant \e{without} decrypting them. The key
file will be held in Pageant's memory still encrypted, and when a file will be held in Pageant's memory still encrypted, and when a
client program first tries to use the key, Pageant will display a client program first tries to use the key, Pageant will display a
dialog box prompting for the passphrase so that the key can be dialog box prompting for the passphrase so that the key can be

View File

@ -41,8 +41,9 @@ BEGIN
IDC_PASSPHRASE_STATIC3, 10, 34, 230, 8 IDC_PASSPHRASE_STATIC3, 10, 34, 230, 8
EDITTEXT IDC_PASSPHRASE_EDITBOX, 10, 44, 230, 12, EDITTEXT IDC_PASSPHRASE_EDITBOX, 10, 44, 230, 12,
ES_PASSWORD | ES_AUTOHSCROLL ES_PASSWORD | ES_AUTOHSCROLL
DEFPUSHBUTTON "O&K", IDOK, 75, 60, 40, 14 DEFPUSHBUTTON "O&K", IDOK, 45, 60, 40, 14
PUSHBUTTON "&Cancel", IDCANCEL, 135, 60, 40, 14 PUSHBUTTON "&Cancel", IDCANCEL, 105, 60, 40, 14
PUSHBUTTON "&Help", IDHELP, 165, 60, 50, 14
END END
IDD_KEYLIST DIALOG DISCARDABLE 0, 0, 450, 236 IDD_KEYLIST DIALOG DISCARDABLE 0, 0, 450, 236

View File

@ -99,6 +99,7 @@ static bool has_security;
struct PassphraseProcStruct { struct PassphraseProcStruct {
bool modal; bool modal;
const char *help_topic;
PageantClientDialogId *dlgid; PageantClientDialogId *dlgid;
char *passphrase; char *passphrase;
const char *comment; const char *comment;
@ -271,6 +272,10 @@ static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg,
case IDCANCEL: case IDCANCEL:
end_passphrase_dialog(hwnd, 0); end_passphrase_dialog(hwnd, 0);
return 0; return 0;
case IDHELP:
if (p->help_topic)
launch_help(hwnd, p->help_topic);
return 0;
case IDC_PASSPHRASE_EDITBOX: case IDC_PASSPHRASE_EDITBOX:
if ((HIWORD(wParam) == EN_CHANGE) && p->passphrase) { if ((HIWORD(wParam) == EN_CHANGE) && p->passphrase) {
burnstr(p->passphrase); burnstr(p->passphrase);
@ -453,6 +458,7 @@ static void win_add_keyfile(Filename *filename, bool encrypted)
INT_PTR dlgret; INT_PTR dlgret;
struct PassphraseProcStruct pps; struct PassphraseProcStruct pps;
pps.modal = true; pps.modal = true;
pps.help_topic = NULL; /* this dialog has no help button */
pps.dlgid = NULL; pps.dlgid = NULL;
pps.passphrase = NULL; pps.passphrase = NULL;
pps.comment = err; pps.comment = err;
@ -902,6 +908,7 @@ static bool ask_passphrase_common(PageantClientDialogId *dlgid,
struct PassphraseProcStruct *pps = snew(struct PassphraseProcStruct); struct PassphraseProcStruct *pps = snew(struct PassphraseProcStruct);
pps->modal = false; pps->modal = false;
pps->help_topic = WINHELP_CTX_pageant_deferred;
pps->dlgid = dlgid; pps->dlgid = dlgid;
pps->passphrase = NULL; pps->passphrase = NULL;
pps->comment = comment; pps->comment = comment;