X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/8e97579565606eb5386c85717640ee534a8606dc..c5e438ecf3f6d7b8caab10e43a452f3555149309:/windlg.c diff --git a/windlg.c b/windlg.c index fe3a1ad6..81194648 100644 --- a/windlg.c +++ b/windlg.c @@ -27,6 +27,8 @@ static int requested_help; static struct prefslist cipherlist; +struct sesslist sesslist; /* exported to window.c */ + #define PRINTER_DISABLED_STRING "None (printing disabled)" void force_normal(HWND hwnd) @@ -140,7 +142,7 @@ static int CALLBACK LogProc(HWND hwnd, UINT msg, memcpy(p, sel_nl, sizeof(sel_nl)); p += sizeof(sel_nl); } - write_aclip(clipdata, size, TRUE); + write_aclip(NULL, clipdata, size, TRUE); sfree(clipdata); } sfree(selitems); @@ -1069,9 +1071,9 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) n = SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_GETCOUNT, 0, 0); for (i = n; i-- > 0;) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_DELETESTRING, i, 0); - for (i = 0; i < nsessions; i++) + for (i = 0; i < sesslist.nsessions; i++) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_ADDSTRING, - 0, (LPARAM) (sessions[i])); + 0, (LPARAM) (sesslist.sessions[i])); } SetDlgItemInt(hwnd, IDC_PORT, cfg.port, FALSE); CheckRadioButton(hwnd, IDC_PROTRAW, IDC_PROTSSH, @@ -2059,11 +2061,11 @@ static int load_selected_session(HWND hwnd) MessageBeep(0); return 0; } - isdef = !strcmp(sessions[n], "Default Settings"); - load_settings(sessions[n], !isdef, &cfg); + isdef = !strcmp(sesslist.sessions[n], "Default Settings"); + load_settings(sesslist.sessions[n], !isdef, &cfg); init_dlg_ctrls(hwnd, TRUE); if (!isdef) - SetDlgItemText(hwnd, IDC_SESSEDIT, sessions[n]); + SetDlgItemText(hwnd, IDC_SESSEDIT, sesslist.sessions[n]); else SetDlgItemText(hwnd, IDC_SESSEDIT, ""); /* Restore the selection, which will have been clobbered by @@ -2413,20 +2415,20 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, MessageBeep(0); break; } - strcpy(str, sessions[n]); + strcpy(str, sesslist.sessions[n]); } save_settings(str, !!strcmp(str, "Default Settings"), &cfg); - get_sesslist(FALSE); - get_sesslist(TRUE); + get_sesslist(&sesslist, FALSE); + get_sesslist(&sesslist, TRUE); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, FALSE, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_RESETCONTENT, 0, 0); - for (i = 0; i < nsessions; i++) + for (i = 0; i < sesslist.nsessions; i++) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_ADDSTRING, 0, - (LPARAM) (sessions[i])); + (LPARAM) (sesslist.sessions[i])); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_SETCURSEL, (WPARAM) - 1, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, @@ -2472,17 +2474,17 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, MessageBeep(0); break; } - del_settings(sessions[n]); - get_sesslist(FALSE); - get_sesslist(TRUE); + del_settings(sesslist.sessions[n]); + get_sesslist(&sesslist, FALSE); + get_sesslist(&sesslist, TRUE); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, FALSE, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_RESETCONTENT, 0, 0); - for (i = 0; i < nsessions; i++) + for (i = 0; i < sesslist.nsessions; i++) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_ADDSTRING, 0, - (LPARAM) (sessions[i])); + (LPARAM) (sesslist.sessions[i])); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_SETCURSEL, (WPARAM) - 1, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, @@ -3726,11 +3728,11 @@ int do_config(void) { int ret; - get_sesslist(TRUE); + get_sesslist(&sesslist, TRUE); savedsession[0] = '\0'; ret = DialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL, MainDlgProc); - get_sesslist(FALSE); + get_sesslist(&sesslist, FALSE); return ret; } @@ -3749,12 +3751,12 @@ int do_reconfig(HWND hwnd) return ret; } -void logevent(char *string) +void logevent(void *frontend, char *string) { char timebuf[40]; time_t t; - log_eventlog(string); + log_eventlog(logctx, string); if (nevents >= negsize) { negsize += 64; @@ -3793,7 +3795,7 @@ void showabout(HWND hwnd) DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd, AboutProc); } -void verify_ssh_host_key(char *host, int port, char *keytype, +void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype, char *keystr, char *fingerprint) { int ret; @@ -3869,7 +3871,7 @@ void verify_ssh_host_key(char *host, int port, char *keytype, * below the configured 'warn' threshold). * cs: 0 = both ways, 1 = client->server, 2 = server->client */ -void askcipher(char *ciphername, int cs) +void askcipher(void *frontend, char *ciphername, int cs) { static const char mbtitle[] = "PuTTY Security Alert"; static const char msg[] = @@ -3898,7 +3900,7 @@ void askcipher(char *ciphername, int cs) * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(char *filename) +int askappend(void *frontend, char *filename) { static const char mbtitle[] = "PuTTY Log to File"; static const char msgtemplate[] = @@ -3927,6 +3929,13 @@ int askappend(char *filename) /* * Warn about the obsolescent key file format. + * + * Uniquely among these functions, this one does _not_ expect a + * frontend handle. This means that if PuTTY is ported to a + * platform which requires frontend handles, this function will be + * an anomaly. Fortunately, the problem it addresses will not have + * been present on that platform, so it can plausibly be + * implemented as an empty function. */ void old_keyfile_warning(void) {