16 #define TVINSERTSTRUCT TV_INSERTSTRUCT
17 #define TVITEM TV_ITEM
21 static char **events
= NULL
;
22 static int nevents
= 0, negsize
= 0;
25 static int sesslist_has_focus
;
26 static int requested_help
;
28 static struct prefslist cipherlist
;
30 struct sesslist sesslist
; /* exported to window.c */
32 #define PRINTER_DISABLED_STRING "None (printing disabled)"
34 void force_normal(HWND hwnd
)
36 static int recurse
= 0;
44 wp
.length
= sizeof(wp
);
45 if (GetWindowPlacement(hwnd
, &wp
) && wp
.showCmd
== SW_SHOWMAXIMIZED
) {
46 wp
.showCmd
= SW_SHOWNORMAL
;
47 SetWindowPlacement(hwnd
, &wp
);
52 static void MyGetDlgItemInt(HWND hwnd
, int id
, int *result
)
56 n
= GetDlgItemInt(hwnd
, id
, &ok
, FALSE
);
61 static void MyGetDlgItemFlt(HWND hwnd
, int id
, int *result
, int scale
)
65 ok
= GetDlgItemText(hwnd
, id
, text
, sizeof(text
) - 1);
67 *result
= (int) (scale
* atof(text
));
70 static void MySetDlgItemFlt(HWND hwnd
, int id
, double value
)
73 sprintf(text
, "%g", value
);
74 SetDlgItemText(hwnd
, id
, text
);
77 static int CALLBACK
LogProc(HWND hwnd
, UINT msg
,
78 WPARAM wParam
, LPARAM lParam
)
85 static int tabs
[4] = { 78, 108 };
86 SendDlgItemMessage(hwnd
, IDN_LIST
, LB_SETTABSTOPS
, 2,
89 for (i
= 0; i
< nevents
; i
++)
90 SendDlgItemMessage(hwnd
, IDN_LIST
, LB_ADDSTRING
,
91 0, (LPARAM
) events
[i
]);
94 switch (LOWORD(wParam
)) {
98 SetActiveWindow(GetParent(hwnd
));
102 if (HIWORD(wParam
) == BN_CLICKED
||
103 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
106 selcount
= SendDlgItemMessage(hwnd
, IDN_LIST
,
107 LB_GETSELCOUNT
, 0, 0);
108 if (selcount
== 0) { /* don't even try to copy zero items */
113 selitems
= smalloc(selcount
* sizeof(int));
115 int count
= SendDlgItemMessage(hwnd
, IDN_LIST
,
122 static unsigned char sel_nl
[] = SEL_NL
;
124 if (count
== 0) { /* can't copy zero stuff */
130 for (i
= 0; i
< count
; i
++)
132 strlen(events
[selitems
[i
]]) + sizeof(sel_nl
);
134 clipdata
= smalloc(size
);
137 for (i
= 0; i
< count
; i
++) {
138 char *q
= events
[selitems
[i
]];
139 int qlen
= strlen(q
);
142 memcpy(p
, sel_nl
, sizeof(sel_nl
));
145 write_aclip(NULL
, clipdata
, size
, TRUE
);
150 for (i
= 0; i
< nevents
; i
++)
151 SendDlgItemMessage(hwnd
, IDN_LIST
, LB_SETSEL
,
160 SetActiveWindow(GetParent(hwnd
));
167 static int CALLBACK
LicenceProc(HWND hwnd
, UINT msg
,
168 WPARAM wParam
, LPARAM lParam
)
174 switch (LOWORD(wParam
)) {
187 static int CALLBACK
AboutProc(HWND hwnd
, UINT msg
,
188 WPARAM wParam
, LPARAM lParam
)
192 SetDlgItemText(hwnd
, IDA_VERSION
, ver
);
195 switch (LOWORD(wParam
)) {
198 EndDialog(hwnd
, TRUE
);
201 EnableWindow(hwnd
, 0);
202 DialogBox(hinst
, MAKEINTRESOURCE(IDD_LICENCEBOX
),
204 EnableWindow(hwnd
, 1);
205 SetActiveWindow(hwnd
);
209 /* Load web browser */
210 ShellExecute(hwnd
, "open",
211 "http://www.chiark.greenend.org.uk/~sgtatham/putty/",
212 0, 0, SW_SHOWDEFAULT
);
217 EndDialog(hwnd
, TRUE
);
224 * Null dialog procedure.
226 static int CALLBACK
NullDlgProc(HWND hwnd
, UINT msg
,
227 WPARAM wParam
, LPARAM lParam
)
232 static char savedsession
[2048];
235 IDC_ABOUT
, IDCX_TVSTATIC
, IDCX_TREEVIEW
, controlstartvalue
,
388 IDC_SCROLLBARFULLSCREEN
,
403 IDC_FULLSCREENONALTENTER
,
406 appearancepanelstart
,
407 IDC_TITLE_APPEARANCE
,
429 connectionpanelstart
,
430 IDC_TITLE_CONNECTION
,
455 IDC_PROXYEXCLUDESTATIC
,
456 IDC_PROXYEXCLUDEEDIT
,
463 IDC_PROXYTELNETCMDSTATIC
,
464 IDC_PROXYTELNETCMDEDIT
,
465 IDC_PROXYSOCKSVERSTATIC
,
596 translationpanelstart
,
597 IDC_TITLE_TRANSLATION
,
598 IDC_BOX_TRANSLATION1
,
599 IDC_BOX_TRANSLATION2
,
600 IDC_BOX_TRANSLATION3
,
638 static const char *const colours
[] = {
639 "Default Foreground", "Default Bold Foreground",
640 "Default Background", "Default Bold Background",
641 "Cursor Text", "Cursor Colour",
642 "ANSI Black", "ANSI Black Bold",
643 "ANSI Red", "ANSI Red Bold",
644 "ANSI Green", "ANSI Green Bold",
645 "ANSI Yellow", "ANSI Yellow Bold",
646 "ANSI Blue", "ANSI Blue Bold",
647 "ANSI Magenta", "ANSI Magenta Bold",
648 "ANSI Cyan", "ANSI Cyan Bold",
649 "ANSI White", "ANSI White Bold"
651 static const int permcolour
[] = {
652 TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, TRUE
,
653 TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
,
654 TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
657 static void fmtfont(char *buf
)
659 sprintf(buf
, "Font: %s, ", cfg
.font
);
661 strcat(buf
, "bold, ");
662 if (cfg
.fontheight
== 0)
663 strcat(buf
, "default height");
665 sprintf(buf
+ strlen(buf
), "%d-point",
666 (cfg
.fontheight
< 0 ?
-cfg
.fontheight
: cfg
.fontheight
));
669 char *help_context_cmd(int id
)
681 return "JI(`',`session.hostname')";
688 return "JI(`',`session.saved')";
693 return "JI(`',`session.coe')";
694 case IDC_LSTATSTATIC
:
698 case IDC_LSTATPACKET
:
699 return "JI(`',`logging.main')";
704 return "JI(`',`logging.filename')";
709 return "JI(`',`logging.exists')";
714 return "JI(`',`keyboard.backspace')";
718 return "JI(`',`keyboard.homeend')";
726 return "JI(`',`keyboard.funkeys')";
730 return "JI(`',`keyboard.appkeypad')";
734 return "JI(`',`keyboard.appcursor')";
736 return "JI(`',`keyboard.nethack')";
738 return "JI(`',`keyboard.compose')";
739 case IDC_CTRLALTKEYS
:
740 return "JI(`',`keyboard.ctrlalt')";
744 return "JI(`',`features.application')";
746 return "JI(`',`features.mouse')";
748 return "JI(`',`features.resize')";
749 case IDC_NOALTSCREEN
:
750 return "JI(`',`features.altscreen')";
752 return "JI(`',`features.retitle')";
753 case IDC_NODBACKSPACE
:
754 return "JI(`',`features.dbackspace')";
756 return "JI(`',`features.charset')";
759 return "JI(`',`terminal.autowrap')";
761 return "JI(`',`terminal.decom')";
763 return "JI(`',`terminal.lfhascr')";
765 return "JI(`',`terminal.bce')";
767 return "JI(`',`terminal.blink')";
770 return "JI(`',`terminal.answerback')";
772 case IDC_ECHOBACKEND
:
775 return "JI(`',`terminal.localecho')";
777 case IDC_EDITBACKEND
:
780 return "JI(`',`terminal.localedit')";
781 case IDC_PRINTERSTATIC
:
783 return "JI(`',`terminal.printing')";
786 case IDC_BELL_DISABLED
:
787 case IDC_BELL_DEFAULT
:
788 case IDC_BELL_WAVEFILE
:
789 case IDC_BELL_VISUAL
:
790 case IDC_BELL_WAVESTATIC
:
791 case IDC_BELL_WAVEEDIT
:
792 case IDC_BELL_WAVEBROWSE
:
793 return "JI(`',`bell.style')";
794 case IDC_B_IND_STATIC
:
795 case IDC_B_IND_DISABLED
:
796 case IDC_B_IND_FLASH
:
797 case IDC_B_IND_STEADY
:
798 return "JI(`',`bell.taskbar')";
800 case IDC_BELLOVLNSTATIC
:
802 case IDC_BELLOVLTSTATIC
:
804 case IDC_BELLOVLEXPLAIN
:
805 case IDC_BELLOVLSSTATIC
:
807 return "JI(`',`bell.overload')";
813 return "JI(`',`window.size')";
814 case IDC_RESIZESTATIC
:
818 case IDC_RESIZEEITHER
:
819 return "JI(`',`window.resize')";
821 case IDC_SCROLLBARFULLSCREEN
:
826 return "JI(`',`window.scrollback')";
829 return "JI(`',`behaviour.closewarn')";
831 return "JI(`',`behaviour.altf4')";
833 return "JI(`',`behaviour.altspace')";
835 return "JI(`',`behaviour.altonly')";
836 case IDC_ALWAYSONTOP
:
837 return "JI(`',`behaviour.alwaysontop')";
838 case IDC_FULLSCREENONALTENTER
:
839 return "JI(`',`behaviour.altenter')";
841 case IDC_CURSORSTATIC
:
846 return "JI(`',`appearance.cursor')";
849 return "JI(`',`appearance.font')";
853 return "JI(`',`appearance.title')";
855 return "JI(`',`appearance.hidemouse')";
859 return "JI(`',`appearance.border')";
863 return "JI(`',`connection.termtype')";
866 return "JI(`',`connection.username')";
869 return "JI(`',`connection.keepalive')";
871 return "JI(`',`connection.nodelay')";
873 case IDC_PROXYTYPESTATIC
:
874 case IDC_PROXYTYPENONE
:
875 case IDC_PROXYTYPEHTTP
:
876 case IDC_PROXYTYPESOCKS
:
877 case IDC_PROXYTYPETELNET
:
878 return "JI(`',`proxy.type')";
879 case IDC_PROXYHOSTSTATIC
:
880 case IDC_PROXYHOSTEDIT
:
881 case IDC_PROXYPORTSTATIC
:
882 case IDC_PROXYPORTEDIT
:
883 return "JI(`',`proxy.main')";
884 case IDC_PROXYEXCLUDESTATIC
:
885 case IDC_PROXYEXCLUDEEDIT
:
886 case IDC_PROXYLOCALHOST
:
887 return "JI(`',`proxy.exclude')";
888 case IDC_PROXYUSERSTATIC
:
889 case IDC_PROXYUSEREDIT
:
890 case IDC_PROXYPASSSTATIC
:
891 case IDC_PROXYPASSEDIT
:
892 return "JI(`',`proxy.auth')";
893 case IDC_PROXYTELNETCMDSTATIC
:
894 case IDC_PROXYTELNETCMDEDIT
:
895 return "JI(`',`proxy.command')";
896 case IDC_PROXYSOCKSVERSTATIC
:
897 case IDC_PROXYSOCKSVER5
:
898 case IDC_PROXYSOCKSVER4
:
899 return "JI(`',`proxy.socksver')";
903 return "JI(`',`telnet.termspeed')";
912 return "JI(`',`telnet.environ')";
916 return "JI(`',`telnet.oldenviron')";
920 return "JI(`',`telnet.passive')";
922 return "JI(`',`telnet.specialkeys')";
924 return "JI(`',`telnet.newline')";
928 return "JI(`',`rlogin.termspeed')";
929 case IDC_RLLUSERSTATIC
:
930 case IDC_RLLUSEREDIT
:
931 return "JI(`',`rlogin.localuser')";
934 return "JI(`',`ssh.nopty')";
935 case IDC_CIPHERSTATIC2
:
940 return "JI(`',`ssh.ciphers')";
941 case IDC_SSHPROTSTATIC
:
942 case IDC_SSHPROT1ONLY
:
945 case IDC_SSHPROT2ONLY
:
946 return "JI(`',`ssh.protocol')";
949 return "JI(`',`ssh.command')";
951 return "JI(`',`ssh.compress')";
956 return "JI(`',`ssh.auth.privkey')";
958 return "JI(`',`ssh.auth.agentfwd')";
960 return "JI(`',`ssh.auth.changeuser')";
962 return "JI(`',`ssh.auth.tis')";
964 return "JI(`',`ssh.auth.ki')";
969 return "JI(`',`selection.buttons')";
970 case IDC_MOUSEOVERRIDE
:
971 return "JI(`',`selection.shiftdrag')";
972 case IDC_SELTYPESTATIC
:
974 case IDC_SELTYPERECT
:
975 return "JI(`',`selection.rect')";
981 return "JI(`',`selection.charclasses')";
983 return "JI(`',`selection.linedraw')";
985 return "JI(`',`selection.rtf')";
988 return "JI(`',`colours.bold')";
990 return "JI(`',`colours.logpal')";
991 case IDC_COLOURSTATIC
:
1000 return "JI(`',`colours.config')";
1002 case IDC_CODEPAGESTATIC
:
1004 return "JI(`',`translation.codepage')";
1005 case IDC_CAPSLOCKCYR
:
1006 return "JI(`',`translation.cyrillic')";
1008 case IDC_VTXWINDOWS
:
1013 return "JI(`',`translation.linedraw')";
1015 case IDC_X11_FORWARD
:
1016 case IDC_X11_DISPSTATIC
:
1017 case IDC_X11_DISPLAY
:
1018 return "JI(`',`ssh.tunnels.x11')";
1019 case IDC_PFWDSTATIC
:
1020 case IDC_PFWDSTATIC2
:
1021 case IDC_PFWDREMOVE
:
1024 case IDC_SPORTSTATIC
:
1026 case IDC_DPORTSTATIC
:
1029 case IDC_PFWDREMOTE
:
1030 return "JI(`',`ssh.tunnels.portfwd')";
1033 return "JI(`',`ssh.tunnels.portfwd.localhost')";
1035 case IDC_BUGS_IGNORE1
:
1036 case IDC_BUGD_IGNORE1
:
1037 return "JI(`',`ssh.bugs.ignore1')";
1038 case IDC_BUGS_PLAINPW1
:
1039 case IDC_BUGD_PLAINPW1
:
1040 return "JI(`',`ssh.bugs.plainpw1')";
1043 return "JI(`',`ssh.bugs.rsa1')";
1044 case IDC_BUGS_HMAC2
:
1045 case IDC_BUGD_HMAC2
:
1046 return "JI(`',`ssh.bugs.hmac2')";
1047 case IDC_BUGS_DERIVEKEY2
:
1048 case IDC_BUGD_DERIVEKEY2
:
1049 return "JI(`',`ssh.bugs.derivekey2')";
1050 case IDC_BUGS_RSAPAD2
:
1051 case IDC_BUGD_RSAPAD2
:
1052 return "JI(`',`ssh.bugs.rsapad2')";
1053 case IDC_BUGS_DHGEX2
:
1054 case IDC_BUGD_DHGEX2
:
1055 return "JI(`',`ssh.bugs.dhgex2')";
1062 /* 2nd arg: NZ => don't redraw session list (use when loading
1064 static void init_dlg_ctrls(HWND hwnd
, int keepsess
)
1067 char fontstatic
[256];
1069 SetDlgItemText(hwnd
, IDC_HOST
, cfg
.host
);
1070 SetDlgItemText(hwnd
, IDC_SESSEDIT
, savedsession
);
1073 n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_GETCOUNT
, 0, 0);
1074 for (i
= n
; i
-- > 0;)
1075 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_DELETESTRING
, i
, 0);
1076 for (i
= 0; i
< sesslist
.nsessions
; i
++)
1077 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_ADDSTRING
,
1078 0, (LPARAM
) (sesslist
.sessions
[i
]));
1080 SetDlgItemInt(hwnd
, IDC_PORT
, cfg
.port
, FALSE
);
1081 CheckRadioButton(hwnd
, IDC_PROTRAW
, IDC_PROTSSH
,
1082 cfg
.protocol
== PROT_SSH ? IDC_PROTSSH
:
1083 cfg
.protocol
== PROT_TELNET ? IDC_PROTTELNET
:
1085 PROT_RLOGIN ? IDC_PROTRLOGIN
: IDC_PROTRAW
);
1086 SetDlgItemInt(hwnd
, IDC_PINGEDIT
, cfg
.ping_interval
, FALSE
);
1087 CheckDlgButton(hwnd
, IDC_NODELAY
, cfg
.tcp_nodelay
);
1089 CheckRadioButton(hwnd
, IDC_DEL008
, IDC_DEL127
,
1090 cfg
.bksp_is_delete ? IDC_DEL127
: IDC_DEL008
);
1091 CheckRadioButton(hwnd
, IDC_HOMETILDE
, IDC_HOMERXVT
,
1092 cfg
.rxvt_homeend ? IDC_HOMERXVT
: IDC_HOMETILDE
);
1093 CheckRadioButton(hwnd
, IDC_FUNCTILDE
, IDC_FUNCSCO
,
1094 cfg
.funky_type
== 0 ? IDC_FUNCTILDE
:
1095 cfg
.funky_type
== 1 ? IDC_FUNCLINUX
:
1096 cfg
.funky_type
== 2 ? IDC_FUNCXTERM
:
1097 cfg
.funky_type
== 3 ? IDC_FUNCVT400
:
1098 cfg
.funky_type
== 4 ? IDC_FUNCVT100P
:
1099 cfg
.funky_type
== 5 ? IDC_FUNCSCO
: IDC_FUNCTILDE
);
1100 CheckDlgButton(hwnd
, IDC_NOAPPLICC
, cfg
.no_applic_c
);
1101 CheckDlgButton(hwnd
, IDC_NOAPPLICK
, cfg
.no_applic_k
);
1102 CheckDlgButton(hwnd
, IDC_NOMOUSEREP
, cfg
.no_mouse_rep
);
1103 CheckDlgButton(hwnd
, IDC_NORESIZE
, cfg
.no_remote_resize
);
1104 CheckDlgButton(hwnd
, IDC_NOALTSCREEN
, cfg
.no_alt_screen
);
1105 CheckDlgButton(hwnd
, IDC_NOWINTITLE
, cfg
.no_remote_wintitle
);
1106 CheckDlgButton(hwnd
, IDC_NODBACKSPACE
, cfg
.no_dbackspace
);
1107 CheckDlgButton(hwnd
, IDC_NOCHARSET
, cfg
.no_remote_charset
);
1108 CheckRadioButton(hwnd
, IDC_CURNORMAL
, IDC_CURAPPLIC
,
1109 cfg
.app_cursor ? IDC_CURAPPLIC
: IDC_CURNORMAL
);
1110 CheckRadioButton(hwnd
, IDC_KPNORMAL
, IDC_KPNH
,
1111 cfg
.nethack_keypad ? IDC_KPNH
:
1112 cfg
.app_keypad ? IDC_KPAPPLIC
: IDC_KPNORMAL
);
1113 CheckDlgButton(hwnd
, IDC_ALTF4
, cfg
.alt_f4
);
1114 CheckDlgButton(hwnd
, IDC_ALTSPACE
, cfg
.alt_space
);
1115 CheckDlgButton(hwnd
, IDC_ALTONLY
, cfg
.alt_only
);
1116 CheckDlgButton(hwnd
, IDC_COMPOSEKEY
, cfg
.compose_key
);
1117 CheckDlgButton(hwnd
, IDC_CTRLALTKEYS
, cfg
.ctrlaltkeys
);
1118 CheckDlgButton(hwnd
, IDC_TELNETKEY
, cfg
.telnet_keyboard
);
1119 CheckDlgButton(hwnd
, IDC_TELNETRET
, cfg
.telnet_newline
);
1120 CheckRadioButton(hwnd
, IDC_ECHOBACKEND
, IDC_ECHONO
,
1121 cfg
.localecho
== LD_BACKEND ? IDC_ECHOBACKEND
:
1122 cfg
.localecho
== LD_YES ? IDC_ECHOYES
: IDC_ECHONO
);
1123 CheckRadioButton(hwnd
, IDC_EDITBACKEND
, IDC_EDITNO
,
1124 cfg
.localedit
== LD_BACKEND ? IDC_EDITBACKEND
:
1125 cfg
.localedit
== LD_YES ? IDC_EDITYES
: IDC_EDITNO
);
1126 SetDlgItemText(hwnd
, IDC_ANSWEREDIT
, cfg
.answerback
);
1127 CheckDlgButton(hwnd
, IDC_ALWAYSONTOP
, cfg
.alwaysontop
);
1128 CheckDlgButton(hwnd
, IDC_FULLSCREENONALTENTER
, cfg
.fullscreenonaltenter
);
1129 CheckDlgButton(hwnd
, IDC_SCROLLKEY
, cfg
.scroll_on_key
);
1130 CheckDlgButton(hwnd
, IDC_SCROLLDISP
, cfg
.scroll_on_disp
);
1132 CheckDlgButton(hwnd
, IDC_WRAPMODE
, cfg
.wrap_mode
);
1133 CheckDlgButton(hwnd
, IDC_DECOM
, cfg
.dec_om
);
1134 CheckDlgButton(hwnd
, IDC_LFHASCR
, cfg
.lfhascr
);
1135 SetDlgItemInt(hwnd
, IDC_ROWSEDIT
, cfg
.height
, FALSE
);
1136 SetDlgItemInt(hwnd
, IDC_COLSEDIT
, cfg
.width
, FALSE
);
1137 SetDlgItemInt(hwnd
, IDC_SAVEEDIT
, cfg
.savelines
, FALSE
);
1138 fmtfont(fontstatic
);
1139 SetDlgItemText(hwnd
, IDC_FONTSTATIC
, fontstatic
);
1140 CheckRadioButton(hwnd
, IDC_BELL_DISABLED
, IDC_BELL_VISUAL
,
1141 cfg
.beep
== BELL_DISABLED ? IDC_BELL_DISABLED
:
1142 cfg
.beep
== BELL_DEFAULT ? IDC_BELL_DEFAULT
:
1143 cfg
.beep
== BELL_WAVEFILE ? IDC_BELL_WAVEFILE
:
1145 BELL_VISUAL ? IDC_BELL_VISUAL
: IDC_BELL_DEFAULT
);
1146 CheckRadioButton(hwnd
, IDC_B_IND_DISABLED
, IDC_B_IND_STEADY
,
1148 B_IND_DISABLED ? IDC_B_IND_DISABLED
: cfg
.beep_ind
==
1149 B_IND_FLASH ? IDC_B_IND_FLASH
: cfg
.beep_ind
==
1150 B_IND_STEADY ? IDC_B_IND_STEADY
: IDC_B_IND_DISABLED
);
1151 SetDlgItemText(hwnd
, IDC_BELL_WAVEEDIT
, cfg
.bell_wavefile
);
1152 CheckDlgButton(hwnd
, IDC_BELLOVL
, cfg
.bellovl
);
1153 SetDlgItemInt(hwnd
, IDC_BELLOVLN
, cfg
.bellovl_n
, FALSE
);
1154 MySetDlgItemFlt(hwnd
, IDC_BELLOVLT
, cfg
.bellovl_t
/ 1000.0);
1155 MySetDlgItemFlt(hwnd
, IDC_BELLOVLS
, cfg
.bellovl_s
/ 1000.0);
1157 CheckDlgButton(hwnd
, IDC_BCE
, cfg
.bce
);
1158 CheckDlgButton(hwnd
, IDC_BLINKTEXT
, cfg
.blinktext
);
1160 SetDlgItemText(hwnd
, IDC_WINEDIT
, cfg
.wintitle
);
1161 CheckDlgButton(hwnd
, IDC_WINNAME
, cfg
.win_name_always
);
1162 CheckDlgButton(hwnd
, IDC_HIDEMOUSE
, cfg
.hide_mouseptr
);
1163 CheckDlgButton(hwnd
, IDC_SUNKENEDGE
, cfg
.sunken_edge
);
1164 SetDlgItemInt(hwnd
, IDC_WINBEDIT
, cfg
.window_border
, FALSE
);
1165 CheckRadioButton(hwnd
, IDC_CURBLOCK
, IDC_CURVERT
,
1166 cfg
.cursor_type
== 0 ? IDC_CURBLOCK
:
1167 cfg
.cursor_type
== 1 ? IDC_CURUNDER
: IDC_CURVERT
);
1168 CheckDlgButton(hwnd
, IDC_BLINKCUR
, cfg
.blink_cur
);
1169 CheckDlgButton(hwnd
, IDC_SCROLLBAR
, cfg
.scrollbar
);
1170 CheckDlgButton(hwnd
, IDC_SCROLLBARFULLSCREEN
, cfg
.scrollbar_in_fullscreen
);
1171 CheckRadioButton(hwnd
, IDC_RESIZETERM
, IDC_RESIZEEITHER
,
1172 cfg
.resize_action
== RESIZE_TERM ? IDC_RESIZETERM
:
1173 cfg
.resize_action
== RESIZE_FONT ? IDC_RESIZEFONT
:
1174 cfg
.resize_action
== RESIZE_EITHER ? IDC_RESIZEEITHER
:
1176 CheckRadioButton(hwnd
, IDC_COEALWAYS
, IDC_COENORMAL
,
1177 cfg
.close_on_exit
== COE_NORMAL ? IDC_COENORMAL
:
1178 cfg
.close_on_exit
==
1179 COE_NEVER ? IDC_COENEVER
: IDC_COEALWAYS
);
1180 CheckDlgButton(hwnd
, IDC_CLOSEWARN
, cfg
.warn_on_close
);
1182 SetDlgItemText(hwnd
, IDC_TTEDIT
, cfg
.termtype
);
1183 SetDlgItemText(hwnd
, IDC_TSEDIT
, cfg
.termspeed
);
1184 SetDlgItemText(hwnd
, IDC_R_TSEDIT
, cfg
.termspeed
);
1185 SetDlgItemText(hwnd
, IDC_RLLUSEREDIT
, cfg
.localusername
);
1186 SetDlgItemText(hwnd
, IDC_LOGEDIT
, cfg
.username
);
1187 SetDlgItemText(hwnd
, IDC_LGFEDIT
, cfg
.logfilename
);
1188 CheckRadioButton(hwnd
, IDC_LSTATOFF
, IDC_LSTATPACKET
,
1189 cfg
.logtype
== LGTYP_NONE ? IDC_LSTATOFF
:
1190 cfg
.logtype
== LGTYP_ASCII ? IDC_LSTATASCII
:
1191 cfg
.logtype
== LGTYP_DEBUG ? IDC_LSTATRAW
:
1193 CheckRadioButton(hwnd
, IDC_LSTATXOVR
, IDC_LSTATXASK
,
1194 cfg
.logxfovr
== LGXF_OVR ? IDC_LSTATXOVR
:
1195 cfg
.logxfovr
== LGXF_ASK ? IDC_LSTATXASK
:
1198 char *p
= cfg
.environmt
;
1199 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_RESETCONTENT
, 0, 0);
1201 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_ADDSTRING
, 0,
1207 SendDlgItemMessage(hwnd
, IDC_PFWDLIST
, LB_ADDSTRING
, 0,
1212 CheckRadioButton(hwnd
, IDC_EMBSD
, IDC_EMRFC
,
1213 cfg
.rfc_environ ? IDC_EMRFC
: IDC_EMBSD
);
1214 CheckRadioButton(hwnd
, IDC_TPASSIVE
, IDC_TACTIVE
,
1215 cfg
.passive_telnet ? IDC_TPASSIVE
: IDC_TACTIVE
);
1217 SetDlgItemText(hwnd
, IDC_TTEDIT
, cfg
.termtype
);
1218 SetDlgItemText(hwnd
, IDC_LOGEDIT
, cfg
.username
);
1219 CheckDlgButton(hwnd
, IDC_NOPTY
, cfg
.nopty
);
1220 CheckDlgButton(hwnd
, IDC_COMPRESS
, cfg
.compression
);
1221 CheckDlgButton(hwnd
, IDC_SSH2DES
, cfg
.ssh2_des_cbc
);
1222 CheckDlgButton(hwnd
, IDC_AGENTFWD
, cfg
.agentfwd
);
1223 CheckDlgButton(hwnd
, IDC_CHANGEUSER
, cfg
.change_username
);
1224 CheckRadioButton(hwnd
, IDC_SSHPROT1ONLY
, IDC_SSHPROT2ONLY
,
1225 cfg
.sshprot
== 1 ? IDC_SSHPROT1
:
1226 cfg
.sshprot
== 2 ? IDC_SSHPROT2
:
1227 cfg
.sshprot
== 3 ? IDC_SSHPROT2ONLY
: IDC_SSHPROT1ONLY
);
1228 CheckDlgButton(hwnd
, IDC_AUTHTIS
, cfg
.try_tis_auth
);
1229 CheckDlgButton(hwnd
, IDC_AUTHKI
, cfg
.try_ki_auth
);
1230 SetDlgItemText(hwnd
, IDC_PKEDIT
, cfg
.keyfile
);
1231 SetDlgItemText(hwnd
, IDC_CMDEDIT
, cfg
.remote_cmd
);
1235 static const struct { char *s
; int c
; } ciphers
[] = {
1236 { "3DES", CIPHER_3DES
},
1237 { "Blowfish", CIPHER_BLOWFISH
},
1238 { "DES", CIPHER_DES
},
1239 { "AES (SSH 2 only)", CIPHER_AES
},
1240 { "-- warn below here --", CIPHER_WARN
}
1243 /* Set up the "selected ciphers" box. */
1244 /* (cipherlist assumed to contain all ciphers) */
1245 SendDlgItemMessage(hwnd
, IDC_CIPHERLIST
, LB_RESETCONTENT
, 0, 0);
1246 for (i
= 0; i
< CIPHER_MAX
; i
++) {
1247 int c
= cfg
.ssh_cipherlist
[i
];
1250 for (j
= 0; j
< (sizeof ciphers
) / (sizeof ciphers
[0]); j
++) {
1251 if (ciphers
[j
].c
== c
) {
1252 cstr
= ciphers
[j
].s
;
1256 pos
= SendDlgItemMessage(hwnd
, IDC_CIPHERLIST
, LB_ADDSTRING
,
1258 SendDlgItemMessage(hwnd
, IDC_CIPHERLIST
, LB_SETITEMDATA
,
1264 CheckRadioButton(hwnd
, IDC_MBWINDOWS
, IDC_MBXTERM
,
1265 cfg
.mouse_is_xterm ? IDC_MBXTERM
: IDC_MBWINDOWS
);
1266 CheckRadioButton(hwnd
, IDC_SELTYPELEX
, IDC_SELTYPERECT
,
1267 cfg
.rect_select
== 0 ? IDC_SELTYPELEX
: IDC_SELTYPERECT
);
1268 CheckDlgButton(hwnd
, IDC_MOUSEOVERRIDE
, cfg
.mouse_override
);
1269 CheckDlgButton(hwnd
, IDC_RAWCNP
, cfg
.rawcnp
);
1270 CheckDlgButton(hwnd
, IDC_RTFPASTE
, cfg
.rtf_paste
);
1272 static int tabs
[4] = { 25, 61, 96, 128 };
1273 SendDlgItemMessage(hwnd
, IDC_CCLIST
, LB_SETTABSTOPS
, 4,
1276 for (i
= 0; i
< 128; i
++) {
1278 sprintf(str
, "%d\t(0x%02X)\t%c\t%d", i
, i
,
1279 (i
>= 0x21 && i
!= 0x7F) ? i
: ' ', cfg
.wordness
[i
]);
1280 SendDlgItemMessage(hwnd
, IDC_CCLIST
, LB_ADDSTRING
, 0,
1284 CheckDlgButton(hwnd
, IDC_BOLDCOLOUR
, cfg
.bold_colour
);
1285 CheckDlgButton(hwnd
, IDC_PALETTE
, cfg
.try_palette
);
1288 n
= SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, LB_GETCOUNT
, 0, 0);
1289 for (i
= n
; i
-- > 0;)
1290 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
1291 LB_DELETESTRING
, i
, 0);
1292 for (i
= 0; i
< 22; i
++)
1293 if (cfg
.bold_colour
|| permcolour
[i
])
1294 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, LB_ADDSTRING
, 0,
1295 (LPARAM
) colours
[i
]);
1297 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, LB_SETCURSEL
, 0, 0);
1298 SetDlgItemInt(hwnd
, IDC_RVALUE
, cfg
.colours
[0][0], FALSE
);
1299 SetDlgItemInt(hwnd
, IDC_GVALUE
, cfg
.colours
[0][1], FALSE
);
1300 SetDlgItemInt(hwnd
, IDC_BVALUE
, cfg
.colours
[0][2], FALSE
);
1305 strcpy(cfg
.line_codepage
, cp_name(decode_codepage(cfg
.line_codepage
)));
1306 SendDlgItemMessage(hwnd
, IDC_CODEPAGE
, CB_RESETCONTENT
, 0, 0);
1307 CheckDlgButton (hwnd
, IDC_CAPSLOCKCYR
, cfg
.xlat_capslockcyr
);
1308 for (i
= 0; (cp
= cp_enumerate(i
)) != NULL
; i
++) {
1309 SendDlgItemMessage(hwnd
, IDC_CODEPAGE
, CB_ADDSTRING
,
1312 SetDlgItemText(hwnd
, IDC_CODEPAGE
, cfg
.line_codepage
);
1318 pe
= printer_start_enum(&nprinters
);
1319 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_RESETCONTENT
, 0, 0);
1320 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_ADDSTRING
,
1321 0, (LPARAM
) PRINTER_DISABLED_STRING
);
1322 for (i
= 0; i
< nprinters
; i
++) {
1323 char *printer_name
= printer_get_name(pe
, i
);
1324 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_ADDSTRING
,
1325 0, (LPARAM
) printer_name
);
1327 printer_finish_enum(pe
);
1328 SetDlgItemText(hwnd
, IDC_PRINTER
,
1329 *cfg
.printer ? cfg
.printer
: PRINTER_DISABLED_STRING
);
1332 CheckRadioButton(hwnd
, IDC_VTXWINDOWS
, IDC_VTUNICODE
,
1333 cfg
.vtmode
== VT_XWINDOWS ? IDC_VTXWINDOWS
:
1334 cfg
.vtmode
== VT_OEMANSI ? IDC_VTOEMANSI
:
1335 cfg
.vtmode
== VT_OEMONLY ? IDC_VTOEMONLY
:
1336 cfg
.vtmode
== VT_UNICODE ? IDC_VTUNICODE
:
1339 CheckDlgButton(hwnd
, IDC_X11_FORWARD
, cfg
.x11_forward
);
1340 SetDlgItemText(hwnd
, IDC_X11_DISPLAY
, cfg
.x11_display
);
1342 CheckDlgButton(hwnd
, IDC_LPORT_ALL
, cfg
.lport_acceptall
);
1343 CheckDlgButton(hwnd
, IDC_RPORT_ALL
, cfg
.rport_acceptall
);
1344 CheckRadioButton(hwnd
, IDC_PFWDLOCAL
, IDC_PFWDREMOTE
, IDC_PFWDLOCAL
);
1347 CheckRadioButton(hwnd
, IDC_PROXYTYPENONE
, IDC_PROXYTYPETELNET
,
1348 cfg
.proxy_type
== PROXY_HTTP ? IDC_PROXYTYPEHTTP
:
1349 cfg
.proxy_type
== PROXY_SOCKS ? IDC_PROXYTYPESOCKS
:
1350 cfg
.proxy_type
== PROXY_TELNET ? IDC_PROXYTYPETELNET
: IDC_PROXYTYPENONE
);
1351 SetDlgItemText(hwnd
, IDC_PROXYHOSTEDIT
, cfg
.proxy_host
);
1352 SetDlgItemInt(hwnd
, IDC_PROXYPORTEDIT
, cfg
.proxy_port
, FALSE
);
1353 SetDlgItemText(hwnd
, IDC_PROXYEXCLUDEEDIT
, cfg
.proxy_exclude_list
);
1354 CheckDlgButton(hwnd
, IDC_PROXYLOCALHOST
, cfg
.even_proxy_localhost
);
1355 SetDlgItemText(hwnd
, IDC_PROXYTELNETCMDEDIT
, cfg
.proxy_telnet_command
);
1356 SetDlgItemText(hwnd
, IDC_PROXYUSEREDIT
, cfg
.proxy_username
);
1357 SetDlgItemText(hwnd
, IDC_PROXYPASSEDIT
, cfg
.proxy_password
);
1358 CheckRadioButton(hwnd
, IDC_PROXYSOCKSVER5
, IDC_PROXYSOCKSVER4
,
1359 cfg
.proxy_socks_version
== 4 ? IDC_PROXYSOCKSVER4
: IDC_PROXYSOCKSVER5
);
1361 /* SSH bugs config */
1362 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_RESETCONTENT
, 0, 0);
1363 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1364 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1365 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1366 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_SETCURSEL
,
1367 cfg
.sshbug_ignore1
== BUG_ON ?
2 :
1368 cfg
.sshbug_ignore1
== BUG_OFF ?
1 : 0, 0);
1369 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_RESETCONTENT
, 0, 0);
1370 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1371 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1372 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1373 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_SETCURSEL
,
1374 cfg
.sshbug_plainpw1
== BUG_ON ?
2 :
1375 cfg
.sshbug_plainpw1
== BUG_OFF ?
1 : 0, 0);
1376 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_RESETCONTENT
, 0, 0);
1377 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1378 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1379 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1380 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_SETCURSEL
,
1381 cfg
.sshbug_rsa1
== BUG_ON ?
2 :
1382 cfg
.sshbug_rsa1
== BUG_OFF ?
1 : 0, 0);
1383 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_RESETCONTENT
, 0, 0);
1384 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1385 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1386 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1387 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_SETCURSEL
,
1388 cfg
.sshbug_hmac2
== BUG_ON ?
2 :
1389 cfg
.sshbug_hmac2
== BUG_OFF ?
1 : 0, 0);
1390 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_RESETCONTENT
, 0, 0);
1391 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1392 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1393 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1394 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_SETCURSEL
,
1395 cfg
.sshbug_derivekey2
== BUG_ON ?
2 :
1396 cfg
.sshbug_derivekey2
== BUG_OFF ?
1 : 0, 0);
1397 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_RESETCONTENT
, 0, 0);
1398 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1399 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1400 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1401 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_SETCURSEL
,
1402 cfg
.sshbug_rsapad2
== BUG_ON ?
2 :
1403 cfg
.sshbug_rsapad2
== BUG_OFF ?
1 : 0, 0);
1404 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_RESETCONTENT
, 0, 0);
1405 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1406 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1407 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1408 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_SETCURSEL
,
1409 cfg
.sshbug_dhgex2
== BUG_ON ?
2 :
1410 cfg
.sshbug_dhgex2
== BUG_OFF ?
1 : 0, 0);
1413 struct treeview_faff
{
1415 HTREEITEM lastat
[4];
1418 static HTREEITEM
treeview_insert(struct treeview_faff
*faff
,
1419 int level
, char *text
)
1424 ins
.hParent
= (level
> 0 ? faff
->lastat
[level
- 1] : TVI_ROOT
);
1425 ins
.hInsertAfter
= faff
->lastat
[level
];
1426 #if _WIN32_IE >= 0x0400 && defined NONAMELESSUNION
1427 #define INSITEM DUMMYUNIONNAME.item
1429 #define INSITEM item
1431 ins
.INSITEM
.mask
= TVIF_TEXT
;
1432 ins
.INSITEM
.pszText
= text
;
1433 newitem
= TreeView_InsertItem(faff
->treeview
, &ins
);
1435 TreeView_Expand(faff
->treeview
, faff
->lastat
[level
- 1],
1437 faff
->lastat
[level
] = newitem
;
1438 for (i
= level
+ 1; i
< 4; i
++)
1439 faff
->lastat
[i
] = NULL
;
1444 * Create the panelfuls of controls in the configuration box.
1446 static void create_controls(HWND hwnd
, int dlgtype
, int panel
)
1448 if (panel
== sessionpanelstart
) {
1449 /* The Session panel. Accelerators used: [acgoh] nprtis elvd w */
1451 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1452 bartitle(&cp
, "Basic options for your PuTTY session",
1455 beginbox(&cp
, "Specify your connection by host name or IP address",
1458 "Host &Name (or IP address)",
1459 IDC_HOSTSTATIC
, IDC_HOST
, 75,
1460 "&Port", IDC_PORTSTATIC
, IDC_PORT
, 25, NULL
);
1461 if (backends
[3].backend
== NULL
) {
1462 /* this is PuTTYtel, so only three protocols available */
1463 radioline(&cp
, "Protocol:", IDC_PROTSTATIC
, 3,
1464 "&Raw", IDC_PROTRAW
,
1465 "&Telnet", IDC_PROTTELNET
,
1466 "Rlog&in", IDC_PROTRLOGIN
, NULL
);
1468 radioline(&cp
, "Protocol:", IDC_PROTSTATIC
, 4,
1469 "&Raw", IDC_PROTRAW
,
1470 "&Telnet", IDC_PROTTELNET
,
1471 "Rlog&in", IDC_PROTRLOGIN
,
1480 beginbox(&cp
, "Load, save or delete a stored session",
1482 sesssaver(&cp
, "Sav&ed Sessions",
1483 IDC_SESSSTATIC
, IDC_SESSEDIT
, IDC_SESSLIST
,
1484 "&Load", IDC_SESSLOAD
,
1485 "Sa&ve", IDC_SESSSAVE
, "&Delete", IDC_SESSDEL
, NULL
);
1488 beginbox(&cp
, NULL
, IDC_BOX_SESSION3
);
1489 radioline(&cp
, "Close &window on exit:", IDC_CLOSEEXIT
, 4,
1490 "Always", IDC_COEALWAYS
,
1491 "Never", IDC_COENEVER
,
1492 "Only on clean exit", IDC_COENORMAL
, NULL
);
1496 if (panel
== loggingpanelstart
) {
1497 /* The Logging panel. Accelerators used: [acgoh] tplsfwe */
1499 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1500 bartitle(&cp
, "Options controlling session logging",
1502 beginbox(&cp
, NULL
, IDC_BOX_LOGGING1
);
1504 "Session logging:", IDC_LSTATSTATIC
,
1505 "Logging &turned off completely", IDC_LSTATOFF
,
1506 "Log &printable output only", IDC_LSTATASCII
,
1507 "&Log all session output", IDC_LSTATRAW
,
1508 "Log &SSH packet data", IDC_LSTATPACKET
,
1510 editbutton(&cp
, "Log &file name:",
1511 IDC_LGFSTATIC
, IDC_LGFEDIT
, "Bro&wse...",
1513 statictext(&cp
, "(Log file name can contain &&Y, &&M, &&D for date,"
1514 " &&T for time, and &&H for host name)", 2, IDC_LGFEXPLAIN
);
1516 "What to do if the log file already &exists:",
1517 IDC_LSTATXIST
, "Always overwrite it", IDC_LSTATXOVR
,
1518 "Always append to the end of it", IDC_LSTATXAPN
,
1519 "Ask the user every time", IDC_LSTATXASK
, NULL
);
1523 if (panel
== terminalpanelstart
) {
1524 /* The Terminal panel. Accelerators used: [acgoh] wdren lts p */
1526 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1527 bartitle(&cp
, "Options controlling the terminal emulation",
1528 IDC_TITLE_TERMINAL
);
1529 beginbox(&cp
, "Set various terminal options", IDC_BOX_TERMINAL1
);
1530 checkbox(&cp
, "Auto &wrap mode initially on", IDC_WRAPMODE
);
1531 checkbox(&cp
, "&DEC Origin Mode initially on", IDC_DECOM
);
1532 checkbox(&cp
, "Implicit C&R in every LF", IDC_LFHASCR
);
1533 checkbox(&cp
, "Use background colour to &erase screen", IDC_BCE
);
1534 checkbox(&cp
, "Enable bli&nking text", IDC_BLINKTEXT
);
1536 "An&swerback to ^E:", IDC_ANSWERBACK
,
1537 IDC_ANSWEREDIT
, 100, NULL
);
1540 beginbox(&cp
, "Line discipline options", IDC_BOX_TERMINAL2
);
1541 radioline(&cp
, "&Local echo:", IDC_ECHOSTATIC
, 3,
1542 "Auto", IDC_ECHOBACKEND
,
1543 "Force on", IDC_ECHOYES
, "Force off", IDC_ECHONO
, NULL
);
1544 radioline(&cp
, "Local line edi&ting:", IDC_EDITSTATIC
, 3,
1545 "Auto", IDC_EDITBACKEND
,
1546 "Force on", IDC_EDITYES
, "Force off", IDC_EDITNO
, NULL
);
1549 beginbox(&cp
, "Remote-controlled printing", IDC_BOX_TERMINAL3
);
1550 combobox(&cp
, "&Printer to send ANSI printer output to:",
1551 IDC_PRINTERSTATIC
, IDC_PRINTER
);
1555 if (panel
== featurespanelstart
) {
1556 /* The Features panel. Accelerators used: [acgoh] ukswtbrx */
1558 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1559 bartitle(&cp
, "Enabling and disabling advanced terminal features ",
1560 IDC_TITLE_FEATURES
);
1561 beginbox(&cp
, NULL
, IDC_BOX_FEATURES1
);
1562 checkbox(&cp
, "Disable application c&ursor keys mode", IDC_NOAPPLICC
);
1563 checkbox(&cp
, "Disable application &keypad mode", IDC_NOAPPLICK
);
1564 checkbox(&cp
, "Disable &xterm-style mouse reporting", IDC_NOMOUSEREP
);
1565 checkbox(&cp
, "Disable remote-controlled terminal re&sizing",
1567 checkbox(&cp
, "Disable s&witching to alternate terminal screen",
1569 checkbox(&cp
, "Disable remote-controlled window &title changing",
1571 checkbox(&cp
, "Disable destructive &backspace on server sending ^?",
1573 checkbox(&cp
, "Disable remote-controlled cha&racter set configuration",
1578 if (panel
== bellpanelstart
) {
1579 /* The Bell panel. Accelerators used: [acgoh] bdsm wit */
1581 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1582 bartitle(&cp
, "Options controlling the terminal bell",
1584 beginbox(&cp
, "Set the style of bell", IDC_BOX_BELL1
);
1586 "Action to happen when a &bell occurs:", IDC_BELLSTATIC
,
1587 "None (bell disabled)", IDC_BELL_DISABLED
,
1588 "Play Windows Default Sound", IDC_BELL_DEFAULT
,
1589 "Play a custom sound file", IDC_BELL_WAVEFILE
,
1590 "Visual bell (flash window)", IDC_BELL_VISUAL
, NULL
);
1591 editbutton(&cp
, "Custom sound file to play as a bell:",
1592 IDC_BELL_WAVESTATIC
, IDC_BELL_WAVEEDIT
,
1593 "Bro&wse...", IDC_BELL_WAVEBROWSE
);
1594 radioline(&cp
, "Taskbar/caption &indication on bell:",
1595 IDC_B_IND_STATIC
, 3, "Disabled", IDC_B_IND_DISABLED
,
1596 "Flashing", IDC_B_IND_FLASH
, "Steady", IDC_B_IND_STEADY
,
1599 beginbox(&cp
, "Control the bell overload behaviour",
1601 checkbox(&cp
, "Bell is temporarily &disabled when over-used",
1603 staticedit(&cp
, "Over-use means this &many bells...",
1604 IDC_BELLOVLNSTATIC
, IDC_BELLOVLN
, 20);
1605 staticedit(&cp
, "... in &this many seconds",
1606 IDC_BELLOVLTSTATIC
, IDC_BELLOVLT
, 20);
1608 "The bell is re-enabled after a few seconds of silence.",
1609 1, IDC_BELLOVLEXPLAIN
);
1610 staticedit(&cp
, "Seconds of &silence required", IDC_BELLOVLSSTATIC
,
1615 if (panel
== keyboardpanelstart
) {
1616 /* The Keyboard panel. Accelerators used: [acgoh] bef rntd */
1618 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1619 bartitle(&cp
, "Options controlling the effects of keys",
1620 IDC_TITLE_KEYBOARD
);
1621 beginbox(&cp
, "Change the sequences sent by:", IDC_BOX_KEYBOARD1
);
1622 radioline(&cp
, "The &Backspace key", IDC_DELSTATIC
, 2,
1623 "Control-H", IDC_DEL008
,
1624 "Control-? (127)", IDC_DEL127
, NULL
);
1625 radioline(&cp
, "The Home and &End keys", IDC_HOMESTATIC
, 2,
1626 "Standard", IDC_HOMETILDE
, "rxvt", IDC_HOMERXVT
, NULL
);
1627 radioline(&cp
, "The &Function keys and keypad", IDC_FUNCSTATIC
, 3,
1628 "ESC[n~", IDC_FUNCTILDE
,
1629 "Linux", IDC_FUNCLINUX
,
1630 "Xterm R6", IDC_FUNCXTERM
,
1631 "VT400", IDC_FUNCVT400
,
1632 "VT100+", IDC_FUNCVT100P
, "SCO", IDC_FUNCSCO
, NULL
);
1634 beginbox(&cp
, "Application keypad settings:", IDC_BOX_KEYBOARD2
);
1635 radioline(&cp
, "Initial state of cu&rsor keys:", IDC_CURSTATIC
, 2,
1636 "Normal", IDC_CURNORMAL
,
1637 "Application", IDC_CURAPPLIC
, NULL
);
1638 radioline(&cp
, "Initial state of &numeric keypad:", IDC_KPSTATIC
,
1639 3, "Normal", IDC_KPNORMAL
, "Application", IDC_KPAPPLIC
,
1640 "NetHack", IDC_KPNH
, NULL
);
1642 beginbox(&cp
, "Enable extra keyboard features:",
1644 checkbox(&cp
, "AltGr ac&ts as Compose key", IDC_COMPOSEKEY
);
1645 checkbox(&cp
, "Control-Alt is &different from AltGr",
1650 if (panel
== windowpanelstart
) {
1651 /* The Window panel. Accelerators used: [acgoh] rmz sdikp */
1653 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1654 bartitle(&cp
, "Options controlling PuTTY's window",
1656 beginbox(&cp
, "Set the size of the window", IDC_BOX_WINDOW1
);
1658 "&Rows", IDC_ROWSSTATIC
, IDC_ROWSEDIT
, 50,
1659 "Colu&mns", IDC_COLSSTATIC
, IDC_COLSEDIT
, 50, NULL
);
1660 radiobig(&cp
, "When window is resi&zed:", IDC_RESIZESTATIC
,
1661 "Change the number of rows and columns", IDC_RESIZETERM
,
1662 "Change the size of the font", IDC_RESIZEFONT
,
1663 "Change font size only when maximised", IDC_RESIZEEITHER
,
1664 "Forbid resizing completely", IDC_RESIZENONE
, NULL
);
1666 beginbox(&cp
, "Control the scrollback in the window",
1668 staticedit(&cp
, "Lines of &scrollback",
1669 IDC_SAVESTATIC
, IDC_SAVEEDIT
, 50);
1670 checkbox(&cp
, "&Display scrollbar", IDC_SCROLLBAR
);
1671 checkbox(&cp
, "D&isplay scrollbar in full screen mode", IDC_SCROLLBARFULLSCREEN
);
1672 checkbox(&cp
, "Reset scrollback on &keypress", IDC_SCROLLKEY
);
1673 checkbox(&cp
, "Reset scrollback on dis&play activity",
1678 if (panel
== appearancepanelstart
) {
1679 /* The Appearance panel. Accelerators used: [acgoh] luvb n ti p s */
1681 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1682 bartitle(&cp
, "Configure the appearance of PuTTY's window",
1683 IDC_TITLE_APPEARANCE
);
1684 beginbox(&cp
, "Adjust the use of the cursor", IDC_BOX_APPEARANCE1
);
1685 radioline(&cp
, "Cursor appearance:", IDC_CURSORSTATIC
, 3,
1686 "B&lock", IDC_CURBLOCK
,
1687 "&Underline", IDC_CURUNDER
,
1688 "&Vertical line", IDC_CURVERT
, NULL
);
1689 checkbox(&cp
, "Cursor &blinks", IDC_BLINKCUR
);
1691 beginbox(&cp
, "Set the font used in the terminal window",
1692 IDC_BOX_APPEARANCE2
);
1693 staticbtn(&cp
, "", IDC_FONTSTATIC
, "Cha&nge...", IDC_CHOOSEFONT
);
1695 beginbox(&cp
, "Adjust the use of the window title",
1696 IDC_BOX_APPEARANCE3
);
1698 "Window &title:", IDC_WINTITLE
, IDC_WINEDIT
, 100, NULL
);
1699 checkbox(&cp
, "Avoid ever using &icon title", IDC_WINNAME
);
1701 beginbox(&cp
, "Adjust the use of the mouse pointer",
1702 IDC_BOX_APPEARANCE4
);
1703 checkbox(&cp
, "Hide mouse &pointer when typing in window",
1706 beginbox(&cp
, "Adjust the window border", IDC_BOX_APPEARANCE5
);
1707 checkbox(&cp
, "&Sunken-edge border (slightly thicker)",
1709 staticedit(&cp
, "Gap between text and window edge",
1710 IDC_WINBSTATIC
, IDC_WINBEDIT
, 20);
1714 if (panel
== behaviourpanelstart
) {
1715 /* The Behaviour panel. Accelerators used: [acgoh] w4yltf */
1717 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1718 bartitle(&cp
, "Configure the behaviour of PuTTY's window",
1720 beginbox(&cp
, NULL
, IDC_BOX_BEHAVIOUR1
);
1721 checkbox(&cp
, "&Warn before closing window", IDC_CLOSEWARN
);
1722 checkbox(&cp
, "Window closes on ALT-F&4", IDC_ALTF4
);
1723 checkbox(&cp
, "S&ystem menu appears on ALT-Space", IDC_ALTSPACE
);
1724 checkbox(&cp
, "System menu appears on A< alone", IDC_ALTONLY
);
1725 checkbox(&cp
, "Ensure window is always on &top", IDC_ALWAYSONTOP
);
1726 checkbox(&cp
, "&Full screen on Alt-Enter", IDC_FULLSCREENONALTENTER
);
1730 if (panel
== translationpanelstart
) {
1731 /* The Translation panel. Accelerators used: [acgoh] rxbepus */
1733 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1734 bartitle(&cp
, "Options controlling character set translation",
1735 IDC_TITLE_TRANSLATION
);
1736 beginbox(&cp
, "Character set translation on received data",
1737 IDC_BOX_TRANSLATION1
);
1738 combobox(&cp
, "&Received data assumed to be in which character set:",
1739 IDC_CODEPAGESTATIC
, IDC_CODEPAGE
);
1741 beginbox(&cp
, "Enable character set translation on input data",
1742 IDC_BOX_TRANSLATION2
);
1743 checkbox(&cp
, "Cap&s Lock acts as Cyrillic switch",
1746 beginbox(&cp
, "Adjust how PuTTY displays line drawing characters",
1747 IDC_BOX_TRANSLATION3
);
1749 "Handling of line drawing characters:", IDC_VTSTATIC
,
1750 "Font has &XWindows encoding", IDC_VTXWINDOWS
,
1751 "Use font in &both ANSI and OEM modes", IDC_VTOEMANSI
,
1752 "Use font in O&EM mode only", IDC_VTOEMONLY
,
1753 "&Poor man's line drawing (" "+" ", " "-" " and " "|" ")",
1754 IDC_VTPOORMAN
, "&Unicode mode", IDC_VTUNICODE
, NULL
);
1758 if (panel
== selectionpanelstart
) {
1759 /* The Selection panel. Accelerators used: [acgoh] df wxp est nr */
1761 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1762 bartitle(&cp
, "Options controlling copy and paste",
1763 IDC_TITLE_SELECTION
);
1764 beginbox(&cp
, "Translation of pasted characters",
1765 IDC_BOX_SELECTION1
);
1767 "&Don't translate line drawing chars into +, - and |",
1770 "Paste to clipboard in RT&F as well as plain text",
1773 beginbox(&cp
, "Control which mouse button does which thing",
1774 IDC_BOX_SELECTION2
);
1775 radiobig(&cp
, "Action of mouse buttons:", IDC_MBSTATIC
,
1776 "&Windows (Right pastes, Middle extends)", IDC_MBWINDOWS
,
1777 "&xterm (Right extends, Middle pastes)", IDC_MBXTERM
,
1780 "Shift overrides a&pplication's use of mouse",
1783 "Default selection mode (Alt+drag does the other one):",
1784 IDC_SELTYPESTATIC
, 2,
1785 "&Normal", IDC_SELTYPELEX
,
1786 "&Rectangular block", IDC_SELTYPERECT
, NULL
);
1788 beginbox(&cp
, "Control the select-one-word-at-a-time mode",
1789 IDC_BOX_SELECTION3
);
1790 charclass(&cp
, "Charact&er classes:", IDC_CCSTATIC
, IDC_CCLIST
,
1791 "&Set", IDC_CCSET
, IDC_CCEDIT
,
1792 "&to class", IDC_CCSTATIC2
);
1796 if (panel
== colourspanelstart
) {
1797 /* The Colours panel. Accelerators used: [acgoh] blum */
1799 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1800 bartitle(&cp
, "Options controlling use of colours",
1802 beginbox(&cp
, "General options for colour usage",
1804 checkbox(&cp
, "&Bolded text is a different colour",
1806 checkbox(&cp
, "Attempt to use &logical palettes", IDC_PALETTE
);
1808 beginbox(&cp
, "Adjust the precise colours PuTTY displays",
1810 colouredit(&cp
, "Select a colo&ur and then click to modify it:",
1811 IDC_COLOURSTATIC
, IDC_COLOURLIST
,
1812 "&Modify...", IDC_CHANGE
,
1813 "Red:", IDC_RSTATIC
, IDC_RVALUE
,
1814 "Green:", IDC_GSTATIC
, IDC_GVALUE
,
1815 "Blue:", IDC_BSTATIC
, IDC_BVALUE
, NULL
);
1819 if (panel
== connectionpanelstart
) {
1820 /* The Connection panel. Accelerators used: [acgoh] tukn */
1822 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1823 bartitle(&cp
, "Options controlling the connection",
1824 IDC_TITLE_CONNECTION
);
1826 beginbox(&cp
, "Data to send to the server",
1827 IDC_BOX_CONNECTION1
);
1828 staticedit(&cp
, "Terminal-&type string", IDC_TTSTATIC
,
1830 staticedit(&cp
, "Auto-login &username", IDC_LOGSTATIC
,
1834 beginbox(&cp
, "Adjust telnet session.", IDC_BOX_CONNECTION1
);
1835 checkbox(&cp
, "Keyboard sends telnet Backspace and Interrupt",
1837 checkbox(&cp
, "Return key sends telnet New Line instead of ^M",
1841 beginbox(&cp
, "Sending of null packets to keep session active",
1842 IDC_BOX_CONNECTION2
);
1843 staticedit(&cp
, "Seconds between &keepalives (0 to turn off)",
1844 IDC_PINGSTATIC
, IDC_PINGEDIT
, 20);
1847 beginbox(&cp
, "Low-level TCP connection options",
1848 IDC_BOX_CONNECTION3
);
1849 checkbox(&cp
, "Disable &Nagle's algorithm (TCP_NODELAY option)",
1855 if (panel
== proxypanelstart
) {
1856 /* The Proxy panel. Accelerators used: [acgoh] ntslypeuwmv */
1858 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1860 bartitle(&cp
, "Options controlling proxy usage",
1862 beginbox(&cp
, "Proxy basics", IDC_BOX_PROXY1
);
1863 radioline(&cp
, "Proxy type:", IDC_PROXYTYPESTATIC
, 4,
1864 "&None", IDC_PROXYTYPENONE
,
1865 "H&TTP", IDC_PROXYTYPEHTTP
,
1866 "&SOCKS", IDC_PROXYTYPESOCKS
,
1867 "Te&lnet", IDC_PROXYTYPETELNET
, NULL
);
1869 "Prox&y Host", IDC_PROXYHOSTSTATIC
, IDC_PROXYHOSTEDIT
, 80,
1870 "&Port", IDC_PROXYPORTSTATIC
, IDC_PROXYPORTEDIT
, 20, NULL
);
1872 "&Exclude Hosts/IPs", IDC_PROXYEXCLUDESTATIC
,
1873 IDC_PROXYEXCLUDEEDIT
, 100, NULL
);
1874 checkbox(&cp
, "Consider pro&xying local host connections",
1875 IDC_PROXYLOCALHOST
);
1876 staticedit(&cp
, "&Username", IDC_PROXYUSERSTATIC
,
1877 IDC_PROXYUSEREDIT
, 60);
1878 staticpassedit(&cp
, "Pass&word", IDC_PROXYPASSSTATIC
,
1879 IDC_PROXYPASSEDIT
, 60);
1881 beginbox(&cp
, "Misc. proxy settings", IDC_BOX_PROXY2
);
1883 "Telnet co&mmand", IDC_PROXYTELNETCMDSTATIC
,
1884 IDC_PROXYTELNETCMDEDIT
, 100, NULL
);
1885 radioline(&cp
, "SOCKS &Version", IDC_PROXYSOCKSVERSTATIC
,
1886 2, "Version 5", IDC_PROXYSOCKSVER5
, "Version 4",
1887 IDC_PROXYSOCKSVER4
, NULL
);
1892 if (panel
== telnetpanelstart
) {
1893 /* The Telnet panel. Accelerators used: [acgoh] svldr bftk */
1895 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1897 bartitle(&cp
, "Options controlling Telnet connections",
1899 beginbox(&cp
, "Data to send to the server", IDC_BOX_TELNET1
);
1900 staticedit(&cp
, "Terminal-&speed string", IDC_TSSTATIC
,
1902 envsetter(&cp
, "Environment variables:", IDC_ENVSTATIC
,
1903 "&Variable", IDC_VARSTATIC
, IDC_VAREDIT
, "Va&lue",
1904 IDC_VALSTATIC
, IDC_VALEDIT
, IDC_ENVLIST
, "A&dd",
1905 IDC_ENVADD
, "&Remove", IDC_ENVREMOVE
);
1907 beginbox(&cp
, "Telnet protocol adjustments", IDC_BOX_TELNET2
);
1908 radioline(&cp
, "Handling of OLD_ENVIRON ambiguity:",
1909 IDC_EMSTATIC
, 2, "&BSD (commonplace)", IDC_EMBSD
,
1910 "R&FC 1408 (unusual)", IDC_EMRFC
, NULL
);
1911 radioline(&cp
, "&Telnet negotiation mode:", IDC_ACTSTATIC
, 2,
1912 "Passive", IDC_TPASSIVE
, "Active",
1914 checkbox(&cp
, "&Keyboard sends telnet Backspace and Interrupt",
1916 checkbox(&cp
, "Return key sends telnet New Line instead of ^M",
1922 if (panel
== rloginpanelstart
) {
1923 /* The Rlogin panel. Accelerators used: [acgoh] sl */
1925 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1927 bartitle(&cp
, "Options controlling Rlogin connections",
1929 beginbox(&cp
, "Data to send to the server", IDC_BOX_RLOGIN1
);
1930 staticedit(&cp
, "Terminal-&speed string", IDC_R_TSSTATIC
,
1932 staticedit(&cp
, "&Local username:", IDC_RLLUSERSTATIC
,
1933 IDC_RLLUSEREDIT
, 50);
1938 if (panel
== sshpanelstart
) {
1939 /* The SSH panel. Accelerators used: [acgoh] r pe12ni sd */
1941 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1943 bartitle(&cp
, "Options controlling SSH connections",
1945 beginbox(&cp
, "Data to send to the server", IDC_BOX_SSH1
);
1947 "&Remote command:", IDC_CMDSTATIC
, IDC_CMDEDIT
, 100,
1950 beginbox(&cp
, "Protocol options", IDC_BOX_SSH2
);
1951 checkbox(&cp
, "Don't allocate a &pseudo-terminal", IDC_NOPTY
);
1952 checkbox(&cp
, "Enable compr&ession", IDC_COMPRESS
);
1953 radioline(&cp
, "Preferred SSH protocol version:",
1954 IDC_SSHPROTSTATIC
, 4,
1955 "1 on&ly", IDC_SSHPROT1ONLY
,
1956 "&1", IDC_SSHPROT1
, "&2", IDC_SSHPROT2
,
1957 "2 o&nly", IDC_SSHPROT2ONLY
, NULL
);
1959 beginbox(&cp
, "Encryption options", IDC_BOX_SSH3
);
1960 prefslist(&cipherlist
, &cp
, "Encryption cipher &selection policy:",
1961 IDC_CIPHERSTATIC2
, IDC_CIPHERLIST
, IDC_CIPHERUP
,
1963 checkbox(&cp
, "Enable non-standard use of single-&DES in SSH 2",
1969 if (panel
== sshauthpanelstart
) {
1970 /* The SSH authentication panel. Accelerators used: [acgoh] m fkiuw */
1972 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1974 bartitle(&cp
, "Options controlling SSH authentication",
1976 beginbox(&cp
, "Authentication methods",
1978 checkbox(&cp
, "Atte&mpt TIS or CryptoCard authentication (SSH1)",
1980 checkbox(&cp
, "Attempt \"keyboard-&interactive\" authentication"
1981 " (SSH2)", IDC_AUTHKI
);
1983 beginbox(&cp
, "Authentication parameters",
1985 checkbox(&cp
, "Allow agent &forwarding", IDC_AGENTFWD
);
1986 checkbox(&cp
, "Allow attempted changes of &username in SSH2",
1988 editbutton(&cp
, "Private &key file for authentication:",
1989 IDC_PKSTATIC
, IDC_PKEDIT
, "Bro&wse...",
1995 if (panel
== sshbugspanelstart
) {
1996 /* The SSH bugs panel. Accelerators used: [acgoh] isrmep */
1998 ctlposinit(&cp
, hwnd
, 80, 3, 13);
2000 bartitle(&cp
, "Workarounds for SSH server bugs",
2002 beginbox(&cp
, "Detection of known bugs in SSH servers",
2004 staticddl(&cp
, "Chokes on SSH1 &ignore messages",
2005 IDC_BUGS_IGNORE1
, IDC_BUGD_IGNORE1
, 20);
2006 staticddl(&cp
, "Refuses all SSH1 pa&ssword camouflage",
2007 IDC_BUGS_PLAINPW1
, IDC_BUGD_PLAINPW1
, 20);
2008 staticddl(&cp
, "Chokes on SSH1 &RSA authentication",
2009 IDC_BUGS_RSA1
, IDC_BUGD_RSA1
, 20);
2010 staticddl(&cp
, "Miscomputes SSH2 H&MAC keys",
2011 IDC_BUGS_HMAC2
, IDC_BUGD_HMAC2
, 20);
2012 staticddl(&cp
, "Miscomputes SSH2 &encryption keys",
2013 IDC_BUGS_DERIVEKEY2
, IDC_BUGD_DERIVEKEY2
, 20);
2014 staticddl(&cp
, "Requires &padding on SSH2 RSA signatures",
2015 IDC_BUGS_RSAPAD2
, IDC_BUGD_RSAPAD2
, 20);
2016 staticddl(&cp
, "Chokes on &Diffie-Hellman group exchange",
2017 IDC_BUGS_DHGEX2
, IDC_BUGD_DHGEX2
, 20);
2022 if (panel
== tunnelspanelstart
) {
2023 /* The Tunnels panel. Accelerators used: [acgoh] deilmrstxp */
2025 ctlposinit(&cp
, hwnd
, 80, 3, 13);
2027 bartitle(&cp
, "Options controlling SSH tunnelling",
2029 beginbox(&cp
, "X11 forwarding", IDC_BOX_TUNNELS1
);
2030 checkbox(&cp
, "&Enable X11 forwarding", IDC_X11_FORWARD
);
2031 multiedit(&cp
, "&X display location", IDC_X11_DISPSTATIC
,
2032 IDC_X11_DISPLAY
, 50, NULL
);
2034 beginbox(&cp
, "Port forwarding", IDC_BOX_TUNNELS2
);
2035 checkbox(&cp
, "Local ports accept connections from o&ther hosts",
2037 checkbox(&cp
, "Remote &ports do the same (SSH v2 only)",
2039 staticbtn(&cp
, "Forwarded ports:", IDC_PFWDSTATIC
,
2040 "&Remove", IDC_PFWDREMOVE
);
2041 fwdsetter(&cp
, IDC_PFWDLIST
,
2042 "Add new forwarded port:", IDC_PFWDSTATIC2
,
2043 "&Source port", IDC_SPORTSTATIC
, IDC_SPORTEDIT
,
2044 "Dest&ination", IDC_DPORTSTATIC
, IDC_DPORTEDIT
,
2045 "A&dd", IDC_PFWDADD
,
2046 "&Local", IDC_PFWDLOCAL
,
2047 "Re&mote", IDC_PFWDREMOTE
);
2055 * Helper function to load the session selected in SESSLIST
2056 * if any, as this is done in more than one place in
2057 * GenericMainDlgProc(). 0 => failure.
2059 static int load_selected_session(HWND hwnd
)
2061 int n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2062 LB_GETCURSEL
, 0, 0);
2068 isdef
= !strcmp(sesslist
.sessions
[n
], "Default Settings");
2069 load_settings(sesslist
.sessions
[n
], !isdef
, &cfg
);
2070 init_dlg_ctrls(hwnd
, TRUE
);
2072 SetDlgItemText(hwnd
, IDC_SESSEDIT
, sesslist
.sessions
[n
]);
2074 SetDlgItemText(hwnd
, IDC_SESSEDIT
, "");
2075 /* Restore the selection, which will have been clobbered by
2076 * SESSEDIT handling. */
2077 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
, n
, 0);
2082 * This function is the configuration box.
2084 static int GenericMainDlgProc(HWND hwnd
, UINT msg
,
2085 WPARAM wParam
, LPARAM lParam
, int dlgtype
)
2088 struct treeview_faff tvfaff
;
2091 char filename
[sizeof(cfg
.keyfile
)];
2094 char fontstatic
[256];
2096 struct servent
*service
;
2098 static UINT draglistmsg
= WM_NULL
;
2103 SetWindowLong(hwnd
, GWL_USERDATA
, 0);
2105 SetWindowLong(hwnd
, GWL_EXSTYLE
,
2106 GetWindowLong(hwnd
, GWL_EXSTYLE
) | WS_EX_CONTEXTHELP
);
2108 HWND item
= GetDlgItem(hwnd
, IDC_HELPBTN
);
2110 DestroyWindow(item
);
2112 requested_help
= FALSE
;
2113 SendMessage(hwnd
, WM_SETICON
, (WPARAM
) ICON_BIG
,
2114 (LPARAM
) LoadIcon(hinst
, MAKEINTRESOURCE(IDI_CFGICON
)));
2116 * Centre the window.
2118 { /* centre the window */
2121 hw
= GetDesktopWindow();
2122 if (GetWindowRect(hw
, &rs
) && GetWindowRect(hwnd
, &rd
))
2124 (rs
.right
+ rs
.left
+ rd
.left
- rd
.right
) / 2,
2125 (rs
.bottom
+ rs
.top
+ rd
.top
- rd
.bottom
) / 2,
2126 rd
.right
- rd
.left
, rd
.bottom
- rd
.top
, TRUE
);
2130 * Create the tree view.
2138 r
.right
= r
.left
+ 75;
2140 r
.bottom
= r
.top
+ 10;
2141 MapDialogRect(hwnd
, &r
);
2142 tvstatic
= CreateWindowEx(0, "STATIC", "Cate&gory:",
2143 WS_CHILD
| WS_VISIBLE
,
2145 r
.right
- r
.left
, r
.bottom
- r
.top
,
2146 hwnd
, (HMENU
) IDCX_TVSTATIC
, hinst
,
2148 font
= SendMessage(hwnd
, WM_GETFONT
, 0, 0);
2149 SendMessage(tvstatic
, WM_SETFONT
, font
, MAKELPARAM(TRUE
, 0));
2152 r
.right
= r
.left
+ 75;
2154 r
.bottom
= r
.top
+ 219;
2155 MapDialogRect(hwnd
, &r
);
2156 treeview
= CreateWindowEx(WS_EX_CLIENTEDGE
, WC_TREEVIEW
, "",
2157 WS_CHILD
| WS_VISIBLE
|
2158 WS_TABSTOP
| TVS_HASLINES
|
2159 TVS_DISABLEDRAGDROP
| TVS_HASBUTTONS
2161 TVS_SHOWSELALWAYS
, r
.left
, r
.top
,
2162 r
.right
- r
.left
, r
.bottom
- r
.top
,
2163 hwnd
, (HMENU
) IDCX_TREEVIEW
, hinst
,
2165 font
= SendMessage(hwnd
, WM_GETFONT
, 0, 0);
2166 SendMessage(treeview
, WM_SETFONT
, font
, MAKELPARAM(TRUE
, 0));
2167 tvfaff
.treeview
= treeview
;
2168 memset(tvfaff
.lastat
, 0, sizeof(tvfaff
.lastat
));
2172 * Set up the tree view contents.
2174 hsession
= treeview_insert(&tvfaff
, 0, "Session");
2175 treeview_insert(&tvfaff
, 1, "Logging");
2176 treeview_insert(&tvfaff
, 0, "Terminal");
2177 treeview_insert(&tvfaff
, 1, "Keyboard");
2178 treeview_insert(&tvfaff
, 1, "Bell");
2179 treeview_insert(&tvfaff
, 1, "Features");
2180 treeview_insert(&tvfaff
, 0, "Window");
2181 treeview_insert(&tvfaff
, 1, "Appearance");
2182 treeview_insert(&tvfaff
, 1, "Behaviour");
2183 treeview_insert(&tvfaff
, 1, "Translation");
2184 treeview_insert(&tvfaff
, 1, "Selection");
2185 treeview_insert(&tvfaff
, 1, "Colours");
2186 treeview_insert(&tvfaff
, 0, "Connection");
2188 treeview_insert(&tvfaff
, 1, "Proxy");
2189 treeview_insert(&tvfaff
, 1, "Telnet");
2190 treeview_insert(&tvfaff
, 1, "Rlogin");
2191 if (backends
[3].backend
!= NULL
) {
2192 treeview_insert(&tvfaff
, 1, "SSH");
2193 /* XXX long name is ugly */
2194 /* XXX make it closed by default? */
2195 treeview_insert(&tvfaff
, 2, "Auth");
2196 treeview_insert(&tvfaff
, 2, "Tunnels");
2197 treeview_insert(&tvfaff
, 2, "Bugs");
2202 * Put the treeview selection on to the Session panel. This
2203 * should also cause creation of the relevant controls.
2205 TreeView_SelectItem(treeview
, hsession
);
2208 * Set focus into the first available control.
2212 ctl
= GetDlgItem(hwnd
, IDC_HOST
);
2214 ctl
= GetDlgItem(hwnd
, IDC_CLOSEEXIT
);
2218 SetWindowLong(hwnd
, GWL_USERDATA
, 1);
2219 sesslist_has_focus
= 0;
2223 * Button release should trigger WM_OK if there was a
2224 * previous double click on the session list.
2228 SendMessage(hwnd
, WM_COMMAND
, IDOK
, 0);
2231 if (LOWORD(wParam
) == IDCX_TREEVIEW
&&
2232 ((LPNMHDR
) lParam
)->code
== TVN_SELCHANGED
) {
2234 TreeView_GetSelection(((LPNMHDR
) lParam
)->hwndFrom
);
2239 SendMessage (hwnd
, WM_SETREDRAW
, FALSE
, 0);
2242 item
.pszText
= buffer
;
2243 item
.cchTextMax
= sizeof(buffer
);
2244 item
.mask
= TVIF_TEXT
;
2245 TreeView_GetItem(((LPNMHDR
) lParam
)->hwndFrom
, &item
);
2246 for (j
= controlstartvalue
; j
< controlendvalue
; j
++) {
2247 HWND item
= GetDlgItem(hwnd
, j
);
2249 DestroyWindow(item
);
2251 if (!strcmp(buffer
, "Session"))
2252 create_controls(hwnd
, dlgtype
, sessionpanelstart
);
2253 if (!strcmp(buffer
, "Logging"))
2254 create_controls(hwnd
, dlgtype
, loggingpanelstart
);
2255 if (!strcmp(buffer
, "Keyboard"))
2256 create_controls(hwnd
, dlgtype
, keyboardpanelstart
);
2257 if (!strcmp(buffer
, "Terminal"))
2258 create_controls(hwnd
, dlgtype
, terminalpanelstart
);
2259 if (!strcmp(buffer
, "Bell"))
2260 create_controls(hwnd
, dlgtype
, bellpanelstart
);
2261 if (!strcmp(buffer
, "Features"))
2262 create_controls(hwnd
, dlgtype
, featurespanelstart
);
2263 if (!strcmp(buffer
, "Window"))
2264 create_controls(hwnd
, dlgtype
, windowpanelstart
);
2265 if (!strcmp(buffer
, "Appearance"))
2266 create_controls(hwnd
, dlgtype
, appearancepanelstart
);
2267 if (!strcmp(buffer
, "Behaviour"))
2268 create_controls(hwnd
, dlgtype
, behaviourpanelstart
);
2269 if (!strcmp(buffer
, "Tunnels"))
2270 create_controls(hwnd
, dlgtype
, tunnelspanelstart
);
2271 if (!strcmp(buffer
, "Connection"))
2272 create_controls(hwnd
, dlgtype
, connectionpanelstart
);
2273 if (!strcmp(buffer
, "Proxy"))
2274 create_controls(hwnd
, dlgtype
, proxypanelstart
);
2275 if (!strcmp(buffer
, "Telnet"))
2276 create_controls(hwnd
, dlgtype
, telnetpanelstart
);
2277 if (!strcmp(buffer
, "Rlogin"))
2278 create_controls(hwnd
, dlgtype
, rloginpanelstart
);
2279 if (!strcmp(buffer
, "SSH"))
2280 create_controls(hwnd
, dlgtype
, sshpanelstart
);
2281 if (!strcmp(buffer
, "Auth"))
2282 create_controls(hwnd
, dlgtype
, sshauthpanelstart
);
2283 if (!strcmp(buffer
, "Bugs"))
2284 create_controls(hwnd
, dlgtype
, sshbugspanelstart
);
2285 if (!strcmp(buffer
, "Selection"))
2286 create_controls(hwnd
, dlgtype
, selectionpanelstart
);
2287 if (!strcmp(buffer
, "Colours"))
2288 create_controls(hwnd
, dlgtype
, colourspanelstart
);
2289 if (!strcmp(buffer
, "Translation"))
2290 create_controls(hwnd
, dlgtype
, translationpanelstart
);
2292 init_dlg_ctrls(hwnd
, FALSE
);
2294 SendMessage (hwnd
, WM_SETREDRAW
, TRUE
, 0);
2295 InvalidateRect (hwnd
, NULL
, TRUE
);
2297 SetFocus(((LPNMHDR
) lParam
)->hwndFrom
); /* ensure focus stays */
2303 * Only process WM_COMMAND once the dialog is fully formed.
2305 if (GetWindowLong(hwnd
, GWL_USERDATA
) == 1)
2306 switch (LOWORD(wParam
)) {
2308 /* Behaviour of the "Open" button is different if the
2309 * session list has focus, *unless* the user just
2310 * double-clicked... */
2311 if (sesslist_has_focus
&& !readytogo
) {
2312 if (!load_selected_session(hwnd
)) {
2317 /* If at this point we have a valid session, go! */
2319 if (requested_help
) {
2320 WinHelp(hwnd
, help_path
, HELP_QUIT
, 0);
2321 requested_help
= FALSE
;
2328 if (HIWORD(wParam
) == BN_CLICKED
||
2329 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2331 WinHelp(hwnd
, help_path
,
2332 help_has_contents ? HELP_FINDER
: HELP_CONTENTS
,
2334 requested_help
= TRUE
;
2339 if (requested_help
) {
2340 WinHelp(hwnd
, help_path
, HELP_QUIT
, 0);
2341 requested_help
= FALSE
;
2345 case IDC_PROTTELNET
:
2346 case IDC_PROTRLOGIN
:
2349 if (HIWORD(wParam
) == BN_CLICKED
||
2350 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2351 int i
= IsDlgButtonChecked(hwnd
, IDC_PROTSSH
);
2352 int j
= IsDlgButtonChecked(hwnd
, IDC_PROTTELNET
);
2353 int k
= IsDlgButtonChecked(hwnd
, IDC_PROTRLOGIN
);
2355 i ? PROT_SSH
: j ? PROT_TELNET
: k ? PROT_RLOGIN
:
2358 * When switching using the arrow keys, we
2359 * appear to get two of these messages, both
2360 * mentioning the target button in
2361 * LOWORD(wParam), but one of them called while
2362 * the previous button is still checked. This
2363 * causes an unnecessary reset of the port
2364 * number field, which we fix by ensuring here
2365 * that the button selected is indeed the one
2368 if (IsDlgButtonChecked(hwnd
, LOWORD(wParam
)) &&
2369 ((cfg
.protocol
== PROT_SSH
&& cfg
.port
!= 22)
2370 || (cfg
.protocol
== PROT_TELNET
&& cfg
.port
!= 23)
2371 || (cfg
.protocol
== PROT_RLOGIN
2372 && cfg
.port
!= 513))) {
2373 cfg
.port
= i ?
22 : j ?
23 : 513;
2374 SetDlgItemInt(hwnd
, IDC_PORT
, cfg
.port
, FALSE
);
2379 if (HIWORD(wParam
) == EN_CHANGE
)
2380 GetDlgItemText(hwnd
, IDC_HOST
, cfg
.host
,
2381 sizeof(cfg
.host
) - 1);
2384 if (HIWORD(wParam
) == EN_CHANGE
) {
2385 GetDlgItemText(hwnd
, IDC_PORT
, portname
, 31);
2386 if (isdigit(portname
[0]))
2387 MyGetDlgItemInt(hwnd
, IDC_PORT
, &cfg
.port
);
2389 service
= getservbyname(portname
, NULL
);
2391 cfg
.port
= ntohs(service
->s_port
);
2398 if (HIWORD(wParam
) == EN_CHANGE
) {
2399 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
,
2401 GetDlgItemText(hwnd
, IDC_SESSEDIT
,
2402 savedsession
, sizeof(savedsession
) - 1);
2403 savedsession
[sizeof(savedsession
) - 1] = '\0';
2407 if (HIWORD(wParam
) == BN_CLICKED
||
2408 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2413 GetDlgItemText(hwnd
, IDC_SESSEDIT
, str
,
2416 int n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2417 LB_GETCURSEL
, 0, 0);
2422 strcpy(str
, sesslist
.sessions
[n
]);
2424 save_settings(str
, !!strcmp(str
, "Default Settings"),
2426 get_sesslist(&sesslist
, FALSE
);
2427 get_sesslist(&sesslist
, TRUE
);
2428 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2430 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_RESETCONTENT
,
2432 for (i
= 0; i
< sesslist
.nsessions
; i
++)
2433 SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2435 (LPARAM
) (sesslist
.sessions
[i
]));
2436 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
,
2438 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2440 InvalidateRect(GetDlgItem(hwnd
, IDC_SESSLIST
), NULL
,
2446 if (LOWORD(wParam
) == IDC_SESSLIST
) {
2447 if (HIWORD(wParam
) == LBN_SETFOCUS
)
2448 sesslist_has_focus
= 1;
2449 else if (HIWORD(wParam
) == LBN_KILLFOCUS
)
2450 sesslist_has_focus
= 0;
2452 if (LOWORD(wParam
) == IDC_SESSLOAD
&&
2453 HIWORD(wParam
) != BN_CLICKED
&&
2454 HIWORD(wParam
) != BN_DOUBLECLICKED
) break;
2455 if (LOWORD(wParam
) == IDC_SESSLIST
&&
2456 HIWORD(wParam
) != LBN_DBLCLK
) break;
2457 /* Load the session selected in SESSLIST. */
2458 if (load_selected_session(hwnd
) &&
2459 LOWORD(wParam
) == IDC_SESSLIST
) {
2461 * A double-click on a saved session should
2462 * actually start the session, not just load it.
2463 * Unless it's Default Settings or some other
2464 * host-less set of saved settings.
2473 if (HIWORD(wParam
) == BN_CLICKED
||
2474 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2475 int n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2476 LB_GETCURSEL
, 0, 0);
2477 if (n
== LB_ERR
|| n
== 0) {
2481 del_settings(sesslist
.sessions
[n
]);
2482 get_sesslist(&sesslist
, FALSE
);
2483 get_sesslist(&sesslist
, TRUE
);
2484 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2486 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_RESETCONTENT
,
2488 for (i
= 0; i
< sesslist
.nsessions
; i
++)
2489 SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2491 (LPARAM
) (sesslist
.sessions
[i
]));
2492 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
,
2494 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2496 InvalidateRect(GetDlgItem(hwnd
, IDC_SESSLIST
), NULL
,
2500 if (HIWORD(wParam
) == EN_CHANGE
)
2501 MyGetDlgItemInt(hwnd
, IDC_PINGEDIT
,
2502 &cfg
.ping_interval
);
2505 if (HIWORD(wParam
) == BN_CLICKED
||
2506 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2508 IsDlgButtonChecked(hwnd
, IDC_NODELAY
);
2512 if (HIWORD(wParam
) == BN_CLICKED
||
2513 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2514 cfg
.bksp_is_delete
=
2515 IsDlgButtonChecked(hwnd
, IDC_DEL127
);
2519 if (HIWORD(wParam
) == BN_CLICKED
||
2520 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2522 IsDlgButtonChecked(hwnd
, IDC_HOMERXVT
);
2528 case IDC_FUNCVT100P
:
2530 if (HIWORD(wParam
) == BN_CLICKED
||
2531 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2532 switch (LOWORD(wParam
)) {
2545 case IDC_FUNCVT100P
:
2555 if (HIWORD(wParam
) == BN_CLICKED
||
2556 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2558 IsDlgButtonChecked(hwnd
, IDC_KPAPPLIC
);
2559 cfg
.nethack_keypad
= FALSE
;
2563 if (HIWORD(wParam
) == BN_CLICKED
||
2564 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2565 cfg
.app_keypad
= FALSE
;
2566 cfg
.nethack_keypad
= TRUE
;
2571 if (HIWORD(wParam
) == BN_CLICKED
||
2572 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2574 IsDlgButtonChecked(hwnd
, IDC_CURAPPLIC
);
2577 if (HIWORD(wParam
) == BN_CLICKED
||
2578 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2580 IsDlgButtonChecked(hwnd
, IDC_NOAPPLICC
);
2583 if (HIWORD(wParam
) == BN_CLICKED
||
2584 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2586 IsDlgButtonChecked(hwnd
, IDC_NOAPPLICK
);
2588 case IDC_NOMOUSEREP
:
2589 if (HIWORD(wParam
) == BN_CLICKED
||
2590 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2592 IsDlgButtonChecked(hwnd
, IDC_NOMOUSEREP
);
2595 if (HIWORD(wParam
) == BN_CLICKED
||
2596 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2597 cfg
.no_remote_resize
=
2598 IsDlgButtonChecked(hwnd
, IDC_NORESIZE
);
2600 case IDC_NOALTSCREEN
:
2601 if (HIWORD(wParam
) == BN_CLICKED
||
2602 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2604 IsDlgButtonChecked(hwnd
, IDC_NOALTSCREEN
);
2606 case IDC_NOWINTITLE
:
2607 if (HIWORD(wParam
) == BN_CLICKED
||
2608 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2609 cfg
.no_remote_wintitle
=
2610 IsDlgButtonChecked(hwnd
, IDC_NOWINTITLE
);
2612 case IDC_NODBACKSPACE
:
2613 if (HIWORD(wParam
) == BN_CLICKED
||
2614 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2616 IsDlgButtonChecked(hwnd
, IDC_NODBACKSPACE
);
2619 if (HIWORD(wParam
) == BN_CLICKED
||
2620 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2621 cfg
.no_remote_charset
=
2622 IsDlgButtonChecked(hwnd
, IDC_NOCHARSET
);
2625 if (HIWORD(wParam
) == BN_CLICKED
||
2626 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2627 cfg
.alt_f4
= IsDlgButtonChecked(hwnd
, IDC_ALTF4
);
2630 if (HIWORD(wParam
) == BN_CLICKED
||
2631 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2633 IsDlgButtonChecked(hwnd
, IDC_ALTSPACE
);
2636 if (HIWORD(wParam
) == BN_CLICKED
||
2637 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2639 IsDlgButtonChecked(hwnd
, IDC_ALTONLY
);
2641 case IDC_ECHOBACKEND
:
2644 if (HIWORD(wParam
) == BN_CLICKED
||
2645 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2646 if (LOWORD(wParam
) == IDC_ECHOBACKEND
)
2647 cfg
.localecho
= LD_BACKEND
;
2648 if (LOWORD(wParam
) == IDC_ECHOYES
)
2649 cfg
.localecho
= LD_YES
;
2650 if (LOWORD(wParam
) == IDC_ECHONO
)
2651 cfg
.localecho
= LD_NO
;
2654 case IDC_EDITBACKEND
:
2657 if (HIWORD(wParam
) == BN_CLICKED
||
2658 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2659 if (LOWORD(wParam
) == IDC_EDITBACKEND
)
2660 cfg
.localedit
= LD_BACKEND
;
2661 if (LOWORD(wParam
) == IDC_EDITYES
)
2662 cfg
.localedit
= LD_YES
;
2663 if (LOWORD(wParam
) == IDC_EDITNO
)
2664 cfg
.localedit
= LD_NO
;
2667 case IDC_ANSWEREDIT
:
2668 if (HIWORD(wParam
) == EN_CHANGE
)
2669 GetDlgItemText(hwnd
, IDC_ANSWEREDIT
, cfg
.answerback
,
2670 sizeof(cfg
.answerback
) - 1);
2672 case IDC_ALWAYSONTOP
:
2673 if (HIWORD(wParam
) == BN_CLICKED
||
2674 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2676 IsDlgButtonChecked(hwnd
, IDC_ALWAYSONTOP
);
2678 case IDC_FULLSCREENONALTENTER
:
2679 if (HIWORD(wParam
) == BN_CLICKED
||
2680 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2681 cfg
.fullscreenonaltenter
=
2682 IsDlgButtonChecked(hwnd
, IDC_FULLSCREENONALTENTER
);
2685 if (HIWORD(wParam
) == BN_CLICKED
||
2686 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2688 IsDlgButtonChecked(hwnd
, IDC_SCROLLKEY
);
2690 case IDC_SCROLLDISP
:
2691 if (HIWORD(wParam
) == BN_CLICKED
||
2692 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2693 cfg
.scroll_on_disp
=
2694 IsDlgButtonChecked(hwnd
, IDC_SCROLLDISP
);
2696 case IDC_COMPOSEKEY
:
2697 if (HIWORD(wParam
) == BN_CLICKED
||
2698 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2700 IsDlgButtonChecked(hwnd
, IDC_COMPOSEKEY
);
2702 case IDC_CTRLALTKEYS
:
2703 if (HIWORD(wParam
) == BN_CLICKED
||
2704 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2706 IsDlgButtonChecked(hwnd
, IDC_CTRLALTKEYS
);
2709 if (HIWORD(wParam
) == BN_CLICKED
||
2710 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2711 cfg
.telnet_keyboard
=
2712 IsDlgButtonChecked(hwnd
, IDC_TELNETKEY
);
2715 if (HIWORD(wParam
) == BN_CLICKED
||
2716 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2717 cfg
.telnet_newline
=
2718 IsDlgButtonChecked(hwnd
, IDC_TELNETRET
);
2721 if (HIWORD(wParam
) == BN_CLICKED
||
2722 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2724 IsDlgButtonChecked(hwnd
, IDC_WRAPMODE
);
2727 if (HIWORD(wParam
) == BN_CLICKED
||
2728 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2729 cfg
.dec_om
= IsDlgButtonChecked(hwnd
, IDC_DECOM
);
2732 if (HIWORD(wParam
) == BN_CLICKED
||
2733 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2735 IsDlgButtonChecked(hwnd
, IDC_LFHASCR
);
2738 if (HIWORD(wParam
) == EN_CHANGE
)
2739 MyGetDlgItemInt(hwnd
, IDC_ROWSEDIT
, &cfg
.height
);
2742 if (HIWORD(wParam
) == EN_CHANGE
)
2743 MyGetDlgItemInt(hwnd
, IDC_COLSEDIT
, &cfg
.width
);
2746 if (HIWORD(wParam
) == EN_CHANGE
)
2747 MyGetDlgItemInt(hwnd
, IDC_SAVEEDIT
, &cfg
.savelines
);
2749 case IDC_CHOOSEFONT
:
2752 lf
.lfHeight
= -MulDiv(cfg
.fontheight
,
2753 GetDeviceCaps(hdc
, LOGPIXELSY
),
2757 lf
.lfWidth
= lf
.lfEscapement
= lf
.lfOrientation
= 0;
2758 lf
.lfItalic
= lf
.lfUnderline
= lf
.lfStrikeOut
= 0;
2759 lf
.lfWeight
= (cfg
.fontisbold ? FW_BOLD
: 0);
2760 lf
.lfCharSet
= cfg
.fontcharset
;
2761 lf
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
2762 lf
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
2763 lf
.lfQuality
= DEFAULT_QUALITY
;
2764 lf
.lfPitchAndFamily
= FIXED_PITCH
| FF_DONTCARE
;
2765 strncpy(lf
.lfFaceName
, cfg
.font
,
2766 sizeof(lf
.lfFaceName
) - 1);
2767 lf
.lfFaceName
[sizeof(lf
.lfFaceName
) - 1] = '\0';
2769 cf
.lStructSize
= sizeof(cf
);
2770 cf
.hwndOwner
= hwnd
;
2772 cf
.Flags
= CF_FIXEDPITCHONLY
| CF_FORCEFONTEXIST
|
2773 CF_INITTOLOGFONTSTRUCT
| CF_SCREENFONTS
;
2775 if (ChooseFont(&cf
)) {
2776 strncpy(cfg
.font
, lf
.lfFaceName
, sizeof(cfg
.font
) - 1);
2777 cfg
.font
[sizeof(cfg
.font
) - 1] = '\0';
2778 cfg
.fontisbold
= (lf
.lfWeight
== FW_BOLD
);
2779 cfg
.fontcharset
= lf
.lfCharSet
;
2780 cfg
.fontheight
= cf
.iPointSize
/ 10;
2781 fmtfont(fontstatic
);
2782 SetDlgItemText(hwnd
, IDC_FONTSTATIC
, fontstatic
);
2785 case IDC_BELL_DISABLED
:
2786 case IDC_BELL_DEFAULT
:
2787 case IDC_BELL_WAVEFILE
:
2788 case IDC_BELL_VISUAL
:
2789 if (HIWORD(wParam
) == BN_CLICKED
||
2790 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2791 if (LOWORD(wParam
) == IDC_BELL_DISABLED
)
2792 cfg
.beep
= BELL_DISABLED
;
2793 if (LOWORD(wParam
) == IDC_BELL_DEFAULT
)
2794 cfg
.beep
= BELL_DEFAULT
;
2795 if (LOWORD(wParam
) == IDC_BELL_WAVEFILE
)
2796 cfg
.beep
= BELL_WAVEFILE
;
2797 if (LOWORD(wParam
) == IDC_BELL_VISUAL
)
2798 cfg
.beep
= BELL_VISUAL
;
2801 case IDC_B_IND_DISABLED
:
2802 case IDC_B_IND_FLASH
:
2803 case IDC_B_IND_STEADY
:
2804 if (HIWORD(wParam
) == BN_CLICKED
||
2805 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2806 if (LOWORD(wParam
) == IDC_B_IND_DISABLED
)
2807 cfg
.beep_ind
= B_IND_DISABLED
;
2808 if (LOWORD(wParam
) == IDC_B_IND_FLASH
)
2809 cfg
.beep_ind
= B_IND_FLASH
;
2810 if (LOWORD(wParam
) == IDC_B_IND_STEADY
)
2811 cfg
.beep_ind
= B_IND_STEADY
;
2814 case IDC_BELL_WAVEBROWSE
:
2815 memset(&of
, 0, sizeof(of
));
2816 #ifdef OPENFILENAME_SIZE_VERSION_400
2817 of
.lStructSize
= OPENFILENAME_SIZE_VERSION_400
;
2819 of
.lStructSize
= sizeof(of
);
2821 of
.hwndOwner
= hwnd
;
2822 of
.lpstrFilter
= "Wave Files\0*.WAV\0AllFiles\0*\0\0\0";
2823 of
.lpstrCustomFilter
= NULL
;
2824 of
.nFilterIndex
= 1;
2825 of
.lpstrFile
= filename
;
2826 strcpy(filename
, cfg
.bell_wavefile
);
2827 of
.nMaxFile
= sizeof(filename
);
2828 of
.lpstrFileTitle
= NULL
;
2829 of
.lpstrInitialDir
= NULL
;
2830 of
.lpstrTitle
= "Select Bell Sound File";
2832 if (GetOpenFileName(&of
)) {
2833 strcpy(cfg
.bell_wavefile
, filename
);
2834 SetDlgItemText(hwnd
, IDC_BELL_WAVEEDIT
,
2838 case IDC_BELL_WAVEEDIT
:
2839 if (HIWORD(wParam
) == EN_CHANGE
)
2840 GetDlgItemText(hwnd
, IDC_BELL_WAVEEDIT
,
2842 sizeof(cfg
.bell_wavefile
) - 1);
2845 if (HIWORD(wParam
) == BN_CLICKED
||
2846 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2848 IsDlgButtonChecked(hwnd
, IDC_BELLOVL
);
2851 if (HIWORD(wParam
) == EN_CHANGE
)
2852 MyGetDlgItemInt(hwnd
, IDC_BELLOVLN
, &cfg
.bellovl_n
);
2855 if (HIWORD(wParam
) == EN_CHANGE
)
2856 MyGetDlgItemFlt(hwnd
, IDC_BELLOVLT
, &cfg
.bellovl_t
,
2860 if (HIWORD(wParam
) == EN_CHANGE
)
2861 MyGetDlgItemFlt(hwnd
, IDC_BELLOVLS
, &cfg
.bellovl_s
,
2865 if (HIWORD(wParam
) == BN_CLICKED
||
2866 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2868 IsDlgButtonChecked(hwnd
, IDC_BLINKTEXT
);
2871 if (HIWORD(wParam
) == BN_CLICKED
||
2872 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2873 cfg
.bce
= IsDlgButtonChecked(hwnd
, IDC_BCE
);
2876 if (HIWORD(wParam
) == BN_CLICKED
||
2877 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2878 cfg
.win_name_always
=
2879 IsDlgButtonChecked(hwnd
, IDC_WINNAME
);
2882 if (HIWORD(wParam
) == BN_CLICKED
||
2883 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2885 IsDlgButtonChecked(hwnd
, IDC_HIDEMOUSE
);
2887 case IDC_SUNKENEDGE
:
2888 if (HIWORD(wParam
) == BN_CLICKED
||
2889 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2891 IsDlgButtonChecked(hwnd
, IDC_SUNKENEDGE
);
2894 if (HIWORD(wParam
) == EN_CHANGE
)
2895 MyGetDlgItemInt(hwnd
, IDC_WINBEDIT
,
2896 &cfg
.window_border
);
2897 if (cfg
.window_border
> 32)
2898 cfg
.window_border
= 32;
2901 if (HIWORD(wParam
) == BN_CLICKED
||
2902 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2903 cfg
.cursor_type
= 0;
2906 if (HIWORD(wParam
) == BN_CLICKED
||
2907 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2908 cfg
.cursor_type
= 1;
2911 if (HIWORD(wParam
) == BN_CLICKED
||
2912 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2913 cfg
.cursor_type
= 2;
2916 if (HIWORD(wParam
) == BN_CLICKED
||
2917 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2919 IsDlgButtonChecked(hwnd
, IDC_BLINKCUR
);
2922 if (HIWORD(wParam
) == BN_CLICKED
||
2923 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2925 IsDlgButtonChecked(hwnd
, IDC_SCROLLBAR
);
2927 case IDC_SCROLLBARFULLSCREEN
:
2928 if (HIWORD(wParam
) == BN_CLICKED
||
2929 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2930 cfg
.scrollbar_in_fullscreen
=
2931 IsDlgButtonChecked(hwnd
, IDC_SCROLLBARFULLSCREEN
);
2933 case IDC_RESIZETERM
:
2934 case IDC_RESIZEFONT
:
2935 case IDC_RESIZENONE
:
2936 case IDC_RESIZEEITHER
:
2937 if (HIWORD(wParam
) == BN_CLICKED
||
2938 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2940 IsDlgButtonChecked(hwnd
,
2941 IDC_RESIZETERM
) ? RESIZE_TERM
:
2942 IsDlgButtonChecked(hwnd
,
2943 IDC_RESIZEFONT
) ? RESIZE_FONT
:
2944 IsDlgButtonChecked(hwnd
,
2945 IDC_RESIZEEITHER
) ? RESIZE_EITHER
:
2950 if (HIWORD(wParam
) == EN_CHANGE
)
2951 GetDlgItemText(hwnd
, IDC_WINEDIT
, cfg
.wintitle
,
2952 sizeof(cfg
.wintitle
) - 1);
2957 if (HIWORD(wParam
) == BN_CLICKED
||
2958 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2960 IsDlgButtonChecked(hwnd
,
2961 IDC_COEALWAYS
) ? COE_ALWAYS
:
2962 IsDlgButtonChecked(hwnd
,
2963 IDC_COENEVER
) ? COE_NEVER
:
2968 if (HIWORD(wParam
) == BN_CLICKED
||
2969 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2971 IsDlgButtonChecked(hwnd
, IDC_CLOSEWARN
);
2974 if (HIWORD(wParam
) == EN_CHANGE
)
2975 GetDlgItemText(hwnd
, IDC_TTEDIT
, cfg
.termtype
,
2976 sizeof(cfg
.termtype
) - 1);
2980 case IDC_PROXYHOSTEDIT
:
2981 if (HIWORD(wParam
) == EN_CHANGE
)
2982 GetDlgItemText(hwnd
, IDC_PROXYHOSTEDIT
, cfg
.proxy_host
,
2983 sizeof(cfg
.proxy_host
) - 1);
2985 case IDC_PROXYPORTEDIT
:
2986 if (HIWORD(wParam
) == EN_CHANGE
) {
2987 GetDlgItemText(hwnd
, IDC_PROXYPORTEDIT
, portname
, 31);
2988 if (isdigit(portname
[0]))
2989 MyGetDlgItemInt(hwnd
, IDC_PROXYPORTEDIT
, &cfg
.proxy_port
);
2991 service
= getservbyname(portname
, NULL
);
2993 cfg
.proxy_port
= ntohs(service
->s_port
);
2999 case IDC_PROXYEXCLUDEEDIT
:
3000 if (HIWORD(wParam
) == EN_CHANGE
)
3001 GetDlgItemText(hwnd
, IDC_PROXYEXCLUDEEDIT
,
3002 cfg
.proxy_exclude_list
,
3003 sizeof(cfg
.proxy_exclude_list
) - 1);
3005 case IDC_PROXYUSEREDIT
:
3006 if (HIWORD(wParam
) == EN_CHANGE
)
3007 GetDlgItemText(hwnd
, IDC_PROXYUSEREDIT
,
3009 sizeof(cfg
.proxy_username
) - 1);
3011 case IDC_PROXYPASSEDIT
:
3012 if (HIWORD(wParam
) == EN_CHANGE
)
3013 GetDlgItemText(hwnd
, IDC_PROXYPASSEDIT
,
3015 sizeof(cfg
.proxy_password
) - 1);
3017 case IDC_PROXYTELNETCMDEDIT
:
3018 if (HIWORD(wParam
) == EN_CHANGE
)
3019 GetDlgItemText(hwnd
, IDC_PROXYTELNETCMDEDIT
,
3020 cfg
.proxy_telnet_command
,
3021 sizeof(cfg
.proxy_telnet_command
) - 1);
3023 case IDC_PROXYSOCKSVER5
:
3024 case IDC_PROXYSOCKSVER4
:
3025 if (HIWORD(wParam
) == BN_CLICKED
||
3026 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3027 cfg
.proxy_socks_version
=
3028 IsDlgButtonChecked(hwnd
, IDC_PROXYSOCKSVER4
) ?
4 : 5;
3031 case IDC_PROXYLOCALHOST
:
3032 if (HIWORD(wParam
) == BN_CLICKED
||
3033 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3034 cfg
.even_proxy_localhost
=
3035 IsDlgButtonChecked(hwnd
, IDC_PROXYLOCALHOST
);
3037 case IDC_PROXYTYPENONE
:
3038 case IDC_PROXYTYPEHTTP
:
3039 case IDC_PROXYTYPESOCKS
:
3040 case IDC_PROXYTYPETELNET
:
3041 if (HIWORD(wParam
) == BN_CLICKED
||
3042 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3044 IsDlgButtonChecked(hwnd
, IDC_PROXYTYPEHTTP
) ? PROXY_HTTP
:
3045 IsDlgButtonChecked(hwnd
, IDC_PROXYTYPESOCKS
) ? PROXY_SOCKS
:
3046 IsDlgButtonChecked(hwnd
, IDC_PROXYTYPETELNET
) ? PROXY_TELNET
:
3052 if (HIWORD(wParam
) == EN_CHANGE
)
3053 GetDlgItemText(hwnd
, IDC_LGFEDIT
, cfg
.logfilename
,
3054 sizeof(cfg
.logfilename
) - 1);
3057 memset(&of
, 0, sizeof(of
));
3058 #ifdef OPENFILENAME_SIZE_VERSION_400
3059 of
.lStructSize
= OPENFILENAME_SIZE_VERSION_400
;
3061 of
.lStructSize
= sizeof(of
);
3063 of
.hwndOwner
= hwnd
;
3064 of
.lpstrFilter
= "All Files\0*\0\0\0";
3065 of
.lpstrCustomFilter
= NULL
;
3066 of
.nFilterIndex
= 1;
3067 of
.lpstrFile
= filename
;
3068 strcpy(filename
, cfg
.logfilename
);
3069 of
.nMaxFile
= sizeof(filename
);
3070 of
.lpstrFileTitle
= NULL
;
3071 of
.lpstrInitialDir
= NULL
;
3072 of
.lpstrTitle
= "Select session log file";
3074 if (GetSaveFileName(&of
)) {
3075 strcpy(cfg
.logfilename
, filename
);
3076 SetDlgItemText(hwnd
, IDC_LGFEDIT
, cfg
.logfilename
);
3080 case IDC_LSTATASCII
:
3082 case IDC_LSTATPACKET
:
3083 if (HIWORD(wParam
) == BN_CLICKED
||
3084 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3085 if (IsDlgButtonChecked(hwnd
, IDC_LSTATOFF
))
3086 cfg
.logtype
= LGTYP_NONE
;
3087 if (IsDlgButtonChecked(hwnd
, IDC_LSTATASCII
))
3088 cfg
.logtype
= LGTYP_ASCII
;
3089 if (IsDlgButtonChecked(hwnd
, IDC_LSTATRAW
))
3090 cfg
.logtype
= LGTYP_DEBUG
;
3091 if (IsDlgButtonChecked(hwnd
, IDC_LSTATPACKET
))
3092 cfg
.logtype
= LGTYP_PACKETS
;
3098 if (HIWORD(wParam
) == BN_CLICKED
||
3099 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3100 if (IsDlgButtonChecked(hwnd
, IDC_LSTATXASK
))
3101 cfg
.logxfovr
= LGXF_ASK
;
3102 if (IsDlgButtonChecked(hwnd
, IDC_LSTATXAPN
))
3103 cfg
.logxfovr
= LGXF_APN
;
3104 if (IsDlgButtonChecked(hwnd
, IDC_LSTATXOVR
))
3105 cfg
.logxfovr
= LGXF_OVR
;
3110 if (HIWORD(wParam
) == EN_CHANGE
)
3111 GetDlgItemText(hwnd
, LOWORD(wParam
), cfg
.termspeed
,
3112 sizeof(cfg
.termspeed
) - 1);
3115 if (HIWORD(wParam
) == EN_CHANGE
)
3116 GetDlgItemText(hwnd
, IDC_LOGEDIT
, cfg
.username
,
3117 sizeof(cfg
.username
) - 1);
3119 case IDC_RLLUSEREDIT
:
3120 if (HIWORD(wParam
) == EN_CHANGE
)
3121 GetDlgItemText(hwnd
, IDC_RLLUSEREDIT
,
3123 sizeof(cfg
.localusername
) - 1);
3127 cfg
.rfc_environ
= IsDlgButtonChecked(hwnd
, IDC_EMRFC
);
3131 cfg
.passive_telnet
=
3132 IsDlgButtonChecked(hwnd
, IDC_TPASSIVE
);
3135 if (HIWORD(wParam
) == BN_CLICKED
||
3136 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3137 char str
[sizeof(cfg
.environmt
)];
3139 GetDlgItemText(hwnd
, IDC_VAREDIT
, str
,
3145 p
= str
+ strlen(str
);
3147 GetDlgItemText(hwnd
, IDC_VALEDIT
, p
,
3148 sizeof(str
) - 1 - (p
- str
));
3159 if ((p
- cfg
.environmt
) + strlen(str
) + 2 <
3160 sizeof(cfg
.environmt
)) {
3162 p
[strlen(str
) + 1] = '\0';
3163 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_ADDSTRING
,
3165 SetDlgItemText(hwnd
, IDC_VAREDIT
, "");
3166 SetDlgItemText(hwnd
, IDC_VALEDIT
, "");
3168 MessageBox(hwnd
, "Environment too big",
3169 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3174 if (HIWORD(wParam
) != BN_CLICKED
&&
3175 HIWORD(wParam
) != BN_DOUBLECLICKED
) break;
3177 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_GETCURSEL
, 0,
3184 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_DELETESTRING
,
3211 if (HIWORD(wParam
) == BN_CLICKED
||
3212 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3213 cfg
.nopty
= IsDlgButtonChecked(hwnd
, IDC_NOPTY
);
3216 if (HIWORD(wParam
) == BN_CLICKED
||
3217 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3219 IsDlgButtonChecked(hwnd
, IDC_COMPRESS
);
3222 if (HIWORD(wParam
) == BN_CLICKED
||
3223 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3225 IsDlgButtonChecked(hwnd
, IDC_SSH2DES
);
3228 if (HIWORD(wParam
) == BN_CLICKED
||
3229 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3231 IsDlgButtonChecked(hwnd
, IDC_AGENTFWD
);
3233 case IDC_CHANGEUSER
:
3234 if (HIWORD(wParam
) == BN_CLICKED
||
3235 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3236 cfg
.change_username
=
3237 IsDlgButtonChecked(hwnd
, IDC_CHANGEUSER
);
3239 case IDC_CIPHERLIST
:
3242 handle_prefslist(&cipherlist
,
3243 cfg
.ssh_cipherlist
, CIPHER_MAX
,
3244 0, hwnd
, wParam
, lParam
);
3246 case IDC_SSHPROT1ONLY
:
3249 case IDC_SSHPROT2ONLY
:
3250 if (HIWORD(wParam
) == BN_CLICKED
||
3251 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3252 if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT1ONLY
))
3254 if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT1
))
3256 else if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT2
))
3258 else if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT2ONLY
))
3263 if (HIWORD(wParam
) == BN_CLICKED
||
3264 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3266 IsDlgButtonChecked(hwnd
, IDC_AUTHTIS
);
3269 if (HIWORD(wParam
) == BN_CLICKED
||
3270 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3272 IsDlgButtonChecked(hwnd
, IDC_AUTHKI
);
3275 if (HIWORD(wParam
) == EN_CHANGE
)
3276 GetDlgItemText(hwnd
, IDC_PKEDIT
, cfg
.keyfile
,
3277 sizeof(cfg
.keyfile
) - 1);
3280 if (HIWORD(wParam
) == EN_CHANGE
)
3281 GetDlgItemText(hwnd
, IDC_CMDEDIT
, cfg
.remote_cmd
,
3282 sizeof(cfg
.remote_cmd
) - 1);
3285 memset(&of
, 0, sizeof(of
));
3286 #ifdef OPENFILENAME_SIZE_VERSION_400
3287 of
.lStructSize
= OPENFILENAME_SIZE_VERSION_400
;
3289 of
.lStructSize
= sizeof(of
);
3291 of
.hwndOwner
= hwnd
;
3292 of
.lpstrFilter
= "PuTTY Private Key Files\0*.PPK\0"
3293 "AllFiles\0*\0\0\0";
3294 of
.lpstrCustomFilter
= NULL
;
3295 of
.nFilterIndex
= 1;
3296 of
.lpstrFile
= filename
;
3297 strcpy(filename
, cfg
.keyfile
);
3298 of
.nMaxFile
= sizeof(filename
);
3299 of
.lpstrFileTitle
= NULL
;
3300 of
.lpstrInitialDir
= NULL
;
3301 of
.lpstrTitle
= "Select Private Key File";
3303 if (GetOpenFileName(&of
)) {
3304 strcpy(cfg
.keyfile
, filename
);
3305 SetDlgItemText(hwnd
, IDC_PKEDIT
, cfg
.keyfile
);
3309 cfg
.rawcnp
= IsDlgButtonChecked(hwnd
, IDC_RAWCNP
);
3312 cfg
.rtf_paste
= IsDlgButtonChecked(hwnd
, IDC_RTFPASTE
);
3316 cfg
.mouse_is_xterm
= IsDlgButtonChecked(hwnd
, IDC_MBXTERM
);
3318 case IDC_SELTYPELEX
:
3319 case IDC_SELTYPERECT
:
3320 cfg
.rect_select
= IsDlgButtonChecked(hwnd
, IDC_SELTYPERECT
);
3322 case IDC_MOUSEOVERRIDE
:
3323 cfg
.mouse_override
= IsDlgButtonChecked(hwnd
, IDC_MOUSEOVERRIDE
);
3329 int n
= GetDlgItemInt(hwnd
, IDC_CCEDIT
, &ok
, FALSE
);
3334 for (i
= 0; i
< 128; i
++)
3335 if (SendDlgItemMessage
3336 (hwnd
, IDC_CCLIST
, LB_GETSEL
, i
, 0)) {
3338 cfg
.wordness
[i
] = n
;
3339 SendDlgItemMessage(hwnd
, IDC_CCLIST
,
3340 LB_DELETESTRING
, i
, 0);
3341 sprintf(str
, "%d\t(0x%02X)\t%c\t%d", i
, i
,
3342 (i
>= 0x21 && i
!= 0x7F) ? i
: ' ',
3344 SendDlgItemMessage(hwnd
, IDC_CCLIST
,
3351 case IDC_BOLDCOLOUR
:
3352 if (HIWORD(wParam
) == BN_CLICKED
||
3353 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3356 IsDlgButtonChecked(hwnd
, IDC_BOLDCOLOUR
);
3357 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, WM_SETREDRAW
,
3360 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3362 if (n
!= 12 + 10 * cfg
.bold_colour
) {
3363 for (i
= n
; i
-- > 0;)
3364 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3365 LB_DELETESTRING
, i
, 0);
3366 for (i
= 0; i
< 22; i
++)
3367 if (cfg
.bold_colour
|| permcolour
[i
])
3368 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3370 (LPARAM
) colours
[i
]);
3372 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, WM_SETREDRAW
,
3374 InvalidateRect(GetDlgItem(hwnd
, IDC_COLOURLIST
), NULL
,
3379 if (HIWORD(wParam
) == BN_CLICKED
||
3380 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3382 IsDlgButtonChecked(hwnd
, IDC_PALETTE
);
3384 case IDC_COLOURLIST
:
3385 if (HIWORD(wParam
) == LBN_DBLCLK
||
3386 HIWORD(wParam
) == LBN_SELCHANGE
) {
3388 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3391 if (!cfg
.bold_colour
)
3392 i
= (i
< 3 ? i
* 2 : i
== 3 ?
5 : i
* 2 - 2);
3393 SetDlgItemInt(hwnd
, IDC_RVALUE
, cfg
.colours
[i
][0],
3395 SetDlgItemInt(hwnd
, IDC_GVALUE
, cfg
.colours
[i
][1],
3397 SetDlgItemInt(hwnd
, IDC_BVALUE
, cfg
.colours
[i
][2],
3402 if (HIWORD(wParam
) == BN_CLICKED
||
3403 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3404 static CHOOSECOLOR cc
;
3405 static DWORD custom
[16] = { 0 }; /* zero initialisers */
3407 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3410 if (!cfg
.bold_colour
)
3411 i
= (i
< 3 ? i
* 2 : i
== 3 ?
5 : i
* 2 - 2);
3412 cc
.lStructSize
= sizeof(cc
);
3413 cc
.hwndOwner
= hwnd
;
3414 cc
.hInstance
= (HWND
) hinst
;
3415 cc
.lpCustColors
= custom
;
3417 RGB(cfg
.colours
[i
][0], cfg
.colours
[i
][1],
3419 cc
.Flags
= CC_FULLOPEN
| CC_RGBINIT
;
3420 if (ChooseColor(&cc
)) {
3422 (unsigned char) (cc
.rgbResult
& 0xFF);
3424 (unsigned char) (cc
.rgbResult
>> 8) & 0xFF;
3426 (unsigned char) (cc
.rgbResult
>> 16) & 0xFF;
3427 SetDlgItemInt(hwnd
, IDC_RVALUE
, cfg
.colours
[i
][0],
3429 SetDlgItemInt(hwnd
, IDC_GVALUE
, cfg
.colours
[i
][1],
3431 SetDlgItemInt(hwnd
, IDC_BVALUE
, cfg
.colours
[i
][2],
3437 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3438 int index
= SendDlgItemMessage(hwnd
, IDC_CODEPAGE
,
3439 CB_GETCURSEL
, 0, 0);
3440 SendDlgItemMessage(hwnd
, IDC_CODEPAGE
, CB_GETLBTEXT
,
3441 index
, (LPARAM
)cfg
.line_codepage
);
3442 } else if (HIWORD(wParam
) == CBN_EDITCHANGE
) {
3443 GetDlgItemText(hwnd
, IDC_CODEPAGE
, cfg
.line_codepage
,
3444 sizeof(cfg
.line_codepage
) - 1);
3445 } else if (HIWORD(wParam
) == CBN_KILLFOCUS
) {
3446 strcpy(cfg
.line_codepage
,
3447 cp_name(decode_codepage(cfg
.line_codepage
)));
3448 SetDlgItemText(hwnd
, IDC_CODEPAGE
, cfg
.line_codepage
);
3452 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3453 int index
= SendDlgItemMessage(hwnd
, IDC_PRINTER
,
3454 CB_GETCURSEL
, 0, 0);
3455 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_GETLBTEXT
,
3456 index
, (LPARAM
)cfg
.printer
);
3457 } else if (HIWORD(wParam
) == CBN_EDITCHANGE
) {
3458 GetDlgItemText(hwnd
, IDC_PRINTER
, cfg
.printer
,
3459 sizeof(cfg
.printer
) - 1);
3461 if (!strcmp(cfg
.printer
, PRINTER_DISABLED_STRING
))
3462 *cfg
.printer
= '\0';
3464 case IDC_CAPSLOCKCYR
:
3465 if (HIWORD(wParam
) == BN_CLICKED
||
3466 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3467 cfg
.xlat_capslockcyr
=
3468 IsDlgButtonChecked (hwnd
, IDC_CAPSLOCKCYR
);
3471 case IDC_VTXWINDOWS
:
3477 (IsDlgButtonChecked(hwnd
, IDC_VTXWINDOWS
) ? VT_XWINDOWS
3478 : IsDlgButtonChecked(hwnd
,
3479 IDC_VTOEMANSI
) ? VT_OEMANSI
:
3480 IsDlgButtonChecked(hwnd
,
3481 IDC_VTOEMONLY
) ? VT_OEMONLY
:
3482 IsDlgButtonChecked(hwnd
,
3483 IDC_VTUNICODE
) ? VT_UNICODE
:
3486 case IDC_X11_FORWARD
:
3487 if (HIWORD(wParam
) == BN_CLICKED
||
3488 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3490 IsDlgButtonChecked(hwnd
, IDC_X11_FORWARD
);
3493 if (HIWORD(wParam
) == BN_CLICKED
||
3494 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3495 cfg
.lport_acceptall
=
3496 IsDlgButtonChecked(hwnd
, IDC_LPORT_ALL
);
3499 if (HIWORD(wParam
) == BN_CLICKED
||
3500 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3501 cfg
.rport_acceptall
=
3502 IsDlgButtonChecked(hwnd
, IDC_RPORT_ALL
);
3504 case IDC_X11_DISPLAY
:
3505 if (HIWORD(wParam
) == EN_CHANGE
)
3506 GetDlgItemText(hwnd
, IDC_X11_DISPLAY
, cfg
.x11_display
,
3507 sizeof(cfg
.x11_display
) - 1);
3510 if (HIWORD(wParam
) == BN_CLICKED
||
3511 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3512 char str
[sizeof(cfg
.portfwd
)];
3514 if (IsDlgButtonChecked(hwnd
, IDC_PFWDLOCAL
))
3518 GetDlgItemText(hwnd
, IDC_SPORTEDIT
, str
+1,
3522 "You need to specify a source port number",
3523 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3526 p
= str
+ strlen(str
);
3528 GetDlgItemText(hwnd
, IDC_DPORTEDIT
, p
,
3529 sizeof(str
) - 1 - (p
- str
));
3530 if (!*p
|| !strchr(p
, ':')) {
3532 "You need to specify a destination address\n"
3533 "in the form \"host.name:port\"",
3534 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3543 if ((p
- cfg
.portfwd
) + strlen(str
) + 2 <
3544 sizeof(cfg
.portfwd
)) {
3546 p
[strlen(str
) + 1] = '\0';
3547 SendDlgItemMessage(hwnd
, IDC_PFWDLIST
, LB_ADDSTRING
,
3549 SetDlgItemText(hwnd
, IDC_SPORTEDIT
, "");
3550 SetDlgItemText(hwnd
, IDC_DPORTEDIT
, "");
3552 MessageBox(hwnd
, "Too many forwardings",
3553 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3557 case IDC_PFWDREMOVE
:
3558 if (HIWORD(wParam
) != BN_CLICKED
&&
3559 HIWORD(wParam
) != BN_DOUBLECLICKED
) break;
3560 i
= SendDlgItemMessage(hwnd
, IDC_PFWDLIST
,
3561 LB_GETCURSEL
, 0, 0);
3567 SendDlgItemMessage(hwnd
, IDC_PFWDLIST
, LB_DELETESTRING
,
3593 case IDC_BUGD_IGNORE1
:
3594 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3595 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
,
3596 CB_GETCURSEL
, 0, 0);
3597 cfg
.sshbug_ignore1
= (index
== 0 ? BUG_AUTO
:
3598 index
== 1 ? BUG_OFF
: BUG_ON
);
3601 case IDC_BUGD_PLAINPW1
:
3602 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3603 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
,
3604 CB_GETCURSEL
, 0, 0);
3605 cfg
.sshbug_plainpw1
= (index
== 0 ? BUG_AUTO
:
3606 index
== 1 ? BUG_OFF
: BUG_ON
);
3610 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3611 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
,
3612 CB_GETCURSEL
, 0, 0);
3613 cfg
.sshbug_rsa1
= (index
== 0 ? BUG_AUTO
:
3614 index
== 1 ? BUG_OFF
: BUG_ON
);
3617 case IDC_BUGD_HMAC2
:
3618 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3619 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
,
3620 CB_GETCURSEL
, 0, 0);
3621 cfg
.sshbug_hmac2
= (index
== 0 ? BUG_AUTO
:
3622 index
== 1 ? BUG_OFF
: BUG_ON
);
3625 case IDC_BUGD_DERIVEKEY2
:
3626 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3627 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
,
3628 CB_GETCURSEL
, 0, 0);
3629 cfg
.sshbug_derivekey2
= (index
== 0 ? BUG_AUTO
:
3630 index
== 1 ? BUG_OFF
: BUG_ON
);
3633 case IDC_BUGD_RSAPAD2
:
3634 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3635 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
,
3636 CB_GETCURSEL
, 0, 0);
3637 cfg
.sshbug_rsapad2
= (index
== 0 ? BUG_AUTO
:
3638 index
== 1 ? BUG_OFF
: BUG_ON
);
3641 case IDC_BUGD_DHGEX2
:
3642 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3643 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
,
3644 CB_GETCURSEL
, 0, 0);
3645 cfg
.sshbug_dhgex2
= (index
== 0 ? BUG_AUTO
:
3646 index
== 1 ? BUG_OFF
: BUG_ON
);
3653 int id
= ((LPHELPINFO
)lParam
)->iCtrlId
;
3654 char *cmd
= help_context_cmd(id
);
3656 WinHelp(hwnd
, help_path
, HELP_COMMAND
, (DWORD
)cmd
);
3657 requested_help
= TRUE
;
3664 if (requested_help
) {
3665 WinHelp(hwnd
, help_path
, HELP_QUIT
, 0);
3666 requested_help
= FALSE
;
3671 /* Grrr Explorer will maximize Dialogs! */
3673 if (wParam
== SIZE_MAXIMIZED
)
3679 * Handle application-defined messages eg. DragListBox
3681 /* First find out what the number is (once). */
3682 if (draglistmsg
== WM_NULL
)
3683 draglistmsg
= RegisterWindowMessage (DRAGLISTMSGSTRING
);
3685 if (msg
== draglistmsg
) {
3686 /* Only process once dialog is fully formed. */
3687 if (GetWindowLong(hwnd
, GWL_USERDATA
) == 1) switch (LOWORD(wParam
)) {
3688 case IDC_CIPHERLIST
:
3689 return handle_prefslist(&cipherlist
,
3690 cfg
.ssh_cipherlist
, CIPHER_MAX
,
3691 1, hwnd
, wParam
, lParam
);
3700 static int CALLBACK
MainDlgProc(HWND hwnd
, UINT msg
,
3701 WPARAM wParam
, LPARAM lParam
)
3703 if (msg
== WM_COMMAND
&& LOWORD(wParam
) == IDOK
) {
3705 if (msg
== WM_COMMAND
&& LOWORD(wParam
) == IDCX_ABOUT
) {
3706 EnableWindow(hwnd
, 0);
3707 DialogBox(hinst
, MAKEINTRESOURCE(IDD_ABOUTBOX
), hwnd
, AboutProc
);
3708 EnableWindow(hwnd
, 1);
3709 SetActiveWindow(hwnd
);
3711 return GenericMainDlgProc(hwnd
, msg
, wParam
, lParam
, 0);
3714 static int CALLBACK
ReconfDlgProc(HWND hwnd
, UINT msg
,
3715 WPARAM wParam
, LPARAM lParam
)
3717 return GenericMainDlgProc(hwnd
, msg
, wParam
, lParam
, 1);
3720 void defuse_showwindow(void)
3723 * Work around the fact that the app's first call to ShowWindow
3724 * will ignore the default in favour of the shell-provided
3729 hwnd
= CreateDialog(hinst
, MAKEINTRESOURCE(IDD_ABOUTBOX
),
3731 ShowWindow(hwnd
, SW_HIDE
);
3732 SetActiveWindow(hwnd
);
3733 DestroyWindow(hwnd
);
3741 get_sesslist(&sesslist
, TRUE
);
3742 savedsession
[0] = '\0';
3744 DialogBox(hinst
, MAKEINTRESOURCE(IDD_MAINBOX
), NULL
, MainDlgProc
);
3745 get_sesslist(&sesslist
, FALSE
);
3750 int do_reconfig(HWND hwnd
)
3755 backup_cfg
= cfg
; /* structure copy */
3757 DialogBox(hinst
, MAKEINTRESOURCE(IDD_RECONF
), hwnd
, ReconfDlgProc
);
3759 cfg
= backup_cfg
; /* structure copy */
3764 void logevent(void *frontend
, char *string
)
3769 log_eventlog(logctx
, string
);
3771 if (nevents
>= negsize
) {
3773 events
= srealloc(events
, negsize
* sizeof(*events
));
3777 strftime(timebuf
, sizeof(timebuf
), "%Y-%m-%d %H:%M:%S\t",
3780 events
[nevents
] = smalloc(strlen(timebuf
) + strlen(string
) + 1);
3781 strcpy(events
[nevents
], timebuf
);
3782 strcat(events
[nevents
], string
);
3785 SendDlgItemMessage(logbox
, IDN_LIST
, LB_ADDSTRING
,
3786 0, (LPARAM
) events
[nevents
]);
3787 count
= SendDlgItemMessage(logbox
, IDN_LIST
, LB_GETCOUNT
, 0, 0);
3788 SendDlgItemMessage(logbox
, IDN_LIST
, LB_SETTOPINDEX
, count
- 1, 0);
3793 void showeventlog(HWND hwnd
)
3796 logbox
= CreateDialog(hinst
, MAKEINTRESOURCE(IDD_LOGBOX
),
3798 ShowWindow(logbox
, SW_SHOWNORMAL
);
3800 SetActiveWindow(logbox
);
3803 void showabout(HWND hwnd
)
3805 DialogBox(hinst
, MAKEINTRESOURCE(IDD_ABOUTBOX
), hwnd
, AboutProc
);
3808 void verify_ssh_host_key(void *frontend
, char *host
, int port
, char *keytype
,
3809 char *keystr
, char *fingerprint
)
3813 static const char absentmsg
[] =
3814 "The server's host key is not cached in the registry. You\n"
3815 "have no guarantee that the server is the computer you\n"
3817 "The server's key fingerprint is:\n"
3819 "If you trust this host, hit Yes to add the key to\n"
3820 "PuTTY's cache and carry on connecting.\n"
3821 "If you want to carry on connecting just once, without\n"
3822 "adding the key to the cache, hit No.\n"
3823 "If you do not trust this host, hit Cancel to abandon the\n"
3826 static const char wrongmsg
[] =
3827 "WARNING - POTENTIAL SECURITY BREACH!\n"
3829 "The server's host key does not match the one PuTTY has\n"
3830 "cached in the registry. This means that either the\n"
3831 "server administrator has changed the host key, or you\n"
3832 "have actually connected to another computer pretending\n"
3833 "to be the server.\n"
3834 "The new key fingerprint is:\n"
3836 "If you were expecting this change and trust the new key,\n"
3837 "hit Yes to update PuTTY's cache and continue connecting.\n"
3838 "If you want to carry on connecting but without updating\n"
3839 "the cache, hit No.\n"
3840 "If you want to abandon the connection completely, hit\n"
3841 "Cancel. Hitting Cancel is the ONLY guaranteed safe\n" "choice.\n";
3843 static const char mbtitle
[] = "PuTTY Security Alert";
3846 /* sensible fingerprint max size */
3847 (sizeof(absentmsg
) > sizeof(wrongmsg
) ?
3848 sizeof(absentmsg
) : sizeof(wrongmsg
))];
3851 * Verify the key against the registry.
3853 ret
= verify_host_key(host
, port
, keytype
, keystr
);
3855 if (ret
== 0) /* success - key matched OK */
3857 if (ret
== 2) { /* key was different */
3859 sprintf(message
, wrongmsg
, fingerprint
);
3860 mbret
= MessageBox(NULL
, message
, mbtitle
,
3861 MB_ICONWARNING
| MB_YESNOCANCEL
);
3863 store_host_key(host
, port
, keytype
, keystr
);
3864 if (mbret
== IDCANCEL
)
3867 if (ret
== 1) { /* key was absent */
3869 sprintf(message
, absentmsg
, fingerprint
);
3870 mbret
= MessageBox(NULL
, message
, mbtitle
,
3871 MB_ICONWARNING
| MB_YESNOCANCEL
);
3873 store_host_key(host
, port
, keytype
, keystr
);
3874 if (mbret
== IDCANCEL
)
3880 * Ask whether the selected cipher is acceptable (since it was
3881 * below the configured 'warn' threshold).
3882 * cs: 0 = both ways, 1 = client->server, 2 = server->client
3884 void askcipher(void *frontend
, char *ciphername
, int cs
)
3886 static const char mbtitle
[] = "PuTTY Security Alert";
3887 static const char msg
[] =
3888 "The first %.35scipher supported by the server\n"
3889 "is %.64s, which is below the configured\n"
3890 "warning threshold.\n"
3891 "Do you want to continue with this connection?\n";
3892 /* guessed cipher name + type max length */
3893 char message
[100 + sizeof(msg
)];
3896 sprintf(message
, msg
,
3898 (cs
== 1) ?
"client-to-server " :
3899 "server-to-client ",
3901 mbret
= MessageBox(NULL
, message
, mbtitle
,
3902 MB_ICONWARNING
| MB_YESNO
);
3910 * Ask whether to wipe a session log file before writing to it.
3911 * Returns 2 for wipe, 1 for append, 0 for cancel (don't log).
3913 int askappend(void *frontend
, char *filename
)
3915 static const char mbtitle
[] = "PuTTY Log to File";
3916 static const char msgtemplate
[] =
3917 "The session log file \"%.*s\" already exists.\n"
3918 "You can overwrite it with a new session log,\n"
3919 "append your session log to the end of it,\n"
3920 "or disable session logging for this session.\n"
3921 "Hit Yes to wipe the file, No to append to it,\n"
3922 "or Cancel to disable logging.";
3923 char message
[sizeof(msgtemplate
) + FILENAME_MAX
];
3925 if (cfg
.logxfovr
!= LGXF_ASK
) {
3926 return ((cfg
.logxfovr
== LGXF_OVR
) ?
2 : 1);
3928 sprintf(message
, msgtemplate
, FILENAME_MAX
, filename
);
3930 mbret
= MessageBox(NULL
, message
, mbtitle
,
3931 MB_ICONQUESTION
| MB_YESNOCANCEL
);
3934 else if (mbret
== IDNO
)
3941 * Warn about the obsolescent key file format.
3943 * Uniquely among these functions, this one does _not_ expect a
3944 * frontend handle. This means that if PuTTY is ported to a
3945 * platform which requires frontend handles, this function will be
3946 * an anomaly. Fortunately, the problem it addresses will not have
3947 * been present on that platform, so it can plausibly be
3948 * implemented as an empty function.
3950 void old_keyfile_warning(void)
3952 static const char mbtitle
[] = "PuTTY Key File Warning";
3953 static const char message
[] =
3954 "You are loading an SSH 2 private key which has an\n"
3955 "old version of the file format. This means your key\n"
3956 "file is not fully tamperproof. Future versions of\n"
3957 "PuTTY may stop supporting this private key format,\n"
3958 "so we recommend you convert your key to the new\n"
3961 "You can perform this conversion by loading the key\n"
3962 "into PuTTYgen and then saving it again.";
3964 MessageBox(NULL
, message
, mbtitle
, MB_OK
);