-static int CALLBACK SshProc (HWND hwnd, UINT msg,
- WPARAM wParam, LPARAM lParam) {
- struct ctlpos cp;
- OPENFILENAME of;
- char filename[sizeof(cfg.keyfile)];
- enum { controlstartvalue = 1000,
- IDC_TTSTATIC,
- IDC_TTEDIT,
- IDC_LOGSTATIC,
- IDC_LOGEDIT,
- IDC_NOPTY,
- IDC_CIPHERSTATIC,
- IDC_CIPHER3DES,
- IDC_CIPHERBLOWF,
- IDC_CIPHERDES,
- IDC_AUTHTIS,
- IDC_PKSTATIC,
- IDC_PKEDIT,
- IDC_PKBUTTON,
- IDC_SSHPROTSTATIC,
- IDC_SSHPROT1,
- IDC_SSHPROT2,
- IDC_AGENTFWD,
- IDC_CMDSTATIC,
- IDC_CMDEDIT
- };
-
- switch (msg) {
- case WM_INITDIALOG:
- /* Accelerators used: [aco] 123abdkmprtuw */
- ctlposinit(&cp, hwnd);
- if (wParam == 0) {
- staticedit(&cp, "Terminal-&type string", IDC_TTSTATIC, IDC_TTEDIT);
- staticedit(&cp, "Auto-login &username", IDC_LOGSTATIC, IDC_LOGEDIT);
- multiedit(&cp,
- "&Remote command:", IDC_CMDSTATIC, IDC_CMDEDIT, 100,
- NULL);
- checkbox(&cp, "Don't allocate a &pseudo-terminal", IDC_NOPTY);
- checkbox(&cp, "Atte&mpt TIS or CryptoCard authentication",
- IDC_AUTHTIS);
- checkbox(&cp, "Allow &agent forwarding", IDC_AGENTFWD);
- editbutton(&cp, "Private &key file for authentication:",
- IDC_PKSTATIC, IDC_PKEDIT, "Bro&wse...", IDC_PKBUTTON);
- radioline(&cp, "Preferred SSH protocol version:",
- IDC_SSHPROTSTATIC, 2,
- "&1", IDC_SSHPROT1, "&2", IDC_SSHPROT2, NULL);
- radioline(&cp, "Preferred encryption algorithm:", IDC_CIPHERSTATIC, 3,
- "&3DES", IDC_CIPHER3DES,
- "&Blowfish", IDC_CIPHERBLOWF,
- "&DES", IDC_CIPHERDES, NULL);
- }
-
- SetDlgItemText (hwnd, IDC_TTEDIT, cfg.termtype);
- SetDlgItemText (hwnd, IDC_LOGEDIT, cfg.username);
- CheckDlgButton (hwnd, IDC_NOPTY, cfg.nopty);
- CheckDlgButton (hwnd, IDC_AGENTFWD, cfg.agentfwd);
- CheckRadioButton (hwnd, IDC_CIPHER3DES, IDC_CIPHERDES,
- cfg.cipher == CIPHER_BLOWFISH ? IDC_CIPHERBLOWF :
- cfg.cipher == CIPHER_DES ? IDC_CIPHERDES :
- IDC_CIPHER3DES);
- CheckRadioButton (hwnd, IDC_SSHPROT1, IDC_SSHPROT2,
- cfg.sshprot == 1 ? IDC_SSHPROT1 : IDC_SSHPROT2);
- CheckDlgButton (hwnd, IDC_AUTHTIS, cfg.try_tis_auth);
- SetDlgItemText (hwnd, IDC_PKEDIT, cfg.keyfile);
- SetDlgItemText (hwnd, IDC_CMDEDIT, cfg.remote_cmd);
- break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TTEDIT:
- if (HIWORD(wParam) == EN_CHANGE)
- GetDlgItemText (hwnd, IDC_TTEDIT, cfg.termtype,
- sizeof(cfg.termtype)-1);
- break;
- case IDC_LOGEDIT:
- if (HIWORD(wParam) == EN_CHANGE)
- GetDlgItemText (hwnd, IDC_LOGEDIT, cfg.username,
- sizeof(cfg.username)-1);
- break;
- case IDC_NOPTY:
- if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED)
- cfg.nopty = IsDlgButtonChecked (hwnd, IDC_NOPTY);
- break;
- case IDC_AGENTFWD:
- if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED)
- cfg.agentfwd = IsDlgButtonChecked (hwnd, IDC_AGENTFWD);
- break;
- case IDC_CIPHER3DES:
- case IDC_CIPHERBLOWF:
- case IDC_CIPHERDES:
- if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED) {
- if (IsDlgButtonChecked (hwnd, IDC_CIPHER3DES))
- cfg.cipher = CIPHER_3DES;
- else if (IsDlgButtonChecked (hwnd, IDC_CIPHERBLOWF))
- cfg.cipher = CIPHER_BLOWFISH;
- else if (IsDlgButtonChecked (hwnd, IDC_CIPHERDES))
- cfg.cipher = CIPHER_DES;
- }
- break;
- case IDC_SSHPROT1:
- case IDC_SSHPROT2:
- if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED) {
- if (IsDlgButtonChecked (hwnd, IDC_SSHPROT1))
- cfg.sshprot = 1;
- else if (IsDlgButtonChecked (hwnd, IDC_SSHPROT2))
- cfg.sshprot = 2;
- }
- break;
- case IDC_AUTHTIS:
- if (HIWORD(wParam) == BN_CLICKED ||
- HIWORD(wParam) == BN_DOUBLECLICKED)
- cfg.try_tis_auth = IsDlgButtonChecked (hwnd, IDC_AUTHTIS);
- break;
- case IDC_PKEDIT:
- if (HIWORD(wParam) == EN_CHANGE)
- GetDlgItemText (hwnd, IDC_PKEDIT, cfg.keyfile,
- sizeof(cfg.keyfile)-1);
- break;
- case IDC_CMDEDIT:
- if (HIWORD(wParam) == EN_CHANGE)
- GetDlgItemText (hwnd, IDC_CMDEDIT, cfg.remote_cmd,
- sizeof(cfg.remote_cmd)-1);
- break;
- case IDC_PKBUTTON:
- /*
- * FIXME: this crashes. Find out why.
- */
- 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;
- of.lpstrFilter = "All Files\0*\0\0\0";
- of.lpstrCustomFilter = NULL;
- of.nFilterIndex = 1;
- of.lpstrFile = filename; strcpy(filename, cfg.keyfile);
- of.nMaxFile = sizeof(filename);
- of.lpstrFileTitle = NULL;
- of.lpstrInitialDir = NULL;
- of.lpstrTitle = "Select Public Key File";
- of.Flags = 0;
- if (GetOpenFileName(&of)) {
- strcpy(cfg.keyfile, filename);
- SetDlgItemText (hwnd, IDC_PKEDIT, cfg.keyfile);
- }
- break;
- }
- break;
- }
- return GeneralPanelProc (hwnd, msg, wParam, lParam);
-}
-
-static int CALLBACK SelectionProc (HWND hwnd, UINT msg,
- WPARAM wParam, LPARAM lParam) {
- struct ctlpos cp;
- int i;
- enum { controlstartvalue = 1000,
- IDC_MBSTATIC,
- IDC_MBWINDOWS,
- IDC_MBXTERM,
- IDC_CCSTATIC,
- IDC_CCLIST,
- IDC_CCSET,
- IDC_CCSTATIC2,
- IDC_CCEDIT
- };
-
- switch (msg) {
- case WM_INITDIALOG:
- /* Accelerators used: [aco] stwx */
- ctlposinit(&cp, hwnd);
- radiobig(&cp, "Action of mouse buttons:", IDC_MBSTATIC,
- "&Windows (Right pastes, Middle extends)", IDC_MBWINDOWS,
- "&xterm (Right extends, Middle pastes)", IDC_MBXTERM,
- NULL);
- charclass(&cp, "Character classes:", IDC_CCSTATIC, IDC_CCLIST,
- "&Set", IDC_CCSET, IDC_CCEDIT,
- "&to class", IDC_CCSTATIC2);
-
- CheckRadioButton (hwnd, IDC_MBWINDOWS, IDC_MBXTERM,
- cfg.mouse_is_xterm ? IDC_MBXTERM : IDC_MBWINDOWS);
- {
- static int tabs[4] = {25, 61, 96, 128};
- SendDlgItemMessage (hwnd, IDC_CCLIST, LB_SETTABSTOPS, 4,
- (LPARAM) tabs);
- }
- for (i=0; i<256; i++) {
- char str[100];
- sprintf(str, "%d\t(0x%02X)\t%c\t%d", i, i,
- (i>=0x21 && i != 0x7F) ? i : ' ',
- cfg.wordness[i]);
- SendDlgItemMessage (hwnd, IDC_CCLIST, LB_ADDSTRING, 0,
- (LPARAM) str);
- }