Created new data types `Filename' and `FontSpec', intended to be
[u/mdw/putty] / windlg.c
index 8119464..944cfda 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -27,6 +27,8 @@ static int requested_help;
 
 static struct prefslist cipherlist;
 
+extern Config cfg;                    /* defined in window.c */
+
 struct sesslist sesslist;             /* exported to window.c */
 
 #define PRINTER_DISABLED_STRING "None (printing disabled)"
@@ -454,6 +456,11 @@ enum { IDCX_ABOUT =
     IDC_PROXYPORTEDIT,
     IDC_PROXYEXCLUDESTATIC,
     IDC_PROXYEXCLUDEEDIT,
+    IDC_PROXYLOCALHOST,
+    IDC_PROXYDNSSTATIC,
+    IDC_PROXYDNSNO,
+    IDC_PROXYDNSAUTO,
+    IDC_PROXYDNSYES,
     IDC_PROXYUSERSTATIC,
     IDC_PROXYUSEREDIT,
     IDC_PROXYPASSSTATIC,
@@ -615,6 +622,9 @@ enum { IDCX_ABOUT =
     IDC_X11_FORWARD,
     IDC_X11_DISPSTATIC,
     IDC_X11_DISPLAY,
+    IDC_X11AUTHSTATIC,
+    IDC_X11MIT,
+    IDC_X11XDM,
     IDC_LPORT_ALL,
     IDC_RPORT_ALL,
     IDC_PFWDSTATIC,
@@ -647,22 +657,17 @@ static const char *const colours[] = {
     "ANSI Cyan", "ANSI Cyan Bold",
     "ANSI White", "ANSI White Bold"
 };
-static const int permcolour[] = {
-    TRUE, FALSE, TRUE, FALSE, TRUE, TRUE,
-    TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE,
-    TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE
-};
 
 static void fmtfont(char *buf)
 {
-    sprintf(buf, "Font: %s, ", cfg.font);
-    if (cfg.fontisbold)
+    sprintf(buf, "Font: %s, ", cfg.font.name);
+    if (cfg.font.isbold)
        strcat(buf, "bold, ");
-    if (cfg.fontheight == 0)
+    if (cfg.font.height == 0)
        strcat(buf, "default height");
     else
        sprintf(buf + strlen(buf), "%d-point",
-               (cfg.fontheight < 0 ? -cfg.fontheight : cfg.fontheight));
+               (cfg.font.height < 0 ? -cfg.font.height : cfg.font.height));
 }
 
 char *help_context_cmd(int id)
@@ -882,7 +887,13 @@ char *help_context_cmd(int id)
         return "JI(`',`proxy.main')";
       case IDC_PROXYEXCLUDESTATIC:
       case IDC_PROXYEXCLUDEEDIT:
+      case IDC_PROXYLOCALHOST:
         return "JI(`',`proxy.exclude')";
+      case IDC_PROXYDNSSTATIC:
+      case IDC_PROXYDNSNO:
+      case IDC_PROXYDNSAUTO:
+      case IDC_PROXYDNSYES:
+       return "JI(`',`proxy.dns')";
       case IDC_PROXYUSERSTATIC:
       case IDC_PROXYUSEREDIT:
       case IDC_PROXYPASSSTATIC:
@@ -1014,6 +1025,10 @@ char *help_context_cmd(int id)
       case IDC_X11_DISPSTATIC:
       case IDC_X11_DISPLAY:
         return "JI(`',`ssh.tunnels.x11')";
+      case IDC_X11AUTHSTATIC:
+      case IDC_X11MIT:
+      case IDC_X11XDM:
+       return "JI(`',`ssh.tunnels.x11auth')";
       case IDC_PFWDSTATIC:
       case IDC_PFWDSTATIC2:
       case IDC_PFWDREMOVE:
@@ -1116,11 +1131,11 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     CheckDlgButton(hwnd, IDC_TELNETKEY, cfg.telnet_keyboard);
     CheckDlgButton(hwnd, IDC_TELNETRET, cfg.telnet_newline);
     CheckRadioButton(hwnd, IDC_ECHOBACKEND, IDC_ECHONO,
-                    cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND :
-                    cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO);
+                    cfg.localecho == AUTO ? IDC_ECHOBACKEND :
+                    cfg.localecho == FORCE_ON ? IDC_ECHOYES : IDC_ECHONO);
     CheckRadioButton(hwnd, IDC_EDITBACKEND, IDC_EDITNO,
-                    cfg.localedit == LD_BACKEND ? IDC_EDITBACKEND :
-                    cfg.localedit == LD_YES ? IDC_EDITYES : IDC_EDITNO);
+                    cfg.localedit == AUTO ? IDC_EDITBACKEND :
+                    cfg.localedit == FORCE_ON ? IDC_EDITYES : IDC_EDITNO);
     SetDlgItemText(hwnd, IDC_ANSWEREDIT, cfg.answerback);
     CheckDlgButton(hwnd, IDC_ALWAYSONTOP, cfg.alwaysontop);
     CheckDlgButton(hwnd, IDC_FULLSCREENONALTENTER, cfg.fullscreenonaltenter);
