#include "win_res.h"
#include "storage.h"
+#ifdef MSVC4
+#define TVINSERTSTRUCT TV_INSERTSTRUCT
+#define TVITEM TV_ITEM
+#define ICON_BIG 1
+#endif
+
static char **events = NULL;
static int nevents = 0, negsize = 0;
IDC_LSTATOFF,
IDC_LSTATASCII,
IDC_LSTATRAW,
+ IDC_LSTATPACKET,
IDC_LGFSTATIC,
IDC_LGFEDIT,
IDC_LGFBUTTON,
IDC_TPASSIVE,
IDC_TACTIVE,
IDC_TELNETKEY,
+ IDC_TELNETRET,
telnetpanelend,
rloginpanelstart,
IDC_PKEDIT,
IDC_PKBUTTON,
IDC_AGENTFWD,
+ IDC_CHANGEUSER,
IDC_AUTHTIS,
IDC_AUTHKI,
sshauthpanelend,
IDC_X11_DISPSTATIC,
IDC_X11_DISPLAY,
IDC_LPORT_ALL,
+ IDC_RPORT_ALL,
IDC_PFWDSTATIC,
IDC_PFWDSTATIC2,
IDC_PFWDREMOVE,
case IDC_LSTATOFF:
case IDC_LSTATASCII:
case IDC_LSTATRAW:
+ case IDC_LSTATPACKET:
return "JI(`',`logging.main')";
case IDC_LGFSTATIC:
case IDC_LGFEDIT:
return "JI(`',`telnet.passive')";
case IDC_TELNETKEY:
return "JI(`',`telnet.specialkeys')";
+ case IDC_TELNETRET:
+ return "JI(`',`telnet.newline')";
case IDC_R_TSSTATIC:
case IDC_R_TSEDIT:
return "JI(`',`ssh.auth.privkey')";
case IDC_AGENTFWD:
return "JI(`',`ssh.auth.agentfwd')";
+ case IDC_CHANGEUSER:
+ return "JI(`',`ssh.auth.changeuser')";
case IDC_AUTHTIS:
return "JI(`',`ssh.auth.tis')";
case IDC_AUTHKI:
case IDC_X11_DISPSTATIC:
case IDC_X11_DISPLAY:
return "JI(`',`ssh.tunnels.x11')";
- case IDC_LPORT_ALL:
case IDC_PFWDSTATIC:
case IDC_PFWDSTATIC2:
case IDC_PFWDREMOVE:
case IDC_PFWDLOCAL:
case IDC_PFWDREMOTE:
return "JI(`',`ssh.tunnels.portfwd')";
+ case IDC_LPORT_ALL:
+ case IDC_RPORT_ALL:
+ return "JI(`',`ssh.tunnels.portfwd.localhost')";
default:
return NULL;
CheckDlgButton(hwnd, IDC_COMPOSEKEY, cfg.compose_key);
CheckDlgButton(hwnd, IDC_CTRLALTKEYS, cfg.ctrlaltkeys);
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);
SetDlgItemText(hwnd, IDC_RLLUSEREDIT, cfg.localusername);
SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);
SetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename);
- CheckRadioButton(hwnd, IDC_LSTATOFF, IDC_LSTATRAW,
- cfg.logtype == 0 ? IDC_LSTATOFF :
- cfg.logtype == 1 ? IDC_LSTATASCII : IDC_LSTATRAW);
+ CheckRadioButton(hwnd, IDC_LSTATOFF, IDC_LSTATPACKET,
+ cfg.logtype == LGTYP_NONE ? IDC_LSTATOFF :
+ cfg.logtype == LGTYP_ASCII ? IDC_LSTATASCII :
+ cfg.logtype == LGTYP_DEBUG ? IDC_LSTATRAW :
+ IDC_LSTATPACKET);
CheckRadioButton(hwnd, IDC_LSTATXOVR, IDC_LSTATXASK,
cfg.logxfovr == LGXF_OVR ? IDC_LSTATXOVR :
cfg.logxfovr == LGXF_ASK ? IDC_LSTATXASK :
CheckDlgButton(hwnd, IDC_BUGGYMAC, cfg.buggymac);
CheckDlgButton(hwnd, IDC_SSH2DES, cfg.ssh2_des_cbc);
CheckDlgButton(hwnd, IDC_AGENTFWD, cfg.agentfwd);
+ CheckDlgButton(hwnd, IDC_CHANGEUSER, cfg.change_username);
CheckRadioButton(hwnd, IDC_SSHPROT1, IDC_SSHPROT2,
cfg.sshprot == 1 ? IDC_SSHPROT1 : IDC_SSHPROT2);
CheckDlgButton(hwnd, IDC_AUTHTIS, cfg.try_tis_auth);
SetDlgItemText(hwnd, IDC_X11_DISPLAY, cfg.x11_display);
CheckDlgButton(hwnd, IDC_LPORT_ALL, cfg.lport_acceptall);
+ CheckDlgButton(hwnd, IDC_RPORT_ALL, cfg.rport_acceptall);
CheckRadioButton(hwnd, IDC_PFWDLOCAL, IDC_PFWDREMOTE, IDC_PFWDLOCAL);
}
static void create_controls(HWND hwnd, int dlgtype, int panel)
{
if (panel == sessionpanelstart) {
- /* The Session panel. Accelerators used: [acgo] nprtih elsd w */
+ /* The Session panel. Accelerators used: [acgoh] nprtis elvd w */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Basic options for your PuTTY session",
"&Telnet", IDC_PROTTELNET,
"Rlog&in", IDC_PROTRLOGIN,
#ifdef FWHACK
- "SS&H/hack",
+ "&SSH/hack",
#else
- "SS&H",
+ "&SSH",
#endif
IDC_PROTSSH, NULL);
}
sesssaver(&cp, "Sav&ed Sessions",
IDC_SESSSTATIC, IDC_SESSEDIT, IDC_SESSLIST,
"&Load", IDC_SESSLOAD,
- "&Save", IDC_SESSSAVE, "&Delete", IDC_SESSDEL, NULL);
+ "Sa&ve", IDC_SESSSAVE, "&Delete", IDC_SESSDEL, NULL);
endbox(&cp);
}
beginbox(&cp, NULL, IDC_BOX_SESSION3);
}
if (panel == loggingpanelstart) {
- /* The Logging panel. Accelerators used: [acgo] tplfwe */
+ /* The Logging panel. Accelerators used: [acgoh] tplsfwe */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling session logging",
"Session logging:", IDC_LSTATSTATIC,
"Logging &turned off completely", IDC_LSTATOFF,
"Log &printable output only", IDC_LSTATASCII,
- "&Log all session output", IDC_LSTATRAW, NULL);
+ "&Log all session output", IDC_LSTATRAW,
+ "Log &SSH packet data", IDC_LSTATPACKET,
+ NULL);
editbutton(&cp, "Log &file name:",
IDC_LGFSTATIC, IDC_LGFEDIT, "Bro&wse...",
IDC_LGFBUTTON);
}
if (panel == terminalpanelstart) {
- /* The Terminal panel. Accelerators used: [acgo] wdlen hts */
+ /* The Terminal panel. Accelerators used: [acgoh] wdren lts */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling the terminal emulation",
beginbox(&cp, "Set various terminal options", IDC_BOX_TERMINAL1);
checkbox(&cp, "Auto &wrap mode initially on", IDC_WRAPMODE);
checkbox(&cp, "&DEC Origin Mode initially on", IDC_DECOM);
- checkbox(&cp, "Implicit CR in every &LF", IDC_LFHASCR);
+ checkbox(&cp, "Implicit C&R in every LF", IDC_LFHASCR);
checkbox(&cp, "Use background colour to &erase screen", IDC_BCE);
checkbox(&cp, "Enable bli&nking text", IDC_BLINKTEXT);
multiedit(&cp,
endbox(&cp);
beginbox(&cp, "Line discipline options", IDC_BOX_TERMINAL2);
- radioline(&cp, "Local ec&ho:", IDC_ECHOSTATIC, 3,
+ radioline(&cp, "&Local echo:", IDC_ECHOSTATIC, 3,
"Auto", IDC_ECHOBACKEND,
"Force on", IDC_ECHOYES, "Force off", IDC_ECHONO, NULL);
radioline(&cp, "Local line edi&ting:", IDC_EDITSTATIC, 3,
}
if (panel == bellpanelstart) {
- /* The Bell panel. Accelerators used: [acgo] bdsm wit */
+ /* The Bell panel. Accelerators used: [acgoh] bdsm wit */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling the terminal bell",
}
if (panel == keyboardpanelstart) {
- /* The Keyboard panel. Accelerators used: [acgo] bhf ruyntd */
+ /* The Keyboard panel. Accelerators used: [acgoh] bef ruyntd */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling the effects of keys",
radioline(&cp, "The &Backspace key", IDC_DELSTATIC, 2,
"Control-H", IDC_DEL008,
"Control-? (127)", IDC_DEL127, NULL);
- radioline(&cp, "The &Home and End keys", IDC_HOMESTATIC, 2,
+ radioline(&cp, "The Home and &End keys", IDC_HOMESTATIC, 2,
"Standard", IDC_HOMETILDE, "rxvt", IDC_HOMERXVT, NULL);
radioline(&cp, "The &Function keys and keypad", IDC_FUNCSTATIC, 3,
"ESC[n~", IDC_FUNCTILDE,
}
if (panel == windowpanelstart) {
- /* The Window panel. Accelerators used: [acgo] rmz sdikp */
+ /* The Window panel. Accelerators used: [acgoh] rmz sdikp */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling PuTTY's window",
}
if (panel == appearancepanelstart) {
- /* The Appearance panel. Accelerators used: [acgo] luvb h ti p s */
+ /* The Appearance panel. Accelerators used: [acgoh] luvb n ti p s */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Configure the appearance of PuTTY's window",
endbox(&cp);
beginbox(&cp, "Set the font used in the terminal window",
IDC_BOX_APPEARANCE2);
- staticbtn(&cp, "", IDC_FONTSTATIC, "C&hange...", IDC_CHOOSEFONT);
+ staticbtn(&cp, "", IDC_FONTSTATIC, "Cha&nge...", IDC_CHOOSEFONT);
endbox(&cp);
beginbox(&cp, "Adjust the use of the window title",
IDC_BOX_APPEARANCE3);
}
if (panel == behaviourpanelstart) {
- /* The Behaviour panel. Accelerators used: [acgo] w4yltf */
+ /* The Behaviour panel. Accelerators used: [acgoh] w4yltf */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Configure the behaviour of PuTTY's window",
}
if (panel == translationpanelstart) {
- /* The Translation panel. Accelerators used: [acgo] rxbepus */
+ /* The Translation panel. Accelerators used: [acgoh] rxbepus */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling character set translation",
}
if (panel == selectionpanelstart) {
- /* The Selection panel. Accelerators used: [acgo] df wxp hst nr */
+ /* The Selection panel. Accelerators used: [acgoh] df wxp est nr */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling copy and paste",
endbox(&cp);
beginbox(&cp, "Control the select-one-word-at-a-time mode",
IDC_BOX_SELECTION3);
- charclass(&cp, "C&haracter classes:", IDC_CCSTATIC, IDC_CCLIST,
+ charclass(&cp, "Charact&er classes:", IDC_CCSTATIC, IDC_CCLIST,
"&Set", IDC_CCSET, IDC_CCEDIT,
"&to class", IDC_CCSTATIC2);
endbox(&cp);
}
if (panel == colourspanelstart) {
- /* The Colours panel. Accelerators used: [acgo] blum */
+ /* The Colours panel. Accelerators used: [acgoh] blum */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling use of colours",
}
if (panel == connectionpanelstart) {
- /* The Connection panel. Accelerators used: [acgo] tukn */
+ /* The Connection panel. Accelerators used: [acgoh] tukn */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling the connection",
beginbox(&cp, "Adjust telnet session.", IDC_BOX_CONNECTION1);
checkbox(&cp, "Keyboard sends telnet Backspace and Interrupt",
IDC_TELNETKEY);
+ checkbox(&cp, "Return key sends telnet New Line instead of ^M",
+ IDC_TELNETRET);
endbox(&cp);
}
beginbox(&cp, "Sending of null packets to keep session active",
}
if (panel == telnetpanelstart) {
- /* The Telnet panel. Accelerators used: [acgo] svldr bftk */
+ /* The Telnet panel. Accelerators used: [acgoh] svldr bftk */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
if (dlgtype == 0) {
IDC_TACTIVE, NULL);
checkbox(&cp, "&Keyboard sends telnet Backspace and Interrupt",
IDC_TELNETKEY);
+ checkbox(&cp, "Return key sends telnet New Line instead of ^M",
+ IDC_TELNETRET);
endbox(&cp);
}
}
if (panel == rloginpanelstart) {
- /* The Rlogin panel. Accelerators used: [acgo] sl */
+ /* The Rlogin panel. Accelerators used: [acgoh] sl */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
if (dlgtype == 0) {
}
if (panel == sshpanelstart) {
- /* The SSH panel. Accelerators used: [acgo] r pe12i sd */
+ /* The SSH panel. Accelerators used: [acgoh] r pe12i sd */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
if (dlgtype == 0) {
}
if (panel == sshauthpanelstart) {
- /* The SSH authentication panel. Accelerators used: [acgo] m fkiw */
+ /* The SSH authentication panel. Accelerators used: [acgoh] m fkiuw */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
if (dlgtype == 0) {
beginbox(&cp, "Authentication parameters",
IDC_BOX_SSHAUTH2);
checkbox(&cp, "Allow agent &forwarding", IDC_AGENTFWD);
+ checkbox(&cp, "Allow attempted changes of &username in SSH2",
+ IDC_CHANGEUSER);
editbutton(&cp, "Private &key file for authentication:",
IDC_PKSTATIC, IDC_PKEDIT, "Bro&wse...",
IDC_PKBUTTON);
}
if (panel == tunnelspanelstart) {
- /* The Tunnels panel. Accelerators used: [acgo] deilmrstx */
+ /* The Tunnels panel. Accelerators used: [acgoh] deilmrstxp */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
if (dlgtype == 0) {
IDC_X11_DISPLAY, 50, NULL);
endbox(&cp);
beginbox(&cp, "Port forwarding", IDC_BOX_TUNNELS2);
- checkbox(&cp, "Local ports accept connections from o&ther hosts", IDC_LPORT_ALL);
+ checkbox(&cp, "Local ports accept connections from o&ther hosts",
+ IDC_LPORT_ALL);
+ checkbox(&cp, "Remote &ports do the same (SSH v2 only)",
+ IDC_RPORT_ALL);
staticbtn(&cp, "Forwarded ports:", IDC_PFWDSTATIC,
"&Remove", IDC_PFWDREMOVE);
fwdsetter(&cp, IDC_PFWDLIST,
"Dest&ination", IDC_DPORTSTATIC, IDC_DPORTEDIT,
"A&dd", IDC_PFWDADD);
bareradioline(&cp, 2,
- "&Local", IDC_PFWDLOCAL, "Re&mote", IDC_PFWDREMOTE, NULL);
+ "&Local", IDC_PFWDLOCAL,
+ "Re&mote", IDC_PFWDREMOTE, NULL);
endbox(&cp);
}
cfg.protocol =
i ? PROT_SSH : j ? PROT_TELNET : k ? PROT_RLOGIN :
PROT_RAW;
- if ((cfg.protocol == PROT_SSH && cfg.port != 22)
- || (cfg.protocol == PROT_TELNET && cfg.port != 23)
- || (cfg.protocol == PROT_RLOGIN
- && cfg.port != 513)) {
+ /*
+ * When switching using the arrow keys, we
+ * appear to get two of these messages, both
+ * mentioning the target button in
+ * LOWORD(wParam), but one of them called while
+ * the previous button is still checked. This
+ * causes an unnecessary reset of the port
+ * number field, which we fix by ensuring here
+ * that the button selected is indeed the one
+ * checked.
+ */
+ if (IsDlgButtonChecked(hwnd, LOWORD(wParam)) &&
+ ((cfg.protocol == PROT_SSH && cfg.port != 22)
+ || (cfg.protocol == PROT_TELNET && cfg.port != 23)
+ || (cfg.protocol == PROT_RLOGIN
+ && cfg.port != 513))) {
cfg.port = i ? 22 : j ? 23 : 513;
SetDlgItemInt(hwnd, IDC_PORT, cfg.port, FALSE);
}
cfg.telnet_keyboard =
IsDlgButtonChecked(hwnd, IDC_TELNETKEY);
break;
+ case IDC_TELNETRET:
+ if (HIWORD(wParam) == BN_CLICKED ||
+ HIWORD(wParam) == BN_DOUBLECLICKED)
+ cfg.telnet_newline =
+ IsDlgButtonChecked(hwnd, IDC_TELNETRET);
+ break;
case IDC_WRAPMODE:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
case IDC_LSTATOFF:
case IDC_LSTATASCII:
case IDC_LSTATRAW:
+ case IDC_LSTATPACKET:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED) {
if (IsDlgButtonChecked(hwnd, IDC_LSTATOFF))
- cfg.logtype = 0;
+ cfg.logtype = LGTYP_NONE;
if (IsDlgButtonChecked(hwnd, IDC_LSTATASCII))
- cfg.logtype = 1;
+ cfg.logtype = LGTYP_ASCII;
if (IsDlgButtonChecked(hwnd, IDC_LSTATRAW))
- cfg.logtype = 2;
+ cfg.logtype = LGTYP_DEBUG;
+ if (IsDlgButtonChecked(hwnd, IDC_LSTATPACKET))
+ cfg.logtype = LGTYP_PACKETS;
}
break;
case IDC_LSTATXASK:
cfg.agentfwd =
IsDlgButtonChecked(hwnd, IDC_AGENTFWD);
break;
+ case IDC_CHANGEUSER:
+ if (HIWORD(wParam) == BN_CLICKED ||
+ HIWORD(wParam) == BN_DOUBLECLICKED)
+ cfg.change_username =
+ IsDlgButtonChecked(hwnd, IDC_CHANGEUSER);
+ break;
case IDC_CIPHERLIST:
case IDC_CIPHERUP:
case IDC_CIPHERDN:
case IDC_X11_FORWARD:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
- cfg.x11_forward =
- IsDlgButtonChecked(hwnd, IDC_X11_FORWARD);
+ cfg.x11_forward =
+ IsDlgButtonChecked(hwnd, IDC_X11_FORWARD);
break;
case IDC_LPORT_ALL:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
- cfg.lport_acceptall =
- IsDlgButtonChecked(hwnd, IDC_LPORT_ALL);
+ cfg.lport_acceptall =
+ IsDlgButtonChecked(hwnd, IDC_LPORT_ALL);
+ break;
+ case IDC_RPORT_ALL:
+ if (HIWORD(wParam) == BN_CLICKED ||
+ HIWORD(wParam) == BN_DOUBLECLICKED)
+ cfg.rport_acceptall =
+ IsDlgButtonChecked(hwnd, IDC_RPORT_ALL);
break;
case IDC_X11_DISPLAY:
if (HIWORD(wParam) == EN_CHANGE)