From f5a962fb344ce284c6346c77b7f800d0731ac675 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 22 Apr 2021 19:58:53 +0100 Subject: [PATCH] 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. --- doc/pageant.but | 2 +- windows/pageant.rc | 5 +++-- windows/winpgnt.c | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/pageant.but b/doc/pageant.but index 09bb95b7..8abb5cdf 100644 --- a/doc/pageant.but +++ b/doc/pageant.but @@ -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 -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 client program first tries to use the key, Pageant will display a dialog box prompting for the passphrase so that the key can be diff --git a/windows/pageant.rc b/windows/pageant.rc index 88010e3a..a4a15195 100644 --- a/windows/pageant.rc +++ b/windows/pageant.rc @@ -41,8 +41,9 @@ BEGIN IDC_PASSPHRASE_STATIC3, 10, 34, 230, 8 EDITTEXT IDC_PASSPHRASE_EDITBOX, 10, 44, 230, 12, ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "O&K", IDOK, 75, 60, 40, 14 - PUSHBUTTON "&Cancel", IDCANCEL, 135, 60, 40, 14 + DEFPUSHBUTTON "O&K", IDOK, 45, 60, 40, 14 + PUSHBUTTON "&Cancel", IDCANCEL, 105, 60, 40, 14 + PUSHBUTTON "&Help", IDHELP, 165, 60, 50, 14 END IDD_KEYLIST DIALOG DISCARDABLE 0, 0, 450, 236 diff --git a/windows/winpgnt.c b/windows/winpgnt.c index 38e79149..041b1337 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -99,6 +99,7 @@ static bool has_security; struct PassphraseProcStruct { bool modal; + const char *help_topic; PageantClientDialogId *dlgid; char *passphrase; const char *comment; @@ -271,6 +272,10 @@ static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg, case IDCANCEL: end_passphrase_dialog(hwnd, 0); return 0; + case IDHELP: + if (p->help_topic) + launch_help(hwnd, p->help_topic); + return 0; case IDC_PASSPHRASE_EDITBOX: if ((HIWORD(wParam) == EN_CHANGE) && p->passphrase) { burnstr(p->passphrase); @@ -453,6 +458,7 @@ static void win_add_keyfile(Filename *filename, bool encrypted) INT_PTR dlgret; struct PassphraseProcStruct pps; pps.modal = true; + pps.help_topic = NULL; /* this dialog has no help button */ pps.dlgid = NULL; pps.passphrase = NULL; pps.comment = err; @@ -902,6 +908,7 @@ static bool ask_passphrase_common(PageantClientDialogId *dlgid, struct PassphraseProcStruct *pps = snew(struct PassphraseProcStruct); pps->modal = false; + pps->help_topic = WINHELP_CTX_pageant_deferred; pps->dlgid = dlgid; pps->passphrase = NULL; pps->comment = comment;