@@ -1146,7 +1161,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
                     B_IND_DISABLED ? IDC_B_IND_DISABLED : cfg.beep_ind ==
                     B_IND_FLASH ? IDC_B_IND_FLASH : cfg.beep_ind ==
                     B_IND_STEADY ? IDC_B_IND_STEADY : IDC_B_IND_DISABLED);
-    SetDlgItemText(hwnd, IDC_BELL_WAVEEDIT, cfg.bell_wavefile);
+    SetDlgItemText(hwnd, IDC_BELL_WAVEEDIT, cfg.bell_wavefile.path);
     CheckDlgButton(hwnd, IDC_BELLOVL, cfg.bellovl);
     SetDlgItemInt(hwnd, IDC_BELLOVLN, cfg.bellovl_n, FALSE);
     MySetDlgItemFlt(hwnd, IDC_BELLOVLT, cfg.bellovl_t / 1000.0);
@@ -1156,7 +1171,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     CheckDlgButton(hwnd, IDC_BLINKTEXT, cfg.blinktext);
 
     SetDlgItemText(hwnd, IDC_WINEDIT, cfg.wintitle);
-    CheckDlgButton(hwnd, IDC_WINNAME, cfg.win_name_always);
+    CheckDlgButton(hwnd, IDC_WINNAME, !cfg.win_name_always);
     CheckDlgButton(hwnd, IDC_HIDEMOUSE, cfg.hide_mouseptr);
     CheckDlgButton(hwnd, IDC_SUNKENEDGE, cfg.sunken_edge);
     SetDlgItemInt(hwnd, IDC_WINBEDIT, cfg.window_border, FALSE);
@@ -1172,9 +1187,9 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
                     cfg.resize_action == RESIZE_EITHER ? IDC_RESIZEEITHER :
                     IDC_RESIZENONE);
     CheckRadioButton(hwnd, IDC_COEALWAYS, IDC_COENORMAL,
-                    cfg.close_on_exit == COE_NORMAL ? IDC_COENORMAL :
+                    cfg.close_on_exit == AUTO ? IDC_COENORMAL :
                     cfg.close_on_exit ==
-                    COE_NEVER ? IDC_COENEVER : IDC_COEALWAYS);
+                    FORCE_OFF ? IDC_COENEVER : IDC_COEALWAYS);
     CheckDlgButton(hwnd, IDC_CLOSEWARN, cfg.warn_on_close);
 
     SetDlgItemText(hwnd, IDC_TTEDIT, cfg.termtype);
@@ -1182,7 +1197,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     SetDlgItemText(hwnd, IDC_R_TSEDIT, cfg.termspeed);
     SetDlgItemText(hwnd, IDC_RLLUSEREDIT, cfg.localusername);
     SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);
-    SetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename);
+    SetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename.path);
     CheckRadioButton(hwnd, IDC_LSTATOFF, IDC_LSTATPACKET,
                     cfg.logtype == LGTYP_NONE ? IDC_LSTATOFF :
                     cfg.logtype == LGTYP_ASCII ? IDC_LSTATASCII :
@@ -1225,7 +1240,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
                     cfg.sshprot == 3 ? IDC_SSHPROT2ONLY : IDC_SSHPROT1ONLY);
     CheckDlgButton(hwnd, IDC_AUTHTIS, cfg.try_tis_auth);
     CheckDlgButton(hwnd, IDC_AUTHKI, cfg.try_ki_auth);
-    SetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile);
+    SetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile.path);
     SetDlgItemText(hwnd, IDC_CMDEDIT, cfg.remote_cmd);
 
     {
@@ -1288,9 +1303,8 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
            SendDlgItemMessage(hwnd, IDC_COLOURLIST,
                               LB_DELETESTRING, i, 0);
        for (i = 0; i < 22; i++)
-           if (cfg.bold_colour || permcolour[i])
-               SendDlgItemMessage(hwnd, IDC_COLOURLIST, LB_ADDSTRING, 0,
-                                  (LPARAM) colours[i]);
+           SendDlgItemMessage(hwnd, IDC_COLOURLIST, LB_ADDSTRING, 0,
+                              (LPARAM) colours[i]);
     }
     SendDlgItemMessage(hwnd, IDC_COLOURLIST, LB_SETCURSEL, 0, 0);
     SetDlgItemInt(hwnd, IDC_RVALUE, cfg.colours[0][0], FALSE);
