Support for selecting AES from the GUI. In the process, I've had to
[u/mdw/putty] / windlg.c
index 6b7314d..9b2e60f 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -3,6 +3,8 @@
 #include <commdlg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
 
 #include "ssh.h"
 #include "putty.h"
@@ -47,6 +49,11 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
 
     switch (msg) {
       case WM_INITDIALOG:
+        {
+            static int tabs[4] = {78, 108};
+            SendDlgItemMessage (hwnd, IDN_LIST, LB_SETTABSTOPS, 2,
+                                (LPARAM) tabs);
+        }
        for (i=0; i<nevents; i++)
            SendDlgItemMessage (hwnd, IDN_LIST, LB_ADDSTRING,
                                0, (LPARAM)events[i]);
@@ -66,6 +73,11 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
                 int *selitems;
                 selcount = SendDlgItemMessage(hwnd, IDN_LIST,
                                               LB_GETSELCOUNT, 0, 0);
+                if (selcount == 0) {   /* don't even try to copy zero items */
+                    MessageBeep(0);
+                    break;
+                }
+                    
                 selitems = smalloc(selcount * sizeof(int));
                 if (selitems) {
                     int count = SendDlgItemMessage(hwnd, IDN_LIST,
@@ -198,8 +210,22 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
     IDC_SESSSAVE,
     IDC_SESSDEL,
     IDC_CLOSEEXIT,
+    IDC_COEALWAYS,
+    IDC_COENEVER,
+    IDC_COENORMAL,
     sessionpanelend,
 
+    loggingpanelstart,
+    IDC_BOX_LOGGING1,
+    IDC_LSTATSTATIC,
+    IDC_LSTATOFF,
+    IDC_LSTATASCII,
+    IDC_LSTATRAW,
+    IDC_LGFSTATIC,
+    IDC_LGFEDIT,
+    IDC_LGFBUTTON,
+    loggingpanelend,
+
     keyboardpanelstart,
     IDC_TITLE_KEYBOARD,
     IDC_BOX_KEYBOARD1,
@@ -238,14 +264,14 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
     IDC_BEEP,
     IDC_BCE,
     IDC_BLINKTEXT,
-    IDC_LDISCTERM,
-    IDC_LSTATSTATIC,
-    IDC_LSTATOFF,
-    IDC_LSTATASCII,
-    IDC_LSTATRAW,
-    IDC_LGFSTATIC,
-    IDC_LGFEDIT,
-    IDC_LGFBUTTON,
+    IDC_ECHOSTATIC,
+    IDC_ECHOBACKEND,
+    IDC_ECHOYES,
+    IDC_ECHONO,
+    IDC_EDITSTATIC,
+    IDC_EDITBACKEND,
+    IDC_EDITYES,
+    IDC_EDITNO,
     terminalpanelend,
 
     windowpanelstart,
@@ -340,6 +366,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
     IDC_CIPHER3DES,
     IDC_CIPHERBLOWF,
     IDC_CIPHERDES,
+    IDC_CIPHERAES,
     IDC_BUGGYMAC,
     IDC_AUTHTIS,
     IDC_PKSTATIC,
@@ -489,7 +516,12 @@ static void init_dlg_ctrls(HWND hwnd) {
     CheckDlgButton (hwnd, IDC_ALTSPACE, cfg.alt_space);
     CheckDlgButton (hwnd, IDC_ALTONLY, cfg.alt_only);
     CheckDlgButton (hwnd, IDC_COMPOSEKEY, cfg.compose_key);
-    CheckDlgButton (hwnd, IDC_LDISCTERM, cfg.ldisc_term);
+    CheckRadioButton (hwnd, IDC_ECHOBACKEND, IDC_ECHONO,
+                     cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND:
+                      cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO);
+    CheckRadioButton (hwnd, IDC_EDITBACKEND, IDC_EDITNO,
+                     cfg.localedit == LD_BACKEND ? IDC_EDITBACKEND:
+                      cfg.localedit == LD_YES ? IDC_EDITYES : IDC_EDITNO);
     CheckDlgButton (hwnd, IDC_ALWAYSONTOP, cfg.alwaysontop);
     CheckDlgButton (hwnd, IDC_SCROLLKEY, cfg.scroll_on_key);
     CheckDlgButton (hwnd, IDC_SCROLLDISP, cfg.scroll_on_disp);
@@ -515,7 +547,9 @@ static void init_dlg_ctrls(HWND hwnd) {
     CheckDlgButton (hwnd, IDC_BLINKCUR, cfg.blink_cur);
     CheckDlgButton (hwnd, IDC_SCROLLBAR, cfg.scrollbar);
     CheckDlgButton (hwnd, IDC_LOCKSIZE, cfg.locksize);
-    CheckDlgButton (hwnd, IDC_CLOSEEXIT, cfg.close_on_exit);
+    CheckRadioButton (hwnd, IDC_COEALWAYS, IDC_COENORMAL,
+                      cfg.close_on_exit==COE_NORMAL ? IDC_COENORMAL :
+                      cfg.close_on_exit==COE_NEVER ? IDC_COENEVER : IDC_COEALWAYS);
     CheckDlgButton (hwnd, IDC_CLOSEWARN, cfg.warn_on_close);
 
     SetDlgItemText (hwnd, IDC_TTEDIT, cfg.termtype);
@@ -545,9 +579,10 @@ static void init_dlg_ctrls(HWND hwnd) {
     CheckDlgButton (hwnd, IDC_COMPRESS, cfg.compression);
     CheckDlgButton (hwnd, IDC_BUGGYMAC, cfg.buggymac);
     CheckDlgButton (hwnd, IDC_AGENTFWD, cfg.agentfwd);
-    CheckRadioButton (hwnd, IDC_CIPHER3DES, IDC_CIPHERDES,
+    CheckRadioButton (hwnd, IDC_CIPHER3DES, IDC_CIPHERAES,
                      cfg.cipher == CIPHER_BLOWFISH ? IDC_CIPHERBLOWF :
                      cfg.cipher == CIPHER_DES ? IDC_CIPHERDES :
+                     cfg.cipher == CIPHER_AES ? IDC_CIPHERAES :
                      IDC_CIPHER3DES);
     CheckRadioButton (hwnd, IDC_SSHPROT1, IDC_SSHPROT2,
                      cfg.sshprot == 1 ? IDC_SSHPROT1 : IDC_SSHPROT2);
@@ -637,7 +672,7 @@ static HTREEITEM treeview_insert(struct treeview_faff *faff,
  */
 static void create_controls(HWND hwnd, int dlgtype, int panel) {
     if (panel == sessionpanelstart) {
-       /* The Session panel. Accelerators used: [acgo] nprthelsdx */
+       /* The Session panel. Accelerators used: [acgo] nprtih elsd w */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Basic options for your PuTTY session",
@@ -653,12 +688,12 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
                 radioline(&cp, "Protocol:", IDC_PROTSTATIC, 4,
                           "&Raw", IDC_PROTRAW,
                           "&Telnet", IDC_PROTTELNET,
-                          "R&login", IDC_PROTRLOGIN, NULL);
+                          "Rlog&in", IDC_PROTRLOGIN, NULL);
             } else {
                 radioline(&cp, "Protocol:", IDC_PROTSTATIC, 4,
                           "&Raw", IDC_PROTRAW,
                           "&Telnet", IDC_PROTTELNET,
-                          "R&login", IDC_PROTRLOGIN,
+                          "Rlog&in", IDC_PROTRLOGIN,
 #ifdef FWHACK
                           "SS&H/hack",
 #else
@@ -677,12 +712,33 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
             endbox(&cp);
         }
         beginbox(&cp, NULL, IDC_BOX_SESSION3);
-        checkbox(&cp, "Close Window on E&xit", IDC_CLOSEEXIT);
+        radioline(&cp, "Close &window on exit:", IDC_CLOSEEXIT, 4,
+                  "Always", IDC_COEALWAYS,
+                  "Never", IDC_COENEVER,
+                  "Only on clean exit", IDC_COENORMAL, NULL);
+        endbox(&cp);
+    }
+
+    if (panel == loggingpanelstart) {
+        /* The Logging panel. Accelerators used: [acgo] tplfw */
+        struct ctlpos cp;
+        ctlposinit(&cp, hwnd, 80, 3, 13);
+        bartitle(&cp, "Options controlling session logging",
+                 IDC_TITLE_TERMINAL);
+        beginbox(&cp, NULL, IDC_BOX_LOGGING1);
+        radiobig(&cp,
+                 "Session logging:", IDC_LSTATSTATIC,
+                 "Logging &turned off completely", IDC_LSTATOFF,
+                 "Log &printable output only", IDC_LSTATASCII,
+                 "&Log all session output", IDC_LSTATRAW, NULL);
+        editbutton(&cp, "Log &file name:",
+                   IDC_LGFSTATIC, IDC_LGFEDIT, "Bro&wse...",
+                   IDC_LGFBUTTON);
         endbox(&cp);
     }
 
     if (panel == terminalpanelstart) {
-        /* The Terminal panel. Accelerators used: [acgo] &dflbenuw */
+        /* The Terminal panel. Accelerators used: [acgo] wdlben ht */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling the terminal emulation",
@@ -695,24 +751,23 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
         checkbox(&cp, "&Beep enabled", IDC_BEEP);
         checkbox(&cp, "Use background colour to &erase screen", IDC_BCE);
         checkbox(&cp, "Enable bli&nking text", IDC_BLINKTEXT);
-        checkbox(&cp, "&Use local terminal line discipline", IDC_LDISCTERM);
         endbox(&cp);
 
-        beginbox(&cp, "Control session logging",
+        beginbox(&cp, "Line discipline options",
                  IDC_BOX_TERMINAL2);
-        radiobig(&cp,
-                 "Session logging:", IDC_LSTATSTATIC,
-                 "Logging turned &off completely", IDC_LSTATOFF,
-                 "Log printable output only", IDC_LSTATASCII,
-                 "Log all session output", IDC_LSTATRAW, NULL);
-        editbutton(&cp, "Log &file name:",
-                   IDC_LGFSTATIC, IDC_LGFEDIT, "Bro&wse...",
-                   IDC_LGFBUTTON);
+        radioline(&cp, "Local ec&ho:", IDC_ECHOSTATIC, 3,
+                  "Auto", IDC_ECHOBACKEND,
+                  "Force on", IDC_ECHOYES,
+                  "Force off", IDC_ECHONO, NULL);
+        radioline(&cp, "Local line edi&ting:", IDC_EDITSTATIC, 3,
+                  "Auto", IDC_EDITBACKEND,
+                  "Force on", IDC_EDITYES,
+                  "Force off", IDC_EDITNO, NULL);
         endbox(&cp);
     }
 
     if (panel == keyboardpanelstart) {
-        /* The Keyboard panel. Accelerators used: [acgo] h?srvlxvnpmietu */
+        /* The Keyboard panel. Accelerators used: [acgo] h?sr~lxv unpymie t */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling the effects of keys",
@@ -755,7 +810,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == windowpanelstart) {
-        /* The Window panel. Accelerators used: [acgo] bsdkw4ylpt */
+        /* The Window panel. Accelerators used: [acgo] rmz sdkp w4ylt */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling PuTTY's window",
@@ -766,7 +821,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
                   "&Rows", IDC_ROWSSTATIC, IDC_ROWSEDIT, 50,
                   "Colu&mns", IDC_COLSSTATIC, IDC_COLSEDIT, 50,
                   NULL);
-        checkbox(&cp, "Loc&k window size against resizing", IDC_LOCKSIZE);
+        checkbox(&cp, "Lock window size against resi&zing", IDC_LOCKSIZE);
         endbox(&cp);
         beginbox(&cp, "Control the scrollback in the window",
                  IDC_BOX_WINDOW2);
@@ -787,7 +842,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == appearancepanelstart) {
-        /* The Appearance panel. Accelerators used: [acgo] rmkhtibluv */
+        /* The Appearance panel. Accelerators used: [acgo] luvb h ti p */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling PuTTY's appearance",
@@ -820,7 +875,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == translationpanelstart) {
-        /* The Translation panel. Accelerators used: [acgo] xbepnkis */
+        /* The Translation panel. Accelerators used: [acgo] xbep t s */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling character set translation",
@@ -838,11 +893,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
         beginbox(&cp, "Enable character set translation on received data",
                  IDC_BOX_TRANSLATION2);
         radiobig(&cp,
-                 "Character set translation:", IDC_XLATSTATIC,
-                 "&None", IDC_NOXLAT,
-                 "&KOI8 / Win-1251", IDC_KOI8WIN1251,
-                 "&ISO-8859-2 / Win-1250", IDC_88592WIN1250,
-                 "&ISO-8859-2 / CP852", IDC_88592CP852, NULL);
+                 "Character set &translation:", IDC_XLATSTATIC,
+                 "None", IDC_NOXLAT,
+                 "KOI8 / Win-1251", IDC_KOI8WIN1251,
+                 "ISO-8859-2 / Win-1250", IDC_88592WIN1250,
+                 "ISO-8859-2 / CP852", IDC_88592CP852, NULL);
         endbox(&cp);
         beginbox(&cp, "Enable character set translation on input data",
                  IDC_BOX_TRANSLATION3);
@@ -852,7 +907,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == selectionpanelstart) {
-        /* The Selection panel. Accelerators used: [acgo] wxst */
+        /* The Selection panel. Accelerators used: [acgo] wx hst */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling copy and paste",
@@ -866,7 +921,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
         endbox(&cp);
         beginbox(&cp, "Control the select-one-word-at-a-time mode",
                  IDC_BOX_SELECTION2);
-        charclass(&cp, "Character classes:", IDC_CCSTATIC, IDC_CCLIST,
+        charclass(&cp, "C&haracter classes:", IDC_CCSTATIC, IDC_CCLIST,
                   "&Set", IDC_CCSET, IDC_CCEDIT,
                   "&to class", IDC_CCSTATIC2);
         endbox(&cp);
@@ -909,12 +964,12 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
         beginbox(&cp, "Sending of null packets to keep session active",
                  IDC_BOX_CONNECTION2);
         staticedit(&cp, "Seconds between &keepalives (0 to turn off)",
-                   IDC_PINGSTATIC, IDC_PINGEDIT, 25);
+                   IDC_PINGSTATIC, IDC_PINGEDIT, 20);
         endbox(&cp);
     }
 
     if (panel == telnetpanelstart) {
-        /* The Telnet panel. Accelerators used: [acgo] svldrbf */
+        /* The Telnet panel. Accelerators used: [acgo] svldr bf */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         if (dlgtype == 0) {
@@ -952,7 +1007,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == sshpanelstart) {
-        /* The SSH panel. Accelerators used: [acgo] rmakwp123bd */
+        /* The SSH panel. Accelerators used: [acgo] rmfkw pe123bd i */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         if (dlgtype == 0) {
@@ -967,7 +1022,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
                      IDC_BOX_SSH2);
             checkbox(&cp, "Atte&mpt TIS or CryptoCard authentication",
                      IDC_AUTHTIS);
-            checkbox(&cp, "Allow &agent forwarding", IDC_AGENTFWD);
+            checkbox(&cp, "Allow agent &forwarding", IDC_AGENTFWD);
             editbutton(&cp, "Private &key file for authentication:",
                        IDC_PKSTATIC, IDC_PKEDIT, "Bro&wse...", IDC_PKBUTTON);
             endbox(&cp);
@@ -978,11 +1033,13 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
             radioline(&cp, "Preferred SSH protocol version:",
                       IDC_SSHPROTSTATIC, 2,
                       "&1", IDC_SSHPROT1, "&2", IDC_SSHPROT2, NULL);
-            radioline(&cp, "Preferred encryption algorithm:", IDC_CIPHERSTATIC, 3,
+            radioline(&cp, "Preferred encryption algorithm:", IDC_CIPHERSTATIC, 4,
                       "&3DES", IDC_CIPHER3DES,
                       "&Blowfish", IDC_CIPHERBLOWF,
-                      "&DES", IDC_CIPHERDES, NULL);
-            checkbox(&cp, "Imitate SSH 2 MAC bug in commercial <= v2.3.x",
+                      "&DES", IDC_CIPHERDES,
+                      "&AES", IDC_CIPHERAES,
+                      NULL);
+            checkbox(&cp, "&Imitate SSH 2 MAC bug in commercial <= v2.3.x",
                      IDC_BUGGYMAC);
             endbox(&cp);
         }
@@ -1081,6 +1138,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
         * Set up the tree view contents.
         */
         hsession = treeview_insert(&tvfaff, 0, "Session");
+        treeview_insert(&tvfaff, 1, "Logging");
         treeview_insert(&tvfaff, 0, "Terminal");
         treeview_insert(&tvfaff, 1, "Keyboard");
         treeview_insert(&tvfaff, 0, "Window");
@@ -1144,6 +1202,8 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
             }
            if (!strcmp(buffer, "Session"))
                create_controls(hwnd, dlgtype, sessionpanelstart);
+           if (!strcmp(buffer, "Logging"))
+               create_controls(hwnd, dlgtype, loggingpanelstart);
            if (!strcmp(buffer, "Keyboard"))
                create_controls(hwnd, dlgtype, keyboardpanelstart);
            if (!strcmp(buffer, "Terminal"))
@@ -1398,10 +1458,25 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
                HIWORD(wParam) == BN_DOUBLECLICKED)
                cfg.alt_only = IsDlgButtonChecked (hwnd, IDC_ALTONLY);
            break;
-         case IDC_LDISCTERM:
+         case IDC_ECHOBACKEND:
+         case IDC_ECHOYES:
+         case IDC_ECHONO:
            if (HIWORD(wParam) == BN_CLICKED ||
-               HIWORD(wParam) == BN_DOUBLECLICKED)
-               cfg.ldisc_term = IsDlgButtonChecked (hwnd, IDC_LDISCTERM);
+               HIWORD(wParam) == BN_DOUBLECLICKED) {
+               if (LOWORD(wParam)==IDC_ECHOBACKEND) cfg.localecho=LD_BACKEND;
+               if (LOWORD(wParam)==IDC_ECHOYES) cfg.localecho=LD_YES;
+               if (LOWORD(wParam)==IDC_ECHONO) cfg.localecho=LD_NO;
+            }
+           break;
+         case IDC_EDITBACKEND:
+         case IDC_EDITYES:
+         case IDC_EDITNO:
+           if (HIWORD(wParam) == BN_CLICKED ||
+               HIWORD(wParam) == BN_DOUBLECLICKED) {
+               if (LOWORD(wParam)==IDC_EDITBACKEND) cfg.localedit=LD_BACKEND;
+               if (LOWORD(wParam)==IDC_EDITYES) cfg.localedit=LD_YES;
+               if (LOWORD(wParam)==IDC_EDITNO) cfg.localedit=LD_NO;
+            }
            break;
           case IDC_ALWAYSONTOP:
            if (HIWORD(wParam) == BN_CLICKED ||
@@ -1539,11 +1614,16 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
                GetDlgItemText (hwnd, IDC_WINEDIT, cfg.wintitle,
                                sizeof(cfg.wintitle)-1);
            break;
-         case IDC_CLOSEEXIT:
-           if (HIWORD(wParam) == BN_CLICKED ||
-               HIWORD(wParam) == BN_DOUBLECLICKED)
-               cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC_CLOSEEXIT);
-           break;
+          case IDC_COEALWAYS:
+          case IDC_COENEVER:
+          case IDC_COENORMAL:
+            if (HIWORD(wParam) == BN_CLICKED ||
+                HIWORD(wParam) == BN_DOUBLECLICKED) {
+                cfg.close_on_exit = IsDlgButtonChecked (hwnd, IDC_COEALWAYS) ? COE_ALWAYS :
+                                    IsDlgButtonChecked (hwnd, IDC_COENEVER) ? COE_NEVER :
+                                    COE_NORMAL;
+            }
+            break;
          case IDC_CLOSEWARN:
            if (HIWORD(wParam) == BN_CLICKED ||
                HIWORD(wParam) == BN_DOUBLECLICKED)
@@ -1570,15 +1650,15 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
             of.lpstrFilter = "All Files\0*\0\0\0";
             of.lpstrCustomFilter = NULL;
             of.nFilterIndex = 1;
-            of.lpstrFile = filename; strcpy(filename, cfg.keyfile);
+            of.lpstrFile = filename; strcpy(filename, cfg.logfilename);
             of.nMaxFile = sizeof(filename);
             of.lpstrFileTitle = NULL;
             of.lpstrInitialDir = NULL;
             of.lpstrTitle = "Select session log file";
             of.Flags = 0;
             if (GetSaveFileName(&of)) {
-                strcpy(cfg.keyfile, filename);
-                SetDlgItemText (hwnd, IDC_LGFEDIT, cfg.keyfile);
+                strcpy(cfg.logfilename, filename);
+                SetDlgItemText (hwnd, IDC_LGFEDIT, cfg.logfilename);
             }
            break;
          case IDC_LSTATOFF:
@@ -1703,6 +1783,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
          case IDC_CIPHER3DES:
          case IDC_CIPHERBLOWF:
          case IDC_CIPHERDES:
+         case IDC_CIPHERAES:
            if (HIWORD(wParam) == BN_CLICKED ||
                HIWORD(wParam) == BN_DOUBLECLICKED) {
                if (IsDlgButtonChecked (hwnd, IDC_CIPHER3DES))
@@ -1711,6 +1792,8 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
                    cfg.cipher = CIPHER_BLOWFISH;
                else if (IsDlgButtonChecked (hwnd, IDC_CIPHERDES))
                    cfg.cipher = CIPHER_DES;
+               else if (IsDlgButtonChecked (hwnd, IDC_CIPHERAES))
+                   cfg.cipher = CIPHER_AES;
            }
            break;
          case IDC_SSHPROT1:
@@ -1912,8 +1995,6 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
 
 static int CALLBACK MainDlgProc (HWND hwnd, UINT msg,
                                 WPARAM wParam, LPARAM lParam) {
-    static HWND page = NULL;
-
     if (msg == WM_COMMAND && LOWORD(wParam) == IDOK) {
     }
     if (msg == WM_COMMAND && LOWORD(wParam) == IDCX_ABOUT) {
@@ -1928,7 +2009,6 @@ static int CALLBACK MainDlgProc (HWND hwnd, UINT msg,
 
 static int CALLBACK ReconfDlgProc (HWND hwnd, UINT msg,
                                   WPARAM wParam, LPARAM lParam) {
-    static HWND page;
     return GenericMainDlgProc (hwnd, msg, wParam, lParam, 1);
 }
 
@@ -1971,20 +2051,28 @@ int do_reconfig (HWND hwnd) {
 }
 
 void logevent (char *string) {
+    char timebuf[40];
+    time_t t;
+
     if (nevents >= negsize) {
        negsize += 64;
        events = srealloc (events, negsize * sizeof(*events));
     }
-    events[nevents] = smalloc(1+strlen(string));
-    strcpy (events[nevents], string);
-    nevents++;
+
+    time(&t);
+    strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S\t", localtime(&t));
+
+    events[nevents] = smalloc(strlen(timebuf)+strlen(string)+1);
+    strcpy(events[nevents], timebuf);
+    strcat(events[nevents], string);
     if (logbox) {
         int count;
        SendDlgItemMessage (logbox, IDN_LIST, LB_ADDSTRING,
-                           0, (LPARAM)string);
+                           0, (LPARAM)events[nevents]);
        count = SendDlgItemMessage (logbox, IDN_LIST, LB_GETCOUNT, 0, 0);
        SendDlgItemMessage (logbox, IDN_LIST, LB_SETTOPINDEX, count-1, 0);
     }
+    nevents++;
 }
 
 void showeventlog (HWND hwnd) {