From fb701dced1093bfaf944129982835dd326f734aa Mon Sep 17 00:00:00 2001 From: cyd01 Date: Tue, 26 Oct 2021 10:22:12 +0200 Subject: [PATCH] first 0.75 version that compiles --- 0.75_My_PuTTY/cmdline.c | 11 +- 0.75_My_PuTTY/config.c | 33 +- 0.75_My_PuTTY/mpunsafe.c | 2 + 0.75_My_PuTTY/pageant.c | 10 +- 0.75_My_PuTTY/putty.h | 53 +++- 0.75_My_PuTTY/sercfg.c | 204 ------------- 0.75_My_PuTTY/settings.c | 6 +- 0.75_My_PuTTY/ssh.c | 24 ++ 0.75_My_PuTTY/ssh2kex-client.c | 2 + 0.75_My_PuTTY/ssh2userauth.c | 10 +- 0.75_My_PuTTY/sshshare.c | 2 + 0.75_My_PuTTY/terminal.c | 19 +- 0.75_My_PuTTY/terminal.h | 6 +- 0.75_My_PuTTY/version.c | 2 +- 0.75_My_PuTTY/windows/MAKEFILE.MINGW | 14 +- 0.75_My_PuTTY/windows/sizetip.c | 385 ++++++++++++------------ 0.75_My_PuTTY/windows/version_major.txt | 2 +- 0.75_My_PuTTY/windows/version_minor.txt | 2 +- 0.75_My_PuTTY/windows/wincapi.h | 9 + 0.75_My_PuTTY/windows/windlg.c | 6 +- 0.75_My_PuTTY/windows/window.c | 136 +++++---- 0.75_My_PuTTY/windows/winpgnt.c | 4 +- 0.75_My_PuTTY/windows/winstuff.h | 2 - kitty.c | 43 +-- kitty.h | 8 +- kitty_commun.c | 1 + kitty_image.c | 18 +- kitty_image.h | 2 +- kitty_launcher.c | 2 +- kitty_savedump.c | 5 +- kitty_settings.c | 8 +- kitty_win.c | 5 +- rutty/script_win.c | 4 +- 33 files changed, 472 insertions(+), 568 deletions(-) delete mode 100644 0.75_My_PuTTY/sercfg.c diff --git a/0.75_My_PuTTY/cmdline.c b/0.75_My_PuTTY/cmdline.c index 1226881..1b99c95 100644 --- a/0.75_My_PuTTY/cmdline.c +++ b/0.75_My_PuTTY/cmdline.c @@ -105,13 +105,13 @@ void ManageConnectString( Conf *cf, char * hostname ) { if( strlen(cm)>0 ) { if( cm[0] == '#' ) { decryptstring( GetCryptSaltFlag(), (char*)cm+1, MASTER_PASSWORD ) ; - conf_set_str( conf, CONF_autocommand, cm+1 ) ; + conf_set_str( cf, CONF_autocommand, cm+1 ) ; } else { char *s = (char*)malloc( strlen(cm)+1 ) ; strcpy( s, cm ) ; int i = decode64(s) ; s[i] = '\0' ; - conf_set_str( conf,CONF_autocommand,s ) ; + conf_set_str( cf,CONF_autocommand,s ) ; free(s) ; } } @@ -573,6 +573,7 @@ int cmdline_process_param(const char *p, char *value, conf_get_str(conf, CONF_host)); } return 1; + } } #ifdef MOD_PERSO if (!strcmp(p, "-kload")) { @@ -581,7 +582,7 @@ int cmdline_process_param(const char *p, char *value, * saved. */ load_open_settings_forced( value, conf ) ; loaded_session = true; - cmdline_session_name = dupstr(value); + //cmdline_session_name = dupstr(value); return 2; } if (!strcmp(p, "-knock")) { @@ -598,8 +599,8 @@ int cmdline_process_param(const char *p, char *value, RETURN(1); UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK); SAVEABLE(0); - default_protocol = PROT_ADB; - conf_set_int(conf, CONF_protocol, default_protocol); + //default_protocol = PROT_ADB; + conf_set_int(conf, CONF_protocol, PROT_ADB); } #endif if (!strcmp(p, "-v")) { diff --git a/0.75_My_PuTTY/config.c b/0.75_My_PuTTY/config.c index d3314d6..a591230 100644 --- a/0.75_My_PuTTY/config.c +++ b/0.75_My_PuTTY/config.c @@ -330,7 +330,7 @@ struct hostport { * serial backend. */ static void config_protocols_handler(union control *ctrl, dlgparam *dlg, - void *data, int event) + void *data, int event) { Conf *conf = (Conf *)data; int curproto = conf_get_int(conf, CONF_protocol); @@ -363,7 +363,7 @@ static void config_protocols_handler(union control *ctrl, dlgparam *dlg, if (curproto == ctrl->radio.buttondata[button].i || button == ctrl->radio.nbuttons-1) { dlg_radiobutton_set(ctrl, dlg, button); - break; + break; } } else if (ctrl == hp->protlist) { int curentry = -1; @@ -419,7 +419,7 @@ static void config_protocols_handler(union control *ctrl, dlgparam *dlg, if (event == EVENT_VALCHANGE && ctrl == hp->protradio) { int button = dlg_radiobutton_get(ctrl, dlg); - assert(button >= 0 && button < ctrl->radio.nbuttons); + assert(button >= 0 && button < ctrl->radio.nbuttons); if (ctrl->radio.buttondata[button].i == -1) { /* * The 'Other' radio button was selected, which means we @@ -439,7 +439,7 @@ static void config_protocols_handler(union control *ctrl, dlgparam *dlg, if (i >= 0) newproto = dlg_listbox_getid(hp->protlist, dlg, i); } else { - newproto = ctrl->radio.buttondata[button].i; + newproto = ctrl->radio.buttondata[button].i; } } else if (event == EVENT_SELCHANGE && ctrl == hp->protlist) { int i = dlg_listbox_index(ctrl, dlg); @@ -451,10 +451,10 @@ static void config_protocols_handler(union control *ctrl, dlgparam *dlg, } } - const struct BackendVtable *cvt = backend_vt_from_proto(curproto); + if (newproto != curproto) { + conf_set_int(conf, CONF_protocol, newproto); - if (oldproto != newproto) { - const struct BackendVtable *ovt = backend_vt_from_proto(oldproto); + const struct BackendVtable *cvt = backend_vt_from_proto(curproto); const struct BackendVtable *nvt = backend_vt_from_proto(newproto); assert(cvt); assert(nvt); @@ -467,16 +467,17 @@ static void config_protocols_handler(union control *ctrl, dlgparam *dlg, * no sensible default for that protocol; in this case * it's displayed as a blank.) * - * This helps with the common case of tabbing through the - * controls in order and setting a non-default port before - * getting to the protocol; we want that non-default port + * This helps with the common case of tabbing through the + * controls in order and setting a non-default port before + * getting to the protocol; we want that non-default port * to be preserved. */ int port = conf_get_int(conf, CONF_port); if (port == cvt->default_port) conf_set_int(conf, CONF_port, nvt->default_port); - dlg_refresh(hp->host, dlg); - dlg_refresh(hp->port, dlg); + + dlg_refresh(hp->host, dlg); + dlg_refresh(hp->port, dlg); } } } @@ -1477,7 +1478,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, } else if( (strlen(ssd->savedsession)>0) && isSessionExist(ssd,ssd->savedsession) ) { strcpy( sessionname, ssd->savedsession ) ; if( strcmp(FileExtension,"") ) { strcat(sessionname,FileExtension); } - if( !RunSession( hwnd, CurrentFolder, sessionname ) ) { dlg_beep(dlg) ; } + //if( !RunSession( hwnd, CurrentFolder, sessionname ) ) { dlg_beep(dlg) ; } + if( !RunSession( GetMainHwnd(), CurrentFolder, sessionname ) ) { dlg_beep(dlg) ; } } else if( dlg_last_focused(ctrl, dlg) == ssd->listbox ) { Conf *conf2 = conf_new() ; bool mbl = false; @@ -1493,7 +1495,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, strcpy( sessionname, ssd->savedsession ) ; if( strcmp(FileExtension,"") ) { strcat(sessionname,FileExtension); } - if (conf_launchable(conf)) { RunSession( hwnd, CurrentFolder, sessionname ) ; } + //if (conf_launchable(conf)) { RunSession( hwnd, CurrentFolder, sessionname ) ; } + if (conf_launchable(conf)) { RunSession( GetMainHwnd(), CurrentFolder, sessionname ) ; } strcpy(ssd->savedsession,oldsavedsession); free(oldsavedsession); conf_free(conf2); @@ -2531,12 +2534,14 @@ void setup_config_box(struct controlbox *b, bool midsession, sessionsaver_handler, P(ssd)); ssd->cancelbutton->button.iscancel = true; #ifdef MOD_PERSO +/* if( strlen(conf_get_str(conf,CONF_host))==0 ) { if( strlen(conf_get_str(conf,CONF_host_alt))>0 ) { conf_set_str( conf, CONF_host, conf_get_str( conf, CONF_host_alt ) ) ; conf_set_str( conf, CONF_host_alt, "" ) ; } } +*/ if( GetConfigBoxHeight() > 7 ) ssd->cancelbutton->generic.column = 0 ; else #endif ssd->cancelbutton->generic.column = 4; diff --git a/0.75_My_PuTTY/mpunsafe.c b/0.75_My_PuTTY/mpunsafe.c index 3f7ce3e..3bda6e2 100644 --- a/0.75_My_PuTTY/mpunsafe.c +++ b/0.75_My_PuTTY/mpunsafe.c @@ -18,7 +18,9 @@ * (Only _client_ connections, however. Uppity, being a test server * only, is exempt.) */ +#ifndef MOD_INTEGRATED_AGENT const int deliberate_symbol_clash = 12345; +#endif static size_t mp_unsafe_words_needed(mp_int *x) { diff --git a/0.75_My_PuTTY/pageant.c b/0.75_My_PuTTY/pageant.c index 3dd65a5..1c033ef 100644 --- a/0.75_My_PuTTY/pageant.c +++ b/0.75_My_PuTTY/pageant.c @@ -29,11 +29,11 @@ int random_byte(void) exit(0); return 0; /* unreachable, but placate optimiser */ } -#endif void random_read(void *buf, size_t size) { modalfatalbox("Internal error: attempt to use random numbers in Pageant"); } +#endif static bool pageant_local = false; @@ -842,8 +842,8 @@ static PageantAsyncOp *pageant_make_op( goto challenge1_cleanup; } #ifdef MOD_PERSO - fingerprint = rsa_ssh1_fingerprint(key); - if (! confirm_key_usage(fingerprint, key->comment)) { + fingerprint = rsa_ssh1_fingerprint(pk->rkey); + if (! confirm_key_usage(fingerprint, pk->rkey->comment)) { goto challenge1_cleanup; } #endif @@ -916,8 +916,8 @@ static PageantAsyncOp *pageant_make_op( goto responded; } #ifdef MOD_PERSO - confirm_fingerprint = ssh2_fingerprint_blob(keyblob); - if (! confirm_key_usage( confirm_fingerprint , key->comment)) { + confirm_fingerprint = ssh2_fingerprint_blob(keyblob, SSH_FPTYPE_DEFAULT); + if (! confirm_key_usage( confirm_fingerprint, pk->rkey->comment)) { sfree(confirm_fingerprint); return; } diff --git a/0.75_My_PuTTY/putty.h b/0.75_My_PuTTY/putty.h index 846f591..ddd77e6 100644 --- a/0.75_My_PuTTY/putty.h +++ b/0.75_My_PuTTY/putty.h @@ -106,8 +106,13 @@ enum { * terminal.c itself. */ +#ifdef MOD_TUTTY +#define CONF_NCOLOURS 26 /* 16 + 6 special ones */ +#define OSCP_NCOLOURS 26 /* same as CONF, but different order */ +#else #define CONF_NCOLOURS 22 /* 16 + 6 special ones */ #define OSCP_NCOLOURS 22 /* same as CONF, but different order */ +#endif #define OSC4_NCOLOURS 262 /* 256 + the same 6 special ones */ /* The list macro for the conf colours also gives the textual names @@ -141,6 +146,52 @@ enum { X(white, "ANSI White") \ X(white_bold, "ANSI White Bold") \ /* end of list */ + +#define OSCP_COLOUR_LIST(X) \ + X(black) \ + X(red) \ + X(green) \ + X(yellow) \ + X(blue) \ + X(magenta) \ + X(cyan) \ + X(white) \ + X(black_bold) \ + X(red_bold) \ + X(green_bold) \ + X(yellow_bold) \ + X(blue_bold) \ + X(magenta_bold) \ + X(cyan_bold) \ + X(white_bold) \ + /* + * In the OSC 4 indexing, this is where the extra 240 colours go. + * They consist of: + * + * - 216 colours forming a 6x6x6 cube, with R the most + * significant colour and G the least. In other words, these + * occupy the space of indices 16 <= i < 232, with each + * individual colour found as i = 16 + 36*r + 6*g + b, for all + * 0 <= r,g,b <= 5. + * + * - The remaining indices, 232 <= i < 256, consist of a uniform + * series of grey shades running between black and white (but + * not including either, since actual black and white are + * already provided in the previous colour cube). + * + * After that, we have the remaining 6 special colours: + */ \ + X(fg) \ + X(fg_bold) \ + X(bg) \ + X(bg_bold) \ + X(cursor_fg) \ + X(cursor_bg) \ + X(fg_underline) \ + X(bg_underline) \ + X(sel_fg) \ + X(sel_bg) \ + /* end of list */ #else #define CONF_COLOUR_LIST(X) \ X(fg, "Default Foreground") \ @@ -166,7 +217,6 @@ enum { X(white, "ANSI White") \ X(white_bold, "ANSI White Bold") \ /* end of list */ -#endif #define OSCP_COLOUR_LIST(X) \ X(black) \ @@ -209,6 +259,7 @@ enum { X(cursor_fg) \ X(cursor_bg) \ /* end of list */ +#endif /* Enumerations of the colour lists. These are available everywhere in * the code. The OSC P encoding shouldn't be used outside terminal.c, diff --git a/0.75_My_PuTTY/sercfg.c b/0.75_My_PuTTY/sercfg.c deleted file mode 100644 index a5a3e3f..0000000 --- a/0.75_My_PuTTY/sercfg.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * sercfg.c - the serial-port specific parts of the PuTTY - * configuration box. Centralised as cross-platform code because - * more than one platform will want to use it, but not part of the - * main configuration. The expectation is that each platform's - * local config function will call out to ser_setup_config_box() if - * it needs to set up the standard serial stuff. (Of course, it can - * then apply local tweaks after ser_setup_config_box() returns, if - * it needs to.) - */ - -#include -#include - -#include "putty.h" -#include "dialog.h" -#include "storage.h" - -static void serial_parity_handler(union control *ctrl, dlgparam *dlg, - void *data, int event) -{ - static const struct { - const char *name; - int val; - } parities[] = { - {"None", SER_PAR_NONE}, - {"Odd", SER_PAR_ODD}, - {"Even", SER_PAR_EVEN}, - {"Mark", SER_PAR_MARK}, - {"Space", SER_PAR_SPACE}, - }; - int mask = ctrl->listbox.context.i; - int i, j; - Conf *conf = (Conf *)data; - - if (event == EVENT_REFRESH) { - /* Fetching this once at the start of the function ensures we - * remember what the right value is supposed to be when - * operations below cause reentrant calls to this function. */ - int oldparity = conf_get_int(conf, CONF_serparity); - - dlg_update_start(ctrl, dlg); - dlg_listbox_clear(ctrl, dlg); - for (i = 0; i < lenof(parities); i++) { - if (mask & (1 << i)) - dlg_listbox_addwithid(ctrl, dlg, parities[i].name, - parities[i].val); - } - for (i = j = 0; i < lenof(parities); i++) { - if (mask & (1 << i)) { - if (oldparity == parities[i].val) { - dlg_listbox_select(ctrl, dlg, j); - break; - } - j++; - } - } - if (i == lenof(parities)) { /* an unsupported setting was chosen */ - dlg_listbox_select(ctrl, dlg, 0); - oldparity = SER_PAR_NONE; - } - dlg_update_done(ctrl, dlg); - conf_set_int(conf, CONF_serparity, oldparity); /* restore */ - } else if (event == EVENT_SELCHANGE) { - int i = dlg_listbox_index(ctrl, dlg); - if (i < 0) - i = SER_PAR_NONE; - else - i = dlg_listbox_getid(ctrl, dlg, i); - conf_set_int(conf, CONF_serparity, i); - } -} - -static void serial_flow_handler(union control *ctrl, dlgparam *dlg, - void *data, int event) -{ - static const struct { - const char *name; - int val; - } flows[] = { - {"None", SER_FLOW_NONE}, - {"XON/XOFF", SER_FLOW_XONXOFF}, - {"RTS/CTS", SER_FLOW_RTSCTS}, - {"DSR/DTR", SER_FLOW_DSRDTR}, - }; - int mask = ctrl->listbox.context.i; - int i, j; - Conf *conf = (Conf *)data; - - if (event == EVENT_REFRESH) { - /* Fetching this once at the start of the function ensures we - * remember what the right value is supposed to be when - * operations below cause reentrant calls to this function. */ - int oldflow = conf_get_int(conf, CONF_serflow); - - dlg_update_start(ctrl, dlg); - dlg_listbox_clear(ctrl, dlg); - for (i = 0; i < lenof(flows); i++) { - if (mask & (1 << i)) - dlg_listbox_addwithid(ctrl, dlg, flows[i].name, flows[i].val); - } - for (i = j = 0; i < lenof(flows); i++) { - if (mask & (1 << i)) { - if (oldflow == flows[i].val) { - dlg_listbox_select(ctrl, dlg, j); - break; - } - j++; - } - } - if (i == lenof(flows)) { /* an unsupported setting was chosen */ - dlg_listbox_select(ctrl, dlg, 0); - oldflow = SER_FLOW_NONE; - } - dlg_update_done(ctrl, dlg); - conf_set_int(conf, CONF_serflow, oldflow);/* restore */ - } else if (event == EVENT_SELCHANGE) { - int i = dlg_listbox_index(ctrl, dlg); - if (i < 0) - i = SER_FLOW_NONE; - else - i = dlg_listbox_getid(ctrl, dlg, i); - conf_set_int(conf, CONF_serflow, i); - } -} - -void ser_setup_config_box(struct controlbox *b, bool midsession, - int parity_mask, int flow_mask) -{ - struct controlset *s; - union control *c; - - if (!midsession) { - int i; - - /* - * Add the serial back end to the protocols list at the - * top of the config box. - */ - s = ctrl_getset(b, "Session", "hostport", - "Specify the destination you want to connect to"); - - for (i = 0; i < s->ncontrols; i++) { - c = s->ctrls[i]; - if (c->generic.type == CTRL_RADIO && - c->generic.handler == config_protocolbuttons_handler) { - c->radio.nbuttons++; - c->radio.ncolumns++; - c->radio.buttons = - sresize(c->radio.buttons, c->radio.nbuttons, char *); - c->radio.buttons[c->radio.nbuttons-1] = - dupstr("Serial"); - c->radio.buttondata = - sresize(c->radio.buttondata, c->radio.nbuttons, intorptr); - c->radio.buttondata[c->radio.nbuttons-1] = I(PROT_SERIAL); - if (c->radio.shortcuts) { - c->radio.shortcuts = - sresize(c->radio.shortcuts, c->radio.nbuttons, char); - c->radio.shortcuts[c->radio.nbuttons-1] = 'r'; - } - } - } - } - - /* - * Entirely new Connection/Serial panel for serial port - * configuration. - */ - ctrl_settitle(b, "Connection/Serial", - "Options controlling local serial lines"); - - if (!midsession) { - /* - * We don't permit switching to a different serial port in - * midflight, although we do allow all other - * reconfiguration. - */ - s = ctrl_getset(b, "Connection/Serial", "serline", - "Select a serial line"); - ctrl_editbox(s, "Serial line to connect to", 'l', 40, - HELPCTX(serial_line), - conf_editbox_handler, I(CONF_serline), I(1)); - } - - s = ctrl_getset(b, "Connection/Serial", "sercfg", "Configure the serial line"); - ctrl_editbox(s, "Speed (baud)", 's', 40, - HELPCTX(serial_speed), - conf_editbox_handler, I(CONF_serspeed), I(-1)); - ctrl_editbox(s, "Data bits", 'b', 40, - HELPCTX(serial_databits), - conf_editbox_handler, I(CONF_serdatabits), I(-1)); - /* - * Stop bits come in units of one half. - */ - ctrl_editbox(s, "Stop bits", 't', 40, - HELPCTX(serial_stopbits), - conf_editbox_handler, I(CONF_serstopbits), I(-2)); - ctrl_droplist(s, "Parity", 'p', 40, - HELPCTX(serial_parity), - serial_parity_handler, I(parity_mask)); - ctrl_droplist(s, "Flow control", 'f', 40, - HELPCTX(serial_flow), - serial_flow_handler, I(flow_mask)); -} diff --git a/0.75_My_PuTTY/settings.c b/0.75_My_PuTTY/settings.c index 4de331e..b4cd814 100644 --- a/0.75_My_PuTTY/settings.c +++ b/0.75_My_PuTTY/settings.c @@ -737,7 +737,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) write_setting_i(sesskey, "BoldAsColourTest", conf_get_int(conf, CONF_bold_colour) ); write_setting_i(sesskey, "UnderlinedAsColour", conf_get_int(conf, CONF_under_colour) ); write_setting_i(sesskey, "SelectedAsColour", conf_get_int(conf, CONF_sel_colour) ); - for (i = 0; i < NCFGCOLOURS; i++) { + for (i = 0; i < 34; i++) { #else for (i = 0; i < 22; i++) { #endif @@ -1365,8 +1365,8 @@ void load_open_settings(settings_r *sesskey, Conf *conf) gppi(sesskey, "BoldAsColourTest", 1, conf, CONF_bold_colour); gppi(sesskey, "UnderlinedAsColour", 0, conf, CONF_under_colour); gppi(sesskey, "SelectedAsColour", 0, conf, CONF_sel_colour); - for (i = 0; i < NCFGCOLOURS; i++) { - static const char *const defaults[NCFGCOLOURS] = { + for (i = 0; i < 34; i++) { + static const char *const defaults[34] = { "187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0", "0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85", "0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187", diff --git a/0.75_My_PuTTY/ssh.c b/0.75_My_PuTTY/ssh.c index adf39d2..d7a7b1d 100644 --- a/0.75_My_PuTTY/ssh.c +++ b/0.75_My_PuTTY/ssh.c @@ -1201,6 +1201,30 @@ void ssh_got_fallback_cmd(Ssh *ssh) ssh->fallback_cmd = true; } +const BackendVtable ssh_backend = { + .init = ssh_init, + .free = ssh_free, + .reconfig = ssh_reconfig, + .send = ssh_send, + .sendbuffer = ssh_sendbuffer, + .size = ssh_size, + .special = ssh_special, + .get_specials = ssh_get_specials, + .connected = ssh_connected, + .exitcode = ssh_return_exitcode, + .sendok = ssh_sendok, + .ldisc_option_state = ssh_ldisc, + .provide_ldisc = ssh_provide_ldisc, + .unthrottle = ssh_unthrottle, + .cfg_info = ssh_cfg_info, + .test_for_upstream = ssh_test_for_upstream, + .close_warn_text = ssh_close_warn_text, + .id = "ssh", + .displayname = "SSH", + .protocol = PROT_SSH, + .default_port = 22, +}; + const BackendVtable sshconn_backend = { .init = ssh_init, .free = ssh_free, diff --git a/0.75_My_PuTTY/ssh2kex-client.c b/0.75_My_PuTTY/ssh2kex-client.c index d7a2b37..55ee273 100644 --- a/0.75_My_PuTTY/ssh2kex-client.c +++ b/0.75_My_PuTTY/ssh2kex-client.c @@ -17,7 +17,9 @@ * Another copy of the symbol defined in mpunsafe.c. See the comment * there. */ +#ifndef MOD_INTEGRATED_AGENT const int deliberate_symbol_clash = 12345; +#endif void ssh2kex_coroutine(struct ssh2_transport_state *s, bool *aborted) { diff --git a/0.75_My_PuTTY/ssh2userauth.c b/0.75_My_PuTTY/ssh2userauth.c index 872ab87..d420384 100644 --- a/0.75_My_PuTTY/ssh2userauth.c +++ b/0.75_My_PuTTY/ssh2userauth.c @@ -1471,8 +1471,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) char *userlog = dupprintf("Send automatic password (Using keyboard-interactive authentication)" ); ppl_logevent(userlog); // Affichage dans l'event log // Affichage à l'écran - if (flags & FLAG_INTERACTIVE && - (flags & FLAG_VERBOSE)) { + //if (flags & FLAG_INTERACTIVE && + //(flags & FLAG_VERBOSE)) { + if(seat_verbose(s->ppl.seat) && seat_interactive(s->ppl.seat)) { ppl_printf("%s\r\n",userlog); } @@ -1656,8 +1657,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) char *userlog = dupprintf("Send automatic password" ); ppl_logevent(userlog); // Affichage dans l'event log // Affichage à l'écran - if (flags & FLAG_INTERACTIVE && - (flags & FLAG_VERBOSE)) { + //if (flags & FLAG_INTERACTIVE && + //(flags & FLAG_VERBOSE)) { + if(seat_verbose(s->ppl.seat) && seat_interactive(s->ppl.seat)) { ppl_printf("\r\n%s\r\n",userlog); } sfree(userlog); diff --git a/0.75_My_PuTTY/sshshare.c b/0.75_My_PuTTY/sshshare.c index 7f6f908..b885db3 100644 --- a/0.75_My_PuTTY/sshshare.c +++ b/0.75_My_PuTTY/sshshare.c @@ -135,6 +135,8 @@ #include #include +#include + #include "putty.h" #include "tree234.h" #include "ssh.h" diff --git a/0.75_My_PuTTY/terminal.c b/0.75_My_PuTTY/terminal.c index ac09487..c13038d 100644 --- a/0.75_My_PuTTY/terminal.c +++ b/0.75_My_PuTTY/terminal.c @@ -19,6 +19,8 @@ int get_param( const char * val ) ; int frontend_is_utf8(void *frontend) ; int GetPuttyFlag(void) ; int GetHyperlinkFlag(void) ; +int GetCursorType() ; +void SetCursorType( const int ct ) ; #endif #ifdef MOD_HYPERLINK /* @@ -3738,9 +3740,6 @@ unsigned long term_translate( return c; } -#ifdef MOD_PERSO -extern int cursor_type; -#endif /* * Remove everything currently in `inbuf' and stick it up on the * in-memory display. There's a big state machine in here to @@ -4295,7 +4294,7 @@ static void term_out(Terminal *term) // cursor shape type (DECSCUSR) int cursor_shape = def(term->esc_args[0], 1); // set cursor_type from shape (cursor_type: 0=block, 1=underline, 2=beam) - cursor_type = (cursor_shape - 1) >> 1; + SetCursorType( (cursor_shape - 1) >> 1 ); // set term->blink_cur from shape (odd numbers indicate blinking in DECSCUSR) if (term->blink_cur != (cursor_shape & 1)) { @@ -7844,7 +7843,7 @@ int format_small_keypad_key(char *buf, Terminal *term, SmallKeypadKey key) default: unreachable("bad small keypad key enum value"); } #ifdef MOD_KEYMAPPING - int home_end_type = conf_get_int(conf, CONF_rxvt_homeend); // standard(0), rxvt, urxvt, xterm(3), bsd1, bsd2 + int home_end_type = conf_get_int(term->conf, CONF_rxvt_homeend); // standard(0), rxvt, urxvt, xterm(3), bsd1, bsd2 bool shift = modifier & 1; bool ctrl = modifier & 2; if (term->funky_type == FUNKY_XTERM && !term->vt52_mode && (home_end_type == 0 || home_end_type == 3)) @@ -7895,7 +7894,7 @@ int format_small_keypad_key(char *buf, Terminal *term, SmallKeypadKey key) p += sprintf(p, "\x1B[%c", codes[code-1]); } #ifdef MOD_PERSO - } else if ((code == 1 || code == 4) && (conf_get_int(conf, CONF_rxvt_homeend) == 1) ) { + } else if ((code == 1 || code == 4) && (conf_get_int(term->conf, CONF_rxvt_homeend) == 1) ) { #else } else if ((code == 1 || code == 4) && term->rxvt_homeend) { #endif @@ -7903,19 +7902,19 @@ int format_small_keypad_key(char *buf, Terminal *term, SmallKeypadKey key) } else { #ifdef MOD_PERSO if ((code == 1 || code == 4) && - conf_get_int(conf, CONF_rxvt_homeend) == 2) { + conf_get_int(term->conf, CONF_rxvt_homeend) == 2) { // urxvt p += sprintf((char *) p, code == 1 ? "\x1B[7~" : "\x1B[8~"); } else if ((code == 1 || code == 4) && - conf_get_int(conf, CONF_rxvt_homeend) == 3) { + conf_get_int(term->conf, CONF_rxvt_homeend) == 3) { // xterm p += sprintf((char *) p, code == 1 ? "\x1BOH" : "\x1BOF"); } else if ((code == 1 || code == 4) && - conf_get_int(conf, CONF_rxvt_homeend) == 4) { + conf_get_int(term->conf, CONF_rxvt_homeend) == 4) { // FreeBSD1 p += sprintf((char *) p, code == 1 ? "\x1B[H" : "\x1B[H"); } else if ((code == 1 || code == 4) && - conf_get_int(conf, CONF_rxvt_homeend) == 5) { + conf_get_int(term->conf, CONF_rxvt_homeend) == 5) { // FreeBSD2 p += sprintf((char *) p, code == 1 ? "\x1BOH" : "\x1B[?1l\x1B>"); } else diff --git a/0.75_My_PuTTY/terminal.h b/0.75_My_PuTTY/terminal.h index 84f34cb..bd4c5dd 100644 --- a/0.75_My_PuTTY/terminal.h +++ b/0.75_My_PuTTY/terminal.h @@ -154,13 +154,11 @@ struct terminal_tag { #ifdef MOD_PERSO int xterm_mouse_mode; /* mouse event mode */ int xterm_mouse_protocol; /* mouse protocol */ - int mouse_is_down; /* used while tracking mouse buttons */ -#else - int xterm_mouse; /* send mouse messages to host */ +#endif + int xterm_mouse; /* send mouse messages to host */ bool xterm_extended_mouse; bool urxvt_extended_mouse; int mouse_is_down; /* used while tracking mouse buttons */ -#endif bool bracketed_paste, bracketed_paste_active; diff --git a/0.75_My_PuTTY/version.c b/0.75_My_PuTTY/version.c index 865557b..570d148 100644 --- a/0.75_My_PuTTY/version.c +++ b/0.75_My_PuTTY/version.c @@ -20,7 +20,7 @@ #include #include const char ver[] = "Custom build" ; -char sshver[] = "PuTTY-KiTTY\0 " ; +const char sshver[] = "PuTTY-KiTTY\0 " ; void set_sshver( char * vers ) { if(strlen(vers)<40 ) { strcpy( sshver, vers ) ; diff --git a/0.75_My_PuTTY/windows/MAKEFILE.MINGW b/0.75_My_PuTTY/windows/MAKEFILE.MINGW index faa8f1a..b63ecc7 100644 --- a/0.75_My_PuTTY/windows/MAKEFILE.MINGW +++ b/0.75_My_PuTTY/windows/MAKEFILE.MINGW @@ -144,6 +144,7 @@ RCFLAGS += -I ../../ -DMOD_PERSO -D$(FLJFLAG) CFLAGS += -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP CFLAGS += -D$(FLJFLAG) CFLAGS += \ + -DMOD_WTS \ -DMOD_PERSO \ -DMOD_STARTBUTTON \ -DMOD_SAVEDUMP \ @@ -155,20 +156,19 @@ CFLAGS += \ -DMOD_PRINTCLIP \ -DMOD_LAUNCHER \ -DMOD_RECONNECT \ - -DMOD_WTS \ -DMOD_TUTTY \ -DMOD_RUTTY \ -DMOD_ADB \ -DMOD_BACKGROUNDIMAGE \ -DMOD_ZMODEM \ -DMOD_PROXY \ + -DMOD_INTEGRATED_AGENT \ -I.././ -I../../ \ -I../charset/ -I../windows/ -I../unix/ -I../mac/ \ -I../macosx \ -I../../base64 \ -I../../bcrypt \ - -I../../md5 -I../../regex -I../../url -I../../rutty - + -I../../md5 -I../../regex -I../../url -I../../rutty # Autre flag a gérer # Ajouter -DMOD_NOPASSWORD \ pour compiler une version sans possibilité de sauvegarder le mot de passe @@ -393,7 +393,7 @@ putty.exe: agentf.o aqsync.o be_all_s.o be_misc.o callback.o cmdline.o \ logging.o mainchan.o marshal.o memory.o minibidi.o misc.o \ miscucs.o mpint.o nullplug.o pgssapi.o pinger.o portfwd.o \ proxy.o putty.res.o raw.o rlogin.o sessprep.o settings.o \ - sizetip.o ssh.o ssh1bpp.o ssh1censor.o ssh1connection.o \ + sizetip.o smallprimes.o ssh.o ssh1bpp.o ssh1censor.o ssh1connection.o \ ssh1connection-client.o ssh1login.o ssh2bpp.o ssh2bpp-bare.o \ ssh2censor.o ssh2connection.o ssh2connection-client.o \ ssh2kex-client.o ssh2transhk.o ssh2transport.o \ @@ -414,14 +414,14 @@ putty.exe: agentf.o aqsync.o be_all_s.o be_misc.o callback.o cmdline.o \ kitty.o kitty_commun.o kitty_crypt.o kitty_image.o kitty_proxy.o kitty_registry.o kitty_ssh.o \ kitty_store.o kitty_tools.o kitty_win.o \ urlhack.o pageant_integrated.o winpgnt_integrated.o winpgen_integrated.o winpzmodem.o \ - import.o sshrsag.o sshdssg.o sshprime.o sshecdsag.o sshbcrypt.o \ + import.o sshrsag.o sshdssg.o sshprime.o sshecdsag.o sshbcrypt.o pockle.o primecandidate.o millerrabin.o mpunsafe.o \ void.o $(UTF8MOUSE_OBJS) $(CC) -mwindows $(LDFLAGS) -o $@ -Wl,-Map,putty.map agentf.o \ aqsync.o be_all_s.o be_misc.o callback.o cmdline.o conf.o \ config.o cproxy.o dialog.o ecc.o errsock.o ldisc.o logging.o \ mainchan.o marshal.o memory.o minibidi.o misc.o miscucs.o \ mpint.o nullplug.o pgssapi.o pinger.o portfwd.o proxy.o \ - putty.res.o raw.o rlogin.o sessprep.o settings.o sizetip.o \ + putty.res.o raw.o rlogin.o sessprep.o settings.o sizetip.o smallprimes.o \ ssh.o ssh1bpp.o ssh1censor.o ssh1connection.o \ ssh1connection-client.o ssh1login.o ssh2bpp.o ssh2bpp-bare.o \ ssh2censor.o ssh2connection.o ssh2connection-client.o \ @@ -443,7 +443,7 @@ putty.exe: agentf.o aqsync.o be_all_s.o be_misc.o callback.o cmdline.o \ kitty.o kitty_commun.o kitty_crypt.o kitty_image.o kitty_proxy.o kitty_registry.o kitty_ssh.o \ kitty_store.o kitty_tools.o kitty_win.o \ urlhack.o pageant_integrated.o winpgnt_integrated.o winpgen_integrated.o winpzmodem.o \ - import.o sshrsag.o sshdssg.o sshprime.o sshecdsag.o sshbcrypt.o \ + import.o sshrsag.o sshdssg.o sshprime.o sshecdsag.o sshbcrypt.o pockle.o primecandidate.o millerrabin.o mpunsafe.o \ void.o $(UTF8MOUSE_OBJS) \ ../../base64/base64.a ../../bcrypt/bcrypt.a ../../blocnote/notepad.a ../../jpeg/libjpeg.a \ ../../md5/MD5check.a ../../mini/mini.a ../../regex/libregex.a \ diff --git a/0.75_My_PuTTY/windows/sizetip.c b/0.75_My_PuTTY/windows/sizetip.c index 3fd1fdf..a40a607 100644 --- a/0.75_My_PuTTY/windows/sizetip.c +++ b/0.75_My_PuTTY/windows/sizetip.c @@ -1,193 +1,192 @@ -/* - * sizetip.c - resize tips for PuTTY(tel) terminal window. - */ - -#include -#include -#include - -#include "putty.h" - -static ATOM tip_class = 0; - -static HFONT tip_font; -static COLORREF tip_bg; -static COLORREF tip_text; - -static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, - WPARAM wParam, LPARAM lParam) -{ - - switch (nMsg) { - case WM_ERASEBKGND: - return true; - - case WM_PAINT: { - HBRUSH hbr; - HGDIOBJ holdbr; - RECT cr; - int wtlen; - LPTSTR wt; - HDC hdc; - - PAINTSTRUCT ps; - hdc = BeginPaint(hWnd, &ps); - - SelectObject(hdc, tip_font); - SelectObject(hdc, GetStockObject(BLACK_PEN)); - - hbr = CreateSolidBrush(tip_bg); - holdbr = SelectObject(hdc, hbr); - - GetClientRect(hWnd, &cr); - Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom); - - wtlen = GetWindowTextLength(hWnd); - wt = (LPTSTR) snewn(wtlen + 1, TCHAR); - GetWindowText(hWnd, wt, wtlen + 1); - - SetTextColor(hdc, tip_text); - SetBkColor(hdc, tip_bg); - - TextOut(hdc, cr.left + 3, cr.top + 3, wt, wtlen); - - sfree(wt); - - SelectObject(hdc, holdbr); - DeleteObject(hbr); - - EndPaint(hWnd, &ps); - return 0; - } - - case WM_NCHITTEST: - return HTTRANSPARENT; - - case WM_DESTROY: - DeleteObject(tip_font); - tip_font = NULL; - break; - - case WM_SETTEXT: { - LPCTSTR str = (LPCTSTR) lParam; - SIZE sz; - HDC hdc = CreateCompatibleDC(NULL); - - SelectObject(hdc, tip_font); - GetTextExtentPoint32(hdc, str, _tcslen(str), &sz); - - SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6, - SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); - InvalidateRect(hWnd, NULL, false); - - DeleteDC(hdc); - } - break; - } - } - - return DefWindowProc(hWnd, nMsg, wParam, lParam); -} - -static HWND tip_wnd = NULL; -static bool tip_enabled = false; - -void UpdateSizeTip(HWND src, int cx, int cy) -{ - TCHAR str[32]; - - if (!tip_enabled) - return; - - if (!tip_wnd) { - NONCLIENTMETRICS nci; - - /* First make sure the window class is registered */ - - if (!tip_class) { - WNDCLASS wc; - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = SizeTipWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hinst; - wc.hIcon = NULL; - wc.hCursor = NULL; - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = "SizeTipClass"; - - tip_class = RegisterClass(&wc); - } -#if 0 - /* Default values based on Windows Standard color scheme */ - - tip_font = GetStockObject(SYSTEM_FONT); - tip_bg = RGB(255, 255, 225); - tip_text = RGB(0, 0, 0); -#endif - - /* Prepare other GDI objects and drawing info */ - - tip_bg = GetSysColor(COLOR_INFOBK); - tip_text = GetSysColor(COLOR_INFOTEXT); - - memset(&nci, 0, sizeof(NONCLIENTMETRICS)); - nci.cbSize = sizeof(NONCLIENTMETRICS); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, - sizeof(NONCLIENTMETRICS), &nci, 0); - tip_font = CreateFontIndirect(&nci.lfStatusFont); - } - - /* Generate the tip text */ - - sprintf(str, "%dx%d", cx, cy); - - if (!tip_wnd) { - HDC hdc; - SIZE sz; - RECT wr; - int ix, iy; - - /* calculate the tip's size */ - - hdc = CreateCompatibleDC(NULL); - GetTextExtentPoint32(hdc, str, _tcslen(str), &sz); - DeleteDC(hdc); - - GetWindowRect(src, &wr); - - ix = wr.left; - if (ix < 16) - ix = 16; - - iy = wr.top - sz.cy; - if (iy < 16) - iy = 16; - - /* Create the tip window */ - - tip_wnd = - CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, - MAKEINTRESOURCE(tip_class), str, WS_POPUP, ix, - iy, sz.cx, sz.cy, NULL, NULL, hinst, NULL); - - ShowWindow(tip_wnd, SW_SHOWNOACTIVATE); - - } else { - - /* Tip already exists, just set the text */ - - SetWindowText(tip_wnd, str); - } -} - -void EnableSizeTip(bool bEnable) -{ - if (tip_wnd && !bEnable) { - DestroyWindow(tip_wnd); - tip_wnd = NULL; - } - - tip_enabled = bEnable; -} +/* + * sizetip.c - resize tips for PuTTY(tel) terminal window. + */ + +#include +#include +#include + +#include "putty.h" + +static ATOM tip_class = 0; + +static HFONT tip_font; +static COLORREF tip_bg; +static COLORREF tip_text; + +static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, + WPARAM wParam, LPARAM lParam) +{ + + switch (nMsg) { + case WM_ERASEBKGND: + return true; + + case WM_PAINT: { + HBRUSH hbr; + HGDIOBJ holdbr; + RECT cr; + int wtlen; + LPTSTR wt; + HDC hdc; + + PAINTSTRUCT ps; + hdc = BeginPaint(hWnd, &ps); + + SelectObject(hdc, tip_font); + SelectObject(hdc, GetStockObject(BLACK_PEN)); + + hbr = CreateSolidBrush(tip_bg); + holdbr = SelectObject(hdc, hbr); + + GetClientRect(hWnd, &cr); + Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom); + + wtlen = GetWindowTextLength(hWnd); + wt = (LPTSTR) snewn(wtlen + 1, TCHAR); + GetWindowText(hWnd, wt, wtlen + 1); + + SetTextColor(hdc, tip_text); + SetBkColor(hdc, tip_bg); + + TextOut(hdc, cr.left + 3, cr.top + 3, wt, wtlen); + + sfree(wt); + + SelectObject(hdc, holdbr); + DeleteObject(hbr); + + EndPaint(hWnd, &ps); + return 0; + } + + case WM_NCHITTEST: + return HTTRANSPARENT; + + case WM_DESTROY: + DeleteObject(tip_font); + tip_font = NULL; + break; + + case WM_SETTEXT: { + LPCTSTR str = (LPCTSTR) lParam; + SIZE sz; + HDC hdc = CreateCompatibleDC(NULL); + + SelectObject(hdc, tip_font); + GetTextExtentPoint32(hdc, str, _tcslen(str), &sz); + + SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6, + SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + InvalidateRect(hWnd, NULL, false); + + DeleteDC(hdc); + break; + } + } + + return DefWindowProc(hWnd, nMsg, wParam, lParam); +} + +static HWND tip_wnd = NULL; +static bool tip_enabled = false; + +void UpdateSizeTip(HWND src, int cx, int cy) +{ + TCHAR str[32]; + + if (!tip_enabled) + return; + + if (!tip_wnd) { + NONCLIENTMETRICS nci; + + /* First make sure the window class is registered */ + + if (!tip_class) { + WNDCLASS wc; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = SizeTipWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hinst; + wc.hIcon = NULL; + wc.hCursor = NULL; + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.lpszClassName = "SizeTipClass"; + + tip_class = RegisterClass(&wc); + } +#if 0 + /* Default values based on Windows Standard color scheme */ + + tip_font = GetStockObject(SYSTEM_FONT); + tip_bg = RGB(255, 255, 225); + tip_text = RGB(0, 0, 0); +#endif + + /* Prepare other GDI objects and drawing info */ + + tip_bg = GetSysColor(COLOR_INFOBK); + tip_text = GetSysColor(COLOR_INFOTEXT); + + memset(&nci, 0, sizeof(NONCLIENTMETRICS)); + nci.cbSize = sizeof(NONCLIENTMETRICS); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, + sizeof(NONCLIENTMETRICS), &nci, 0); + tip_font = CreateFontIndirect(&nci.lfStatusFont); + } + + /* Generate the tip text */ + + sprintf(str, "%dx%d", cx, cy); + + if (!tip_wnd) { + HDC hdc; + SIZE sz; + RECT wr; + int ix, iy; + + /* calculate the tip's size */ + + hdc = CreateCompatibleDC(NULL); + GetTextExtentPoint32(hdc, str, _tcslen(str), &sz); + DeleteDC(hdc); + + GetWindowRect(src, &wr); + + ix = wr.left; + if (ix < 16) + ix = 16; + + iy = wr.top - sz.cy; + if (iy < 16) + iy = 16; + + /* Create the tip window */ + + tip_wnd = + CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, + MAKEINTRESOURCE(tip_class), str, WS_POPUP, ix, + iy, sz.cx, sz.cy, NULL, NULL, hinst, NULL); + + ShowWindow(tip_wnd, SW_SHOWNOACTIVATE); + + } else { + + /* Tip already exists, just set the text */ + + SetWindowText(tip_wnd, str); + } +} + +void EnableSizeTip(bool bEnable) +{ + if (tip_wnd && !bEnable) { + DestroyWindow(tip_wnd); + tip_wnd = NULL; + } + + tip_enabled = bEnable; +} diff --git a/0.75_My_PuTTY/windows/version_major.txt b/0.75_My_PuTTY/windows/version_major.txt index 7a2911a..cfbe7b7 100644 --- a/0.75_My_PuTTY/windows/version_major.txt +++ b/0.75_My_PuTTY/windows/version_major.txt @@ -1 +1 @@ -"0.74.4" +"0.75.0" diff --git a/0.75_My_PuTTY/windows/version_minor.txt b/0.75_My_PuTTY/windows/version_minor.txt index b1bd38b..573541a 100644 --- a/0.75_My_PuTTY/windows/version_minor.txt +++ b/0.75_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -13 +0 diff --git a/0.75_My_PuTTY/windows/wincapi.h b/0.75_My_PuTTY/windows/wincapi.h index 732412e..88bdcae 100644 --- a/0.75_My_PuTTY/windows/wincapi.h +++ b/0.75_My_PuTTY/windows/wincapi.h @@ -29,3 +29,12 @@ bool got_crypt(void); char *capi_obfuscate_string(const char *realname); #endif + + +#ifndef CRYPTPROTECTMEMORY_CROSS_PROCESS +#define CRYPTPROTECTMEMORY_CROSS_PROCESS 0x1 +#endif +#ifndef CRYPTPROTECTMEMORY_BLOCK_SIZE +#define CRYPTPROTECTMEMORY_BLOCK_SIZE 16 +#endif + diff --git a/0.75_My_PuTTY/windows/windlg.c b/0.75_My_PuTTY/windows/windlg.c index 01c3278..06c138f 100644 --- a/0.75_My_PuTTY/windows/windlg.c +++ b/0.75_My_PuTTY/windows/windlg.c @@ -78,6 +78,8 @@ int print_event_log( FILE * fp, int i ) { fprintf( fp, "%s\n", pst ) ; return 1 ; } +void do_eventlog( const char * st ) ; + #endif #ifdef MOD_PRINTCLIP #define PRINT_TO_CLIPBOARD_STRING "Windows clipboard" @@ -1023,12 +1025,12 @@ bool do_config(Conf *conf) load_settings(NULL,defconf); if( !strcmp(FileExtension,"") ) { if( save_settings( "Default Settings", defconf ) != NULL ) { - lp_eventlog(default_logpolicy, "Can not create Default Settings file" ) ; + do_eventlog( "Can not create Default Settings file" ) ; } } else { sprintf(buffer,"Default Settings%s", FileExtension); if( save_settings( buffer, defconf ) != NULL ) { - lp_eventlog(default_logpolicy, "Can not create Default Settings file" ) ; + do_eventlog("Can not create Default Settings file" ) ; } } conf_free( defconf ) ; diff --git a/0.75_My_PuTTY/windows/window.c b/0.75_My_PuTTY/windows/window.c index 05fb86b..0e0ee19 100644 --- a/0.75_My_PuTTY/windows/window.c +++ b/0.75_My_PuTTY/windows/window.c @@ -159,7 +159,11 @@ static struct { enum { SYSMENU, CTXMENU }; static HMENU savedsess_menu; +#ifdef MOD_PERSO +Conf *conf; +#else static Conf *conf; +#endif static LogContext *logctx; static Terminal *term; @@ -259,6 +263,8 @@ void SaveDump( void ) ; #include "../../kitty_tools.h" #include "../../kitty_win.h" extern int PuttyFlag ; +int GetCursorType() { return cursor_type ; } +void SetCursorType( const int ct ) { cursor_type = ct ; } extern char BuildVersionTime[256] ; void SendStrToTerminal( const char * str, const int len ) { char c ; @@ -438,7 +444,7 @@ typedef enum _WTS_VIRTUAL_CLASS { WTSVirtualClientData, WTSVirtualFileHandle } W #endif #ifdef MOD_RECONNECT static time_t last_reconnect = 0; -void SetConnBreakIcon( void ) ; +void SetConnBreakIcon( HWND hwnd ) ; static void close_session(void *ignored_context); #endif /* rutty: */ @@ -522,8 +528,7 @@ static const TermWinVtable windows_termwin_vt = { .set_cursor_pos = wintw_set_cursor_pos, .set_raw_mouse_mode = wintw_set_raw_mouse_mode, #ifdef MOD_PERSO - //wintw_set_focus_reporting_mode, - .set_focus_reporting_mode, + .set_focus_reporting_mode = wintw_set_focus_reporting_mode, #endif .set_raw_mouse_mode_pointer = wintw_set_raw_mouse_mode_pointer, .set_scrollbar = wintw_set_scrollbar, @@ -610,6 +615,11 @@ static const SeatVtable win_seat_vt = { static WinGuiSeat wgs = { .seat.vt = &win_seat_vt, .logpolicy.vt = &win_gui_logpolicy_vt }; +#ifdef MOD_PERSO +Terminal* GetTerminal() { return term ; } +void do_eventlog( const char * st ) { lp_eventlog(&wgs.logpolicy,st); } +#endif + static void start_backend(void) { const struct BackendVtable *vt; @@ -643,7 +653,7 @@ static void start_backend(void) conf_dest(conf), error); sfree(error); if( GetAutoreconnectFlag() && conf_get_int(conf,CONF_failure_reconnect) && is_backend_first_connected ) { - lp_eventlog(default_logpolicy, msg) ; + lp_eventlog(&wgs.logpolicy, msg) ; } else { if( GetAutoreconnectFlag() && conf_get_int(conf,CONF_failure_reconnect) ) { if( MessageBox(NULL, msg, str, MB_ICONERROR | MB_RETRYCANCEL | MB_DEFBUTTON2) == IDCANCEL ) { @@ -661,12 +671,12 @@ static void start_backend(void) sfree(str); sfree(msg); if( GetAutoreconnectFlag() && conf_get_int(conf,CONF_failure_reconnect) && is_backend_first_connected ) { - SetConnBreakIcon() ; + SetConnBreakIcon(wgs.term_hwnd) ; SetSSHConnected(0) ; queue_toplevel_callback(close_session, NULL); session_closed = true; - lp_eventlog(default_logpolicy, "Unable to connect, trying to reconnect...") ; - SetTimer(hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ; + lp_eventlog(&wgs.logpolicy, "Unable to connect, trying to reconnect...") ; + SetTimer(wgs.term_hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ; return ; } else @@ -760,14 +770,14 @@ void RestartSession( void ) { queue_toplevel_callback(close_session, NULL) ; backend = NULL ; } if( GetAutoreconnectFlag() ) { - lp_eventlog(default_logpolicy, "User request session restart..." ) ; + lp_eventlog(&wgs.logpolicy, "User request session restart..." ) ; } else { - win_seat_connection_fatal( win_seat, "User request session restart..." ) ; - SetTimer(hwnd, TIMER_RECONNECT, 10, NULL) ; + win_seat_connection_fatal( &wgs.seat, "User request session restart..." ) ; + SetTimer(wgs.term_hwnd, TIMER_RECONNECT, 10, NULL) ; } - PostMessage(hwnd,WM_KEYDOWN,VK_RETURN ,0) ; - PostMessage(hwnd,WM_KEYUP,VK_RETURN ,1) ; + PostMessage(wgs.term_hwnd,WM_KEYDOWN,VK_RETURN ,0) ; + PostMessage(wgs.term_hwnd,WM_KEYUP,VK_RETURN ,1) ; } #endif @@ -1048,10 +1058,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) if( existfile(argv[i]) ) { LoadFile = (char*) malloc( strlen(argv[i])+1 ) ; strcpy( LoadFile, argv[i] ) ; - RunPuttyEd( hwnd, LoadFile ) ; + RunPuttyEd( wgs.term_hwnd, LoadFile ) ; free( LoadFile ) ; } else { - MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; + MessageBox(wgs.term_hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; } exit( 0 ) ; } else if( !strcmp(p, "-folder") ) { @@ -1086,7 +1096,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } } else if( !strcmp(p, "-version") || !strcmp(p, "-about") ) { - showabout(hwnd) ; exit( 0 ) ; + showabout(wgs.term_hwnd) ; exit( 0 ) ; } else if( !strcmp(p, "-noctrltab") ) { SetCtrlTabFlag( 0 ) ; } else if( !strcmp(p, "-noicon") ) { @@ -1223,7 +1233,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) sprintf(buffer, "%s|%s|%s|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV"), argv[i] ) ; return Notepad_WinMain(inst, prev, buffer, show) ; } else { - MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; + MessageBox(wgs.term_hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; } exit(0); } else if( !strcmp(p, "-help") || !strcmp(p, "-h") ) { @@ -1282,7 +1292,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } else if( !strcmp(p, "-sendcmd") ) { i++ ; if( strlen(argv[i])>0 ) - SendCommandAllWindows( hwnd, argv[i] ) ; + SendCommandAllWindows( wgs.term_hwnd, argv[i] ) ; exit(0); } else if( !strcmp(p, "-kload") ) { i++ ; @@ -1418,7 +1428,7 @@ TrayIcone.uCallbackMessage = MYWM_NOTIFYICON; TrayIcone.hIcon = LoadIcon(NULL, NULL); // On ne load aucune icone pour le moment //TrayIcone.szTip[1024] = "PuTTY That\'s all folks!\0" ; // Le tooltip par defaut, soit rien strcpy( TrayIcone.szTip, "PuTTY That\'s all folks!\0") ; // Le tooltip par defaut, soit rien -TrayIcone.hWnd = hwnd ; +TrayIcone.hWnd = wgs.term_hwnd ; #endif memset(&ucsdata, 0, sizeof(ucsdata)); @@ -1579,7 +1589,7 @@ TrayIcone.hWnd = hwnd ; if( !PuttyFlag ) if( (conf_get_bool(conf,CONF_saveonexit)||conf_get_bool(conf,CONF_save_windowpos)) /*&& (xpos_init>=0) && (ypos_init>=0)*/ ) { - MoveWindow(hwnd, xpos_init, ypos_init, guess_width, guess_height, TRUE ); + MoveWindow(wgs.term_hwnd, xpos_init, ypos_init, guess_width, guess_height, TRUE ); } #endif @@ -1775,13 +1785,13 @@ TrayIcone.hWnd = hwnd ; #ifndef MOD_NOTRANSPARENCY if( GetTransparencyFlag() && conf_get_int(conf,CONF_transparencynumber) != -1 ) { if( conf_get_int(conf,CONF_transparencynumber) > 0 ) { - SetTransparency( hwnd, 255-conf_get_int(conf,CONF_transparencynumber) ) ; + SetTransparency( wgs.term_hwnd, 255-conf_get_int(conf,CONF_transparencynumber) ) ; } } #endif // Lancement du timer auto-command pour les connexions non SSH if(conf_get_int(conf,CONF_protocol) != PROT_SSH) { is_backend_connected = 1 ; } - SetTimer(hwnd, TIMER_INIT, init_delay, NULL) ; + SetTimer(wgs.term_hwnd, TIMER_INIT, init_delay, NULL) ; if( IniFileFlag == SAVEMODE_REG ) { sprintf( reg_buffer, "%s@%s:%d (prot=%d) name=%s", conf_get_str(conf,CONF_username), conf_get_str(conf,CONF_host), conf_get_int(conf,CONF_port), conf_get_int(conf,CONF_protocol), conf_get_str(conf,CONF_sessionname)) ; @@ -1794,19 +1804,19 @@ TrayIcone.hWnd = hwnd ; if( (!GetBackgroundImageFlag()) || GetPuttyFlag() ) conf_set_int(conf,CONF_bg_type,0); if( conf_get_int(conf,CONF_bg_type)!=0 ) { if(conf_get_int(conf,CONF_bg_slideshow)>0) - SetTimer(hwnd, TIMER_SLIDEBG, (int)(conf_get_int(conf,CONF_bg_slideshow)*1000), NULL) ; + SetTimer(wgs.term_hwnd, TIMER_SLIDEBG, (int)(conf_get_int(conf,CONF_bg_slideshow)*1000), NULL) ; else if(ImageSlideDelay>0) - SetTimer(hwnd, TIMER_SLIDEBG, (int)(ImageSlideDelay*1000), NULL) ; + SetTimer(wgs.term_hwnd, TIMER_SLIDEBG, (int)(ImageSlideDelay*1000), NULL) ; } // Lancement du rafraichissement toutes les 10 minutes (pour l'image de fond, pour pallier bug d'affichage) if( GetBackgroundImageFlag() && ReadParameter( INIT_SECTION, "redraw", reg_buffer ) ) { - if( stricmp( reg_buffer, "NO" ) ) SetTimer(hwnd, TIMER_REDRAW, (int)(600*1000), NULL) ; - } else SetTimer(hwnd, TIMER_REDRAW, (int)(600*1000), NULL) ; + if( stricmp( reg_buffer, "NO" ) ) SetTimer(wgs.term_hwnd, TIMER_REDRAW, (int)(600*1000), NULL) ; + } else SetTimer(wgs.term_hwnd, TIMER_REDRAW, (int)(600*1000), NULL) ; #endif // Lancement du timer d'anti-idle - SetTimer(hwnd, TIMER_ANTIIDLE, (int)(30*1000), NULL) ; + SetTimer(wgs.term_hwnd, TIMER_ANTIIDLE, (int)(30*1000), NULL) ; } // fin de if( !PuttyFlag ) #ifdef MOD_HYPERLINK @@ -2222,7 +2232,7 @@ static void wintw_set_focus_reporting_mode(TermWin *tw, bool activate) //send first activation notification message if (activate) { - SendKeyboard(hwnd, "\033[I"); + SendKeyboard(wgs.term_hwnd, "\033[I"); } } } @@ -2235,7 +2245,7 @@ static void win_seat_connection_fatal(Seat *seat, const char *msg) { #ifdef MOD_RECONNECT if( GetAutoreconnectFlag() && is_backend_first_connected ) { - SetConnBreakIcon() ; + SetConnBreakIcon(wgs.term_hwnd) ; SetSSHConnected(0); queue_toplevel_callback(close_session, NULL); session_closed = true; @@ -2247,13 +2257,13 @@ static void win_seat_connection_fatal(Seat *seat, const char *msg) if( conf_get_int(conf,CONF_failure_reconnect) ) { queue_toplevel_callback(close_session, NULL); session_closed = true; - lp_eventlog(default_logpolicy, "Lost connection, trying to reconnect...") ; - SetTimer(wgs.hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ; + lp_eventlog(&wgs.logpolicy, "Lost connection, trying to reconnect...") ; + SetTimer(wgs.term_hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ; } } else { char *title = dupprintf("%s Fatal Error", appname); show_mouseptr(true); - MessageBox(wgs.hwnd, msg, title, MB_ICONERROR | MB_OK); + MessageBox(wgs.term_hwnd, msg, title, MB_ICONERROR | MB_OK); sfree(title); if (conf_get_int(conf, CONF_close_on_exit) == FORCE_ON) @@ -3320,13 +3330,13 @@ static void win_seat_notify_remote_exit(Seat *seat) * we should not generate this informational one. */ #ifdef MOD_RECONNECT if( GetAutoreconnectFlag() && is_backend_first_connected ) { - SetConnBreakIcon() ; + SetConnBreakIcon(wgs.term_hwnd) ; SetSSHConnected(0); queue_toplevel_callback(close_session, NULL); session_closed = true; ReadInitScript(NULL); show_mouseptr(true); - lp_eventlog(default_logpolicy, "Connection closed by remote host"); + lp_eventlog(&wgs.logpolicy, "Connection closed by remote host"); } else #endif if (exitcode != INT_MAX) { @@ -3509,12 +3519,12 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation // On envoie l'autocommand if( strlen( conf_get_str(conf,CONF_autocommand) ) > 0 ) { - lp_eventlog(default_logpolicy, "Start autocommand timer" ); + lp_eventlog(&wgs.logpolicy, "Start autocommand timer" ); SetTimer(hwnd, TIMER_AUTOCOMMAND, autocommand_delay, NULL) ; } if( conf_get_int(conf,CONF_logtimerotation) > 0 ) { SetTimer(hwnd, TIMER_LOGROTATION, (int)( conf_get_int(conf,CONF_logtimerotation)*1000), NULL) ; - lp_eventlog(default_logpolicy, "Start log rotation" ); + lp_eventlog(&wgs.logpolicy, "Start log rotation" ); } RefreshBackground( hwnd ) ; @@ -3609,7 +3619,7 @@ else if((UINT_PTR)wParam == TIMER_ANTIIDLE) { // Envoi de l'anti-idle #ifdef MOD_RECONNECT if(!backend||!is_backend_connected) { // On essaie de se reconnecter en cas de problème de connexion if ( conf_get_int(conf,CONF_failure_reconnect) && is_backend_first_connected ) { - lp_eventlog(default_logpolicy, "No connection, trying to reconnect...") ; + lp_eventlog(&wgs.logpolicy, "No connection, trying to reconnect...") ; SetTimer(hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ; } break; @@ -3640,7 +3650,7 @@ else if((UINT_PTR)wParam == TIMER_BLINKTRAYICON) { // Clignotement de l'icone d #ifdef MOD_RECONNECT else if((UINT_PTR)wParam == TIMER_RECONNECT) { if( !backend ) { - lp_eventlog(default_logpolicy, "No backend connection, reconnecting...") ; + lp_eventlog(&wgs.logpolicy, "No backend connection, reconnecting...") ; PostMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ; } KillTimer( hwnd, TIMER_RECONNECT ) ; @@ -3656,7 +3666,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation { // Initialiation MainHwnd = hwnd ; - if( debug_flag ) { lp_eventlog(default_logpolicy,"Starting window creation") ; } + if( debug_flag ) { lp_eventlog(&wgs.logpolicy,"Starting window creation") ; } if( GetIconeFlag() != -1 ) SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_INIT ) ; @@ -3934,7 +3944,7 @@ free(cmd); if( !backend ) { if ( conf_get_int(conf,CONF_failure_reconnect) && is_backend_first_connected ) { SetTimer(hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ; - lp_eventlog(default_logpolicy, "Unable to connect, trying to reconnect...") ; + lp_eventlog(&wgs.logpolicy, "Unable to connect, trying to reconnect...") ; } break; } @@ -3969,7 +3979,7 @@ free(cmd); #ifdef MOD_PERSO if( force_reconf++ ) { reconfig_result = - do_reconfig(hwnd, backend ? backend_cfg_info(backend) : 0); + do_reconfig(hwnd, conf, backend ? backend_cfg_info(backend) : 0); reconfiguring = false; if (!reconfig_result) { conf_free(prev_conf); @@ -4241,7 +4251,7 @@ free(cmd); #ifdef MOD_RUTTY case IDM_SCRIPTHALT: script_close(&scriptdata); - lp_eventlog(default_logpolicy, "script stopped"); + lp_eventlog(&wgs.logpolicy, "script stopped"); break; case IDM_SCRIPTSEND: { @@ -4336,10 +4346,10 @@ free(cmd); ManagePrint( hwnd ) ; break ; case IDM_FONTUP: - ChangeFontSize(hwnd,1) ; + ChangeFontSize(term,conf,hwnd,1) ; break ; case IDM_FONTDOWN: - ChangeFontSize(hwnd,-1) ; + ChangeFontSize(term,conf,hwnd,-1) ; break ; case IDM_FONTBLACKANDWHITE: BlackOnWhiteColours(hwnd) ; @@ -4543,7 +4553,7 @@ free(cmd); #ifdef MOD_RECONNECT if( ((!backend) || (!is_backend_connected)) && GetAutoreconnectFlag() && is_backend_first_connected ) { // trying to reconnect PostMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ; - lp_eventlog(default_logpolicy, "No connection on mouse click, trying to reconnect...") ; + lp_eventlog(&wgs.logpolicy, "No connection on mouse click, trying to reconnect...") ; break ; } #endif @@ -4555,14 +4565,14 @@ free(cmd); if(!PuttyFlag && GetMouseShortcutsFlag() ) { if( (message == WM_LBUTTONUP) && ((wParam & MK_SHIFT) && (wParam & MK_CONTROL) ) ) { // shift + CTRL + left button => duplicate session if( backend && is_backend_connected ) { - lp_eventlog(default_logpolicy, "Duplicate session") ; + lp_eventlog(&wgs.logpolicy, "Duplicate session") ; SendMessage( hwnd, WM_COMMAND, IDM_DUPSESS, 0 ) ; } #ifdef MOD_RECONNECT else { if( is_backend_first_connected && GetAutoreconnectFlag() ) { SendMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ; - lp_eventlog(default_logpolicy, "No connection on mouse click, trying to reconnect...") ; + lp_eventlog(&wgs.logpolicy, "No connection on mouse click, trying to reconnect...") ; } } #endif @@ -4591,7 +4601,7 @@ free(cmd); } else if ( GetPasteCommandFlag() && (message == WM_RBUTTONDOWN) && ((wParam & MK_SHIFT) ) ) {// shift+bouton droit => coller (paste) ameliore (pour serveur lent, on utilise la methode autocommand par TIMER) - SetPasteCommand() ; + SetPasteCommand(wgs.term_hwnd) ; break ; } } @@ -4920,7 +4930,7 @@ free(cmd); } // Last paint edges - paint_term_edges(hdccod, p.rcPaint.left, p.rcPaint.top, p.rcPaint.right, p.rcPaint.bottom); + paint_term_edges(term,hdccod, p.rcPaint.left, p.rcPaint.top, p.rcPaint.right, p.rcPaint.bottom); EndPaint(hwnd, &p); ShowCaret(hwnd); @@ -5498,7 +5508,7 @@ free(cmd); #ifdef MOD_RECONNECT //if( !back && GetAutoreconnectFlag() && is_backend_first_connected && (WM_COMMAND==WM_KEYDOWN) && !(GetKeyState(VK_CONTROL)&0x8000) && !(GetKeyState(VK_SHIFT)&0x8000) && !(GetKeyState(VK_MENU)&0x8000) && (wParam!=VK_TAB) && (wParam!=VK_LEFT) && (wParam!=VK_UP) && (wParam!=VK_RIGHT) && (wParam!=VK_DOWN) && !((wParam>=VK_F1)&&(wParam<=VK_F16)) ) { if( (!backend || !is_backend_connected) && (message==WM_KEYDOWN) && GetAutoreconnectFlag() && is_backend_first_connected && (wParam!=VK_CONTROL) && (wParam!=VK_SHIFT) && (wParam!=VK_MENU) && (wParam!=VK_TAB) && (wParam!=VK_LEFT) && (wParam!=VK_UP) && (wParam!=VK_RIGHT) && (wParam!=VK_DOWN) && !((wParam>=VK_F1)&&(wParam<=VK_F16)) ) { - lp_eventlog(default_logpolicy, "No connection on key pressed, trying to reconnect...") ; + lp_eventlog(&wgs.logpolicy, "No connection on key pressed, trying to reconnect...") ; PostMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ; break ; } @@ -5543,7 +5553,7 @@ free(cmd); if( GetShortcutsFlag() ) { if ( (message==WM_KEYDOWN)||(message==WM_SYSKEYDOWN) ) { - if( ManageShortcuts( hwnd, clips_system, wParam + if( ManageShortcuts(term, conf, hwnd, clips_system, wParam , GetKeyState(VK_SHIFT)&0x8000 , GetKeyState(VK_CONTROL)&0x8000 , (GetKeyState(VK_MENU)&0x8000)||(GetKeyState(VK_LMENU)&0x8000) @@ -5754,13 +5764,13 @@ if( (GetKeyState(VK_MENU)&0x8000) && (wParam==VK_SPACE) ) { start_backend(); SetTimer(hwnd, TIMER_INIT, init_delay, NULL) ; */ - lp_eventlog(default_logpolicy, "Unable to connect on wakeup, trying to reconnect...") ; + lp_eventlog(&wgs.logpolicy, "Unable to connect on wakeup, trying to reconnect...") ; SetTimer(hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ; } break; case PBT_APMSUSPEND: if(!session_closed && backend) { - lp_eventlog(default_logpolicy, "Suspend detected, disconnecting cleanly..."); + lp_eventlog(&wgs.logpolicy, "Suspend detected, disconnecting cleanly..."); queue_toplevel_callback(close_session, NULL); // close_session(); session_closed = true; } @@ -5830,7 +5840,7 @@ if( (GetKeyState(VK_MENU)&0x8000) && (wParam==VK_SPACE) ) { // endregion */ } else if (control_pressed) { - ChangeFontSize(hwnd, MBT_WHEEL_UP == b ? 1 : -1); + ChangeFontSize(term,conf,hwnd, MBT_WHEEL_UP == b ? 1 : -1); } else { /* * PuttyFeatures: Scroll Lines @@ -6197,7 +6207,7 @@ static void do_text_internal( COLORREF backgroundcolor = colours[258]; // Default Background if(!bBgRelToTerm) - ClientToScreen(hwnd, &bgloc); + ClientToScreen(wgs.term_hwnd, &bgloc); if(bg == backgroundcolor) { // Use fast screen fill for default background. @@ -7460,8 +7470,8 @@ void set_title_internal(TermWin *tw, const char *title) { sfree(window_name); window_name = snewn(1 + strlen(title), char); strcpy(window_name, title); - if (conf_get_bool(conf, CONF_win_name_always) || !IsIconic(hwnd)) - SetWindowText(hwnd, title); + if (conf_get_bool(conf, CONF_win_name_always) || !IsIconic(wgs.term_hwnd)) + SetWindowText(wgs.term_hwnd, title); } /* Creer un titre de fenetre a partir d'un schema donne @@ -8477,12 +8487,12 @@ static void wintw_bell(TermWin *tw, int mode) #ifdef MOD_PERSO if( GetVisibleFlag()!=VISIBLE_TRAY ) { if(conf_get_bool(conf,CONF_foreground_on_bell) ) { // Tester avec sleep 4 ; echo -e '\a' - if( IsIconic(hwnd) ) SwitchToThisWindow( hwnd, TRUE ) ; - else SetForegroundWindow( MainHwnd ) ; + if( IsIconic(wgs.term_hwnd) ) SwitchToThisWindow( wgs.term_hwnd, TRUE ) ; + else SetForegroundWindow( wgs.term_hwnd ) ; } else { if( mode == BELL_VISUAL ) { - if( IsIconic(hwnd) ) - FlashWindow(hwnd, TRUE) ; + if( IsIconic(wgs.term_hwnd) ) + FlashWindow(wgs.term_hwnd, TRUE) ; else flash_window(2) ; } else { @@ -8491,9 +8501,9 @@ static void wintw_bell(TermWin *tw, int mode) } } else if( GetVisibleFlag()==VISIBLE_TRAY ) { if( conf_get_bool(conf,CONF_foreground_on_bell) ) { - SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 ) ; + SendMessage( wgs.term_hwnd, WM_COMMAND, IDM_FROMTRAY, 0 ) ; } else if(mode == BELL_VISUAL) - SetTimer(hwnd, TIMER_BLINKTRAYICON, (int)500, NULL) ; + SetTimer(wgs.term_hwnd, TIMER_BLINKTRAYICON, (int)500, NULL) ; //SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 ); //flash_window(2); /* start */ //ShowWindow( MainHwnd, SW_MINIMIZE); @@ -8692,7 +8702,7 @@ static void flip_full_screen() ShowWindow(wgs.term_hwnd, SW_MAXIMIZE); } #if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ) - if( GetBackgroundImageFlag()&&(!PuttyFlag)&&(conf_get_int(conf,CONF_bg_image_abs_fixed)==1)&&(conf_get_int(conf,CONF_bg_type)!=0) ) RefreshBackground( hwnd ) ; + if( GetBackgroundImageFlag()&&(!PuttyFlag)&&(conf_get_int(conf,CONF_bg_image_abs_fixed)==1)&&(conf_get_int(conf,CONF_bg_type)!=0) ) RefreshBackground( wgs.term_hwnd ) ; #endif } diff --git a/0.75_My_PuTTY/windows/winpgnt.c b/0.75_My_PuTTY/windows/winpgnt.c index 1d77956..00b57a7 100644 --- a/0.75_My_PuTTY/windows/winpgnt.c +++ b/0.75_My_PuTTY/windows/winpgnt.c @@ -497,8 +497,8 @@ static void win_add_keyfile(Filename *filename, bool encrypted) pps.comment = err; #ifdef MOD_PERSO if( strlen(pphrase)>0 ) { - passphrase=(char*)malloc(strlen(pphrase)+1); - strcpy(passphrase,pphrase); + pps.passphrase=(char*)malloc(strlen(pphrase)+1); + strcpy(pps.passphrase,pphrase); } else diff --git a/0.75_My_PuTTY/windows/winstuff.h b/0.75_My_PuTTY/windows/winstuff.h index 28149a5..a6e8021 100644 --- a/0.75_My_PuTTY/windows/winstuff.h +++ b/0.75_My_PuTTY/windows/winstuff.h @@ -9,9 +9,7 @@ #include #endif -#ifdef MOD_PERSO #include -#endif #include #include /* for FILENAME_MAX */ diff --git a/kitty.c b/kitty.c index 7558777..8966bee 100644 --- a/kitty.c +++ b/kitty.c @@ -673,7 +673,7 @@ char * get_param_str( const char * val ) { #ifdef MOD_ZMODEM void xyz_updateMenuItems(Terminal *term) { if( !GetZModemFlag() ) return ; - HMENU m = GetSystemMenu(hwnd, FALSE); + HMENU m = GetSystemMenu(MainHwnd, FALSE); // EnableMenuItem(m, IDM_XYZSTART, term->xyz_transfering?MF_GRAYED:MF_ENABLED); EnableMenuItem(m, IDM_XYZSTART, term->xyz_transfering?MF_GRAYED:MF_DISABLED); EnableMenuItem(m, IDM_XYZUPLOAD, term->xyz_transfering?MF_GRAYED:MF_ENABLED); @@ -683,28 +683,29 @@ void xyz_updateMenuItems(Terminal *term) { #endif char * kitty_current_dir() { - static char cdir[1024]; + return NULL ; /* Ce code est tres specifique et ne marche pas partout */ - + /* + static char cdir[1024]; char * dir = strstr(term->osc_string, ":") ; if(dir) { if( strlen(dir) > 1 ) { dir = dir + 1 ; - if(*dir == '~') { + if(*dir == '~') { if(strlen(conf_get_str(conf,CONF_username))>0) { - snprintf(cdir, 1024, "\"/home/%s/%s\"", conf_get_str(conf,CONF_username), dir + 1); - return cdir; - } - } - else if(*dir == '/') { + snprintf(cdir, 1024, "\"/home/%s/%s\"", conf_get_str(conf,CONF_username), dir + 1); + return cdir; + } + } else if(*dir == '/') { snprintf(cdir, 1024, "\"%s\"", dir); return cdir; - } } - } + } + } return NULL; - } + */ +} // Liste des folder char **FolderList=NULL ; @@ -1968,7 +1969,7 @@ void SetNewIcon( HWND hwnd, char * iconefile, int icone, const int mode ) { } // Modification de l'icone pour mettre l'icone de perte de connexion -void SetConnBreakIcon( void ) { +void SetConnBreakIcon( HWND hwnd ) { #ifdef MOD_PERSO HICON hIcon = NULL ; hIcon = LoadIcon( hInstIcons, MAKEINTRESOURCE(IDI_NOCON) ) ; @@ -3646,7 +3647,7 @@ int InternalCommand( HWND hwnd, char * st ) { return 1 ; } else if( !strcmp( st, "/urlregex" ) ) { char b[1024] ; - sprintf(b,"%d: %s",conf_get_int(term->conf,CONF_url_defregex),conf_get_str(conf,CONF_url_regex)); + sprintf(b,"%d: %s",conf_get_int(conf,CONF_url_defregex),conf_get_str(conf,CONF_url_regex)); MessageBox( NULL, b, "URL regex", MB_OK ) ; return 1 ; #endif } else if( !strcmp( st, "/save" ) ) { @@ -4665,7 +4666,7 @@ void ResetWindow(int reinit) ; void NegativeColours(HWND hwnd) { int i ; #ifdef MOD_TUTTY - for (i = 0; i < NCFGCOLOURS; i++) { + for (i = 0; i < 34; i++) { #else for (i = 0; i < 22; i++) { #endif @@ -4715,7 +4716,7 @@ void BlackOnWhiteColours(HWND hwnd) { } static int original_fontsize = -1 ; -void ChangeFontSize(HWND hwnd, int dec) { +void ChangeFontSize(Terminal *term, Conf *conf,HWND hwnd, int dec) { FontSpec *fontspec = conf_get_fontspec(conf, CONF_font); if( original_fontsize<0 ) original_fontsize = fontspec->height ; if( dec == 0 ) { fontspec->height = original_fontsize ; } @@ -5014,7 +5015,7 @@ void InitShortcuts( void ) { } int SwitchLogMode(void) ; -int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) { +int ManageShortcuts( Terminal *term, Conf *conf, HWND hwnd, const int* clips_system, int key_num, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) { int key, i ; key = key_num ; if( alt_flag ) key = key + ALTKEY ; @@ -5167,7 +5168,7 @@ int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_ if (key_num == VK_ADD) { SendMessage( hwnd, WM_COMMAND, IDM_FONTUP, 0 ) ; return 1 ; } if (key_num == VK_SUBTRACT) { SendMessage( hwnd, WM_COMMAND, IDM_FONTDOWN, 0 ) ; return 1 ; } - if (key_num == VK_NUMPAD0) { ChangeFontSize(hwnd,0) ; return 1 ; } + if (key_num == VK_NUMPAD0) { ChangeFontSize(term,conf,hwnd,0) ; return 1 ; } #ifdef MOD_LAUNCHER /* ====> Ne fonctionne pas !!! if (key_num == VK_LEFT ) //Fenetre KiTTY precedente @@ -5182,7 +5183,7 @@ int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_ // shift+bouton droit => paste ameliore pour serveur "lent" // Le paste utilise la methode "autocommand" -void SetPasteCommand( void ) { +void SetPasteCommand( HWND hwnd ) { if( !PasteCommandFlag ) return ; if( PasteCommand != NULL ) { free( PasteCommand ) ; PasteCommand = NULL ; } char *pst = NULL ; @@ -5225,7 +5226,7 @@ void LoadParameters( void ) { { AntiIdleCountMax = (int)floor(atoi(buffer)/10.0) ; if( AntiIdleCountMax<=0 ) AntiIdleCountMax =1 ; } if( ReadParameter( INIT_SECTION, "autostoresshkey", buffer ) ) { if( !stricmp( buffer, "YES" ) ) SetAutoStoreSSHKeyFlag( 1 ) ; } #if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ) - if( debug_flag ) + //if( debug_flag ) if( ReadParameter( INIT_SECTION, "backgroundimage", buffer ) ) { if( !stricmp( buffer, "NO" ) ) SetBackgroundImageFlag( 0 ) ; if( !stricmp( buffer, "YES" ) ) SetBackgroundImageFlag( 1 ) ; // Broken en 0.71 ==> on desactive @@ -5703,7 +5704,7 @@ void InitWinMain( void ) ; int ManageLocalCmd( HWND hwnd, const char * cmd ) ; // Gestion des raccourcis -int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) ; +int ManageShortcuts( Terminal *term, Conf *conf, HWND hwnd, const int* clips_system, int key_num, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) ; // Nettoie la clé de PuTTY pour enlever les clés et valeurs spécifique à KiTTY // Se trouve dans le fichier kitty_registry.c diff --git a/kitty.h b/kitty.h index 37b14ee..4b8d1be 100644 --- a/kitty.h +++ b/kitty.h @@ -6,7 +6,7 @@ #include // Handle sur la fenetre principale -extern HWND MainHwnd ; +//extern HWND MainHwnd ; HWND GetMainHwnd(void) ; @@ -320,7 +320,7 @@ int WriteParameter( const char * key, const char * name, char * value ) ; int DelParameter( const char * key, const char * name ) ; void GetSessionFolderName( const char * session_in, char * folder ) ; int MakeDirTree( const char * Directory, const char * s, const char * sd ) ; -int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) ; +int ManageShortcuts( Terminal *term, Conf *conf, HWND hwnd, const int* clips_system, int key_num, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) ; void print_log( const char *fmt, ...) ; char * SetInitialSessPath( void ) ; char * SetSessPath( const char * dec ) ; @@ -388,7 +388,7 @@ void OnDropFiles(HWND hwnd, HDROP hDropInfo) ; void DisplaySystemTrayMenu( HWND hwnd ) ; // shift+bouton droit => paste ameliore pour serveur "lent" // Le paste utilise la methode "autocommand" -void SetPasteCommand( void ) ; +void SetPasteCommand( HWND hwnd ) ; // Recupere les coordonnees de la fenetre void GetWindowCoord( HWND hwnd ) ; int ManageLocalCmd( HWND hwnd, const char * cmd ) ; @@ -409,7 +409,7 @@ void unmungestr( const char *in, char *out, int outlen ) ; void NegativeColours(HWND hwnd) ; void BlackOnWhiteColours(HWND hwnd) ; -void ChangeFontSize(HWND hwnd, int dec) ; +void ChangeFontSize(Terminal *term, Conf *conf,HWND hwnd, int dec) ; void create_settings( const char * name ) ; void SetHostKeyExtension( const char* ext ) ; diff --git a/kitty_commun.c b/kitty_commun.c index 891b267..14fa297 100644 --- a/kitty_commun.c +++ b/kitty_commun.c @@ -382,6 +382,7 @@ void unmungestr( const char *in, char *out, int outlen ) { } // Fonctions de gestion du mot de passe +extern Conf *conf; void GetPasswordInConfig( char * p ) { if( strlen(conf_get_str(conf,CONF_password)) == 0 ) return ; /* On decrypte le password */ diff --git a/kitty_image.c b/kitty_image.c index bd56a9c..e555322 100644 --- a/kitty_image.c +++ b/kitty_image.c @@ -626,7 +626,7 @@ void init_dc_blend(void) { pAlphaBlend = GetProcAddress(msimg32_dll, "AlphaBlend"); if(pAlphaBlend) { - HDC hdc = GetDC(hwnd); + HDC hdc = GetDC(MainHwnd); // Create one pixel size bitmap for use in color_blend. if( colorinpixeldc !=NULL ) { DeleteDC(colorinpixeldc ) ; } colorinpixeldc = CreateCompatibleDC(hdc); @@ -635,7 +635,7 @@ void init_dc_blend(void) { colorinpixel = 0; SetPixelV(colorinpixeldc, 0, 0, colorinpixel); - ReleaseDC(hwnd, hdc); + ReleaseDC(MainHwnd, hdc); } } @@ -851,7 +851,7 @@ void CreateBlankBitmap( HBITMAP * rawImage, const int width, const int height ) *rawImage = CreateDIBSection( dc,&bi,DIB_RGB_COLORS,&pvBits,NULL,0 ); ReleaseDC(NULL, dc) ; - HDC hDC = GetDC(hwnd); + HDC hDC = GetDC(MainHwnd); HDC hDCDst = CreateCompatibleDC(hDC); // memory device context for dest bitmap ReleaseDC(NULL, hDC); @@ -938,7 +938,7 @@ BOOL load_bg_bmp() } } - hdcPrimary = GetDC(hwnd); + hdcPrimary = GetDC(MainHwnd); deskWidth = GetDeviceCaps(hdcPrimary, HORZRES); deskHeight = GetDeviceCaps(hdcPrimary, VERTRES); @@ -1043,7 +1043,7 @@ BOOL load_bg_bmp() //if( (newhbmpBMP = ResizeBmp( rawImage,clientWidth,clientHeight)) != NULL ) { DeleteDC(bmpdc) ; bmpdc = CreateCompatibleDC(0) ; - DeleteDC(backgrounddc); backgrounddc = GetDC(hwnd); + DeleteDC(backgrounddc); backgrounddc = GetDC(MainHwnd); SelectObject(bmpdc, newhbmpBMP ) ; BitBlt(backgrounddc, 0, 0,clientWidth,clientHeight, bmpdc, 0, 0, SRCCOPY ) ; DeleteObject(newhbmpBMP); @@ -1085,13 +1085,13 @@ BOOL load_bg_bmp() } } - ReleaseDC(hwnd, hdcPrimary); + ReleaseDC(MainHwnd, hdcPrimary); //DeleteDC(hdcPrimary); return TRUE; } -void paint_term_edges(HDC hdc, LONG paint_left, LONG paint_top, LONG paint_right, LONG paint_bottom) +void paint_term_edges(Terminal*term, HDC hdc, LONG paint_left, LONG paint_top, LONG paint_right, LONG paint_bottom) { if(backgrounddc == 0) load_bg_bmp(); @@ -1109,14 +1109,14 @@ void paint_term_edges(HDC hdc, LONG paint_left, LONG paint_top, LONG paint_right srcTopLeft.y = topLeftY; if(!bBgRelToTerm) - ClientToScreen(hwnd, &srcTopLeft); + ClientToScreen(MainHwnd, &srcTopLeft); if(!srcdc) srcdc = backgrounddc; if(resizing) { - GetClientRect(hwnd, &size_now); + GetClientRect(MainHwnd, &size_now); if(size_now.bottom > size_before.bottom || size_now.right > size_before.right) { // Draw on full area on resize. diff --git a/kitty_image.h b/kitty_image.h index 54263dd..cec3c04 100644 --- a/kitty_image.h +++ b/kitty_image.h @@ -18,7 +18,7 @@ extern bool resizing; extern RECT size_before; void color_blend(HDC destDc, int x, int y, int width, int height, COLORREF alphacolor, int opacity) ; -void paint_term_edges(HDC hdc, LONG paint_left, LONG paint_top, LONG paint_right, LONG paint_bottom) ; +void paint_term_edges(Terminal *term, HDC hdc, LONG paint_left, LONG paint_top, LONG paint_right, LONG paint_bottom) ; void init_dc_blend(void); int screenCapturePart(int x, int y, int w, int h, LPCSTR fname,int quality) ; diff --git a/kitty_launcher.c b/kitty_launcher.c index ca8b94c..7816da5 100644 --- a/kitty_launcher.c +++ b/kitty_launcher.c @@ -704,7 +704,7 @@ int WINAPI Launcher_WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int s } if( LauncherConfReload ) InitLauncherRegistry() ; - hwnd = CreateWindowEx(0, className, "KiTTYLauncher", + MainHwnd = CreateWindowEx(0, className, "KiTTYLauncher", 0,//WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, diff --git a/kitty_savedump.c b/kitty_savedump.c index 51a335e..bbe94e2 100644 --- a/kitty_savedump.c +++ b/kitty_savedump.c @@ -268,11 +268,12 @@ void SaveDumpListConf( FILE *fp, const char *directory ) { } } +Terminal* GetTerminal() ; void kitty_term_copyall(Terminal *term) ; void SaveDumpClipBoard( FILE *fp ) { char *pst = NULL ; - if( term==NULL ) return ; - kitty_term_copyall(term) ; + if( GetTerminal()==NULL ) return ; + kitty_term_copyall(GetTerminal()) ; if( OpenClipboard(NULL) ) { HGLOBAL hglb ; if( (hglb = GetClipboardData( CF_TEXT ) ) != NULL ) { diff --git a/kitty_settings.c b/kitty_settings.c index caf04f1..ce989cf 100644 --- a/kitty_settings.c +++ b/kitty_settings.c @@ -82,7 +82,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { const struct BackendVtable *vt = backend_vt_from_proto(conf_get_int(conf, CONF_protocol)); if (vt) - p = vt->name; + p = vt->id; } write_setting_s_forced(sesskey, "Protocol", p); write_setting_i_forced(sesskey, "PortNumber", conf_get_int(conf, CONF_port)); @@ -234,7 +234,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { write_setting_i_forced(sesskey, "BoldAsColourTest", conf_get_int(conf, CONF_bold_colour) ); write_setting_i_forced(sesskey, "UnderlinedAsColour", conf_get_int(conf, CONF_under_colour) ); write_setting_i_forced(sesskey, "SelectedAsColour", conf_get_int(conf, CONF_sel_colour) ); - for (i = 0; i < NCFGCOLOURS; i++) { + for (i = 0; i < 34; i++) { #else for (i = 0; i < 22; i++) { #endif @@ -829,8 +829,8 @@ void load_open_settings_forced(char *filename, Conf *conf) { gppi_forced(sesskey, "BoldAsColourTest", 1, conf, CONF_bold_colour); gppi_forced(sesskey, "UnderlinedAsColour", 0, conf, CONF_under_colour); gppi_forced(sesskey, "SelectedAsColour", 0, conf, CONF_sel_colour); - for (i = 0; i < NCFGCOLOURS; i++) { - static const char *const defaults[NCFGCOLOURS] = { + for (i = 0; i < 34; i++) { + static const char *const defaults[34] = { "187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0", "0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85", "0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187", diff --git a/kitty_win.c b/kitty_win.c index bcf2f1d..da6755e 100644 --- a/kitty_win.c +++ b/kitty_win.c @@ -425,7 +425,7 @@ void debug_logevent( const char *fmt, ... ) { va_start(ap, fmt); buf = dupvprintf(fmt, ap) ; va_end(ap); - lp_eventlog(default_logpolicy,buf) ; + do_eventlog(buf) ; free(buf); } @@ -506,7 +506,7 @@ HWND CreateToolTip(int toolID, HWND hDlg, PTSTR pszText) return hwndTip; } - +/* HWND CreateToolTip2(int toolID, HWND hDlg, PTSTR pszText) { HWND hwndToolTips = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, @@ -529,3 +529,4 @@ HWND CreateToolTip2(int toolID, HWND hDlg, PTSTR pszText) { } return hwndToolTips ; } +*/ diff --git a/rutty/script_win.c b/rutty/script_win.c index 26589f3..a70ce23 100644 --- a/rutty/script_win.c +++ b/rutty/script_win.c @@ -5,7 +5,7 @@ */ extern Ldisc *ldisc; /* defined in window.c */ -extern HWND hwnd; /* in winstuff.h */ +extern HWND MainHwnd; /* in winstuff.h */ /* sort of copy of prompt_keyfile in winpgen.c @@ -32,7 +32,7 @@ int prompt_scriptfile(HWND hwnd, char * filename) */ void script_fail(char * message) { - MessageBox(hwnd,message,appname,MB_OK | MB_ICONEXCLAMATION); // + MessageBox(MainHwnd,message,appname,MB_OK | MB_ICONEXCLAMATION); // }