@@ -1336,6 +1350,8 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
 
     CheckDlgButton(hwnd, IDC_X11_FORWARD, cfg.x11_forward);
     SetDlgItemText(hwnd, IDC_X11_DISPLAY, cfg.x11_display);
+    CheckRadioButton(hwnd, IDC_X11MIT, IDC_X11XDM,
+                    cfg.x11_auth == X11_MIT ? IDC_X11MIT : IDC_X11XDM);
 
     CheckDlgButton(hwnd, IDC_LPORT_ALL, cfg.lport_acceptall);
     CheckDlgButton(hwnd, IDC_RPORT_ALL, cfg.rport_acceptall);
@@ -1349,6 +1365,11 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     SetDlgItemText(hwnd, IDC_PROXYHOSTEDIT, cfg.proxy_host);
     SetDlgItemInt(hwnd, IDC_PROXYPORTEDIT, cfg.proxy_port, FALSE);
     SetDlgItemText(hwnd, IDC_PROXYEXCLUDEEDIT, cfg.proxy_exclude_list);
+    CheckDlgButton(hwnd, IDC_PROXYLOCALHOST, cfg.even_proxy_localhost);
+    CheckRadioButton(hwnd, IDC_PROXYDNSNO, IDC_PROXYDNSYES,
+                    cfg.proxy_dns == FORCE_OFF ? IDC_PROXYDNSNO :
+                    cfg.proxy_dns == FORCE_ON ? IDC_PROXYDNSYES :
+                    IDC_PROXYDNSAUTO);
     SetDlgItemText(hwnd, IDC_PROXYTELNETCMDEDIT, cfg.proxy_telnet_command);
     SetDlgItemText(hwnd, IDC_PROXYUSEREDIT, cfg.proxy_username);
     SetDlgItemText(hwnd, IDC_PROXYPASSEDIT, cfg.proxy_password);
@@ -1361,50 +1382,50 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_ADDSTRING, 0, (LPARAM)"Off");
     SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_ADDSTRING, 0, (LPARAM)"On");
     SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_SETCURSEL,
-                      cfg.sshbug_ignore1 == BUG_ON ? 2 :
-                      cfg.sshbug_ignore1 == BUG_OFF ? 1 : 0, 0);
+                      cfg.sshbug_ignore1 == FORCE_ON ? 2 :
+                      cfg.sshbug_ignore1 == FORCE_OFF ? 1 : 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_RESETCONTENT, 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_ADDSTRING, 0, (LPARAM)"Auto");
     SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_ADDSTRING, 0, (LPARAM)"Off");
     SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_ADDSTRING, 0, (LPARAM)"On");
     SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_SETCURSEL,
-                      cfg.sshbug_plainpw1 == BUG_ON ? 2 :
-                      cfg.sshbug_plainpw1 == BUG_OFF ? 1 : 0, 0);
+                      cfg.sshbug_plainpw1 == FORCE_ON ? 2 :
+                      cfg.sshbug_plainpw1 == FORCE_OFF ? 1 : 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_RESETCONTENT, 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_ADDSTRING, 0, (LPARAM)"Auto");
     SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_ADDSTRING, 0, (LPARAM)"Off");
     SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_ADDSTRING, 0, (LPARAM)"On");
     SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_SETCURSEL,
-                      cfg.sshbug_rsa1 == BUG_ON ? 2 :
-                      cfg.sshbug_rsa1 == BUG_OFF ? 1 : 0, 0);
+                      cfg.sshbug_rsa1 == FORCE_ON ? 2 :
+                      cfg.sshbug_rsa1 == FORCE_OFF ? 1 : 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_RESETCONTENT, 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_ADDSTRING, 0, (LPARAM)"Auto");
     SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_ADDSTRING, 0, (LPARAM)"Off");
     SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_ADDSTRING, 0, (LPARAM)"On");
     SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_SETCURSEL,
-                      cfg.sshbug_hmac2 == BUG_ON ? 2 :
-                      cfg.sshbug_hmac2 == BUG_OFF ? 1 : 0, 0);
+                      cfg.sshbug_hmac2 == FORCE_ON ? 2 :
+                      cfg.sshbug_hmac2 == FORCE_OFF ? 1 : 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_RESETCONTENT, 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_ADDSTRING, 0, (LPARAM)"Auto");
     SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_ADDSTRING, 0, (LPARAM)"Off");
     SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_ADDSTRING, 0, (LPARAM)"On");
     SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_SETCURSEL,
