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
,
462 IDC_PROXYTELNETCMDSTATIC
,
463 IDC_PROXYTELNETCMDEDIT
,
464 IDC_PROXYSOCKSVERSTATIC
,
595 translationpanelstart
,
596 IDC_TITLE_TRANSLATION
,
597 IDC_BOX_TRANSLATION1
,
598 IDC_BOX_TRANSLATION2
,
599 IDC_BOX_TRANSLATION3
,
637 static const char *const colours
[] = {
638 "Default Foreground", "Default Bold Foreground",
639 "Default Background", "Default Bold Background",
640 "Cursor Text", "Cursor Colour",
641 "ANSI Black", "ANSI Black Bold",
642 "ANSI Red", "ANSI Red Bold",
643 "ANSI Green", "ANSI Green Bold",
644 "ANSI Yellow", "ANSI Yellow Bold",
645 "ANSI Blue", "ANSI Blue Bold",
646 "ANSI Magenta", "ANSI Magenta Bold",
647 "ANSI Cyan", "ANSI Cyan Bold",
648 "ANSI White", "ANSI White Bold"
650 static const int permcolour
[] = {
651 TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, TRUE
,
652 TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
,
653 TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
, TRUE
, FALSE
656 static void fmtfont(char *buf
)
658 sprintf(buf
, "Font: %s, ", cfg
.font
);
660 strcat(buf
, "bold, ");
661 if (cfg
.fontheight
== 0)
662 strcat(buf
, "default height");
664 sprintf(buf
+ strlen(buf
), "%d-point",
665 (cfg
.fontheight
< 0 ?
-cfg
.fontheight
: cfg
.fontheight
));
668 char *help_context_cmd(int id
)
680 return "JI(`',`session.hostname')";
687 return "JI(`',`session.saved')";
692 return "JI(`',`session.coe')";
693 case IDC_LSTATSTATIC
:
697 case IDC_LSTATPACKET
:
698 return "JI(`',`logging.main')";
703 return "JI(`',`logging.filename')";
708 return "JI(`',`logging.exists')";
713 return "JI(`',`keyboard.backspace')";
717 return "JI(`',`keyboard.homeend')";
725 return "JI(`',`keyboard.funkeys')";
729 return "JI(`',`keyboard.appkeypad')";
733 return "JI(`',`keyboard.appcursor')";
735 return "JI(`',`keyboard.nethack')";
737 return "JI(`',`keyboard.compose')";
738 case IDC_CTRLALTKEYS
:
739 return "JI(`',`keyboard.ctrlalt')";
743 return "JI(`',`features.application')";
745 return "JI(`',`features.mouse')";
747 return "JI(`',`features.resize')";
748 case IDC_NOALTSCREEN
:
749 return "JI(`',`features.altscreen')";
751 return "JI(`',`features.retitle')";
752 case IDC_NODBACKSPACE
:
753 return "JI(`',`features.dbackspace')";
755 return "JI(`',`features.charset')";
758 return "JI(`',`terminal.autowrap')";
760 return "JI(`',`terminal.decom')";
762 return "JI(`',`terminal.lfhascr')";
764 return "JI(`',`terminal.bce')";
766 return "JI(`',`terminal.blink')";
769 return "JI(`',`terminal.answerback')";
771 case IDC_ECHOBACKEND
:
774 return "JI(`',`terminal.localecho')";
776 case IDC_EDITBACKEND
:
779 return "JI(`',`terminal.localedit')";
780 case IDC_PRINTERSTATIC
:
782 return "JI(`',`terminal.printing')";
785 case IDC_BELL_DISABLED
:
786 case IDC_BELL_DEFAULT
:
787 case IDC_BELL_WAVEFILE
:
788 case IDC_BELL_VISUAL
:
789 case IDC_BELL_WAVESTATIC
:
790 case IDC_BELL_WAVEEDIT
:
791 case IDC_BELL_WAVEBROWSE
:
792 return "JI(`',`bell.style')";
793 case IDC_B_IND_STATIC
:
794 case IDC_B_IND_DISABLED
:
795 case IDC_B_IND_FLASH
:
796 case IDC_B_IND_STEADY
:
797 return "JI(`',`bell.taskbar')";
799 case IDC_BELLOVLNSTATIC
:
801 case IDC_BELLOVLTSTATIC
:
803 case IDC_BELLOVLEXPLAIN
:
804 case IDC_BELLOVLSSTATIC
:
806 return "JI(`',`bell.overload')";
812 return "JI(`',`window.size')";
813 case IDC_RESIZESTATIC
:
817 case IDC_RESIZEEITHER
:
818 return "JI(`',`window.resize')";
820 case IDC_SCROLLBARFULLSCREEN
:
825 return "JI(`',`window.scrollback')";
828 return "JI(`',`behaviour.closewarn')";
830 return "JI(`',`behaviour.altf4')";
832 return "JI(`',`behaviour.altspace')";
834 return "JI(`',`behaviour.altonly')";
835 case IDC_ALWAYSONTOP
:
836 return "JI(`',`behaviour.alwaysontop')";
837 case IDC_FULLSCREENONALTENTER
:
838 return "JI(`',`behaviour.altenter')";
840 case IDC_CURSORSTATIC
:
845 return "JI(`',`appearance.cursor')";
848 return "JI(`',`appearance.font')";
852 return "JI(`',`appearance.title')";
854 return "JI(`',`appearance.hidemouse')";
858 return "JI(`',`appearance.border')";
862 return "JI(`',`connection.termtype')";
865 return "JI(`',`connection.username')";
868 return "JI(`',`connection.keepalive')";
870 return "JI(`',`connection.nodelay')";
872 case IDC_PROXYTYPESTATIC
:
873 case IDC_PROXYTYPENONE
:
874 case IDC_PROXYTYPEHTTP
:
875 case IDC_PROXYTYPESOCKS
:
876 case IDC_PROXYTYPETELNET
:
877 return "JI(`',`proxy.type')";
878 case IDC_PROXYHOSTSTATIC
:
879 case IDC_PROXYHOSTEDIT
:
880 case IDC_PROXYPORTSTATIC
:
881 case IDC_PROXYPORTEDIT
:
882 return "JI(`',`proxy.main')";
883 case IDC_PROXYEXCLUDESTATIC
:
884 case IDC_PROXYEXCLUDEEDIT
:
885 return "JI(`',`proxy.exclude')";
886 case IDC_PROXYUSERSTATIC
:
887 case IDC_PROXYUSEREDIT
:
888 case IDC_PROXYPASSSTATIC
:
889 case IDC_PROXYPASSEDIT
:
890 return "JI(`',`proxy.auth')";
891 case IDC_PROXYTELNETCMDSTATIC
:
892 case IDC_PROXYTELNETCMDEDIT
:
893 return "JI(`',`proxy.command')";
894 case IDC_PROXYSOCKSVERSTATIC
:
895 case IDC_PROXYSOCKSVER5
:
896 case IDC_PROXYSOCKSVER4
:
897 return "JI(`',`proxy.socksver')";
901 return "JI(`',`telnet.termspeed')";
910 return "JI(`',`telnet.environ')";
914 return "JI(`',`telnet.oldenviron')";
918 return "JI(`',`telnet.passive')";
920 return "JI(`',`telnet.specialkeys')";
922 return "JI(`',`telnet.newline')";
926 return "JI(`',`rlogin.termspeed')";
927 case IDC_RLLUSERSTATIC
:
928 case IDC_RLLUSEREDIT
:
929 return "JI(`',`rlogin.localuser')";
932 return "JI(`',`ssh.nopty')";
933 case IDC_CIPHERSTATIC2
:
938 return "JI(`',`ssh.ciphers')";
939 case IDC_SSHPROTSTATIC
:
940 case IDC_SSHPROT1ONLY
:
943 case IDC_SSHPROT2ONLY
:
944 return "JI(`',`ssh.protocol')";
947 return "JI(`',`ssh.command')";
949 return "JI(`',`ssh.compress')";
954 return "JI(`',`ssh.auth.privkey')";
956 return "JI(`',`ssh.auth.agentfwd')";
958 return "JI(`',`ssh.auth.changeuser')";
960 return "JI(`',`ssh.auth.tis')";
962 return "JI(`',`ssh.auth.ki')";
967 return "JI(`',`selection.buttons')";
968 case IDC_MOUSEOVERRIDE
:
969 return "JI(`',`selection.shiftdrag')";
970 case IDC_SELTYPESTATIC
:
972 case IDC_SELTYPERECT
:
973 return "JI(`',`selection.rect')";
979 return "JI(`',`selection.charclasses')";
981 return "JI(`',`selection.linedraw')";
983 return "JI(`',`selection.rtf')";
986 return "JI(`',`colours.bold')";
988 return "JI(`',`colours.logpal')";
989 case IDC_COLOURSTATIC
:
998 return "JI(`',`colours.config')";
1000 case IDC_CODEPAGESTATIC
:
1002 return "JI(`',`translation.codepage')";
1003 case IDC_CAPSLOCKCYR
:
1004 return "JI(`',`translation.cyrillic')";
1006 case IDC_VTXWINDOWS
:
1011 return "JI(`',`translation.linedraw')";
1013 case IDC_X11_FORWARD
:
1014 case IDC_X11_DISPSTATIC
:
1015 case IDC_X11_DISPLAY
:
1016 return "JI(`',`ssh.tunnels.x11')";
1017 case IDC_PFWDSTATIC
:
1018 case IDC_PFWDSTATIC2
:
1019 case IDC_PFWDREMOVE
:
1022 case IDC_SPORTSTATIC
:
1024 case IDC_DPORTSTATIC
:
1027 case IDC_PFWDREMOTE
:
1028 return "JI(`',`ssh.tunnels.portfwd')";
1031 return "JI(`',`ssh.tunnels.portfwd.localhost')";
1033 case IDC_BUGS_IGNORE1
:
1034 case IDC_BUGD_IGNORE1
:
1035 return "JI(`',`ssh.bugs.ignore1')";
1036 case IDC_BUGS_PLAINPW1
:
1037 case IDC_BUGD_PLAINPW1
:
1038 return "JI(`',`ssh.bugs.plainpw1')";
1041 return "JI(`',`ssh.bugs.rsa1')";
1042 case IDC_BUGS_HMAC2
:
1043 case IDC_BUGD_HMAC2
:
1044 return "JI(`',`ssh.bugs.hmac2')";
1045 case IDC_BUGS_DERIVEKEY2
:
1046 case IDC_BUGD_DERIVEKEY2
:
1047 return "JI(`',`ssh.bugs.derivekey2')";
1048 case IDC_BUGS_RSAPAD2
:
1049 case IDC_BUGD_RSAPAD2
:
1050 return "JI(`',`ssh.bugs.rsapad2')";
1051 case IDC_BUGS_DHGEX2
:
1052 case IDC_BUGD_DHGEX2
:
1053 return "JI(`',`ssh.bugs.dhgex2')";
1060 /* 2nd arg: NZ => don't redraw session list (use when loading
1062 static void init_dlg_ctrls(HWND hwnd
, int keepsess
)
1065 char fontstatic
[256];
1067 SetDlgItemText(hwnd
, IDC_HOST
, cfg
.host
);
1068 SetDlgItemText(hwnd
, IDC_SESSEDIT
, savedsession
);
1071 n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_GETCOUNT
, 0, 0);
1072 for (i
= n
; i
-- > 0;)
1073 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_DELETESTRING
, i
, 0);
1074 for (i
= 0; i
< sesslist
.nsessions
; i
++)
1075 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_ADDSTRING
,
1076 0, (LPARAM
) (sesslist
.sessions
[i
]));
1078 SetDlgItemInt(hwnd
, IDC_PORT
, cfg
.port
, FALSE
);
1079 CheckRadioButton(hwnd
, IDC_PROTRAW
, IDC_PROTSSH
,
1080 cfg
.protocol
== PROT_SSH ? IDC_PROTSSH
:
1081 cfg
.protocol
== PROT_TELNET ? IDC_PROTTELNET
:
1083 PROT_RLOGIN ? IDC_PROTRLOGIN
: IDC_PROTRAW
);
1084 SetDlgItemInt(hwnd
, IDC_PINGEDIT
, cfg
.ping_interval
, FALSE
);
1085 CheckDlgButton(hwnd
, IDC_NODELAY
, cfg
.tcp_nodelay
);
1087 CheckRadioButton(hwnd
, IDC_DEL008
, IDC_DEL127
,
1088 cfg
.bksp_is_delete ? IDC_DEL127
: IDC_DEL008
);
1089 CheckRadioButton(hwnd
, IDC_HOMETILDE
, IDC_HOMERXVT
,
1090 cfg
.rxvt_homeend ? IDC_HOMERXVT
: IDC_HOMETILDE
);
1091 CheckRadioButton(hwnd
, IDC_FUNCTILDE
, IDC_FUNCSCO
,
1092 cfg
.funky_type
== 0 ? IDC_FUNCTILDE
:
1093 cfg
.funky_type
== 1 ? IDC_FUNCLINUX
:
1094 cfg
.funky_type
== 2 ? IDC_FUNCXTERM
:
1095 cfg
.funky_type
== 3 ? IDC_FUNCVT400
:
1096 cfg
.funky_type
== 4 ? IDC_FUNCVT100P
:
1097 cfg
.funky_type
== 5 ? IDC_FUNCSCO
: IDC_FUNCTILDE
);
1098 CheckDlgButton(hwnd
, IDC_NOAPPLICC
, cfg
.no_applic_c
);
1099 CheckDlgButton(hwnd
, IDC_NOAPPLICK
, cfg
.no_applic_k
);
1100 CheckDlgButton(hwnd
, IDC_NOMOUSEREP
, cfg
.no_mouse_rep
);
1101 CheckDlgButton(hwnd
, IDC_NORESIZE
, cfg
.no_remote_resize
);
1102 CheckDlgButton(hwnd
, IDC_NOALTSCREEN
, cfg
.no_alt_screen
);
1103 CheckDlgButton(hwnd
, IDC_NOWINTITLE
, cfg
.no_remote_wintitle
);
1104 CheckDlgButton(hwnd
, IDC_NODBACKSPACE
, cfg
.no_dbackspace
);
1105 CheckDlgButton(hwnd
, IDC_NOCHARSET
, cfg
.no_remote_charset
);
1106 CheckRadioButton(hwnd
, IDC_CURNORMAL
, IDC_CURAPPLIC
,
1107 cfg
.app_cursor ? IDC_CURAPPLIC
: IDC_CURNORMAL
);
1108 CheckRadioButton(hwnd
, IDC_KPNORMAL
, IDC_KPNH
,
1109 cfg
.nethack_keypad ? IDC_KPNH
:
1110 cfg
.app_keypad ? IDC_KPAPPLIC
: IDC_KPNORMAL
);
1111 CheckDlgButton(hwnd
, IDC_ALTF4
, cfg
.alt_f4
);
1112 CheckDlgButton(hwnd
, IDC_ALTSPACE
, cfg
.alt_space
);
1113 CheckDlgButton(hwnd
, IDC_ALTONLY
, cfg
.alt_only
);
1114 CheckDlgButton(hwnd
, IDC_COMPOSEKEY
, cfg
.compose_key
);
1115 CheckDlgButton(hwnd
, IDC_CTRLALTKEYS
, cfg
.ctrlaltkeys
);
1116 CheckDlgButton(hwnd
, IDC_TELNETKEY
, cfg
.telnet_keyboard
);
1117 CheckDlgButton(hwnd
, IDC_TELNETRET
, cfg
.telnet_newline
);
1118 CheckRadioButton(hwnd
, IDC_ECHOBACKEND
, IDC_ECHONO
,
1119 cfg
.localecho
== LD_BACKEND ? IDC_ECHOBACKEND
:
1120 cfg
.localecho
== LD_YES ? IDC_ECHOYES
: IDC_ECHONO
);
1121 CheckRadioButton(hwnd
, IDC_EDITBACKEND
, IDC_EDITNO
,
1122 cfg
.localedit
== LD_BACKEND ? IDC_EDITBACKEND
:
1123 cfg
.localedit
== LD_YES ? IDC_EDITYES
: IDC_EDITNO
);
1124 SetDlgItemText(hwnd
, IDC_ANSWEREDIT
, cfg
.answerback
);
1125 CheckDlgButton(hwnd
, IDC_ALWAYSONTOP
, cfg
.alwaysontop
);
1126 CheckDlgButton(hwnd
, IDC_FULLSCREENONALTENTER
, cfg
.fullscreenonaltenter
);
1127 CheckDlgButton(hwnd
, IDC_SCROLLKEY
, cfg
.scroll_on_key
);
1128 CheckDlgButton(hwnd
, IDC_SCROLLDISP
, cfg
.scroll_on_disp
);
1130 CheckDlgButton(hwnd
, IDC_WRAPMODE
, cfg
.wrap_mode
);
1131 CheckDlgButton(hwnd
, IDC_DECOM
, cfg
.dec_om
);
1132 CheckDlgButton(hwnd
, IDC_LFHASCR
, cfg
.lfhascr
);
1133 SetDlgItemInt(hwnd
, IDC_ROWSEDIT
, cfg
.height
, FALSE
);
1134 SetDlgItemInt(hwnd
, IDC_COLSEDIT
, cfg
.width
, FALSE
);
1135 SetDlgItemInt(hwnd
, IDC_SAVEEDIT
, cfg
.savelines
, FALSE
);
1136 fmtfont(fontstatic
);
1137 SetDlgItemText(hwnd
, IDC_FONTSTATIC
, fontstatic
);
1138 CheckRadioButton(hwnd
, IDC_BELL_DISABLED
, IDC_BELL_VISUAL
,
1139 cfg
.beep
== BELL_DISABLED ? IDC_BELL_DISABLED
:
1140 cfg
.beep
== BELL_DEFAULT ? IDC_BELL_DEFAULT
:
1141 cfg
.beep
== BELL_WAVEFILE ? IDC_BELL_WAVEFILE
:
1143 BELL_VISUAL ? IDC_BELL_VISUAL
: IDC_BELL_DEFAULT
);
1144 CheckRadioButton(hwnd
, IDC_B_IND_DISABLED
, IDC_B_IND_STEADY
,
1146 B_IND_DISABLED ? IDC_B_IND_DISABLED
: cfg
.beep_ind
==
1147 B_IND_FLASH ? IDC_B_IND_FLASH
: cfg
.beep_ind
==
1148 B_IND_STEADY ? IDC_B_IND_STEADY
: IDC_B_IND_DISABLED
);
1149 SetDlgItemText(hwnd
, IDC_BELL_WAVEEDIT
, cfg
.bell_wavefile
);
1150 CheckDlgButton(hwnd
, IDC_BELLOVL
, cfg
.bellovl
);
1151 SetDlgItemInt(hwnd
, IDC_BELLOVLN
, cfg
.bellovl_n
, FALSE
);
1152 MySetDlgItemFlt(hwnd
, IDC_BELLOVLT
, cfg
.bellovl_t
/ 1000.0);
1153 MySetDlgItemFlt(hwnd
, IDC_BELLOVLS
, cfg
.bellovl_s
/ 1000.0);
1155 CheckDlgButton(hwnd
, IDC_BCE
, cfg
.bce
);
1156 CheckDlgButton(hwnd
, IDC_BLINKTEXT
, cfg
.blinktext
);
1158 SetDlgItemText(hwnd
, IDC_WINEDIT
, cfg
.wintitle
);
1159 CheckDlgButton(hwnd
, IDC_WINNAME
, cfg
.win_name_always
);
1160 CheckDlgButton(hwnd
, IDC_HIDEMOUSE
, cfg
.hide_mouseptr
);
1161 CheckDlgButton(hwnd
, IDC_SUNKENEDGE
, cfg
.sunken_edge
);
1162 SetDlgItemInt(hwnd
, IDC_WINBEDIT
, cfg
.window_border
, FALSE
);
1163 CheckRadioButton(hwnd
, IDC_CURBLOCK
, IDC_CURVERT
,
1164 cfg
.cursor_type
== 0 ? IDC_CURBLOCK
:
1165 cfg
.cursor_type
== 1 ? IDC_CURUNDER
: IDC_CURVERT
);
1166 CheckDlgButton(hwnd
, IDC_BLINKCUR
, cfg
.blink_cur
);
1167 CheckDlgButton(hwnd
, IDC_SCROLLBAR
, cfg
.scrollbar
);
1168 CheckDlgButton(hwnd
, IDC_SCROLLBARFULLSCREEN
, cfg
.scrollbar_in_fullscreen
);
1169 CheckRadioButton(hwnd
, IDC_RESIZETERM
, IDC_RESIZEEITHER
,
1170 cfg
.resize_action
== RESIZE_TERM ? IDC_RESIZETERM
:
1171 cfg
.resize_action
== RESIZE_FONT ? IDC_RESIZEFONT
:
1172 cfg
.resize_action
== RESIZE_EITHER ? IDC_RESIZEEITHER
:
1174 CheckRadioButton(hwnd
, IDC_COEALWAYS
, IDC_COENORMAL
,
1175 cfg
.close_on_exit
== COE_NORMAL ? IDC_COENORMAL
:
1176 cfg
.close_on_exit
==
1177 COE_NEVER ? IDC_COENEVER
: IDC_COEALWAYS
);
1178 CheckDlgButton(hwnd
, IDC_CLOSEWARN
, cfg
.warn_on_close
);
1180 SetDlgItemText(hwnd
, IDC_TTEDIT
, cfg
.termtype
);
1181 SetDlgItemText(hwnd
, IDC_TSEDIT
, cfg
.termspeed
);
1182 SetDlgItemText(hwnd
, IDC_R_TSEDIT
, cfg
.termspeed
);
1183 SetDlgItemText(hwnd
, IDC_RLLUSEREDIT
, cfg
.localusername
);
1184 SetDlgItemText(hwnd
, IDC_LOGEDIT
, cfg
.username
);
1185 SetDlgItemText(hwnd
, IDC_LGFEDIT
, cfg
.logfilename
);
1186 CheckRadioButton(hwnd
, IDC_LSTATOFF
, IDC_LSTATPACKET
,
1187 cfg
.logtype
== LGTYP_NONE ? IDC_LSTATOFF
:
1188 cfg
.logtype
== LGTYP_ASCII ? IDC_LSTATASCII
:
1189 cfg
.logtype
== LGTYP_DEBUG ? IDC_LSTATRAW
:
1191 CheckRadioButton(hwnd
, IDC_LSTATXOVR
, IDC_LSTATXASK
,
1192 cfg
.logxfovr
== LGXF_OVR ? IDC_LSTATXOVR
:
1193 cfg
.logxfovr
== LGXF_ASK ? IDC_LSTATXASK
:
1196 char *p
= cfg
.environmt
;
1197 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_RESETCONTENT
, 0, 0);
1199 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_ADDSTRING
, 0,
1205 SendDlgItemMessage(hwnd
, IDC_PFWDLIST
, LB_ADDSTRING
, 0,
1210 CheckRadioButton(hwnd
, IDC_EMBSD
, IDC_EMRFC
,
1211 cfg
.rfc_environ ? IDC_EMRFC
: IDC_EMBSD
);
1212 CheckRadioButton(hwnd
, IDC_TPASSIVE
, IDC_TACTIVE
,
1213 cfg
.passive_telnet ? IDC_TPASSIVE
: IDC_TACTIVE
);
1215 SetDlgItemText(hwnd
, IDC_TTEDIT
, cfg
.termtype
);
1216 SetDlgItemText(hwnd
, IDC_LOGEDIT
, cfg
.username
);
1217 CheckDlgButton(hwnd
, IDC_NOPTY
, cfg
.nopty
);
1218 CheckDlgButton(hwnd
, IDC_COMPRESS
, cfg
.compression
);
1219 CheckDlgButton(hwnd
, IDC_SSH2DES
, cfg
.ssh2_des_cbc
);
1220 CheckDlgButton(hwnd
, IDC_AGENTFWD
, cfg
.agentfwd
);
1221 CheckDlgButton(hwnd
, IDC_CHANGEUSER
, cfg
.change_username
);
1222 CheckRadioButton(hwnd
, IDC_SSHPROT1ONLY
, IDC_SSHPROT2ONLY
,
1223 cfg
.sshprot
== 1 ? IDC_SSHPROT1
:
1224 cfg
.sshprot
== 2 ? IDC_SSHPROT2
:
1225 cfg
.sshprot
== 3 ? IDC_SSHPROT2ONLY
: IDC_SSHPROT1ONLY
);
1226 CheckDlgButton(hwnd
, IDC_AUTHTIS
, cfg
.try_tis_auth
);
1227 CheckDlgButton(hwnd
, IDC_AUTHKI
, cfg
.try_ki_auth
);
1228 SetDlgItemText(hwnd
, IDC_PKEDIT
, cfg
.keyfile
);
1229 SetDlgItemText(hwnd
, IDC_CMDEDIT
, cfg
.remote_cmd
);
1233 static const struct { char *s
; int c
; } ciphers
[] = {
1234 { "3DES", CIPHER_3DES
},
1235 { "Blowfish", CIPHER_BLOWFISH
},
1236 { "DES", CIPHER_DES
},
1237 { "AES (SSH 2 only)", CIPHER_AES
},
1238 { "-- warn below here --", CIPHER_WARN
}
1241 /* Set up the "selected ciphers" box. */
1242 /* (cipherlist assumed to contain all ciphers) */
1243 SendDlgItemMessage(hwnd
, IDC_CIPHERLIST
, LB_RESETCONTENT
, 0, 0);
1244 for (i
= 0; i
< CIPHER_MAX
; i
++) {
1245 int c
= cfg
.ssh_cipherlist
[i
];
1248 for (j
= 0; j
< (sizeof ciphers
) / (sizeof ciphers
[0]); j
++) {
1249 if (ciphers
[j
].c
== c
) {
1250 cstr
= ciphers
[j
].s
;
1254 pos
= SendDlgItemMessage(hwnd
, IDC_CIPHERLIST
, LB_ADDSTRING
,
1256 SendDlgItemMessage(hwnd
, IDC_CIPHERLIST
, LB_SETITEMDATA
,
1262 CheckRadioButton(hwnd
, IDC_MBWINDOWS
, IDC_MBXTERM
,
1263 cfg
.mouse_is_xterm ? IDC_MBXTERM
: IDC_MBWINDOWS
);
1264 CheckRadioButton(hwnd
, IDC_SELTYPELEX
, IDC_SELTYPERECT
,
1265 cfg
.rect_select
== 0 ? IDC_SELTYPELEX
: IDC_SELTYPERECT
);
1266 CheckDlgButton(hwnd
, IDC_MOUSEOVERRIDE
, cfg
.mouse_override
);
1267 CheckDlgButton(hwnd
, IDC_RAWCNP
, cfg
.rawcnp
);
1268 CheckDlgButton(hwnd
, IDC_RTFPASTE
, cfg
.rtf_paste
);
1270 static int tabs
[4] = { 25, 61, 96, 128 };
1271 SendDlgItemMessage(hwnd
, IDC_CCLIST
, LB_SETTABSTOPS
, 4,
1274 for (i
= 0; i
< 128; i
++) {
1276 sprintf(str
, "%d\t(0x%02X)\t%c\t%d", i
, i
,
1277 (i
>= 0x21 && i
!= 0x7F) ? i
: ' ', cfg
.wordness
[i
]);
1278 SendDlgItemMessage(hwnd
, IDC_CCLIST
, LB_ADDSTRING
, 0,
1282 CheckDlgButton(hwnd
, IDC_BOLDCOLOUR
, cfg
.bold_colour
);
1283 CheckDlgButton(hwnd
, IDC_PALETTE
, cfg
.try_palette
);
1286 n
= SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, LB_GETCOUNT
, 0, 0);
1287 for (i
= n
; i
-- > 0;)
1288 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
1289 LB_DELETESTRING
, i
, 0);
1290 for (i
= 0; i
< 22; i
++)
1291 if (cfg
.bold_colour
|| permcolour
[i
])
1292 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, LB_ADDSTRING
, 0,
1293 (LPARAM
) colours
[i
]);
1295 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, LB_SETCURSEL
, 0, 0);
1296 SetDlgItemInt(hwnd
, IDC_RVALUE
, cfg
.colours
[0][0], FALSE
);
1297 SetDlgItemInt(hwnd
, IDC_GVALUE
, cfg
.colours
[0][1], FALSE
);
1298 SetDlgItemInt(hwnd
, IDC_BVALUE
, cfg
.colours
[0][2], FALSE
);
1303 strcpy(cfg
.line_codepage
, cp_name(decode_codepage(cfg
.line_codepage
)));
1304 SendDlgItemMessage(hwnd
, IDC_CODEPAGE
, CB_RESETCONTENT
, 0, 0);
1305 CheckDlgButton (hwnd
, IDC_CAPSLOCKCYR
, cfg
.xlat_capslockcyr
);
1306 for (i
= 0; (cp
= cp_enumerate(i
)) != NULL
; i
++) {
1307 SendDlgItemMessage(hwnd
, IDC_CODEPAGE
, CB_ADDSTRING
,
1310 SetDlgItemText(hwnd
, IDC_CODEPAGE
, cfg
.line_codepage
);
1316 pe
= printer_start_enum(&nprinters
);
1317 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_RESETCONTENT
, 0, 0);
1318 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_ADDSTRING
,
1319 0, (LPARAM
) PRINTER_DISABLED_STRING
);
1320 for (i
= 0; i
< nprinters
; i
++) {
1321 char *printer_name
= printer_get_name(pe
, i
);
1322 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_ADDSTRING
,
1323 0, (LPARAM
) printer_name
);
1325 printer_finish_enum(pe
);
1326 SetDlgItemText(hwnd
, IDC_PRINTER
,
1327 *cfg
.printer ? cfg
.printer
: PRINTER_DISABLED_STRING
);
1330 CheckRadioButton(hwnd
, IDC_VTXWINDOWS
, IDC_VTUNICODE
,
1331 cfg
.vtmode
== VT_XWINDOWS ? IDC_VTXWINDOWS
:
1332 cfg
.vtmode
== VT_OEMANSI ? IDC_VTOEMANSI
:
1333 cfg
.vtmode
== VT_OEMONLY ? IDC_VTOEMONLY
:
1334 cfg
.vtmode
== VT_UNICODE ? IDC_VTUNICODE
:
1337 CheckDlgButton(hwnd
, IDC_X11_FORWARD
, cfg
.x11_forward
);
1338 SetDlgItemText(hwnd
, IDC_X11_DISPLAY
, cfg
.x11_display
);
1340 CheckDlgButton(hwnd
, IDC_LPORT_ALL
, cfg
.lport_acceptall
);
1341 CheckDlgButton(hwnd
, IDC_RPORT_ALL
, cfg
.rport_acceptall
);
1342 CheckRadioButton(hwnd
, IDC_PFWDLOCAL
, IDC_PFWDREMOTE
, IDC_PFWDLOCAL
);
1345 CheckRadioButton(hwnd
, IDC_PROXYTYPENONE
, IDC_PROXYTYPETELNET
,
1346 cfg
.proxy_type
== PROXY_HTTP ? IDC_PROXYTYPEHTTP
:
1347 cfg
.proxy_type
== PROXY_SOCKS ? IDC_PROXYTYPESOCKS
:
1348 cfg
.proxy_type
== PROXY_TELNET ? IDC_PROXYTYPETELNET
: IDC_PROXYTYPENONE
);
1349 SetDlgItemText(hwnd
, IDC_PROXYHOSTEDIT
, cfg
.proxy_host
);
1350 SetDlgItemInt(hwnd
, IDC_PROXYPORTEDIT
, cfg
.proxy_port
, FALSE
);
1351 SetDlgItemText(hwnd
, IDC_PROXYEXCLUDEEDIT
, cfg
.proxy_exclude_list
);
1352 SetDlgItemText(hwnd
, IDC_PROXYTELNETCMDEDIT
, cfg
.proxy_telnet_command
);
1353 SetDlgItemText(hwnd
, IDC_PROXYUSEREDIT
, cfg
.proxy_username
);
1354 SetDlgItemText(hwnd
, IDC_PROXYPASSEDIT
, cfg
.proxy_password
);
1355 CheckRadioButton(hwnd
, IDC_PROXYSOCKSVER5
, IDC_PROXYSOCKSVER4
,
1356 cfg
.proxy_socks_version
== 4 ? IDC_PROXYSOCKSVER4
: IDC_PROXYSOCKSVER5
);
1358 /* SSH bugs config */
1359 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_RESETCONTENT
, 0, 0);
1360 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1361 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1362 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1363 SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
, CB_SETCURSEL
,
1364 cfg
.sshbug_ignore1
== BUG_ON ?
2 :
1365 cfg
.sshbug_ignore1
== BUG_OFF ?
1 : 0, 0);
1366 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_RESETCONTENT
, 0, 0);
1367 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1368 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1369 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1370 SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
, CB_SETCURSEL
,
1371 cfg
.sshbug_plainpw1
== BUG_ON ?
2 :
1372 cfg
.sshbug_plainpw1
== BUG_OFF ?
1 : 0, 0);
1373 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_RESETCONTENT
, 0, 0);
1374 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1375 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1376 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1377 SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
, CB_SETCURSEL
,
1378 cfg
.sshbug_rsa1
== BUG_ON ?
2 :
1379 cfg
.sshbug_rsa1
== BUG_OFF ?
1 : 0, 0);
1380 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_RESETCONTENT
, 0, 0);
1381 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1382 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1383 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1384 SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
, CB_SETCURSEL
,
1385 cfg
.sshbug_hmac2
== BUG_ON ?
2 :
1386 cfg
.sshbug_hmac2
== BUG_OFF ?
1 : 0, 0);
1387 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_RESETCONTENT
, 0, 0);
1388 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1389 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1390 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1391 SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
, CB_SETCURSEL
,
1392 cfg
.sshbug_derivekey2
== BUG_ON ?
2 :
1393 cfg
.sshbug_derivekey2
== BUG_OFF ?
1 : 0, 0);
1394 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_RESETCONTENT
, 0, 0);
1395 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1396 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1397 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1398 SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
, CB_SETCURSEL
,
1399 cfg
.sshbug_rsapad2
== BUG_ON ?
2 :
1400 cfg
.sshbug_rsapad2
== BUG_OFF ?
1 : 0, 0);
1401 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_RESETCONTENT
, 0, 0);
1402 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_ADDSTRING
, 0, (LPARAM
)"Auto");
1403 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_ADDSTRING
, 0, (LPARAM
)"Off");
1404 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_ADDSTRING
, 0, (LPARAM
)"On");
1405 SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
, CB_SETCURSEL
,
1406 cfg
.sshbug_dhgex2
== BUG_ON ?
2 :
1407 cfg
.sshbug_dhgex2
== BUG_OFF ?
1 : 0, 0);
1410 struct treeview_faff
{
1412 HTREEITEM lastat
[4];
1415 static HTREEITEM
treeview_insert(struct treeview_faff
*faff
,
1416 int level
, char *text
)
1421 ins
.hParent
= (level
> 0 ? faff
->lastat
[level
- 1] : TVI_ROOT
);
1422 ins
.hInsertAfter
= faff
->lastat
[level
];
1423 #if _WIN32_IE >= 0x0400 && defined NONAMELESSUNION
1424 #define INSITEM DUMMYUNIONNAME.item
1426 #define INSITEM item
1428 ins
.INSITEM
.mask
= TVIF_TEXT
;
1429 ins
.INSITEM
.pszText
= text
;
1430 newitem
= TreeView_InsertItem(faff
->treeview
, &ins
);
1432 TreeView_Expand(faff
->treeview
, faff
->lastat
[level
- 1],
1434 faff
->lastat
[level
] = newitem
;
1435 for (i
= level
+ 1; i
< 4; i
++)
1436 faff
->lastat
[i
] = NULL
;
1441 * Create the panelfuls of controls in the configuration box.
1443 static void create_controls(HWND hwnd
, int dlgtype
, int panel
)
1445 if (panel
== sessionpanelstart
) {
1446 /* The Session panel. Accelerators used: [acgoh] nprtis elvd w */
1448 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1449 bartitle(&cp
, "Basic options for your PuTTY session",
1452 beginbox(&cp
, "Specify your connection by host name or IP address",
1455 "Host &Name (or IP address)",
1456 IDC_HOSTSTATIC
, IDC_HOST
, 75,
1457 "&Port", IDC_PORTSTATIC
, IDC_PORT
, 25, NULL
);
1458 if (backends
[3].backend
== NULL
) {
1459 /* this is PuTTYtel, so only three protocols available */
1460 radioline(&cp
, "Protocol:", IDC_PROTSTATIC
, 3,
1461 "&Raw", IDC_PROTRAW
,
1462 "&Telnet", IDC_PROTTELNET
,
1463 "Rlog&in", IDC_PROTRLOGIN
, NULL
);
1465 radioline(&cp
, "Protocol:", IDC_PROTSTATIC
, 4,
1466 "&Raw", IDC_PROTRAW
,
1467 "&Telnet", IDC_PROTTELNET
,
1468 "Rlog&in", IDC_PROTRLOGIN
,
1477 beginbox(&cp
, "Load, save or delete a stored session",
1479 sesssaver(&cp
, "Sav&ed Sessions",
1480 IDC_SESSSTATIC
, IDC_SESSEDIT
, IDC_SESSLIST
,
1481 "&Load", IDC_SESSLOAD
,
1482 "Sa&ve", IDC_SESSSAVE
, "&Delete", IDC_SESSDEL
, NULL
);
1485 beginbox(&cp
, NULL
, IDC_BOX_SESSION3
);
1486 radioline(&cp
, "Close &window on exit:", IDC_CLOSEEXIT
, 4,
1487 "Always", IDC_COEALWAYS
,
1488 "Never", IDC_COENEVER
,
1489 "Only on clean exit", IDC_COENORMAL
, NULL
);
1493 if (panel
== loggingpanelstart
) {
1494 /* The Logging panel. Accelerators used: [acgoh] tplsfwe */
1496 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1497 bartitle(&cp
, "Options controlling session logging",
1499 beginbox(&cp
, NULL
, IDC_BOX_LOGGING1
);
1501 "Session logging:", IDC_LSTATSTATIC
,
1502 "Logging &turned off completely", IDC_LSTATOFF
,
1503 "Log &printable output only", IDC_LSTATASCII
,
1504 "&Log all session output", IDC_LSTATRAW
,
1505 "Log &SSH packet data", IDC_LSTATPACKET
,
1507 editbutton(&cp
, "Log &file name:",
1508 IDC_LGFSTATIC
, IDC_LGFEDIT
, "Bro&wse...",
1510 statictext(&cp
, "(Log file name can contain &&Y, &&M, &&D for date,"
1511 " &&T for time, and &&H for host name)", 2, IDC_LGFEXPLAIN
);
1513 "What to do if the log file already &exists:",
1514 IDC_LSTATXIST
, "Always overwrite it", IDC_LSTATXOVR
,
1515 "Always append to the end of it", IDC_LSTATXAPN
,
1516 "Ask the user every time", IDC_LSTATXASK
, NULL
);
1520 if (panel
== terminalpanelstart
) {
1521 /* The Terminal panel. Accelerators used: [acgoh] wdren lts p */
1523 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1524 bartitle(&cp
, "Options controlling the terminal emulation",
1525 IDC_TITLE_TERMINAL
);
1526 beginbox(&cp
, "Set various terminal options", IDC_BOX_TERMINAL1
);
1527 checkbox(&cp
, "Auto &wrap mode initially on", IDC_WRAPMODE
);
1528 checkbox(&cp
, "&DEC Origin Mode initially on", IDC_DECOM
);
1529 checkbox(&cp
, "Implicit C&R in every LF", IDC_LFHASCR
);
1530 checkbox(&cp
, "Use background colour to &erase screen", IDC_BCE
);
1531 checkbox(&cp
, "Enable bli&nking text", IDC_BLINKTEXT
);
1533 "An&swerback to ^E:", IDC_ANSWERBACK
,
1534 IDC_ANSWEREDIT
, 100, NULL
);
1537 beginbox(&cp
, "Line discipline options", IDC_BOX_TERMINAL2
);
1538 radioline(&cp
, "&Local echo:", IDC_ECHOSTATIC
, 3,
1539 "Auto", IDC_ECHOBACKEND
,
1540 "Force on", IDC_ECHOYES
, "Force off", IDC_ECHONO
, NULL
);
1541 radioline(&cp
, "Local line edi&ting:", IDC_EDITSTATIC
, 3,
1542 "Auto", IDC_EDITBACKEND
,
1543 "Force on", IDC_EDITYES
, "Force off", IDC_EDITNO
, NULL
);
1546 beginbox(&cp
, "Remote-controlled printing", IDC_BOX_TERMINAL3
);
1547 combobox(&cp
, "&Printer to send ANSI printer output to:",
1548 IDC_PRINTERSTATIC
, IDC_PRINTER
);
1552 if (panel
== featurespanelstart
) {
1553 /* The Features panel. Accelerators used: [acgoh] ukswtbrx */
1555 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1556 bartitle(&cp
, "Enabling and disabling advanced terminal features ",
1557 IDC_TITLE_FEATURES
);
1558 beginbox(&cp
, NULL
, IDC_BOX_FEATURES1
);
1559 checkbox(&cp
, "Disable application c&ursor keys mode", IDC_NOAPPLICC
);
1560 checkbox(&cp
, "Disable application &keypad mode", IDC_NOAPPLICK
);
1561 checkbox(&cp
, "Disable &xterm-style mouse reporting", IDC_NOMOUSEREP
);
1562 checkbox(&cp
, "Disable remote-controlled terminal re&sizing",
1564 checkbox(&cp
, "Disable s&witching to alternate terminal screen",
1566 checkbox(&cp
, "Disable remote-controlled window &title changing",
1568 checkbox(&cp
, "Disable destructive &backspace on server sending ^?",
1570 checkbox(&cp
, "Disable remote-controlled cha&racter set configuration",
1575 if (panel
== bellpanelstart
) {
1576 /* The Bell panel. Accelerators used: [acgoh] bdsm wit */
1578 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1579 bartitle(&cp
, "Options controlling the terminal bell",
1581 beginbox(&cp
, "Set the style of bell", IDC_BOX_BELL1
);
1583 "Action to happen when a &bell occurs:", IDC_BELLSTATIC
,
1584 "None (bell disabled)", IDC_BELL_DISABLED
,
1585 "Play Windows Default Sound", IDC_BELL_DEFAULT
,
1586 "Play a custom sound file", IDC_BELL_WAVEFILE
,
1587 "Visual bell (flash window)", IDC_BELL_VISUAL
, NULL
);
1588 editbutton(&cp
, "Custom sound file to play as a bell:",
1589 IDC_BELL_WAVESTATIC
, IDC_BELL_WAVEEDIT
,
1590 "Bro&wse...", IDC_BELL_WAVEBROWSE
);
1591 radioline(&cp
, "Taskbar/caption &indication on bell:",
1592 IDC_B_IND_STATIC
, 3, "Disabled", IDC_B_IND_DISABLED
,
1593 "Flashing", IDC_B_IND_FLASH
, "Steady", IDC_B_IND_STEADY
,
1596 beginbox(&cp
, "Control the bell overload behaviour",
1598 checkbox(&cp
, "Bell is temporarily &disabled when over-used",
1600 staticedit(&cp
, "Over-use means this &many bells...",
1601 IDC_BELLOVLNSTATIC
, IDC_BELLOVLN
, 20);
1602 staticedit(&cp
, "... in &this many seconds",
1603 IDC_BELLOVLTSTATIC
, IDC_BELLOVLT
, 20);
1605 "The bell is re-enabled after a few seconds of silence.",
1606 1, IDC_BELLOVLEXPLAIN
);
1607 staticedit(&cp
, "Seconds of &silence required", IDC_BELLOVLSSTATIC
,
1612 if (panel
== keyboardpanelstart
) {
1613 /* The Keyboard panel. Accelerators used: [acgoh] bef rntd */
1615 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1616 bartitle(&cp
, "Options controlling the effects of keys",
1617 IDC_TITLE_KEYBOARD
);
1618 beginbox(&cp
, "Change the sequences sent by:", IDC_BOX_KEYBOARD1
);
1619 radioline(&cp
, "The &Backspace key", IDC_DELSTATIC
, 2,
1620 "Control-H", IDC_DEL008
,
1621 "Control-? (127)", IDC_DEL127
, NULL
);
1622 radioline(&cp
, "The Home and &End keys", IDC_HOMESTATIC
, 2,
1623 "Standard", IDC_HOMETILDE
, "rxvt", IDC_HOMERXVT
, NULL
);
1624 radioline(&cp
, "The &Function keys and keypad", IDC_FUNCSTATIC
, 3,
1625 "ESC[n~", IDC_FUNCTILDE
,
1626 "Linux", IDC_FUNCLINUX
,
1627 "Xterm R6", IDC_FUNCXTERM
,
1628 "VT400", IDC_FUNCVT400
,
1629 "VT100+", IDC_FUNCVT100P
, "SCO", IDC_FUNCSCO
, NULL
);
1631 beginbox(&cp
, "Application keypad settings:", IDC_BOX_KEYBOARD2
);
1632 radioline(&cp
, "Initial state of cu&rsor keys:", IDC_CURSTATIC
, 2,
1633 "Normal", IDC_CURNORMAL
,
1634 "Application", IDC_CURAPPLIC
, NULL
);
1635 radioline(&cp
, "Initial state of &numeric keypad:", IDC_KPSTATIC
,
1636 3, "Normal", IDC_KPNORMAL
, "Application", IDC_KPAPPLIC
,
1637 "NetHack", IDC_KPNH
, NULL
);
1639 beginbox(&cp
, "Enable extra keyboard features:",
1641 checkbox(&cp
, "AltGr ac&ts as Compose key", IDC_COMPOSEKEY
);
1642 checkbox(&cp
, "Control-Alt is &different from AltGr",
1647 if (panel
== windowpanelstart
) {
1648 /* The Window panel. Accelerators used: [acgoh] rmz sdikp */
1650 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1651 bartitle(&cp
, "Options controlling PuTTY's window",
1653 beginbox(&cp
, "Set the size of the window", IDC_BOX_WINDOW1
);
1655 "&Rows", IDC_ROWSSTATIC
, IDC_ROWSEDIT
, 50,
1656 "Colu&mns", IDC_COLSSTATIC
, IDC_COLSEDIT
, 50, NULL
);
1657 radiobig(&cp
, "When window is resi&zed:", IDC_RESIZESTATIC
,
1658 "Change the number of rows and columns", IDC_RESIZETERM
,
1659 "Change the size of the font", IDC_RESIZEFONT
,
1660 "Change font size only when maximised", IDC_RESIZEEITHER
,
1661 "Forbid resizing completely", IDC_RESIZENONE
, NULL
);
1663 beginbox(&cp
, "Control the scrollback in the window",
1665 staticedit(&cp
, "Lines of &scrollback",
1666 IDC_SAVESTATIC
, IDC_SAVEEDIT
, 50);
1667 checkbox(&cp
, "&Display scrollbar", IDC_SCROLLBAR
);
1668 checkbox(&cp
, "D&isplay scrollbar in full screen mode", IDC_SCROLLBARFULLSCREEN
);
1669 checkbox(&cp
, "Reset scrollback on &keypress", IDC_SCROLLKEY
);
1670 checkbox(&cp
, "Reset scrollback on dis&play activity",
1675 if (panel
== appearancepanelstart
) {
1676 /* The Appearance panel. Accelerators used: [acgoh] luvb n ti p s */
1678 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1679 bartitle(&cp
, "Configure the appearance of PuTTY's window",
1680 IDC_TITLE_APPEARANCE
);
1681 beginbox(&cp
, "Adjust the use of the cursor", IDC_BOX_APPEARANCE1
);
1682 radioline(&cp
, "Cursor appearance:", IDC_CURSORSTATIC
, 3,
1683 "B&lock", IDC_CURBLOCK
,
1684 "&Underline", IDC_CURUNDER
,
1685 "&Vertical line", IDC_CURVERT
, NULL
);
1686 checkbox(&cp
, "Cursor &blinks", IDC_BLINKCUR
);
1688 beginbox(&cp
, "Set the font used in the terminal window",
1689 IDC_BOX_APPEARANCE2
);
1690 staticbtn(&cp
, "", IDC_FONTSTATIC
, "Cha&nge...", IDC_CHOOSEFONT
);
1692 beginbox(&cp
, "Adjust the use of the window title",
1693 IDC_BOX_APPEARANCE3
);
1695 "Window &title:", IDC_WINTITLE
, IDC_WINEDIT
, 100, NULL
);
1696 checkbox(&cp
, "Avoid ever using &icon title", IDC_WINNAME
);
1698 beginbox(&cp
, "Adjust the use of the mouse pointer",
1699 IDC_BOX_APPEARANCE4
);
1700 checkbox(&cp
, "Hide mouse &pointer when typing in window",
1703 beginbox(&cp
, "Adjust the window border", IDC_BOX_APPEARANCE5
);
1704 checkbox(&cp
, "&Sunken-edge border (slightly thicker)",
1706 staticedit(&cp
, "Gap between text and window edge",
1707 IDC_WINBSTATIC
, IDC_WINBEDIT
, 20);
1711 if (panel
== behaviourpanelstart
) {
1712 /* The Behaviour panel. Accelerators used: [acgoh] w4yltf */
1714 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1715 bartitle(&cp
, "Configure the behaviour of PuTTY's window",
1717 beginbox(&cp
, NULL
, IDC_BOX_BEHAVIOUR1
);
1718 checkbox(&cp
, "&Warn before closing window", IDC_CLOSEWARN
);
1719 checkbox(&cp
, "Window closes on ALT-F&4", IDC_ALTF4
);
1720 checkbox(&cp
, "S&ystem menu appears on ALT-Space", IDC_ALTSPACE
);
1721 checkbox(&cp
, "System menu appears on A< alone", IDC_ALTONLY
);
1722 checkbox(&cp
, "Ensure window is always on &top", IDC_ALWAYSONTOP
);
1723 checkbox(&cp
, "&Full screen on Alt-Enter", IDC_FULLSCREENONALTENTER
);
1727 if (panel
== translationpanelstart
) {
1728 /* The Translation panel. Accelerators used: [acgoh] rxbepus */
1730 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1731 bartitle(&cp
, "Options controlling character set translation",
1732 IDC_TITLE_TRANSLATION
);
1733 beginbox(&cp
, "Character set translation on received data",
1734 IDC_BOX_TRANSLATION1
);
1735 combobox(&cp
, "&Received data assumed to be in which character set:",
1736 IDC_CODEPAGESTATIC
, IDC_CODEPAGE
);
1738 beginbox(&cp
, "Enable character set translation on input data",
1739 IDC_BOX_TRANSLATION2
);
1740 checkbox(&cp
, "Cap&s Lock acts as Cyrillic switch",
1743 beginbox(&cp
, "Adjust how PuTTY displays line drawing characters",
1744 IDC_BOX_TRANSLATION3
);
1746 "Handling of line drawing characters:", IDC_VTSTATIC
,
1747 "Font has &XWindows encoding", IDC_VTXWINDOWS
,
1748 "Use font in &both ANSI and OEM modes", IDC_VTOEMANSI
,
1749 "Use font in O&EM mode only", IDC_VTOEMONLY
,
1750 "&Poor man's line drawing (" "+" ", " "-" " and " "|" ")",
1751 IDC_VTPOORMAN
, "&Unicode mode", IDC_VTUNICODE
, NULL
);
1755 if (panel
== selectionpanelstart
) {
1756 /* The Selection panel. Accelerators used: [acgoh] df wxp est nr */
1758 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1759 bartitle(&cp
, "Options controlling copy and paste",
1760 IDC_TITLE_SELECTION
);
1761 beginbox(&cp
, "Translation of pasted characters",
1762 IDC_BOX_SELECTION1
);
1764 "&Don't translate line drawing chars into +, - and |",
1767 "Paste to clipboard in RT&F as well as plain text",
1770 beginbox(&cp
, "Control which mouse button does which thing",
1771 IDC_BOX_SELECTION2
);
1772 radiobig(&cp
, "Action of mouse buttons:", IDC_MBSTATIC
,
1773 "&Windows (Right pastes, Middle extends)", IDC_MBWINDOWS
,
1774 "&xterm (Right extends, Middle pastes)", IDC_MBXTERM
,
1777 "Shift overrides a&pplication's use of mouse",
1780 "Default selection mode (Alt+drag does the other one):",
1781 IDC_SELTYPESTATIC
, 2,
1782 "&Normal", IDC_SELTYPELEX
,
1783 "&Rectangular block", IDC_SELTYPERECT
, NULL
);
1785 beginbox(&cp
, "Control the select-one-word-at-a-time mode",
1786 IDC_BOX_SELECTION3
);
1787 charclass(&cp
, "Charact&er classes:", IDC_CCSTATIC
, IDC_CCLIST
,
1788 "&Set", IDC_CCSET
, IDC_CCEDIT
,
1789 "&to class", IDC_CCSTATIC2
);
1793 if (panel
== colourspanelstart
) {
1794 /* The Colours panel. Accelerators used: [acgoh] blum */
1796 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1797 bartitle(&cp
, "Options controlling use of colours",
1799 beginbox(&cp
, "General options for colour usage",
1801 checkbox(&cp
, "&Bolded text is a different colour",
1803 checkbox(&cp
, "Attempt to use &logical palettes", IDC_PALETTE
);
1805 beginbox(&cp
, "Adjust the precise colours PuTTY displays",
1807 colouredit(&cp
, "Select a colo&ur and then click to modify it:",
1808 IDC_COLOURSTATIC
, IDC_COLOURLIST
,
1809 "&Modify...", IDC_CHANGE
,
1810 "Red:", IDC_RSTATIC
, IDC_RVALUE
,
1811 "Green:", IDC_GSTATIC
, IDC_GVALUE
,
1812 "Blue:", IDC_BSTATIC
, IDC_BVALUE
, NULL
);
1816 if (panel
== connectionpanelstart
) {
1817 /* The Connection panel. Accelerators used: [acgoh] tukn */
1819 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1820 bartitle(&cp
, "Options controlling the connection",
1821 IDC_TITLE_CONNECTION
);
1823 beginbox(&cp
, "Data to send to the server",
1824 IDC_BOX_CONNECTION1
);
1825 staticedit(&cp
, "Terminal-&type string", IDC_TTSTATIC
,
1827 staticedit(&cp
, "Auto-login &username", IDC_LOGSTATIC
,
1831 beginbox(&cp
, "Adjust telnet session.", IDC_BOX_CONNECTION1
);
1832 checkbox(&cp
, "Keyboard sends telnet Backspace and Interrupt",
1834 checkbox(&cp
, "Return key sends telnet New Line instead of ^M",
1838 beginbox(&cp
, "Sending of null packets to keep session active",
1839 IDC_BOX_CONNECTION2
);
1840 staticedit(&cp
, "Seconds between &keepalives (0 to turn off)",
1841 IDC_PINGSTATIC
, IDC_PINGEDIT
, 20);
1844 beginbox(&cp
, "Low-level TCP connection options",
1845 IDC_BOX_CONNECTION3
);
1846 checkbox(&cp
, "Disable &Nagle's algorithm (TCP_NODELAY option)",
1852 if (panel
== proxypanelstart
) {
1853 /* The Proxy panel. Accelerators used: [acgoh] ntslypeuwmv */
1855 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1857 bartitle(&cp
, "Options controlling proxy usage",
1859 beginbox(&cp
, "Proxy basics", IDC_BOX_PROXY1
);
1860 radioline(&cp
, "Proxy type:", IDC_PROXYTYPESTATIC
, 4,
1861 "&None", IDC_PROXYTYPENONE
,
1862 "H&TTP", IDC_PROXYTYPEHTTP
,
1863 "&SOCKS", IDC_PROXYTYPESOCKS
,
1864 "Te&lnet", IDC_PROXYTYPETELNET
, NULL
);
1866 "Prox&y Host", IDC_PROXYHOSTSTATIC
, IDC_PROXYHOSTEDIT
, 80,
1867 "&Port", IDC_PROXYPORTSTATIC
, IDC_PROXYPORTEDIT
, 20, NULL
);
1869 "&Exclude Hosts/IPs", IDC_PROXYEXCLUDESTATIC
,
1870 IDC_PROXYEXCLUDEEDIT
, 100, NULL
);
1871 staticedit(&cp
, "&Username", IDC_PROXYUSERSTATIC
,
1872 IDC_PROXYUSEREDIT
, 60);
1873 staticpassedit(&cp
, "Pass&word", IDC_PROXYPASSSTATIC
,
1874 IDC_PROXYPASSEDIT
, 60);
1876 beginbox(&cp
, "Misc. proxy settings", IDC_BOX_PROXY2
);
1878 "Telnet co&mmand", IDC_PROXYTELNETCMDSTATIC
,
1879 IDC_PROXYTELNETCMDEDIT
, 100, NULL
);
1880 radioline(&cp
, "SOCKS &Version", IDC_PROXYSOCKSVERSTATIC
,
1881 2, "Version 5", IDC_PROXYSOCKSVER5
, "Version 4",
1882 IDC_PROXYSOCKSVER4
, NULL
);
1887 if (panel
== telnetpanelstart
) {
1888 /* The Telnet panel. Accelerators used: [acgoh] svldr bftk */
1890 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1892 bartitle(&cp
, "Options controlling Telnet connections",
1894 beginbox(&cp
, "Data to send to the server", IDC_BOX_TELNET1
);
1895 staticedit(&cp
, "Terminal-&speed string", IDC_TSSTATIC
,
1897 envsetter(&cp
, "Environment variables:", IDC_ENVSTATIC
,
1898 "&Variable", IDC_VARSTATIC
, IDC_VAREDIT
, "Va&lue",
1899 IDC_VALSTATIC
, IDC_VALEDIT
, IDC_ENVLIST
, "A&dd",
1900 IDC_ENVADD
, "&Remove", IDC_ENVREMOVE
);
1902 beginbox(&cp
, "Telnet protocol adjustments", IDC_BOX_TELNET2
);
1903 radioline(&cp
, "Handling of OLD_ENVIRON ambiguity:",
1904 IDC_EMSTATIC
, 2, "&BSD (commonplace)", IDC_EMBSD
,
1905 "R&FC 1408 (unusual)", IDC_EMRFC
, NULL
);
1906 radioline(&cp
, "&Telnet negotiation mode:", IDC_ACTSTATIC
, 2,
1907 "Passive", IDC_TPASSIVE
, "Active",
1909 checkbox(&cp
, "&Keyboard sends telnet Backspace and Interrupt",
1911 checkbox(&cp
, "Return key sends telnet New Line instead of ^M",
1917 if (panel
== rloginpanelstart
) {
1918 /* The Rlogin panel. Accelerators used: [acgoh] sl */
1920 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1922 bartitle(&cp
, "Options controlling Rlogin connections",
1924 beginbox(&cp
, "Data to send to the server", IDC_BOX_RLOGIN1
);
1925 staticedit(&cp
, "Terminal-&speed string", IDC_R_TSSTATIC
,
1927 staticedit(&cp
, "&Local username:", IDC_RLLUSERSTATIC
,
1928 IDC_RLLUSEREDIT
, 50);
1933 if (panel
== sshpanelstart
) {
1934 /* The SSH panel. Accelerators used: [acgoh] r pe12ni sd */
1936 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1938 bartitle(&cp
, "Options controlling SSH connections",
1940 beginbox(&cp
, "Data to send to the server", IDC_BOX_SSH1
);
1942 "&Remote command:", IDC_CMDSTATIC
, IDC_CMDEDIT
, 100,
1945 beginbox(&cp
, "Protocol options", IDC_BOX_SSH2
);
1946 checkbox(&cp
, "Don't allocate a &pseudo-terminal", IDC_NOPTY
);
1947 checkbox(&cp
, "Enable compr&ession", IDC_COMPRESS
);
1948 radioline(&cp
, "Preferred SSH protocol version:",
1949 IDC_SSHPROTSTATIC
, 4,
1950 "1 on&ly", IDC_SSHPROT1ONLY
,
1951 "&1", IDC_SSHPROT1
, "&2", IDC_SSHPROT2
,
1952 "2 o&nly", IDC_SSHPROT2ONLY
, NULL
);
1954 beginbox(&cp
, "Encryption options", IDC_BOX_SSH3
);
1955 prefslist(&cipherlist
, &cp
, "Encryption cipher &selection policy:",
1956 IDC_CIPHERSTATIC2
, IDC_CIPHERLIST
, IDC_CIPHERUP
,
1958 checkbox(&cp
, "Enable non-standard use of single-&DES in SSH 2",
1964 if (panel
== sshauthpanelstart
) {
1965 /* The SSH authentication panel. Accelerators used: [acgoh] m fkiuw */
1967 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1969 bartitle(&cp
, "Options controlling SSH authentication",
1971 beginbox(&cp
, "Authentication methods",
1973 checkbox(&cp
, "Atte&mpt TIS or CryptoCard authentication (SSH1)",
1975 checkbox(&cp
, "Attempt \"keyboard-&interactive\" authentication"
1976 " (SSH2)", IDC_AUTHKI
);
1978 beginbox(&cp
, "Authentication parameters",
1980 checkbox(&cp
, "Allow agent &forwarding", IDC_AGENTFWD
);
1981 checkbox(&cp
, "Allow attempted changes of &username in SSH2",
1983 editbutton(&cp
, "Private &key file for authentication:",
1984 IDC_PKSTATIC
, IDC_PKEDIT
, "Bro&wse...",
1990 if (panel
== sshbugspanelstart
) {
1991 /* The SSH bugs panel. Accelerators used: [acgoh] isrmep */
1993 ctlposinit(&cp
, hwnd
, 80, 3, 13);
1995 bartitle(&cp
, "Workarounds for SSH server bugs",
1997 beginbox(&cp
, "Detection of known bugs in SSH servers",
1999 staticddl(&cp
, "Chokes on SSH1 &ignore messages",
2000 IDC_BUGS_IGNORE1
, IDC_BUGD_IGNORE1
, 20);
2001 staticddl(&cp
, "Refuses all SSH1 pa&ssword camouflage",
2002 IDC_BUGS_PLAINPW1
, IDC_BUGD_PLAINPW1
, 20);
2003 staticddl(&cp
, "Chokes on SSH1 &RSA authentication",
2004 IDC_BUGS_RSA1
, IDC_BUGD_RSA1
, 20);
2005 staticddl(&cp
, "Miscomputes SSH2 H&MAC keys",
2006 IDC_BUGS_HMAC2
, IDC_BUGD_HMAC2
, 20);
2007 staticddl(&cp
, "Miscomputes SSH2 &encryption keys",
2008 IDC_BUGS_DERIVEKEY2
, IDC_BUGD_DERIVEKEY2
, 20);
2009 staticddl(&cp
, "Requires &padding on SSH2 RSA signatures",
2010 IDC_BUGS_RSAPAD2
, IDC_BUGD_RSAPAD2
, 20);
2011 staticddl(&cp
, "Chokes on &Diffie-Hellman group exchange",
2012 IDC_BUGS_DHGEX2
, IDC_BUGD_DHGEX2
, 20);
2017 if (panel
== tunnelspanelstart
) {
2018 /* The Tunnels panel. Accelerators used: [acgoh] deilmrstxp */
2020 ctlposinit(&cp
, hwnd
, 80, 3, 13);
2022 bartitle(&cp
, "Options controlling SSH tunnelling",
2024 beginbox(&cp
, "X11 forwarding", IDC_BOX_TUNNELS1
);
2025 checkbox(&cp
, "&Enable X11 forwarding", IDC_X11_FORWARD
);
2026 multiedit(&cp
, "&X display location", IDC_X11_DISPSTATIC
,
2027 IDC_X11_DISPLAY
, 50, NULL
);
2029 beginbox(&cp
, "Port forwarding", IDC_BOX_TUNNELS2
);
2030 checkbox(&cp
, "Local ports accept connections from o&ther hosts",
2032 checkbox(&cp
, "Remote &ports do the same (SSH v2 only)",
2034 staticbtn(&cp
, "Forwarded ports:", IDC_PFWDSTATIC
,
2035 "&Remove", IDC_PFWDREMOVE
);
2036 fwdsetter(&cp
, IDC_PFWDLIST
,
2037 "Add new forwarded port:", IDC_PFWDSTATIC2
,
2038 "&Source port", IDC_SPORTSTATIC
, IDC_SPORTEDIT
,
2039 "Dest&ination", IDC_DPORTSTATIC
, IDC_DPORTEDIT
,
2040 "A&dd", IDC_PFWDADD
,
2041 "&Local", IDC_PFWDLOCAL
,
2042 "Re&mote", IDC_PFWDREMOTE
);
2050 * Helper function to load the session selected in SESSLIST
2051 * if any, as this is done in more than one place in
2052 * GenericMainDlgProc(). 0 => failure.
2054 static int load_selected_session(HWND hwnd
)
2056 int n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2057 LB_GETCURSEL
, 0, 0);
2063 isdef
= !strcmp(sesslist
.sessions
[n
], "Default Settings");
2064 load_settings(sesslist
.sessions
[n
], !isdef
, &cfg
);
2065 init_dlg_ctrls(hwnd
, TRUE
);
2067 SetDlgItemText(hwnd
, IDC_SESSEDIT
, sesslist
.sessions
[n
]);
2069 SetDlgItemText(hwnd
, IDC_SESSEDIT
, "");
2070 /* Restore the selection, which will have been clobbered by
2071 * SESSEDIT handling. */
2072 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
, n
, 0);
2077 * This function is the configuration box.
2079 static int GenericMainDlgProc(HWND hwnd
, UINT msg
,
2080 WPARAM wParam
, LPARAM lParam
, int dlgtype
)
2083 struct treeview_faff tvfaff
;
2086 char filename
[sizeof(cfg
.keyfile
)];
2089 char fontstatic
[256];
2091 struct servent
*service
;
2093 static UINT draglistmsg
= WM_NULL
;
2098 SetWindowLong(hwnd
, GWL_USERDATA
, 0);
2100 SetWindowLong(hwnd
, GWL_EXSTYLE
,
2101 GetWindowLong(hwnd
, GWL_EXSTYLE
) | WS_EX_CONTEXTHELP
);
2103 HWND item
= GetDlgItem(hwnd
, IDC_HELPBTN
);
2105 DestroyWindow(item
);
2107 requested_help
= FALSE
;
2108 SendMessage(hwnd
, WM_SETICON
, (WPARAM
) ICON_BIG
,
2109 (LPARAM
) LoadIcon(hinst
, MAKEINTRESOURCE(IDI_CFGICON
)));
2111 * Centre the window.
2113 { /* centre the window */
2116 hw
= GetDesktopWindow();
2117 if (GetWindowRect(hw
, &rs
) && GetWindowRect(hwnd
, &rd
))
2119 (rs
.right
+ rs
.left
+ rd
.left
- rd
.right
) / 2,
2120 (rs
.bottom
+ rs
.top
+ rd
.top
- rd
.bottom
) / 2,
2121 rd
.right
- rd
.left
, rd
.bottom
- rd
.top
, TRUE
);
2125 * Create the tree view.
2133 r
.right
= r
.left
+ 75;
2135 r
.bottom
= r
.top
+ 10;
2136 MapDialogRect(hwnd
, &r
);
2137 tvstatic
= CreateWindowEx(0, "STATIC", "Cate&gory:",
2138 WS_CHILD
| WS_VISIBLE
,
2140 r
.right
- r
.left
, r
.bottom
- r
.top
,
2141 hwnd
, (HMENU
) IDCX_TVSTATIC
, hinst
,
2143 font
= SendMessage(hwnd
, WM_GETFONT
, 0, 0);
2144 SendMessage(tvstatic
, WM_SETFONT
, font
, MAKELPARAM(TRUE
, 0));
2147 r
.right
= r
.left
+ 75;
2149 r
.bottom
= r
.top
+ 219;
2150 MapDialogRect(hwnd
, &r
);
2151 treeview
= CreateWindowEx(WS_EX_CLIENTEDGE
, WC_TREEVIEW
, "",
2152 WS_CHILD
| WS_VISIBLE
|
2153 WS_TABSTOP
| TVS_HASLINES
|
2154 TVS_DISABLEDRAGDROP
| TVS_HASBUTTONS
2156 TVS_SHOWSELALWAYS
, r
.left
, r
.top
,
2157 r
.right
- r
.left
, r
.bottom
- r
.top
,
2158 hwnd
, (HMENU
) IDCX_TREEVIEW
, hinst
,
2160 font
= SendMessage(hwnd
, WM_GETFONT
, 0, 0);
2161 SendMessage(treeview
, WM_SETFONT
, font
, MAKELPARAM(TRUE
, 0));
2162 tvfaff
.treeview
= treeview
;
2163 memset(tvfaff
.lastat
, 0, sizeof(tvfaff
.lastat
));
2167 * Set up the tree view contents.
2169 hsession
= treeview_insert(&tvfaff
, 0, "Session");
2170 treeview_insert(&tvfaff
, 1, "Logging");
2171 treeview_insert(&tvfaff
, 0, "Terminal");
2172 treeview_insert(&tvfaff
, 1, "Keyboard");
2173 treeview_insert(&tvfaff
, 1, "Bell");
2174 treeview_insert(&tvfaff
, 1, "Features");
2175 treeview_insert(&tvfaff
, 0, "Window");
2176 treeview_insert(&tvfaff
, 1, "Appearance");
2177 treeview_insert(&tvfaff
, 1, "Behaviour");
2178 treeview_insert(&tvfaff
, 1, "Translation");
2179 treeview_insert(&tvfaff
, 1, "Selection");
2180 treeview_insert(&tvfaff
, 1, "Colours");
2181 treeview_insert(&tvfaff
, 0, "Connection");
2183 treeview_insert(&tvfaff
, 1, "Proxy");
2184 treeview_insert(&tvfaff
, 1, "Telnet");
2185 treeview_insert(&tvfaff
, 1, "Rlogin");
2186 if (backends
[3].backend
!= NULL
) {
2187 treeview_insert(&tvfaff
, 1, "SSH");
2188 /* XXX long name is ugly */
2189 /* XXX make it closed by default? */
2190 treeview_insert(&tvfaff
, 2, "Auth");
2191 treeview_insert(&tvfaff
, 2, "Tunnels");
2192 treeview_insert(&tvfaff
, 2, "Bugs");
2197 * Put the treeview selection on to the Session panel. This
2198 * should also cause creation of the relevant controls.
2200 TreeView_SelectItem(treeview
, hsession
);
2203 * Set focus into the first available control.
2207 ctl
= GetDlgItem(hwnd
, IDC_HOST
);
2209 ctl
= GetDlgItem(hwnd
, IDC_CLOSEEXIT
);
2213 SetWindowLong(hwnd
, GWL_USERDATA
, 1);
2214 sesslist_has_focus
= 0;
2218 * Button release should trigger WM_OK if there was a
2219 * previous double click on the session list.
2223 SendMessage(hwnd
, WM_COMMAND
, IDOK
, 0);
2226 if (LOWORD(wParam
) == IDCX_TREEVIEW
&&
2227 ((LPNMHDR
) lParam
)->code
== TVN_SELCHANGED
) {
2229 TreeView_GetSelection(((LPNMHDR
) lParam
)->hwndFrom
);
2234 SendMessage (hwnd
, WM_SETREDRAW
, FALSE
, 0);
2237 item
.pszText
= buffer
;
2238 item
.cchTextMax
= sizeof(buffer
);
2239 item
.mask
= TVIF_TEXT
;
2240 TreeView_GetItem(((LPNMHDR
) lParam
)->hwndFrom
, &item
);
2241 for (j
= controlstartvalue
; j
< controlendvalue
; j
++) {
2242 HWND item
= GetDlgItem(hwnd
, j
);
2244 DestroyWindow(item
);
2246 if (!strcmp(buffer
, "Session"))
2247 create_controls(hwnd
, dlgtype
, sessionpanelstart
);
2248 if (!strcmp(buffer
, "Logging"))
2249 create_controls(hwnd
, dlgtype
, loggingpanelstart
);
2250 if (!strcmp(buffer
, "Keyboard"))
2251 create_controls(hwnd
, dlgtype
, keyboardpanelstart
);
2252 if (!strcmp(buffer
, "Terminal"))
2253 create_controls(hwnd
, dlgtype
, terminalpanelstart
);
2254 if (!strcmp(buffer
, "Bell"))
2255 create_controls(hwnd
, dlgtype
, bellpanelstart
);
2256 if (!strcmp(buffer
, "Features"))
2257 create_controls(hwnd
, dlgtype
, featurespanelstart
);
2258 if (!strcmp(buffer
, "Window"))
2259 create_controls(hwnd
, dlgtype
, windowpanelstart
);
2260 if (!strcmp(buffer
, "Appearance"))
2261 create_controls(hwnd
, dlgtype
, appearancepanelstart
);
2262 if (!strcmp(buffer
, "Behaviour"))
2263 create_controls(hwnd
, dlgtype
, behaviourpanelstart
);
2264 if (!strcmp(buffer
, "Tunnels"))
2265 create_controls(hwnd
, dlgtype
, tunnelspanelstart
);
2266 if (!strcmp(buffer
, "Connection"))
2267 create_controls(hwnd
, dlgtype
, connectionpanelstart
);
2268 if (!strcmp(buffer
, "Proxy"))
2269 create_controls(hwnd
, dlgtype
, proxypanelstart
);
2270 if (!strcmp(buffer
, "Telnet"))
2271 create_controls(hwnd
, dlgtype
, telnetpanelstart
);
2272 if (!strcmp(buffer
, "Rlogin"))
2273 create_controls(hwnd
, dlgtype
, rloginpanelstart
);
2274 if (!strcmp(buffer
, "SSH"))
2275 create_controls(hwnd
, dlgtype
, sshpanelstart
);
2276 if (!strcmp(buffer
, "Auth"))
2277 create_controls(hwnd
, dlgtype
, sshauthpanelstart
);
2278 if (!strcmp(buffer
, "Bugs"))
2279 create_controls(hwnd
, dlgtype
, sshbugspanelstart
);
2280 if (!strcmp(buffer
, "Selection"))
2281 create_controls(hwnd
, dlgtype
, selectionpanelstart
);
2282 if (!strcmp(buffer
, "Colours"))
2283 create_controls(hwnd
, dlgtype
, colourspanelstart
);
2284 if (!strcmp(buffer
, "Translation"))
2285 create_controls(hwnd
, dlgtype
, translationpanelstart
);
2287 init_dlg_ctrls(hwnd
, FALSE
);
2289 SendMessage (hwnd
, WM_SETREDRAW
, TRUE
, 0);
2290 InvalidateRect (hwnd
, NULL
, TRUE
);
2292 SetFocus(((LPNMHDR
) lParam
)->hwndFrom
); /* ensure focus stays */
2298 * Only process WM_COMMAND once the dialog is fully formed.
2300 if (GetWindowLong(hwnd
, GWL_USERDATA
) == 1)
2301 switch (LOWORD(wParam
)) {
2303 /* Behaviour of the "Open" button is different if the
2304 * session list has focus, *unless* the user just
2305 * double-clicked... */
2306 if (sesslist_has_focus
&& !readytogo
) {
2307 if (!load_selected_session(hwnd
)) {
2312 /* If at this point we have a valid session, go! */
2314 if (requested_help
) {
2315 WinHelp(hwnd
, help_path
, HELP_QUIT
, 0);
2316 requested_help
= FALSE
;
2323 if (HIWORD(wParam
) == BN_CLICKED
||
2324 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2326 WinHelp(hwnd
, help_path
,
2327 help_has_contents ? HELP_FINDER
: HELP_CONTENTS
,
2329 requested_help
= TRUE
;
2334 if (requested_help
) {
2335 WinHelp(hwnd
, help_path
, HELP_QUIT
, 0);
2336 requested_help
= FALSE
;
2340 case IDC_PROTTELNET
:
2341 case IDC_PROTRLOGIN
:
2344 if (HIWORD(wParam
) == BN_CLICKED
||
2345 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2346 int i
= IsDlgButtonChecked(hwnd
, IDC_PROTSSH
);
2347 int j
= IsDlgButtonChecked(hwnd
, IDC_PROTTELNET
);
2348 int k
= IsDlgButtonChecked(hwnd
, IDC_PROTRLOGIN
);
2350 i ? PROT_SSH
: j ? PROT_TELNET
: k ? PROT_RLOGIN
:
2353 * When switching using the arrow keys, we
2354 * appear to get two of these messages, both
2355 * mentioning the target button in
2356 * LOWORD(wParam), but one of them called while
2357 * the previous button is still checked. This
2358 * causes an unnecessary reset of the port
2359 * number field, which we fix by ensuring here
2360 * that the button selected is indeed the one
2363 if (IsDlgButtonChecked(hwnd
, LOWORD(wParam
)) &&
2364 ((cfg
.protocol
== PROT_SSH
&& cfg
.port
!= 22)
2365 || (cfg
.protocol
== PROT_TELNET
&& cfg
.port
!= 23)
2366 || (cfg
.protocol
== PROT_RLOGIN
2367 && cfg
.port
!= 513))) {
2368 cfg
.port
= i ?
22 : j ?
23 : 513;
2369 SetDlgItemInt(hwnd
, IDC_PORT
, cfg
.port
, FALSE
);
2374 if (HIWORD(wParam
) == EN_CHANGE
)
2375 GetDlgItemText(hwnd
, IDC_HOST
, cfg
.host
,
2376 sizeof(cfg
.host
) - 1);
2379 if (HIWORD(wParam
) == EN_CHANGE
) {
2380 GetDlgItemText(hwnd
, IDC_PORT
, portname
, 31);
2381 if (isdigit(portname
[0]))
2382 MyGetDlgItemInt(hwnd
, IDC_PORT
, &cfg
.port
);
2384 service
= getservbyname(portname
, NULL
);
2386 cfg
.port
= ntohs(service
->s_port
);
2393 if (HIWORD(wParam
) == EN_CHANGE
) {
2394 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
,
2396 GetDlgItemText(hwnd
, IDC_SESSEDIT
,
2397 savedsession
, sizeof(savedsession
) - 1);
2398 savedsession
[sizeof(savedsession
) - 1] = '\0';
2402 if (HIWORD(wParam
) == BN_CLICKED
||
2403 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2408 GetDlgItemText(hwnd
, IDC_SESSEDIT
, str
,
2411 int n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2412 LB_GETCURSEL
, 0, 0);
2417 strcpy(str
, sesslist
.sessions
[n
]);
2419 save_settings(str
, !!strcmp(str
, "Default Settings"),
2421 get_sesslist(&sesslist
, FALSE
);
2422 get_sesslist(&sesslist
, TRUE
);
2423 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2425 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_RESETCONTENT
,
2427 for (i
= 0; i
< sesslist
.nsessions
; i
++)
2428 SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2430 (LPARAM
) (sesslist
.sessions
[i
]));
2431 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
,
2433 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2435 InvalidateRect(GetDlgItem(hwnd
, IDC_SESSLIST
), NULL
,
2441 if (LOWORD(wParam
) == IDC_SESSLIST
) {
2442 if (HIWORD(wParam
) == LBN_SETFOCUS
)
2443 sesslist_has_focus
= 1;
2444 else if (HIWORD(wParam
) == LBN_KILLFOCUS
)
2445 sesslist_has_focus
= 0;
2447 if (LOWORD(wParam
) == IDC_SESSLOAD
&&
2448 HIWORD(wParam
) != BN_CLICKED
&&
2449 HIWORD(wParam
) != BN_DOUBLECLICKED
) break;
2450 if (LOWORD(wParam
) == IDC_SESSLIST
&&
2451 HIWORD(wParam
) != LBN_DBLCLK
) break;
2452 /* Load the session selected in SESSLIST. */
2453 if (load_selected_session(hwnd
) &&
2454 LOWORD(wParam
) == IDC_SESSLIST
) {
2456 * A double-click on a saved session should
2457 * actually start the session, not just load it.
2458 * Unless it's Default Settings or some other
2459 * host-less set of saved settings.
2468 if (HIWORD(wParam
) == BN_CLICKED
||
2469 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2470 int n
= SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2471 LB_GETCURSEL
, 0, 0);
2472 if (n
== LB_ERR
|| n
== 0) {
2476 del_settings(sesslist
.sessions
[n
]);
2477 get_sesslist(&sesslist
, FALSE
);
2478 get_sesslist(&sesslist
, TRUE
);
2479 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2481 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_RESETCONTENT
,
2483 for (i
= 0; i
< sesslist
.nsessions
; i
++)
2484 SendDlgItemMessage(hwnd
, IDC_SESSLIST
,
2486 (LPARAM
) (sesslist
.sessions
[i
]));
2487 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, LB_SETCURSEL
,
2489 SendDlgItemMessage(hwnd
, IDC_SESSLIST
, WM_SETREDRAW
,
2491 InvalidateRect(GetDlgItem(hwnd
, IDC_SESSLIST
), NULL
,
2495 if (HIWORD(wParam
) == EN_CHANGE
)
2496 MyGetDlgItemInt(hwnd
, IDC_PINGEDIT
,
2497 &cfg
.ping_interval
);
2500 if (HIWORD(wParam
) == BN_CLICKED
||
2501 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2503 IsDlgButtonChecked(hwnd
, IDC_NODELAY
);
2507 if (HIWORD(wParam
) == BN_CLICKED
||
2508 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2509 cfg
.bksp_is_delete
=
2510 IsDlgButtonChecked(hwnd
, IDC_DEL127
);
2514 if (HIWORD(wParam
) == BN_CLICKED
||
2515 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2517 IsDlgButtonChecked(hwnd
, IDC_HOMERXVT
);
2523 case IDC_FUNCVT100P
:
2525 if (HIWORD(wParam
) == BN_CLICKED
||
2526 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2527 switch (LOWORD(wParam
)) {
2540 case IDC_FUNCVT100P
:
2550 if (HIWORD(wParam
) == BN_CLICKED
||
2551 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2553 IsDlgButtonChecked(hwnd
, IDC_KPAPPLIC
);
2554 cfg
.nethack_keypad
= FALSE
;
2558 if (HIWORD(wParam
) == BN_CLICKED
||
2559 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2560 cfg
.app_keypad
= FALSE
;
2561 cfg
.nethack_keypad
= TRUE
;
2566 if (HIWORD(wParam
) == BN_CLICKED
||
2567 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2569 IsDlgButtonChecked(hwnd
, IDC_CURAPPLIC
);
2572 if (HIWORD(wParam
) == BN_CLICKED
||
2573 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2575 IsDlgButtonChecked(hwnd
, IDC_NOAPPLICC
);
2578 if (HIWORD(wParam
) == BN_CLICKED
||
2579 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2581 IsDlgButtonChecked(hwnd
, IDC_NOAPPLICK
);
2583 case IDC_NOMOUSEREP
:
2584 if (HIWORD(wParam
) == BN_CLICKED
||
2585 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2587 IsDlgButtonChecked(hwnd
, IDC_NOMOUSEREP
);
2590 if (HIWORD(wParam
) == BN_CLICKED
||
2591 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2592 cfg
.no_remote_resize
=
2593 IsDlgButtonChecked(hwnd
, IDC_NORESIZE
);
2595 case IDC_NOALTSCREEN
:
2596 if (HIWORD(wParam
) == BN_CLICKED
||
2597 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2599 IsDlgButtonChecked(hwnd
, IDC_NOALTSCREEN
);
2601 case IDC_NOWINTITLE
:
2602 if (HIWORD(wParam
) == BN_CLICKED
||
2603 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2604 cfg
.no_remote_wintitle
=
2605 IsDlgButtonChecked(hwnd
, IDC_NOWINTITLE
);
2607 case IDC_NODBACKSPACE
:
2608 if (HIWORD(wParam
) == BN_CLICKED
||
2609 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2611 IsDlgButtonChecked(hwnd
, IDC_NODBACKSPACE
);
2614 if (HIWORD(wParam
) == BN_CLICKED
||
2615 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2616 cfg
.no_remote_charset
=
2617 IsDlgButtonChecked(hwnd
, IDC_NOCHARSET
);
2620 if (HIWORD(wParam
) == BN_CLICKED
||
2621 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2622 cfg
.alt_f4
= IsDlgButtonChecked(hwnd
, IDC_ALTF4
);
2625 if (HIWORD(wParam
) == BN_CLICKED
||
2626 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2628 IsDlgButtonChecked(hwnd
, IDC_ALTSPACE
);
2631 if (HIWORD(wParam
) == BN_CLICKED
||
2632 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2634 IsDlgButtonChecked(hwnd
, IDC_ALTONLY
);
2636 case IDC_ECHOBACKEND
:
2639 if (HIWORD(wParam
) == BN_CLICKED
||
2640 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2641 if (LOWORD(wParam
) == IDC_ECHOBACKEND
)
2642 cfg
.localecho
= LD_BACKEND
;
2643 if (LOWORD(wParam
) == IDC_ECHOYES
)
2644 cfg
.localecho
= LD_YES
;
2645 if (LOWORD(wParam
) == IDC_ECHONO
)
2646 cfg
.localecho
= LD_NO
;
2649 case IDC_EDITBACKEND
:
2652 if (HIWORD(wParam
) == BN_CLICKED
||
2653 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2654 if (LOWORD(wParam
) == IDC_EDITBACKEND
)
2655 cfg
.localedit
= LD_BACKEND
;
2656 if (LOWORD(wParam
) == IDC_EDITYES
)
2657 cfg
.localedit
= LD_YES
;
2658 if (LOWORD(wParam
) == IDC_EDITNO
)
2659 cfg
.localedit
= LD_NO
;
2662 case IDC_ANSWEREDIT
:
2663 if (HIWORD(wParam
) == EN_CHANGE
)
2664 GetDlgItemText(hwnd
, IDC_ANSWEREDIT
, cfg
.answerback
,
2665 sizeof(cfg
.answerback
) - 1);
2667 case IDC_ALWAYSONTOP
:
2668 if (HIWORD(wParam
) == BN_CLICKED
||
2669 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2671 IsDlgButtonChecked(hwnd
, IDC_ALWAYSONTOP
);
2673 case IDC_FULLSCREENONALTENTER
:
2674 if (HIWORD(wParam
) == BN_CLICKED
||
2675 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2676 cfg
.fullscreenonaltenter
=
2677 IsDlgButtonChecked(hwnd
, IDC_FULLSCREENONALTENTER
);
2680 if (HIWORD(wParam
) == BN_CLICKED
||
2681 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2683 IsDlgButtonChecked(hwnd
, IDC_SCROLLKEY
);
2685 case IDC_SCROLLDISP
:
2686 if (HIWORD(wParam
) == BN_CLICKED
||
2687 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2688 cfg
.scroll_on_disp
=
2689 IsDlgButtonChecked(hwnd
, IDC_SCROLLDISP
);
2691 case IDC_COMPOSEKEY
:
2692 if (HIWORD(wParam
) == BN_CLICKED
||
2693 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2695 IsDlgButtonChecked(hwnd
, IDC_COMPOSEKEY
);
2697 case IDC_CTRLALTKEYS
:
2698 if (HIWORD(wParam
) == BN_CLICKED
||
2699 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2701 IsDlgButtonChecked(hwnd
, IDC_CTRLALTKEYS
);
2704 if (HIWORD(wParam
) == BN_CLICKED
||
2705 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2706 cfg
.telnet_keyboard
=
2707 IsDlgButtonChecked(hwnd
, IDC_TELNETKEY
);
2710 if (HIWORD(wParam
) == BN_CLICKED
||
2711 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2712 cfg
.telnet_newline
=
2713 IsDlgButtonChecked(hwnd
, IDC_TELNETRET
);
2716 if (HIWORD(wParam
) == BN_CLICKED
||
2717 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2719 IsDlgButtonChecked(hwnd
, IDC_WRAPMODE
);
2722 if (HIWORD(wParam
) == BN_CLICKED
||
2723 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2724 cfg
.dec_om
= IsDlgButtonChecked(hwnd
, IDC_DECOM
);
2727 if (HIWORD(wParam
) == BN_CLICKED
||
2728 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2730 IsDlgButtonChecked(hwnd
, IDC_LFHASCR
);
2733 if (HIWORD(wParam
) == EN_CHANGE
)
2734 MyGetDlgItemInt(hwnd
, IDC_ROWSEDIT
, &cfg
.height
);
2737 if (HIWORD(wParam
) == EN_CHANGE
)
2738 MyGetDlgItemInt(hwnd
, IDC_COLSEDIT
, &cfg
.width
);
2741 if (HIWORD(wParam
) == EN_CHANGE
)
2742 MyGetDlgItemInt(hwnd
, IDC_SAVEEDIT
, &cfg
.savelines
);
2744 case IDC_CHOOSEFONT
:
2747 lf
.lfHeight
= -MulDiv(cfg
.fontheight
,
2748 GetDeviceCaps(hdc
, LOGPIXELSY
),
2752 lf
.lfWidth
= lf
.lfEscapement
= lf
.lfOrientation
= 0;
2753 lf
.lfItalic
= lf
.lfUnderline
= lf
.lfStrikeOut
= 0;
2754 lf
.lfWeight
= (cfg
.fontisbold ? FW_BOLD
: 0);
2755 lf
.lfCharSet
= cfg
.fontcharset
;
2756 lf
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
2757 lf
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
2758 lf
.lfQuality
= DEFAULT_QUALITY
;
2759 lf
.lfPitchAndFamily
= FIXED_PITCH
| FF_DONTCARE
;
2760 strncpy(lf
.lfFaceName
, cfg
.font
,
2761 sizeof(lf
.lfFaceName
) - 1);
2762 lf
.lfFaceName
[sizeof(lf
.lfFaceName
) - 1] = '\0';
2764 cf
.lStructSize
= sizeof(cf
);
2765 cf
.hwndOwner
= hwnd
;
2767 cf
.Flags
= CF_FIXEDPITCHONLY
| CF_FORCEFONTEXIST
|
2768 CF_INITTOLOGFONTSTRUCT
| CF_SCREENFONTS
;
2770 if (ChooseFont(&cf
)) {
2771 strncpy(cfg
.font
, lf
.lfFaceName
, sizeof(cfg
.font
) - 1);
2772 cfg
.font
[sizeof(cfg
.font
) - 1] = '\0';
2773 cfg
.fontisbold
= (lf
.lfWeight
== FW_BOLD
);
2774 cfg
.fontcharset
= lf
.lfCharSet
;
2775 cfg
.fontheight
= cf
.iPointSize
/ 10;
2776 fmtfont(fontstatic
);
2777 SetDlgItemText(hwnd
, IDC_FONTSTATIC
, fontstatic
);
2780 case IDC_BELL_DISABLED
:
2781 case IDC_BELL_DEFAULT
:
2782 case IDC_BELL_WAVEFILE
:
2783 case IDC_BELL_VISUAL
:
2784 if (HIWORD(wParam
) == BN_CLICKED
||
2785 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2786 if (LOWORD(wParam
) == IDC_BELL_DISABLED
)
2787 cfg
.beep
= BELL_DISABLED
;
2788 if (LOWORD(wParam
) == IDC_BELL_DEFAULT
)
2789 cfg
.beep
= BELL_DEFAULT
;
2790 if (LOWORD(wParam
) == IDC_BELL_WAVEFILE
)
2791 cfg
.beep
= BELL_WAVEFILE
;
2792 if (LOWORD(wParam
) == IDC_BELL_VISUAL
)
2793 cfg
.beep
= BELL_VISUAL
;
2796 case IDC_B_IND_DISABLED
:
2797 case IDC_B_IND_FLASH
:
2798 case IDC_B_IND_STEADY
:
2799 if (HIWORD(wParam
) == BN_CLICKED
||
2800 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2801 if (LOWORD(wParam
) == IDC_B_IND_DISABLED
)
2802 cfg
.beep_ind
= B_IND_DISABLED
;
2803 if (LOWORD(wParam
) == IDC_B_IND_FLASH
)
2804 cfg
.beep_ind
= B_IND_FLASH
;
2805 if (LOWORD(wParam
) == IDC_B_IND_STEADY
)
2806 cfg
.beep_ind
= B_IND_STEADY
;
2809 case IDC_BELL_WAVEBROWSE
:
2810 memset(&of
, 0, sizeof(of
));
2811 #ifdef OPENFILENAME_SIZE_VERSION_400
2812 of
.lStructSize
= OPENFILENAME_SIZE_VERSION_400
;
2814 of
.lStructSize
= sizeof(of
);
2816 of
.hwndOwner
= hwnd
;
2817 of
.lpstrFilter
= "Wave Files\0*.WAV\0AllFiles\0*\0\0\0";
2818 of
.lpstrCustomFilter
= NULL
;
2819 of
.nFilterIndex
= 1;
2820 of
.lpstrFile
= filename
;
2821 strcpy(filename
, cfg
.bell_wavefile
);
2822 of
.nMaxFile
= sizeof(filename
);
2823 of
.lpstrFileTitle
= NULL
;
2824 of
.lpstrInitialDir
= NULL
;
2825 of
.lpstrTitle
= "Select Bell Sound File";
2827 if (GetOpenFileName(&of
)) {
2828 strcpy(cfg
.bell_wavefile
, filename
);
2829 SetDlgItemText(hwnd
, IDC_BELL_WAVEEDIT
,
2833 case IDC_BELL_WAVEEDIT
:
2834 if (HIWORD(wParam
) == EN_CHANGE
)
2835 GetDlgItemText(hwnd
, IDC_BELL_WAVEEDIT
,
2837 sizeof(cfg
.bell_wavefile
) - 1);
2840 if (HIWORD(wParam
) == BN_CLICKED
||
2841 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2843 IsDlgButtonChecked(hwnd
, IDC_BELLOVL
);
2846 if (HIWORD(wParam
) == EN_CHANGE
)
2847 MyGetDlgItemInt(hwnd
, IDC_BELLOVLN
, &cfg
.bellovl_n
);
2850 if (HIWORD(wParam
) == EN_CHANGE
)
2851 MyGetDlgItemFlt(hwnd
, IDC_BELLOVLT
, &cfg
.bellovl_t
,
2855 if (HIWORD(wParam
) == EN_CHANGE
)
2856 MyGetDlgItemFlt(hwnd
, IDC_BELLOVLS
, &cfg
.bellovl_s
,
2860 if (HIWORD(wParam
) == BN_CLICKED
||
2861 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2863 IsDlgButtonChecked(hwnd
, IDC_BLINKTEXT
);
2866 if (HIWORD(wParam
) == BN_CLICKED
||
2867 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2868 cfg
.bce
= IsDlgButtonChecked(hwnd
, IDC_BCE
);
2871 if (HIWORD(wParam
) == BN_CLICKED
||
2872 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2873 cfg
.win_name_always
=
2874 IsDlgButtonChecked(hwnd
, IDC_WINNAME
);
2877 if (HIWORD(wParam
) == BN_CLICKED
||
2878 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2880 IsDlgButtonChecked(hwnd
, IDC_HIDEMOUSE
);
2882 case IDC_SUNKENEDGE
:
2883 if (HIWORD(wParam
) == BN_CLICKED
||
2884 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2886 IsDlgButtonChecked(hwnd
, IDC_SUNKENEDGE
);
2889 if (HIWORD(wParam
) == EN_CHANGE
)
2890 MyGetDlgItemInt(hwnd
, IDC_WINBEDIT
,
2891 &cfg
.window_border
);
2892 if (cfg
.window_border
> 32)
2893 cfg
.window_border
= 32;
2896 if (HIWORD(wParam
) == BN_CLICKED
||
2897 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2898 cfg
.cursor_type
= 0;
2901 if (HIWORD(wParam
) == BN_CLICKED
||
2902 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2903 cfg
.cursor_type
= 1;
2906 if (HIWORD(wParam
) == BN_CLICKED
||
2907 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2908 cfg
.cursor_type
= 2;
2911 if (HIWORD(wParam
) == BN_CLICKED
||
2912 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2914 IsDlgButtonChecked(hwnd
, IDC_BLINKCUR
);
2917 if (HIWORD(wParam
) == BN_CLICKED
||
2918 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2920 IsDlgButtonChecked(hwnd
, IDC_SCROLLBAR
);
2922 case IDC_SCROLLBARFULLSCREEN
:
2923 if (HIWORD(wParam
) == BN_CLICKED
||
2924 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2925 cfg
.scrollbar_in_fullscreen
=
2926 IsDlgButtonChecked(hwnd
, IDC_SCROLLBARFULLSCREEN
);
2928 case IDC_RESIZETERM
:
2929 case IDC_RESIZEFONT
:
2930 case IDC_RESIZENONE
:
2931 case IDC_RESIZEEITHER
:
2932 if (HIWORD(wParam
) == BN_CLICKED
||
2933 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2935 IsDlgButtonChecked(hwnd
,
2936 IDC_RESIZETERM
) ? RESIZE_TERM
:
2937 IsDlgButtonChecked(hwnd
,
2938 IDC_RESIZEFONT
) ? RESIZE_FONT
:
2939 IsDlgButtonChecked(hwnd
,
2940 IDC_RESIZEEITHER
) ? RESIZE_EITHER
:
2945 if (HIWORD(wParam
) == EN_CHANGE
)
2946 GetDlgItemText(hwnd
, IDC_WINEDIT
, cfg
.wintitle
,
2947 sizeof(cfg
.wintitle
) - 1);
2952 if (HIWORD(wParam
) == BN_CLICKED
||
2953 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
2955 IsDlgButtonChecked(hwnd
,
2956 IDC_COEALWAYS
) ? COE_ALWAYS
:
2957 IsDlgButtonChecked(hwnd
,
2958 IDC_COENEVER
) ? COE_NEVER
:
2963 if (HIWORD(wParam
) == BN_CLICKED
||
2964 HIWORD(wParam
) == BN_DOUBLECLICKED
)
2966 IsDlgButtonChecked(hwnd
, IDC_CLOSEWARN
);
2969 if (HIWORD(wParam
) == EN_CHANGE
)
2970 GetDlgItemText(hwnd
, IDC_TTEDIT
, cfg
.termtype
,
2971 sizeof(cfg
.termtype
) - 1);
2975 case IDC_PROXYHOSTEDIT
:
2976 if (HIWORD(wParam
) == EN_CHANGE
)
2977 GetDlgItemText(hwnd
, IDC_PROXYHOSTEDIT
, cfg
.proxy_host
,
2978 sizeof(cfg
.proxy_host
) - 1);
2980 case IDC_PROXYPORTEDIT
:
2981 if (HIWORD(wParam
) == EN_CHANGE
) {
2982 GetDlgItemText(hwnd
, IDC_PROXYPORTEDIT
, portname
, 31);
2983 if (isdigit(portname
[0]))
2984 MyGetDlgItemInt(hwnd
, IDC_PROXYPORTEDIT
, &cfg
.proxy_port
);
2986 service
= getservbyname(portname
, NULL
);
2988 cfg
.proxy_port
= ntohs(service
->s_port
);
2994 case IDC_PROXYEXCLUDEEDIT
:
2995 if (HIWORD(wParam
) == EN_CHANGE
)
2996 GetDlgItemText(hwnd
, IDC_PROXYEXCLUDEEDIT
,
2997 cfg
.proxy_exclude_list
,
2998 sizeof(cfg
.proxy_exclude_list
) - 1);
3000 case IDC_PROXYUSEREDIT
:
3001 if (HIWORD(wParam
) == EN_CHANGE
)
3002 GetDlgItemText(hwnd
, IDC_PROXYUSEREDIT
,
3004 sizeof(cfg
.proxy_username
) - 1);
3006 case IDC_PROXYPASSEDIT
:
3007 if (HIWORD(wParam
) == EN_CHANGE
)
3008 GetDlgItemText(hwnd
, IDC_PROXYPASSEDIT
,
3010 sizeof(cfg
.proxy_password
) - 1);
3012 case IDC_PROXYTELNETCMDEDIT
:
3013 if (HIWORD(wParam
) == EN_CHANGE
)
3014 GetDlgItemText(hwnd
, IDC_PROXYTELNETCMDEDIT
,
3015 cfg
.proxy_telnet_command
,
3016 sizeof(cfg
.proxy_telnet_command
) - 1);
3018 case IDC_PROXYSOCKSVER5
:
3019 case IDC_PROXYSOCKSVER4
:
3020 if (HIWORD(wParam
) == BN_CLICKED
||
3021 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3022 cfg
.proxy_socks_version
=
3023 IsDlgButtonChecked(hwnd
, IDC_PROXYSOCKSVER4
) ?
4 : 5;
3026 case IDC_PROXYTYPENONE
:
3027 case IDC_PROXYTYPEHTTP
:
3028 case IDC_PROXYTYPESOCKS
:
3029 case IDC_PROXYTYPETELNET
:
3030 if (HIWORD(wParam
) == BN_CLICKED
||
3031 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3033 IsDlgButtonChecked(hwnd
, IDC_PROXYTYPEHTTP
) ? PROXY_HTTP
:
3034 IsDlgButtonChecked(hwnd
, IDC_PROXYTYPESOCKS
) ? PROXY_SOCKS
:
3035 IsDlgButtonChecked(hwnd
, IDC_PROXYTYPETELNET
) ? PROXY_TELNET
:
3041 if (HIWORD(wParam
) == EN_CHANGE
)
3042 GetDlgItemText(hwnd
, IDC_LGFEDIT
, cfg
.logfilename
,
3043 sizeof(cfg
.logfilename
) - 1);
3046 memset(&of
, 0, sizeof(of
));
3047 #ifdef OPENFILENAME_SIZE_VERSION_400
3048 of
.lStructSize
= OPENFILENAME_SIZE_VERSION_400
;
3050 of
.lStructSize
= sizeof(of
);
3052 of
.hwndOwner
= hwnd
;
3053 of
.lpstrFilter
= "All Files\0*\0\0\0";
3054 of
.lpstrCustomFilter
= NULL
;
3055 of
.nFilterIndex
= 1;
3056 of
.lpstrFile
= filename
;
3057 strcpy(filename
, cfg
.logfilename
);
3058 of
.nMaxFile
= sizeof(filename
);
3059 of
.lpstrFileTitle
= NULL
;
3060 of
.lpstrInitialDir
= NULL
;
3061 of
.lpstrTitle
= "Select session log file";
3063 if (GetSaveFileName(&of
)) {
3064 strcpy(cfg
.logfilename
, filename
);
3065 SetDlgItemText(hwnd
, IDC_LGFEDIT
, cfg
.logfilename
);
3069 case IDC_LSTATASCII
:
3071 case IDC_LSTATPACKET
:
3072 if (HIWORD(wParam
) == BN_CLICKED
||
3073 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3074 if (IsDlgButtonChecked(hwnd
, IDC_LSTATOFF
))
3075 cfg
.logtype
= LGTYP_NONE
;
3076 if (IsDlgButtonChecked(hwnd
, IDC_LSTATASCII
))
3077 cfg
.logtype
= LGTYP_ASCII
;
3078 if (IsDlgButtonChecked(hwnd
, IDC_LSTATRAW
))
3079 cfg
.logtype
= LGTYP_DEBUG
;
3080 if (IsDlgButtonChecked(hwnd
, IDC_LSTATPACKET
))
3081 cfg
.logtype
= LGTYP_PACKETS
;
3087 if (HIWORD(wParam
) == BN_CLICKED
||
3088 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3089 if (IsDlgButtonChecked(hwnd
, IDC_LSTATXASK
))
3090 cfg
.logxfovr
= LGXF_ASK
;
3091 if (IsDlgButtonChecked(hwnd
, IDC_LSTATXAPN
))
3092 cfg
.logxfovr
= LGXF_APN
;
3093 if (IsDlgButtonChecked(hwnd
, IDC_LSTATXOVR
))
3094 cfg
.logxfovr
= LGXF_OVR
;
3099 if (HIWORD(wParam
) == EN_CHANGE
)
3100 GetDlgItemText(hwnd
, LOWORD(wParam
), cfg
.termspeed
,
3101 sizeof(cfg
.termspeed
) - 1);
3104 if (HIWORD(wParam
) == EN_CHANGE
)
3105 GetDlgItemText(hwnd
, IDC_LOGEDIT
, cfg
.username
,
3106 sizeof(cfg
.username
) - 1);
3108 case IDC_RLLUSEREDIT
:
3109 if (HIWORD(wParam
) == EN_CHANGE
)
3110 GetDlgItemText(hwnd
, IDC_RLLUSEREDIT
,
3112 sizeof(cfg
.localusername
) - 1);
3116 cfg
.rfc_environ
= IsDlgButtonChecked(hwnd
, IDC_EMRFC
);
3120 cfg
.passive_telnet
=
3121 IsDlgButtonChecked(hwnd
, IDC_TPASSIVE
);
3124 if (HIWORD(wParam
) == BN_CLICKED
||
3125 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3126 char str
[sizeof(cfg
.environmt
)];
3128 GetDlgItemText(hwnd
, IDC_VAREDIT
, str
,
3134 p
= str
+ strlen(str
);
3136 GetDlgItemText(hwnd
, IDC_VALEDIT
, p
,
3137 sizeof(str
) - 1 - (p
- str
));
3148 if ((p
- cfg
.environmt
) + strlen(str
) + 2 <
3149 sizeof(cfg
.environmt
)) {
3151 p
[strlen(str
) + 1] = '\0';
3152 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_ADDSTRING
,
3154 SetDlgItemText(hwnd
, IDC_VAREDIT
, "");
3155 SetDlgItemText(hwnd
, IDC_VALEDIT
, "");
3157 MessageBox(hwnd
, "Environment too big",
3158 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3163 if (HIWORD(wParam
) != BN_CLICKED
&&
3164 HIWORD(wParam
) != BN_DOUBLECLICKED
) break;
3166 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_GETCURSEL
, 0,
3173 SendDlgItemMessage(hwnd
, IDC_ENVLIST
, LB_DELETESTRING
,
3200 if (HIWORD(wParam
) == BN_CLICKED
||
3201 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3202 cfg
.nopty
= IsDlgButtonChecked(hwnd
, IDC_NOPTY
);
3205 if (HIWORD(wParam
) == BN_CLICKED
||
3206 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3208 IsDlgButtonChecked(hwnd
, IDC_COMPRESS
);
3211 if (HIWORD(wParam
) == BN_CLICKED
||
3212 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3214 IsDlgButtonChecked(hwnd
, IDC_SSH2DES
);
3217 if (HIWORD(wParam
) == BN_CLICKED
||
3218 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3220 IsDlgButtonChecked(hwnd
, IDC_AGENTFWD
);
3222 case IDC_CHANGEUSER
:
3223 if (HIWORD(wParam
) == BN_CLICKED
||
3224 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3225 cfg
.change_username
=
3226 IsDlgButtonChecked(hwnd
, IDC_CHANGEUSER
);
3228 case IDC_CIPHERLIST
:
3231 handle_prefslist(&cipherlist
,
3232 cfg
.ssh_cipherlist
, CIPHER_MAX
,
3233 0, hwnd
, wParam
, lParam
);
3235 case IDC_SSHPROT1ONLY
:
3238 case IDC_SSHPROT2ONLY
:
3239 if (HIWORD(wParam
) == BN_CLICKED
||
3240 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3241 if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT1ONLY
))
3243 if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT1
))
3245 else if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT2
))
3247 else if (IsDlgButtonChecked(hwnd
, IDC_SSHPROT2ONLY
))
3252 if (HIWORD(wParam
) == BN_CLICKED
||
3253 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3255 IsDlgButtonChecked(hwnd
, IDC_AUTHTIS
);
3258 if (HIWORD(wParam
) == BN_CLICKED
||
3259 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3261 IsDlgButtonChecked(hwnd
, IDC_AUTHKI
);
3264 if (HIWORD(wParam
) == EN_CHANGE
)
3265 GetDlgItemText(hwnd
, IDC_PKEDIT
, cfg
.keyfile
,
3266 sizeof(cfg
.keyfile
) - 1);
3269 if (HIWORD(wParam
) == EN_CHANGE
)
3270 GetDlgItemText(hwnd
, IDC_CMDEDIT
, cfg
.remote_cmd
,
3271 sizeof(cfg
.remote_cmd
) - 1);
3274 memset(&of
, 0, sizeof(of
));
3275 #ifdef OPENFILENAME_SIZE_VERSION_400
3276 of
.lStructSize
= OPENFILENAME_SIZE_VERSION_400
;
3278 of
.lStructSize
= sizeof(of
);
3280 of
.hwndOwner
= hwnd
;
3281 of
.lpstrFilter
= "PuTTY Private Key Files\0*.PPK\0"
3282 "AllFiles\0*\0\0\0";
3283 of
.lpstrCustomFilter
= NULL
;
3284 of
.nFilterIndex
= 1;
3285 of
.lpstrFile
= filename
;
3286 strcpy(filename
, cfg
.keyfile
);
3287 of
.nMaxFile
= sizeof(filename
);
3288 of
.lpstrFileTitle
= NULL
;
3289 of
.lpstrInitialDir
= NULL
;
3290 of
.lpstrTitle
= "Select Private Key File";
3292 if (GetOpenFileName(&of
)) {
3293 strcpy(cfg
.keyfile
, filename
);
3294 SetDlgItemText(hwnd
, IDC_PKEDIT
, cfg
.keyfile
);
3298 cfg
.rawcnp
= IsDlgButtonChecked(hwnd
, IDC_RAWCNP
);
3301 cfg
.rtf_paste
= IsDlgButtonChecked(hwnd
, IDC_RTFPASTE
);
3305 cfg
.mouse_is_xterm
= IsDlgButtonChecked(hwnd
, IDC_MBXTERM
);
3307 case IDC_SELTYPELEX
:
3308 case IDC_SELTYPERECT
:
3309 cfg
.rect_select
= IsDlgButtonChecked(hwnd
, IDC_SELTYPERECT
);
3311 case IDC_MOUSEOVERRIDE
:
3312 cfg
.mouse_override
= IsDlgButtonChecked(hwnd
, IDC_MOUSEOVERRIDE
);
3318 int n
= GetDlgItemInt(hwnd
, IDC_CCEDIT
, &ok
, FALSE
);
3323 for (i
= 0; i
< 128; i
++)
3324 if (SendDlgItemMessage
3325 (hwnd
, IDC_CCLIST
, LB_GETSEL
, i
, 0)) {
3327 cfg
.wordness
[i
] = n
;
3328 SendDlgItemMessage(hwnd
, IDC_CCLIST
,
3329 LB_DELETESTRING
, i
, 0);
3330 sprintf(str
, "%d\t(0x%02X)\t%c\t%d", i
, i
,
3331 (i
>= 0x21 && i
!= 0x7F) ? i
: ' ',
3333 SendDlgItemMessage(hwnd
, IDC_CCLIST
,
3340 case IDC_BOLDCOLOUR
:
3341 if (HIWORD(wParam
) == BN_CLICKED
||
3342 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3345 IsDlgButtonChecked(hwnd
, IDC_BOLDCOLOUR
);
3346 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, WM_SETREDRAW
,
3349 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3351 if (n
!= 12 + 10 * cfg
.bold_colour
) {
3352 for (i
= n
; i
-- > 0;)
3353 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3354 LB_DELETESTRING
, i
, 0);
3355 for (i
= 0; i
< 22; i
++)
3356 if (cfg
.bold_colour
|| permcolour
[i
])
3357 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3359 (LPARAM
) colours
[i
]);
3361 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
, WM_SETREDRAW
,
3363 InvalidateRect(GetDlgItem(hwnd
, IDC_COLOURLIST
), NULL
,
3368 if (HIWORD(wParam
) == BN_CLICKED
||
3369 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3371 IsDlgButtonChecked(hwnd
, IDC_PALETTE
);
3373 case IDC_COLOURLIST
:
3374 if (HIWORD(wParam
) == LBN_DBLCLK
||
3375 HIWORD(wParam
) == LBN_SELCHANGE
) {
3377 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3380 if (!cfg
.bold_colour
)
3381 i
= (i
< 3 ? i
* 2 : i
== 3 ?
5 : i
* 2 - 2);
3382 SetDlgItemInt(hwnd
, IDC_RVALUE
, cfg
.colours
[i
][0],
3384 SetDlgItemInt(hwnd
, IDC_GVALUE
, cfg
.colours
[i
][1],
3386 SetDlgItemInt(hwnd
, IDC_BVALUE
, cfg
.colours
[i
][2],
3391 if (HIWORD(wParam
) == BN_CLICKED
||
3392 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3393 static CHOOSECOLOR cc
;
3394 static DWORD custom
[16] = { 0 }; /* zero initialisers */
3396 SendDlgItemMessage(hwnd
, IDC_COLOURLIST
,
3399 if (!cfg
.bold_colour
)
3400 i
= (i
< 3 ? i
* 2 : i
== 3 ?
5 : i
* 2 - 2);
3401 cc
.lStructSize
= sizeof(cc
);
3402 cc
.hwndOwner
= hwnd
;
3403 cc
.hInstance
= (HWND
) hinst
;
3404 cc
.lpCustColors
= custom
;
3406 RGB(cfg
.colours
[i
][0], cfg
.colours
[i
][1],
3408 cc
.Flags
= CC_FULLOPEN
| CC_RGBINIT
;
3409 if (ChooseColor(&cc
)) {
3411 (unsigned char) (cc
.rgbResult
& 0xFF);
3413 (unsigned char) (cc
.rgbResult
>> 8) & 0xFF;
3415 (unsigned char) (cc
.rgbResult
>> 16) & 0xFF;
3416 SetDlgItemInt(hwnd
, IDC_RVALUE
, cfg
.colours
[i
][0],
3418 SetDlgItemInt(hwnd
, IDC_GVALUE
, cfg
.colours
[i
][1],
3420 SetDlgItemInt(hwnd
, IDC_BVALUE
, cfg
.colours
[i
][2],
3426 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3427 int index
= SendDlgItemMessage(hwnd
, IDC_CODEPAGE
,
3428 CB_GETCURSEL
, 0, 0);
3429 SendDlgItemMessage(hwnd
, IDC_CODEPAGE
, CB_GETLBTEXT
,
3430 index
, (LPARAM
)cfg
.line_codepage
);
3431 } else if (HIWORD(wParam
) == CBN_EDITCHANGE
) {
3432 GetDlgItemText(hwnd
, IDC_CODEPAGE
, cfg
.line_codepage
,
3433 sizeof(cfg
.line_codepage
) - 1);
3434 } else if (HIWORD(wParam
) == CBN_KILLFOCUS
) {
3435 strcpy(cfg
.line_codepage
,
3436 cp_name(decode_codepage(cfg
.line_codepage
)));
3437 SetDlgItemText(hwnd
, IDC_CODEPAGE
, cfg
.line_codepage
);
3441 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3442 int index
= SendDlgItemMessage(hwnd
, IDC_PRINTER
,
3443 CB_GETCURSEL
, 0, 0);
3444 SendDlgItemMessage(hwnd
, IDC_PRINTER
, CB_GETLBTEXT
,
3445 index
, (LPARAM
)cfg
.printer
);
3446 } else if (HIWORD(wParam
) == CBN_EDITCHANGE
) {
3447 GetDlgItemText(hwnd
, IDC_PRINTER
, cfg
.printer
,
3448 sizeof(cfg
.printer
) - 1);
3450 if (!strcmp(cfg
.printer
, PRINTER_DISABLED_STRING
))
3451 *cfg
.printer
= '\0';
3453 case IDC_CAPSLOCKCYR
:
3454 if (HIWORD(wParam
) == BN_CLICKED
||
3455 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3456 cfg
.xlat_capslockcyr
=
3457 IsDlgButtonChecked (hwnd
, IDC_CAPSLOCKCYR
);
3460 case IDC_VTXWINDOWS
:
3466 (IsDlgButtonChecked(hwnd
, IDC_VTXWINDOWS
) ? VT_XWINDOWS
3467 : IsDlgButtonChecked(hwnd
,
3468 IDC_VTOEMANSI
) ? VT_OEMANSI
:
3469 IsDlgButtonChecked(hwnd
,
3470 IDC_VTOEMONLY
) ? VT_OEMONLY
:
3471 IsDlgButtonChecked(hwnd
,
3472 IDC_VTUNICODE
) ? VT_UNICODE
:
3475 case IDC_X11_FORWARD
:
3476 if (HIWORD(wParam
) == BN_CLICKED
||
3477 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3479 IsDlgButtonChecked(hwnd
, IDC_X11_FORWARD
);
3482 if (HIWORD(wParam
) == BN_CLICKED
||
3483 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3484 cfg
.lport_acceptall
=
3485 IsDlgButtonChecked(hwnd
, IDC_LPORT_ALL
);
3488 if (HIWORD(wParam
) == BN_CLICKED
||
3489 HIWORD(wParam
) == BN_DOUBLECLICKED
)
3490 cfg
.rport_acceptall
=
3491 IsDlgButtonChecked(hwnd
, IDC_RPORT_ALL
);
3493 case IDC_X11_DISPLAY
:
3494 if (HIWORD(wParam
) == EN_CHANGE
)
3495 GetDlgItemText(hwnd
, IDC_X11_DISPLAY
, cfg
.x11_display
,
3496 sizeof(cfg
.x11_display
) - 1);
3499 if (HIWORD(wParam
) == BN_CLICKED
||
3500 HIWORD(wParam
) == BN_DOUBLECLICKED
) {
3501 char str
[sizeof(cfg
.portfwd
)];
3503 if (IsDlgButtonChecked(hwnd
, IDC_PFWDLOCAL
))
3507 GetDlgItemText(hwnd
, IDC_SPORTEDIT
, str
+1,
3511 "You need to specify a source port number",
3512 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3515 p
= str
+ strlen(str
);
3517 GetDlgItemText(hwnd
, IDC_DPORTEDIT
, p
,
3518 sizeof(str
) - 1 - (p
- str
));
3519 if (!*p
|| !strchr(p
, ':')) {
3521 "You need to specify a destination address\n"
3522 "in the form \"host.name:port\"",
3523 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3532 if ((p
- cfg
.portfwd
) + strlen(str
) + 2 <
3533 sizeof(cfg
.portfwd
)) {
3535 p
[strlen(str
) + 1] = '\0';
3536 SendDlgItemMessage(hwnd
, IDC_PFWDLIST
, LB_ADDSTRING
,
3538 SetDlgItemText(hwnd
, IDC_SPORTEDIT
, "");
3539 SetDlgItemText(hwnd
, IDC_DPORTEDIT
, "");
3541 MessageBox(hwnd
, "Too many forwardings",
3542 "PuTTY Error", MB_OK
| MB_ICONERROR
);
3546 case IDC_PFWDREMOVE
:
3547 if (HIWORD(wParam
) != BN_CLICKED
&&
3548 HIWORD(wParam
) != BN_DOUBLECLICKED
) break;
3549 i
= SendDlgItemMessage(hwnd
, IDC_PFWDLIST
,
3550 LB_GETCURSEL
, 0, 0);
3556 SendDlgItemMessage(hwnd
, IDC_PFWDLIST
, LB_DELETESTRING
,
3582 case IDC_BUGD_IGNORE1
:
3583 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3584 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_IGNORE1
,
3585 CB_GETCURSEL
, 0, 0);
3586 cfg
.sshbug_ignore1
= (index
== 0 ? BUG_AUTO
:
3587 index
== 1 ? BUG_OFF
: BUG_ON
);
3590 case IDC_BUGD_PLAINPW1
:
3591 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3592 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_PLAINPW1
,
3593 CB_GETCURSEL
, 0, 0);
3594 cfg
.sshbug_plainpw1
= (index
== 0 ? BUG_AUTO
:
3595 index
== 1 ? BUG_OFF
: BUG_ON
);
3599 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3600 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_RSA1
,
3601 CB_GETCURSEL
, 0, 0);
3602 cfg
.sshbug_rsa1
= (index
== 0 ? BUG_AUTO
:
3603 index
== 1 ? BUG_OFF
: BUG_ON
);
3606 case IDC_BUGD_HMAC2
:
3607 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3608 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_HMAC2
,
3609 CB_GETCURSEL
, 0, 0);
3610 cfg
.sshbug_hmac2
= (index
== 0 ? BUG_AUTO
:
3611 index
== 1 ? BUG_OFF
: BUG_ON
);
3614 case IDC_BUGD_DERIVEKEY2
:
3615 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3616 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_DERIVEKEY2
,
3617 CB_GETCURSEL
, 0, 0);
3618 cfg
.sshbug_derivekey2
= (index
== 0 ? BUG_AUTO
:
3619 index
== 1 ? BUG_OFF
: BUG_ON
);
3622 case IDC_BUGD_RSAPAD2
:
3623 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3624 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_RSAPAD2
,
3625 CB_GETCURSEL
, 0, 0);
3626 cfg
.sshbug_rsapad2
= (index
== 0 ? BUG_AUTO
:
3627 index
== 1 ? BUG_OFF
: BUG_ON
);
3630 case IDC_BUGD_DHGEX2
:
3631 if (HIWORD(wParam
) == CBN_SELCHANGE
) {
3632 int index
= SendDlgItemMessage(hwnd
, IDC_BUGD_DHGEX2
,
3633 CB_GETCURSEL
, 0, 0);
3634 cfg
.sshbug_dhgex2
= (index
== 0 ? BUG_AUTO
:
3635 index
== 1 ? BUG_OFF
: BUG_ON
);
3642 int id
= ((LPHELPINFO
)lParam
)->iCtrlId
;
3643 char *cmd
= help_context_cmd(id
);
3645 WinHelp(hwnd
, help_path
, HELP_COMMAND
, (DWORD
)cmd
);
3646 requested_help
= TRUE
;
3653 if (requested_help
) {
3654 WinHelp(hwnd
, help_path
, HELP_QUIT
, 0);
3655 requested_help
= FALSE
;
3660 /* Grrr Explorer will maximize Dialogs! */
3662 if (wParam
== SIZE_MAXIMIZED
)
3668 * Handle application-defined messages eg. DragListBox
3670 /* First find out what the number is (once). */
3671 if (draglistmsg
== WM_NULL
)
3672 draglistmsg
= RegisterWindowMessage (DRAGLISTMSGSTRING
);
3674 if (msg
== draglistmsg
) {
3675 /* Only process once dialog is fully formed. */
3676 if (GetWindowLong(hwnd
, GWL_USERDATA
) == 1) switch (LOWORD(wParam
)) {
3677 case IDC_CIPHERLIST
:
3678 return handle_prefslist(&cipherlist
,
3679 cfg
.ssh_cipherlist
, CIPHER_MAX
,
3680 1, hwnd
, wParam
, lParam
);
3689 static int CALLBACK
MainDlgProc(HWND hwnd
, UINT msg
,
3690 WPARAM wParam
, LPARAM lParam
)
3692 if (msg
== WM_COMMAND
&& LOWORD(wParam
) == IDOK
) {
3694 if (msg
== WM_COMMAND
&& LOWORD(wParam
) == IDCX_ABOUT
) {
3695 EnableWindow(hwnd
, 0);
3696 DialogBox(hinst
, MAKEINTRESOURCE(IDD_ABOUTBOX
), hwnd
, AboutProc
);
3697 EnableWindow(hwnd
, 1);
3698 SetActiveWindow(hwnd
);
3700 return GenericMainDlgProc(hwnd
, msg
, wParam
, lParam
, 0);
3703 static int CALLBACK
ReconfDlgProc(HWND hwnd
, UINT msg
,
3704 WPARAM wParam
, LPARAM lParam
)
3706 return GenericMainDlgProc(hwnd
, msg
, wParam
, lParam
, 1);
3709 void defuse_showwindow(void)
3712 * Work around the fact that the app's first call to ShowWindow
3713 * will ignore the default in favour of the shell-provided
3718 hwnd
= CreateDialog(hinst
, MAKEINTRESOURCE(IDD_ABOUTBOX
),
3720 ShowWindow(hwnd
, SW_HIDE
);
3721 SetActiveWindow(hwnd
);
3722 DestroyWindow(hwnd
);
3730 get_sesslist(&sesslist
, TRUE
);
3731 savedsession
[0] = '\0';
3733 DialogBox(hinst
, MAKEINTRESOURCE(IDD_MAINBOX
), NULL
, MainDlgProc
);
3734 get_sesslist(&sesslist
, FALSE
);
3739 int do_reconfig(HWND hwnd
)
3744 backup_cfg
= cfg
; /* structure copy */
3746 DialogBox(hinst
, MAKEINTRESOURCE(IDD_RECONF
), hwnd
, ReconfDlgProc
);
3748 cfg
= backup_cfg
; /* structure copy */
3753 void logevent(void *frontend
, char *string
)
3758 log_eventlog(logctx
, string
);
3760 if (nevents
>= negsize
) {
3762 events
= srealloc(events
, negsize
* sizeof(*events
));
3766 strftime(timebuf
, sizeof(timebuf
), "%Y-%m-%d %H:%M:%S\t",
3769 events
[nevents
] = smalloc(strlen(timebuf
) + strlen(string
) + 1);
3770 strcpy(events
[nevents
], timebuf
);
3771 strcat(events
[nevents
], string
);
3774 SendDlgItemMessage(logbox
, IDN_LIST
, LB_ADDSTRING
,
3775 0, (LPARAM
) events
[nevents
]);
3776 count
= SendDlgItemMessage(logbox
, IDN_LIST
, LB_GETCOUNT
, 0, 0);
3777 SendDlgItemMessage(logbox
, IDN_LIST
, LB_SETTOPINDEX
, count
- 1, 0);
3782 void showeventlog(HWND hwnd
)
3785 logbox
= CreateDialog(hinst
, MAKEINTRESOURCE(IDD_LOGBOX
),
3787 ShowWindow(logbox
, SW_SHOWNORMAL
);
3789 SetActiveWindow(logbox
);
3792 void showabout(HWND hwnd
)
3794 DialogBox(hinst
, MAKEINTRESOURCE(IDD_ABOUTBOX
), hwnd
, AboutProc
);
3797 void verify_ssh_host_key(void *frontend
, char *host
, int port
, char *keytype
,
3798 char *keystr
, char *fingerprint
)
3802 static const char absentmsg
[] =
3803 "The server's host key is not cached in the registry. You\n"
3804 "have no guarantee that the server is the computer you\n"
3806 "The server's key fingerprint is:\n"
3808 "If you trust this host, hit Yes to add the key to\n"
3809 "PuTTY's cache and carry on connecting.\n"
3810 "If you want to carry on connecting just once, without\n"
3811 "adding the key to the cache, hit No.\n"
3812 "If you do not trust this host, hit Cancel to abandon the\n"
3815 static const char wrongmsg
[] =
3816 "WARNING - POTENTIAL SECURITY BREACH!\n"
3818 "The server's host key does not match the one PuTTY has\n"
3819 "cached in the registry. This means that either the\n"
3820 "server administrator has changed the host key, or you\n"
3821 "have actually connected to another computer pretending\n"
3822 "to be the server.\n"
3823 "The new key fingerprint is:\n"
3825 "If you were expecting this change and trust the new key,\n"
3826 "hit Yes to update PuTTY's cache and continue connecting.\n"
3827 "If you want to carry on connecting but without updating\n"
3828 "the cache, hit No.\n"
3829 "If you want to abandon the connection completely, hit\n"
3830 "Cancel. Hitting Cancel is the ONLY guaranteed safe\n" "choice.\n";
3832 static const char mbtitle
[] = "PuTTY Security Alert";
3835 /* sensible fingerprint max size */
3836 (sizeof(absentmsg
) > sizeof(wrongmsg
) ?
3837 sizeof(absentmsg
) : sizeof(wrongmsg
))];
3840 * Verify the key against the registry.
3842 ret
= verify_host_key(host
, port
, keytype
, keystr
);
3844 if (ret
== 0) /* success - key matched OK */
3846 if (ret
== 2) { /* key was different */
3848 sprintf(message
, wrongmsg
, fingerprint
);
3849 mbret
= MessageBox(NULL
, message
, mbtitle
,
3850 MB_ICONWARNING
| MB_YESNOCANCEL
);
3852 store_host_key(host
, port
, keytype
, keystr
);
3853 if (mbret
== IDCANCEL
)
3856 if (ret
== 1) { /* key was absent */
3858 sprintf(message
, absentmsg
, fingerprint
);
3859 mbret
= MessageBox(NULL
, message
, mbtitle
,
3860 MB_ICONWARNING
| MB_YESNOCANCEL
);
3862 store_host_key(host
, port
, keytype
, keystr
);
3863 if (mbret
== IDCANCEL
)
3869 * Ask whether the selected cipher is acceptable (since it was
3870 * below the configured 'warn' threshold).
3871 * cs: 0 = both ways, 1 = client->server, 2 = server->client
3873 void askcipher(void *frontend
, char *ciphername
, int cs
)
3875 static const char mbtitle
[] = "PuTTY Security Alert";
3876 static const char msg
[] =
3877 "The first %.35scipher supported by the server\n"
3878 "is %.64s, which is below the configured\n"
3879 "warning threshold.\n"
3880 "Do you want to continue with this connection?\n";
3881 /* guessed cipher name + type max length */
3882 char message
[100 + sizeof(msg
)];
3885 sprintf(message
, msg
,
3887 (cs
== 1) ?
"client-to-server " :
3888 "server-to-client ",
3890 mbret
= MessageBox(NULL
, message
, mbtitle
,
3891 MB_ICONWARNING
| MB_YESNO
);
3899 * Ask whether to wipe a session log file before writing to it.
3900 * Returns 2 for wipe, 1 for append, 0 for cancel (don't log).
3902 int askappend(void *frontend
, char *filename
)
3904 static const char mbtitle
[] = "PuTTY Log to File";
3905 static const char msgtemplate
[] =
3906 "The session log file \"%.*s\" already exists.\n"
3907 "You can overwrite it with a new session log,\n"
3908 "append your session log to the end of it,\n"
3909 "or disable session logging for this session.\n"
3910 "Hit Yes to wipe the file, No to append to it,\n"
3911 "or Cancel to disable logging.";
3912 char message
[sizeof(msgtemplate
) + FILENAME_MAX
];
3914 if (cfg
.logxfovr
!= LGXF_ASK
) {
3915 return ((cfg
.logxfovr
== LGXF_OVR
) ?
2 : 1);
3917 sprintf(message
, msgtemplate
, FILENAME_MAX
, filename
);
3919 mbret
= MessageBox(NULL
, message
, mbtitle
,
3920 MB_ICONQUESTION
| MB_YESNOCANCEL
);
3923 else if (mbret
== IDNO
)
3930 * Warn about the obsolescent key file format.
3932 * Uniquely among these functions, this one does _not_ expect a
3933 * frontend handle. This means that if PuTTY is ported to a
3934 * platform which requires frontend handles, this function will be
3935 * an anomaly. Fortunately, the problem it addresses will not have
3936 * been present on that platform, so it can plausibly be
3937 * implemented as an empty function.
3939 void old_keyfile_warning(void)
3941 static const char mbtitle
[] = "PuTTY Key File Warning";
3942 static const char message
[] =
3943 "You are loading an SSH 2 private key which has an\n"
3944 "old version of the file format. This means your key\n"
3945 "file is not fully tamperproof. Future versions of\n"
3946 "PuTTY may stop supporting this private key format,\n"
3947 "so we recommend you convert your key to the new\n"
3950 "You can perform this conversion by loading the key\n"
3951 "into PuTTYgen and then saving it again.";
3953 MessageBox(NULL
, message
, mbtitle
, MB_OK
);