CheckDlgButton(hwnd, IDC_RTFPASTE, cfg.rtf_paste);
static void init_dlg_ctrls(HWND hwnd, int keepsess){    int i;    char fontstatic[256];    SetDlgItemText(hwnd, IDC_HOST, cfg.host);    SetDlgItemText(hwnd, IDC_SESSEDIT, savedsession);    if (!keepsess) {	int i, n;	n = SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_GETCOUNT, 0, 0);	for (i = n; i-- > 0;)	    SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_DELETESTRING, i, 0);	for (i = 0; i < nsessions; i++)	    SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_ADDSTRING,			       0, (LPARAM) (sessions[i]));    }    SetDlgItemInt(hwnd, IDC_PORT, cfg.port, FALSE);    CheckRadioButton(hwnd, IDC_PROTRAW, IDC_PROTSSH,		     cfg.protocol == PROT_SSH ? IDC_PROTSSH :		     cfg.protocol == PROT_TELNET ? IDC_PROTTELNET :		     cfg.protocol ==		     PROT_RLOGIN ? IDC_PROTRLOGIN : IDC_PROTRAW);    SetDlgItemInt(hwnd, IDC_PINGEDIT, cfg.ping_interval, FALSE);    CheckRadioButton(hwnd, IDC_DEL008, IDC_DEL127,		     cfg.bksp_is_delete ? IDC_DEL127 : IDC_DEL008);    CheckRadioButton(hwnd, IDC_HOMETILDE, IDC_HOMERXVT,		     cfg.rxvt_homeend ? IDC_HOMERXVT : IDC_HOMETILDE);    CheckRadioButton(hwnd, IDC_FUNCTILDE, IDC_FUNCSCO,		     cfg.funky_type == 0 ? IDC_FUNCTILDE :		     cfg.funky_type == 1 ? IDC_FUNCLINUX :		     cfg.funky_type == 2 ? IDC_FUNCXTERM :		     cfg.funky_type == 3 ? IDC_FUNCVT400 :		     cfg.funky_type == 4 ? IDC_FUNCVT100P :		     cfg.funky_type == 5 ? IDC_FUNCSCO : IDC_FUNCTILDE);    CheckDlgButton(hwnd, IDC_NOAPPLICC, cfg.no_applic_c);    CheckDlgButton(hwnd, IDC_NOAPPLICK, cfg.no_applic_k);    CheckRadioButton(hwnd, IDC_CURNORMAL, IDC_CURAPPLIC,		     cfg.app_cursor ? IDC_CURAPPLIC : IDC_CURNORMAL);    CheckRadioButton(hwnd, IDC_KPNORMAL, IDC_KPNH,		     cfg.nethack_keypad ? IDC_KPNH :		     cfg.app_keypad ? IDC_KPAPPLIC : IDC_KPNORMAL);    CheckDlgButton(hwnd, IDC_ALTF4, cfg.alt_f4);    CheckDlgButton(hwnd, IDC_ALTSPACE, cfg.alt_space);    CheckDlgButton(hwnd, IDC_ALTONLY, cfg.alt_only);    CheckDlgButton(hwnd, IDC_COMPOSEKEY, cfg.compose_key);    CheckDlgButton(hwnd, IDC_CTRLALTKEYS, cfg.ctrlaltkeys);    CheckDlgButton(hwnd, IDC_TELNETKEY, cfg.telnet_keyboard);    CheckRadioButton(hwnd, IDC_ECHOBACKEND, IDC_ECHONO,		     cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND :		     cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO);    CheckRadioButton(hwnd, IDC_EDITBACKEND, IDC_EDITNO,		     cfg.localedit == LD_BACKEND ? IDC_EDITBACKEND :		     cfg.localedit == LD_YES ? IDC_EDITYES : IDC_EDITNO);    SetDlgItemText(hwnd, IDC_ANSWEREDIT, cfg.answerback);    CheckDlgButton(hwnd, IDC_ALWAYSONTOP, cfg.alwaysontop);    CheckDlgButton(hwnd, IDC_FULLSCREENONALTENTER, cfg.fullscreenonaltenter);    CheckDlgButton(hwnd, IDC_SCROLLKEY, cfg.scroll_on_key);    CheckDlgButton(hwnd, IDC_SCROLLDISP, cfg.scroll_on_disp);    CheckDlgButton(hwnd, IDC_WRAPMODE, cfg.wrap_mode);    CheckDlgButton(hwnd, IDC_DECOM, cfg.dec_om);    CheckDlgButton(hwnd, IDC_LFHASCR, cfg.lfhascr);    SetDlgItemInt(hwnd, IDC_ROWSEDIT, cfg.height, FALSE);    SetDlgItemInt(hwnd, IDC_COLSEDIT, cfg.width, FALSE);    SetDlgItemInt(hwnd, IDC_SAVEEDIT, cfg.savelines, FALSE);    fmtfont(fontstatic);    SetDlgItemText(hwnd, IDC_FONTSTATIC, fontstatic);    CheckRadioButton(hwnd, IDC_BELL_DISABLED, IDC_BELL_VISUAL,		     cfg.beep == BELL_DISABLED ? IDC_BELL_DISABLED :		     cfg.beep == BELL_DEFAULT ? IDC_BELL_DEFAULT :		     cfg.beep == BELL_WAVEFILE ? IDC_BELL_WAVEFILE :		     cfg.beep ==		     BELL_VISUAL ? IDC_BELL_VISUAL : IDC_BELL_DEFAULT);    CheckRadioButton(hwnd, IDC_B_IND_DISABLED, IDC_B_IND_STEADY,		     cfg.beep_ind ==		     B_IND_DISABLED ? IDC_B_IND_DISABLED : cfg.beep_ind ==		     B_IND_FLASH ? IDC_B_IND_FLASH : cfg.beep_ind ==		     B_IND_STEADY ? IDC_B_IND_STEADY : IDC_B_IND_DISABLED);    SetDlgItemText(hwnd, IDC_BELL_WAVEEDIT, cfg.bell_wavefile);    CheckDlgButton(hwnd, IDC_BELLOVL, cfg.bellovl);    SetDlgItemInt(hwnd, IDC_BELLOVLN, cfg.bellovl_n, FALSE);    MySetDlgItemFlt(hwnd, IDC_BELLOVLT, cfg.bellovl_t / 1000.0);    MySetDlgItemFlt(hwnd, IDC_BELLOVLS, cfg.bellovl_s / 1000.0);    CheckDlgButton(hwnd, IDC_BCE, cfg.bce);    CheckDlgButton(hwnd, IDC_BLINKTEXT, cfg.blinktext);    SetDlgItemText(hwnd, IDC_WINEDIT, cfg.wintitle);    CheckDlgButton(hwnd, IDC_WINNAME, cfg.win_name_always);    CheckDlgButton(hwnd, IDC_HIDEMOUSE, cfg.hide_mouseptr);    CheckDlgButton(hwnd, IDC_SUNKENEDGE, cfg.sunken_edge);    SetDlgItemInt(hwnd, IDC_WINBEDIT, cfg.window_border, FALSE);    CheckRadioButton(hwnd, IDC_CURBLOCK, IDC_CURVERT,		     cfg.cursor_type == 0 ? IDC_CURBLOCK :		     cfg.cursor_type == 1 ? IDC_CURUNDER : IDC_CURVERT);    CheckDlgButton(hwnd, IDC_BLINKCUR, cfg.blink_cur);    CheckDlgButton(hwnd, IDC_SCROLLBAR, cfg.scrollbar);    CheckDlgButton(hwnd, IDC_SCROLLBARFULLSCREEN, cfg.scrollbar_in_fullscreen);    CheckRadioButton(hwnd, IDC_RESIZETERM, IDC_RESIZENONE,		     cfg.resize_action == RESIZE_TERM ? IDC_RESIZETERM :		     cfg.resize_action == RESIZE_FONT ? IDC_RESIZEFONT :		     IDC_RESIZENONE);    CheckRadioButton(hwnd, IDC_COEALWAYS, IDC_COENORMAL,		     cfg.close_on_exit == COE_NORMAL ? IDC_COENORMAL :		     cfg.close_on_exit ==		     COE_NEVER ? IDC_COENEVER : IDC_COEALWAYS);    CheckDlgButton(hwnd, IDC_CLOSEWARN, cfg.warn_on_close);    SetDlgItemText(hwnd, IDC_TTEDIT, cfg.termtype);    SetDlgItemText(hwnd, IDC_TSEDIT, cfg.termspeed);    SetDlgItemText(hwnd, IDC_R_TSEDIT, cfg.termspeed);    SetDlgItemText(hwnd, IDC_RLLUSEREDIT, cfg.localusername);    SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);    SetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename);    CheckRadioButton(hwnd, IDC_LSTATOFF, IDC_LSTATRAW,		     cfg.logtype == 0 ? IDC_LSTATOFF :		     cfg.logtype == 1 ? IDC_LSTATASCII : IDC_LSTATRAW);    CheckRadioButton(hwnd, IDC_LSTATXOVR, IDC_LSTATXASK,		     cfg.logxfovr == LGXF_OVR ? IDC_LSTATXOVR :		     cfg.logxfovr == LGXF_ASK ? IDC_LSTATXASK :		     IDC_LSTATXAPN);    {	char *p = cfg.environmt;	SendDlgItemMessage(hwnd, IDC_ENVLIST, LB_RESETCONTENT, 0, 0);	while (*p) {	    SendDlgItemMessage(hwnd, IDC_ENVLIST, LB_ADDSTRING, 0,			       (LPARAM) p);	    p += strlen(p) + 1;	}	p = cfg.portfwd;	while (*p) {	    SendDlgItemMessage(hwnd, IDC_PFWDLIST, LB_ADDSTRING, 0,			       (LPARAM) p);	    p += strlen(p) + 1;	}    }    CheckRadioButton(hwnd, IDC_EMBSD, IDC_EMRFC,		     cfg.rfc_environ ? IDC_EMRFC : IDC_EMBSD);    CheckRadioButton(hwnd, IDC_TPASSIVE, IDC_TACTIVE,		     cfg.passive_telnet ? IDC_TPASSIVE : IDC_TACTIVE);    SetDlgItemText(hwnd, IDC_TTEDIT, cfg.termtype);    SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);    CheckDlgButton(hwnd, IDC_NOPTY, cfg.nopty);    CheckDlgButton(hwnd, IDC_COMPRESS, cfg.compression);    CheckDlgButton(hwnd, IDC_BUGGYMAC, cfg.buggymac);    CheckDlgButton(hwnd, IDC_AGENTFWD, cfg.agentfwd);    CheckRadioButton(hwnd, IDC_SSHPROT1, IDC_SSHPROT2,		     cfg.sshprot == 1 ? IDC_SSHPROT1 : IDC_SSHPROT2);    CheckDlgButton(hwnd, IDC_AUTHTIS, cfg.try_tis_auth);    SetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile);    SetDlgItemText(hwnd, IDC_CMDEDIT, cfg.remote_cmd);    {	int i;	static const struct { char *s; int c; } ciphers[] = {	    { "3DES",			CIPHER_3DES },	    { "Blowfish",		CIPHER_BLOWFISH },	    { "DES (SSH 1 only)",	CIPHER_DES },	    { "AES (SSH 2 only)",	CIPHER_AES },	    { "-- warn below here --",	CIPHER_WARN }	};	/* Set up the "selected ciphers" box. */	/* (cipherlist assumed to contain all ciphers) */	SendDlgItemMessage(hwnd, IDC_CIPHERLIST, LB_RESETCONTENT, 0, 0);	for (i = 0; i < CIPHER_MAX; i++) {	    int c = cfg.ssh_cipherlist[i];	    int j, pos;	    char *cstr = NULL;	    for (j = 0; j < (sizeof ciphers) / (sizeof ciphers[0]); j++) {		if (ciphers[j].c == c) {		    cstr = ciphers[j].s;		    break;		}	    }	    pos = SendDlgItemMessage(hwnd, IDC_CIPHERLIST, LB_ADDSTRING,				     0, (LPARAM) cstr);	    SendDlgItemMessage(hwnd, IDC_CIPHERLIST, LB_SETITEMDATA,			       pos, (LPARAM) c);	}    }    CheckRadioButton(hwnd, IDC_MBWINDOWS, IDC_MBXTERM,		     cfg.mouse_is_xterm ? IDC_MBXTERM : IDC_MBWINDOWS);    CheckRadioButton(hwnd, IDC_SELTYPELEX, IDC_SELTYPERECT,		     cfg.rect_select == 0 ? IDC_SELTYPELEX : IDC_SELTYPERECT);    CheckDlgButton(hwnd, IDC_MOUSEOVERRIDE, cfg.mouse_override);    CheckDlgButton(hwnd, IDC_RAWCNP, cfg.rawcnp);    {	static int tabs[4] = { 25, 61, 96, 128 };	SendDlgItemMessage(hwnd, IDC_CCLIST, LB_SETTABSTOPS, 4,			   (LPARAM) tabs);    }    for (i = 0; i < 128; i++) {	char str[100];	sprintf(str, "%d\t(0x%02X)\t%c\t%d", i, i,		(i >= 0x21 && i != 0x7F) ? i : ' ', cfg.wordness[i]);	SendDlgItemMessage(hwnd, IDC_CCLIST, LB_ADDSTRING, 0,			   (LPARAM) str);    }    CheckDlgButton(hwnd, IDC_BOLDCOLOUR, cfg.bold_colour);    CheckDlgButton(hwnd, IDC_PALETTE, cfg.try_palette);    {	int i, n;	n = SendDlgItemMessage(hwnd, IDC_COLOURLIST, LB_GETCOUNT, 0, 0);	for (i = n; i-- > 0;)	    SendDlgItemMessage(hwnd, IDC_COLOURLIST,			       LB_DELETESTRING, i, 0);	for (i = 0; i < 22; i++)	    if (cfg.bold_colour || permcolour[i])		SendDlgItemMessage(hwnd, IDC_COLOURLIST, LB_ADDSTRING, 0,				   (LPARAM) colours[i]);    }    SendDlgItemMessage(hwnd, IDC_COLOURLIST, LB_SETCURSEL, 0, 0);    SetDlgItemInt(hwnd, IDC_RVALUE, cfg.colours[0][0], FALSE);    SetDlgItemInt(hwnd, IDC_GVALUE, cfg.colours[0][1], FALSE);    SetDlgItemInt(hwnd, IDC_BVALUE, cfg.colours[0][2], FALSE);    {	int i;	char *cp;	strcpy(cfg.line_codepage, cp_name(decode_codepage(cfg.line_codepage)));	SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_RESETCONTENT, 0, 0);	CheckDlgButton (hwnd, IDC_CAPSLOCKCYR, cfg.xlat_capslockcyr);	for (i = 0; (cp = cp_enumerate(i)) != NULL; i++) {	    SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_ADDSTRING,			       0, (LPARAM) cp);	}	SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage);    }        CheckRadioButton(hwnd, IDC_VTXWINDOWS, IDC_VTUNICODE,		     cfg.vtmode == VT_XWINDOWS ? IDC_VTXWINDOWS :		     cfg.vtmode == VT_OEMANSI ? IDC_VTOEMANSI :		     cfg.vtmode == VT_OEMONLY ? IDC_VTOEMONLY :		     cfg.vtmode == VT_UNICODE ? IDC_VTUNICODE :		     IDC_VTPOORMAN);    CheckDlgButton(hwnd, IDC_X11_FORWARD, cfg.x11_forward);    SetDlgItemText(hwnd, IDC_X11_DISPLAY, cfg.x11_display);    CheckDlgButton(hwnd, IDC_LPORT_ALL, cfg.lport_acceptall);    CheckRadioButton(hwnd, IDC_PFWDLOCAL, IDC_PFWDREMOTE, IDC_PFWDLOCAL);}