-                      cfg.sshbug_derivekey2 == BUG_ON ? 2 :
-                      cfg.sshbug_derivekey2 == BUG_OFF ? 1 : 0, 0);
+                      cfg.sshbug_derivekey2 == FORCE_ON ? 2 :
+                      cfg.sshbug_derivekey2 == FORCE_OFF ? 1 : 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_RESETCONTENT, 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_ADDSTRING, 0, (LPARAM)"Auto");
     SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_ADDSTRING, 0, (LPARAM)"Off");
     SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_ADDSTRING, 0, (LPARAM)"On");
     SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_SETCURSEL,
-                      cfg.sshbug_rsapad2 == BUG_ON ? 2 :
-                      cfg.sshbug_rsapad2 == BUG_OFF ? 1 : 0, 0);
+                      cfg.sshbug_rsapad2 == FORCE_ON ? 2 :
+                      cfg.sshbug_rsapad2 == FORCE_OFF ? 1 : 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_RESETCONTENT, 0, 0);
     SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_ADDSTRING, 0, (LPARAM)"Auto");
     SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_ADDSTRING, 0, (LPARAM)"Off");
     SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_ADDSTRING, 0, (LPARAM)"On");
     SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_SETCURSEL,
-                      cfg.sshbug_dhgex2 == BUG_ON ? 2 :
-                      cfg.sshbug_dhgex2 == BUG_OFF ? 1 : 0, 0);
+                      cfg.sshbug_dhgex2 == FORCE_ON ? 2 :
+                      cfg.sshbug_dhgex2 == FORCE_OFF ? 1 : 0, 0);
 }
 
 struct treeview_faff {
@@ -1693,7 +1714,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
                 IDC_BOX_APPEARANCE3);
        multiedit(&cp,
                  "Window &title:", IDC_WINTITLE, IDC_WINEDIT, 100, NULL);
-       checkbox(&cp, "Avoid ever using &icon title", IDC_WINNAME);
+       checkbox(&cp, "Separate window and &icon titles", IDC_WINNAME);
        endbox(&cp);
        beginbox(&cp, "Adjust the use of the mouse pointer",
                 IDC_BOX_APPEARANCE4);
