X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/1e87cce57fa5ba8819ba5b11fdbabefc6d8dab9e..e527cc48938cbd53591aa0ac9436069aca078c1f:/windows/winpgen.c diff --git a/windows/winpgen.c b/windows/winpgen.c index dae9f93f..d027fc78 100644 --- a/windows/winpgen.c +++ b/windows/winpgen.c @@ -21,8 +21,6 @@ #define DEFAULT_KEYSIZE 1024 -static int requested_help; - static char *cmdline_keyfile = NULL; /* @@ -198,11 +196,6 @@ static int prompt_keyfile(HWND hwnd, char *dlgtitle, { OPENFILENAME of; memset(&of, 0, sizeof(of)); -#ifdef OPENFILENAME_SIZE_VERSION_400 - of.lStructSize = OPENFILENAME_SIZE_VERSION_400; -#else - of.lStructSize = sizeof(of); -#endif of.hwndOwner = hwnd; if (ppk) { of.lpstrFilter = "PuTTY Private Key Files (*.ppk)\0*.ppk\0" @@ -217,13 +210,9 @@ static int prompt_keyfile(HWND hwnd, char *dlgtitle, *filename = '\0'; of.nMaxFile = FILENAME_MAX; of.lpstrFileTitle = NULL; - of.lpstrInitialDir = NULL; of.lpstrTitle = dlgtitle; of.Flags = 0; - if (save) - return GetSaveFileName(&of); - else - return GetOpenFileName(&of); + return request_file(NULL, &of, FALSE, save); } /* @@ -644,8 +633,8 @@ void load_key_file(HWND hwnd, struct MainDlgState *state, !import_possible(type)) { char *msg = dupprintf("Couldn't load private key (%s)", key_type_to_str(type)); - MessageBox(NULL, msg, - "PuTTYgen Error", MB_OK | MB_ICONERROR); + message_box(msg, "PuTTYgen Error", MB_OK | MB_ICONERROR, + HELPCTXID(errors_cantloadkey)); sfree(msg); return; } @@ -706,7 +695,8 @@ void load_key_file(HWND hwnd, struct MainDlgState *state, sfree(comment); if (ret == 0) { char *msg = dupprintf("Couldn't load private key (%s)", errmsg); - MessageBox(NULL, msg, "PuTTYgen Error", MB_OK | MB_ICONERROR); + message_box(msg, "PuTTYgen Error", MB_OK | MB_ICONERROR, + HELPCTXID(errors_cantloadkey)); sfree(msg); } else if (ret == 1) { /* @@ -1426,6 +1416,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) InitCommonControls(); hinst = inst; + hwnd = NULL; /* * See if we can find our Help file.