@@ -1850,7 +1871,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == proxypanelstart) {
-       /* The Proxy panel. Accelerators used: [acgoh] ntslypeuwmv */
+       /* The Proxy panel. Accelerators used: [acgoh] ntslypeuwmvxd */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        if (dlgtype == 0) {
@@ -1868,6 +1889,13 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
            multiedit(&cp,
                      "&Exclude Hosts/IPs", IDC_PROXYEXCLUDESTATIC,
                      IDC_PROXYEXCLUDEEDIT, 100, NULL);
+           checkbox(&cp, "Consider pro&xying local host connections",
+                    IDC_PROXYLOCALHOST);
+           radioline(&cp, "Do &DNS name lookup at proxy end:",
+                     IDC_PROXYDNSSTATIC, 3,
+                     "No", IDC_PROXYDNSNO,
+                     "Auto", IDC_PROXYDNSAUTO,
+                     "Yes", IDC_PROXYDNSYES, NULL);
            staticedit(&cp, "&Username", IDC_PROXYUSERSTATIC,
                       IDC_PROXYUSEREDIT, 60);
            staticpassedit(&cp, "Pass&word", IDC_PROXYPASSSTATIC,
@@ -1931,7 +1959,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == sshpanelstart) {
-       /* The SSH panel. Accelerators used: [acgoh] r pe12ni sd */
+       /* The SSH panel. Accelerators used: [acgoh] r pel12n sud i */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        if (dlgtype == 0) {
@@ -1952,10 +1980,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
                      "2 o&nly", IDC_SSHPROT2ONLY, NULL);
            endbox(&cp);
            beginbox(&cp, "Encryption options", IDC_BOX_SSH3);
+           /* Adds accelerators: ud */
            prefslist(&cipherlist, &cp, "Encryption cipher &selection policy:",
                      IDC_CIPHERSTATIC2, IDC_CIPHERLIST, IDC_CIPHERUP,
                      IDC_CIPHERDN);
-           checkbox(&cp, "Enable non-standard use of single-&DES in SSH 2",
+           checkbox(&cp, "Enable non-standard use of s&ingle-DES in SSH 2",
                     IDC_SSH2DES);
            endbox(&cp);
        }
@@ -1988,7 +2017,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == sshbugspanelstart) {
-       /* The SSH bugs panel. Accelerators used: [acgoh] isrmep */
+       /* The SSH bugs panel. Accelerators used: [acgoh] isrmepd */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        if (dlgtype == 0) {
@@ -2015,7 +2044,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == tunnelspanelstart) {
-       /* The Tunnels panel. Accelerators used: [acgoh] deilmrstxp */
+       /* The Tunnels panel. Accelerators used: [acgoh] exu tprsdilm */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        if (dlgtype == 0) {
@@ -2023,8 +2052,12 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
                     IDC_TITLE_TUNNELS);
            beginbox(&cp, "X11 forwarding", IDC_BOX_TUNNELS1);
            checkbox(&cp, "&Enable X11 forwarding", IDC_X11_FORWARD);
-           multiedit(&cp, "&X display location", IDC_X11_DISPSTATIC,
-                     IDC_X11_DISPLAY, 50, NULL);
+           staticedit(&cp, "&X display location", IDC_X11_DISPSTATIC,
+                     IDC_X11_DISPLAY, 50);
+           radioline(&cp, "Remote X11 a&uthentication protocol",
+                     IDC_X11AUTHSTATIC, 2,
+                     "MIT-Magic-Cookie-1", IDC_X11MIT,
+                     "XDM-Authorization-1", IDC_X11XDM, NULL);
            endbox(&cp);
            beginbox(&cp, "Port forwarding", IDC_BOX_TUNNELS2);
            checkbox(&cp, "Local ports accept connections from o&ther hosts",
@@ -2037,10 +2070,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
                      "Add new forwarded port:", IDC_PFWDSTATIC2,
                      "&Source port", IDC_SPORTSTATIC, IDC_SPORTEDIT,
                      "Dest&ination", IDC_DPORTSTATIC, IDC_DPORTEDIT,
-                     "A&dd", IDC_PFWDADD);
-           bareradioline(&cp, 2,
-                         "&Local", IDC_PFWDLOCAL,
-                         "Re&mote", IDC_PFWDREMOTE, NULL);
+                     "A&dd", IDC_PFWDADD,
+                     "&Local", IDC_PFWDLOCAL,
+                     "Re&mote", IDC_PFWDREMOTE);
            endbox(&cp);
 
        }
@@ -2084,7 +2116,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
     struct treeview_faff tvfaff;
     HTREEITEM hsession;
     OPENFILENAME of;
-    char filename[sizeof(cfg.keyfile)];
+    char filename[sizeof(cfg.keyfile.path)];
     CHOOSEFONT cf;
     LOGFONT lf;
     char fontstatic[256];
@@ -2640,11 +2672,11 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED) {
                    if (LOWORD(wParam) == IDC_ECHOBACKEND)
-                       cfg.localecho = LD_BACKEND;
+                       cfg.localecho = AUTO;
                    if (LOWORD(wParam) == IDC_ECHOYES)
-                       cfg.localecho = LD_YES;
+                       cfg.localecho = FORCE_ON;
                    if (LOWORD(wParam) == IDC_ECHONO)
-                       cfg.localecho = LD_NO;
+                       cfg.localecho = FORCE_OFF;
                }
                break;
              case IDC_EDITBACKEND:
@@ -2653,11 +2685,11 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED) {
                    if (LOWORD(wParam) == IDC_EDITBACKEND)
-                       cfg.localedit = LD_BACKEND;
+                       cfg.localedit = AUTO;
                    if (LOWORD(wParam) == IDC_EDITYES)
-                       cfg.localedit = LD_YES;
+                       cfg.localedit = FORCE_ON;
                    if (LOWORD(wParam) == IDC_EDITNO)
-                       cfg.localedit = LD_NO;
+                       cfg.localedit = FORCE_OFF;
                }
                break;
              case IDC_ANSWEREDIT:
@@ -2745,20 +2777,20 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
              case IDC_CHOOSEFONT:
                {
                    HDC hdc = GetDC(0);
-                   lf.lfHeight = -MulDiv(cfg.fontheight,
+                   lf.lfHeight = -MulDiv(cfg.font.height,
                                          GetDeviceCaps(hdc, LOGPIXELSY),
                                          72);
                    ReleaseDC(0, hdc);
                }
                lf.lfWidth = lf.lfEscapement = lf.lfOrientation = 0;
                lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = 0;
-               lf.lfWeight = (cfg.fontisbold ? FW_BOLD : 0);
-               lf.lfCharSet = cfg.fontcharset;
+               lf.lfWeight = (cfg.font.isbold ? FW_BOLD : 0);
+               lf.lfCharSet = cfg.font.charset;
                lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
                lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
                lf.lfQuality = DEFAULT_QUALITY;
                lf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
-               strncpy(lf.lfFaceName, cfg.font,
+               strncpy(lf.lfFaceName, cfg.font.name,
                        sizeof(lf.lfFaceName) - 1);
                lf.lfFaceName[sizeof(lf.lfFaceName) - 1] = '\0';
 
@@ -2769,11 +2801,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                    CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
 
                if (ChooseFont(&cf)) {
-                   strncpy(cfg.font, lf.lfFaceName, sizeof(cfg.font) - 1);
-                   cfg.font[sizeof(cfg.font) - 1] = '\0';
-                   cfg.fontisbold = (lf.lfWeight == FW_BOLD);
-                   cfg.fontcharset = lf.lfCharSet;
-                   cfg.fontheight = cf.iPointSize / 10;
+                   strncpy(cfg.font.name, lf.lfFaceName,
+                           sizeof(cfg.font.name) - 1);
+                   cfg.font.name[sizeof(cfg.font.name) - 1] = '\0';
+                   cfg.font.isbold = (lf.lfWeight == FW_BOLD);
+                   cfg.font.charset = lf.lfCharSet;
+                   cfg.font.height = cf.iPointSize / 10;
                    fmtfont(fontstatic);
                    SetDlgItemText(hwnd, IDC_FONTSTATIC, fontstatic);
                }
@@ -2815,27 +2848,28 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                of.lStructSize = sizeof(of);
 #endif
                of.hwndOwner = hwnd;
-               of.lpstrFilter = "Wave Files\0*.WAV\0AllFiles\0*\0\0\0";
+               of.lpstrFilter = "Wave Files (*.wav)\0*.WAV\0"
+                   "All Files (*.*)\0*\0\0\0";
                of.lpstrCustomFilter = NULL;
                of.nFilterIndex = 1;
                of.lpstrFile = filename;
-               strcpy(filename, cfg.bell_wavefile);
+               strcpy(filename, cfg.bell_wavefile.path);
                of.nMaxFile = sizeof(filename);
                of.lpstrFileTitle = NULL;
                of.lpstrInitialDir = NULL;
                of.lpstrTitle = "Select Bell Sound File";
                of.Flags = 0;
                if (GetOpenFileName(&of)) {
-                   strcpy(cfg.bell_wavefile, filename);
+                   strcpy(cfg.bell_wavefile.path, filename);
                    SetDlgItemText(hwnd, IDC_BELL_WAVEEDIT,
-                                  cfg.bell_wavefile);
+                                  cfg.bell_wavefile.path);
                }
                break;
              case IDC_BELL_WAVEEDIT:
                if (HIWORD(wParam) == EN_CHANGE)
                    GetDlgItemText(hwnd, IDC_BELL_WAVEEDIT,
-                                  cfg.bell_wavefile,
-                                  sizeof(cfg.bell_wavefile) - 1);
+                                  cfg.bell_wavefile.path,
+                                  sizeof(cfg.bell_wavefile.path) - 1);
                break;
              case IDC_BELLOVL:
                if (HIWORD(wParam) == BN_CLICKED ||
@@ -2872,7 +2906,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED)
                        cfg.win_name_always =
-                       IsDlgButtonChecked(hwnd, IDC_WINNAME);
+                       !IsDlgButtonChecked(hwnd, IDC_WINNAME);
                break;
              case IDC_HIDEMOUSE:
                if (HIWORD(wParam) == BN_CLICKED ||
@@ -2954,10 +2988,10 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                    HIWORD(wParam) == BN_DOUBLECLICKED) {
                    cfg.close_on_exit =
                        IsDlgButtonChecked(hwnd,
-                                          IDC_COEALWAYS) ? COE_ALWAYS :
+                                          IDC_COEALWAYS) ? FORCE_ON :
                        IsDlgButtonChecked(hwnd,
-                                          IDC_COENEVER) ? COE_NEVER :
-                       COE_NORMAL;
+                                          IDC_COENEVER) ? FORCE_OFF :
+                       AUTO;
                }
                break;
              case IDC_CLOSEWARN:
@@ -3024,6 +3058,23 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                        IsDlgButtonChecked(hwnd, IDC_PROXYSOCKSVER4) ? 4 : 5;
                }
                break;
+             case IDC_PROXYLOCALHOST:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED)
+                   cfg.even_proxy_localhost =
+                   IsDlgButtonChecked(hwnd, IDC_PROXYLOCALHOST);
+               break;
+             case IDC_PROXYDNSNO:
+             case IDC_PROXYDNSAUTO:
+             case IDC_PROXYDNSYES:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED) {
+                   cfg.proxy_dns =
+                       IsDlgButtonChecked(hwnd, IDC_PROXYDNSNO) ? FORCE_OFF :
+                       IsDlgButtonChecked(hwnd, IDC_PROXYDNSYES) ? FORCE_ON :
+                       AUTO;
+               }
+               break;
              case IDC_PROXYTYPENONE:
              case IDC_PROXYTYPEHTTP:
              case IDC_PROXYTYPESOCKS:
@@ -3040,8 +3091,8 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
 
              case IDC_LGFEDIT:
                if (HIWORD(wParam) == EN_CHANGE)
-                   GetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename,
-                                  sizeof(cfg.logfilename) - 1);
+                   GetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename.path,
+                                  sizeof(cfg.logfilename.path) - 1);
                break;
              case IDC_LGFBUTTON:
                memset(&of, 0, sizeof(of));
@@ -3051,19 +3102,19 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                of.lStructSize = sizeof(of);
 #endif
                of.hwndOwner = hwnd;
-               of.lpstrFilter = "All Files\0*\0\0\0";
+               of.lpstrFilter = "All Files (*.*)\0*\0\0\0";
                of.lpstrCustomFilter = NULL;
                of.nFilterIndex = 1;
                of.lpstrFile = filename;
-               strcpy(filename, cfg.logfilename);
+               strcpy(filename, cfg.logfilename.path);
                of.nMaxFile = sizeof(filename);
                of.lpstrFileTitle = NULL;
                of.lpstrInitialDir = NULL;
                of.lpstrTitle = "Select session log file";
                of.Flags = 0;
                if (GetSaveFileName(&of)) {
-                   strcpy(cfg.logfilename, filename);
-                   SetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename);
+                   strcpy(cfg.logfilename.path, filename);
+                   SetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename.path);
                }
                break;
              case IDC_LSTATOFF:
@@ -3263,8 +3314,8 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                break;
              case IDC_PKEDIT:
                if (HIWORD(wParam) == EN_CHANGE)
-                   GetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile,
-                                  sizeof(cfg.keyfile) - 1);
+                   GetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile.path,
+                                  sizeof(cfg.keyfile.path) - 1);
                break;
              case IDC_CMDEDIT:
                if (HIWORD(wParam) == EN_CHANGE)
@@ -3279,20 +3330,20 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                of.lStructSize = sizeof(of);
 #endif
                of.hwndOwner = hwnd;
-               of.lpstrFilter = "PuTTY Private Key Files\0*.PPK\0"
-                   "AllFiles\0*\0\0\0";
+               of.lpstrFilter = "PuTTY Private Key Files (*.ppk)\0*.ppk\0"
+                   "All Files (*.*)\0*\0\0\0";
                of.lpstrCustomFilter = NULL;
                of.nFilterIndex = 1;
                of.lpstrFile = filename;
-               strcpy(filename, cfg.keyfile);
+               strcpy(filename, cfg.keyfile.path);
                of.nMaxFile = sizeof(filename);
                of.lpstrFileTitle = NULL;
                of.lpstrInitialDir = NULL;
                of.lpstrTitle = "Select Private Key File";
                of.Flags = 0;
                if (GetOpenFileName(&of)) {
-                   strcpy(cfg.keyfile, filename);
-                   SetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile);
+                   strcpy(cfg.keyfile.path, filename);
+                   SetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile.path);
                }
                break;
              case IDC_RAWCNP:
@@ -3344,25 +3395,6 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                    int n, i;
                    cfg.bold_colour =
                        IsDlgButtonChecked(hwnd, IDC_BOLDCOLOUR);
-                   SendDlgItemMessage(hwnd, IDC_COLOURLIST, WM_SETREDRAW,
-                                      FALSE, 0);
-                   n =
-                       SendDlgItemMessage(hwnd, IDC_COLOURLIST,
-                                          LB_GETCOUNT, 0, 0);
-                   if (n != 12 + 10 * cfg.bold_colour) {
-                       for (i = n; i-- > 0;)
-                           SendDlgItemMessage(hwnd, IDC_COLOURLIST,
-                                              LB_DELETESTRING, i, 0);
-                       for (i = 0; i < 22; i++)
-                           if (cfg.bold_colour || permcolour[i])
-                               SendDlgItemMessage(hwnd, IDC_COLOURLIST,
-                                                  LB_ADDSTRING, 0,
-                                                  (LPARAM) colours[i]);
-                   }
-                   SendDlgItemMessage(hwnd, IDC_COLOURLIST, WM_SETREDRAW,
-                                      TRUE, 0);
-                   InvalidateRect(GetDlgItem(hwnd, IDC_COLOURLIST), NULL,
-                                  TRUE);
                }
                break;
              case IDC_PALETTE:
@@ -3496,6 +3528,16 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                    GetDlgItemText(hwnd, IDC_X11_DISPLAY, cfg.x11_display,
                                   sizeof(cfg.x11_display) - 1);
                break;
+             case IDC_X11MIT:
+             case IDC_X11XDM:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED) {
+                   if (IsDlgButtonChecked(hwnd, IDC_X11MIT))
+                       cfg.x11_auth = X11_MIT;
+                   else if (IsDlgButtonChecked(hwnd, IDC_X11XDM))
+                       cfg.x11_auth = X11_XDM;
+               }
+               break;
              case IDC_PFWDADD:
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED) {
@@ -3584,56 +3626,56 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                if (HIWORD(wParam) == CBN_SELCHANGE) {
                    int index = SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1,
                                                   CB_GETCURSEL, 0, 0);
-                   cfg.sshbug_ignore1 = (index == 0 ? BUG_AUTO :
-                                         index == 1 ? BUG_OFF : BUG_ON);
+                   cfg.sshbug_ignore1 = (index == 0 ? AUTO :
+                                         index == 1 ? FORCE_OFF : FORCE_ON);
                }
                break;
              case IDC_BUGD_PLAINPW1:
                if (HIWORD(wParam) == CBN_SELCHANGE) {
                    int index = SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1,
                                                   CB_GETCURSEL, 0, 0);
-                   cfg.sshbug_plainpw1 = (index == 0 ? BUG_AUTO :
-                                          index == 1 ? BUG_OFF : BUG_ON);
+                   cfg.sshbug_plainpw1 = (index == 0 ? AUTO :
+                                          index == 1 ? FORCE_OFF : FORCE_ON);
                }
                break;
              case IDC_BUGD_RSA1:
                if (HIWORD(wParam) == CBN_SELCHANGE) {
                    int index = SendDlgItemMessage(hwnd, IDC_BUGD_RSA1,
                                                   CB_GETCURSEL, 0, 0);
-                   cfg.sshbug_rsa1 = (index == 0 ? BUG_AUTO :
-                                      index == 1 ? BUG_OFF : BUG_ON);
+                   cfg.sshbug_rsa1 = (index == 0 ? AUTO :
+                                      index == 1 ? FORCE_OFF : FORCE_ON);
                }
                break;
              case IDC_BUGD_HMAC2:
                if (HIWORD(wParam) == CBN_SELCHANGE) {
                    int index = SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2,
                                                   CB_GETCURSEL, 0, 0);
-                   cfg.sshbug_hmac2 = (index == 0 ? BUG_AUTO :
-                                       index == 1 ? BUG_OFF : BUG_ON);
+                   cfg.sshbug_hmac2 = (index == 0 ? AUTO :
+                                       index == 1 ? FORCE_OFF : FORCE_ON);
                }
                break;
              case IDC_BUGD_DERIVEKEY2:
                if (HIWORD(wParam) == CBN_SELCHANGE) {
                    int index = SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2,
                                                   CB_GETCURSEL, 0, 0);
-                   cfg.sshbug_derivekey2 = (index == 0 ? BUG_AUTO :
-                                            index == 1 ? BUG_OFF : BUG_ON);
+                   cfg.sshbug_derivekey2 = (index == 0 ? AUTO :
+                                            index == 1 ? FORCE_OFF:FORCE_ON);
                }
                break;
              case IDC_BUGD_RSAPAD2:
                if (HIWORD(wParam) == CBN_SELCHANGE) {
                    int index = SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2,
                                                   CB_GETCURSEL, 0, 0);
-                   cfg.sshbug_rsapad2 = (index == 0 ? BUG_AUTO :
-                                         index == 1 ? BUG_OFF : BUG_ON);
+                   cfg.sshbug_rsapad2 = (index == 0 ? AUTO :
+                                         index == 1 ? FORCE_OFF : FORCE_ON);
                }
                break;
              case IDC_BUGD_DHGEX2:
                if (HIWORD(wParam) == CBN_SELCHANGE) {
                    int index = SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2,
                                                   CB_GETCURSEL, 0, 0);
-                   cfg.sshbug_dhgex2 = (index == 0 ? BUG_AUTO :
-                                        index == 1 ? BUG_OFF : BUG_ON);
+                   cfg.sshbug_dhgex2 = (index == 0 ? AUTO :
+                                        index == 1 ? FORCE_OFF : FORCE_ON);
                }
                break;
            }
@@ -3900,7 +3942,7 @@ void askcipher(void *frontend, 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(void *frontend, char *filename)
+int askappend(void *frontend, Filename filename)
 {
     static const char mbtitle[] = "PuTTY Log to File";
     static const char msgtemplate[] =
@@ -3912,10 +3954,8 @@ int askappend(void *frontend, char *filename)
        "or Cancel to disable logging.";
     char message[sizeof(msgtemplate) + FILENAME_MAX];
     int mbret;
-    if (cfg.logxfovr != LGXF_ASK) {
-       return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1);
-    }
-    sprintf(message, msgtemplate, FILENAME_MAX, filename);
+
+    sprintf(message, msgtemplate, FILENAME_MAX, filename.path);
 
     mbret = MessageBox(NULL, message, mbtitle,
                       MB_ICONQUESTION | MB_YESNOCANCEL);