From dc1ce29a51ffe34161a93e71f6df59e51d1cc35e Mon Sep 17 00:00:00 2001 From: cyd01 Date: Sat, 11 May 2019 23:32:18 +0200 Subject: [PATCH] - bug fix: export ktx file - bug fix: issue when wrong password input --- 0.71_My_PuTTY/ssh2userauth.c | 6 + 0.71_My_PuTTY/windows/MAKEFILE.MINGW | 4 +- 0.71_My_PuTTY/windows/wincfg.c | 7 - 0.71_My_PuTTY/windows/windlg.c | 2 +- 0.71_My_PuTTY/windows/window.c | 104 +- 0.71_My_PuTTY/windows/winnet.c | 4 + jpeg/jpeglib.h | 1 + kitty.c | 6 +- kitty_crypt.c | 2 +- kitty_image.c | 246 ++-- kitty_image.h | 5 +- kitty_savedump.c | 1744 +++++++++++++------------- kitty_settings.c | 7 +- zmodem/winpzmodem.c | 16 +- 14 files changed, 1082 insertions(+), 1072 deletions(-) diff --git a/0.71_My_PuTTY/ssh2userauth.c b/0.71_My_PuTTY/ssh2userauth.c index 13e694c..6234e6b 100644 --- a/0.71_My_PuTTY/ssh2userauth.c +++ b/0.71_My_PuTTY/ssh2userauth.c @@ -596,10 +596,16 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) ppl_logevent("Keyboard-interactive authentication " "failed"); ppl_printf("Access denied\r\n"); +#ifdef PERSOPORT + SetPasswordInConfig("") ; +#endif } else { assert(s->type == AUTH_TYPE_PASSWORD); ppl_logevent("Password authentication failed"); ppl_printf("Access denied\r\n"); +#ifdef PERSOPORT + SetPasswordInConfig("") ; +#endif if (s->change_username) { /* XXX perhaps we should allow diff --git a/0.71_My_PuTTY/windows/MAKEFILE.MINGW b/0.71_My_PuTTY/windows/MAKEFILE.MINGW index 0784fee..268d37d 100644 --- a/0.71_My_PuTTY/windows/MAKEFILE.MINGW +++ b/0.71_My_PuTTY/windows/MAKEFILE.MINGW @@ -155,14 +155,14 @@ CFLAGS += -DPERSOPORT \ -DRUTTYPORT \ -DZMODEMPORT \ -DADBPORT \ - -DIMAGEPORT \ - -DCYGTERMPORT \ -I.././ -I../../ \ -I../charset/ -I../windows/ -I../unix/ -I../mac/ \ -I../macosx \ -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../wincrypt -I../../rutty # -DWINCRYPTPORT \ +# -DCYGTERMPORT \ +# -DIMAGEPORT \ # Autre flag a gérer diff --git a/0.71_My_PuTTY/windows/wincfg.c b/0.71_My_PuTTY/windows/wincfg.c index 3e531ae..cb349e6 100644 --- a/0.71_My_PuTTY/windows/wincfg.c +++ b/0.71_My_PuTTY/windows/wincfg.c @@ -634,13 +634,6 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help, "Application (*.exe)\0*.exe\0All files (*.*)\0*.*\0\0", TRUE, "Select executable to scp/sftp transfer", HELPCTX(no_help), conf_filesel_handler, I(CONF_url_browser)); - - //ctrl_checkbox(s, "Use the default browser", 'b', - // HELPCTX(no_help), - // dlg_stdcheckbox_handler, I(offsetof(Config,url_defbrowser))); - - //ctrl_text(s, "The single white space will be cropped in front of the link, if exists.", - // HELPCTX(no_help)); } #if (defined IMAGEPORT) && (!defined FDJ) diff --git a/0.71_My_PuTTY/windows/windlg.c b/0.71_My_PuTTY/windows/windlg.c index ae6ba45..f8a03d6 100644 --- a/0.71_My_PuTTY/windows/windlg.c +++ b/0.71_My_PuTTY/windows/windlg.c @@ -1074,7 +1074,7 @@ bool do_reconfig(HWND hwnd, int protcfginfo) if((conf_get_int(conf,CONF_bg_type)!=0)&&(conf_get_int(conf,CONF_bg_slideshow)>0)) SetTimer(hwnd, TIMER_SLIDEBG, (int)(conf_get_int(conf,CONF_bg_slideshow)*1000), NULL) ; InvalidateRect(hwnd, NULL, TRUE); - } + } #endif conf_free(backup_conf); diff --git a/0.71_My_PuTTY/windows/window.c b/0.71_My_PuTTY/windows/window.c index cdd2de8..3b657d8 100644 --- a/0.71_My_PuTTY/windows/window.c +++ b/0.71_My_PuTTY/windows/window.c @@ -1318,6 +1318,8 @@ TrayIcone.hWnd = hwnd ; winmode, CW_USEDEFAULT, CW_USEDEFAULT, guess_width, guess_height, NULL, NULL, inst, NULL); + + if( GetBackgroundImageFlag() ) init_dc_blend() ; #else hwnd = CreateWindowExW(exwinmode|WS_EX_ACCEPTFILES, uappname, uappname, winmode, CW_USEDEFAULT, CW_USEDEFAULT, @@ -1509,10 +1511,11 @@ TrayIcone.hWnd = hwnd ; #ifdef ZMODEMPORT if( (!GetPuttyFlag()) && GetZModemFlag() ) { AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, term->xyz_transfering?MF_GRAYED:MF_ENABLED, IDM_XYZSTART, "&Zmodem Receive"); + //AppendMenu(m, term->xyz_transfering?MF_GRAYED:MF_ENABLED, IDM_XYZSTART, "&Zmodem Receive"); + AppendMenu(m, term->xyz_transfering?MF_GRAYED:MF_DISABLED, IDM_XYZSTART, "&Zmodem Receive (broken)"); AppendMenu(m, term->xyz_transfering?MF_GRAYED:MF_ENABLED, IDM_XYZUPLOAD, "Zmodem &Upload"); AppendMenu(m, !term->xyz_transfering?MF_GRAYED:MF_ENABLED, IDM_XYZABORT, "Zmodem &Abort"); - } + } #endif AppendMenu(m, MF_SEPARATOR, 0, 0); if (has_help()) @@ -1587,10 +1590,9 @@ TrayIcone.hWnd = hwnd ; } // Lancement du rafraichissement toutes les 10 minutes (pour l'image de fond, pour pallier bug d'affichage) - if( ReadParameter( INIT_SECTION, "redraw", reg_buffer ) ) { + 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) ; + } else SetTimer(hwnd, TIMER_REDRAW, (int)(600*1000), NULL) ; // Lancement du timer d'anti-idle SetTimer(hwnd, TIMER_ANTIIDLE, (int)(30*1000), NULL) ; @@ -3217,13 +3219,13 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation strcat( buffer, "\\n" ) ; } } - if( strlen( conf_get_str(conf,CONF_autocommand)/*cfg.autocommand*/ ) > 0 ) { + if( strlen( conf_get_str(conf,CONF_autocommand) ) > 0 ) { strcat( buffer, "\\n\\p" ) ; - strcat( buffer, conf_get_str(conf,CONF_autocommand)/*cfg.autocommand*/ ) ; + strcat( buffer, conf_get_str(conf,CONF_autocommand) ) ; strcat( buffer, "\\n" ) ; } if( strlen(buffer) > 0 ) { - conf_set_str( conf, CONF_autocommand, buffer ); //strcpy( cfg.autocommand, buffer ) ; + conf_set_str( conf, CONF_autocommand, buffer ); } } @@ -3231,22 +3233,22 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation if( GetAutoSendToTray() ) ManageToTray( hwnd ) ; // Maximize automatic - if( conf_get_int(conf,CONF_maximize) /*cfg.maximize*/ ) { PostMessage( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, (LPARAM)NULL ) ; } + if( conf_get_int(conf,CONF_maximize) ) { PostMessage( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, (LPARAM)NULL ) ; } // Fullscreen automatic - if( conf_get_int(conf,CONF_fullscreen) /*cfg.fullscreen*/ ) { PostMessage( hwnd, WM_COMMAND, IDM_FULLSCREEN, (LPARAM)NULL ) ; } + if( conf_get_int(conf,CONF_fullscreen) ) { PostMessage( hwnd, WM_COMMAND, IDM_FULLSCREEN, (LPARAM)NULL ) ; } // Affichage d'une note de la session s'il y en a une - if( GetSessionField( conf_get_str( conf, CONF_sessionname)/*cfg.sessionname*/, conf_get_str( conf, CONF_folder)/*cfg.folder*/, "Notes", buffer ) ) + if( GetSessionField( conf_get_str( conf, CONF_sessionname), conf_get_str( conf, CONF_folder), "Notes", buffer ) ) { if( strlen( buffer ) > 0 ) MessageBox( hwnd, buffer, "Notes", MB_OK ) ; } - RenewPassword( conf/*&cfg*/ ) ; + RenewPassword( conf ) ; - if( strlen( conf_get_str(conf,CONF_autocommand)/*cfg.autocommand*/ ) > 0 ) { + if( strlen( conf_get_str(conf,CONF_autocommand) ) > 0 ) { SetTimer(hwnd, TIMER_AUTOCOMMAND, autocommand_delay, NULL) ; } - if( conf_get_int(conf,CONF_logtimerotation)/*cfg.logtimerotation*/ > 0 ) { - SetTimer(hwnd, TIMER_LOGROTATION, (int)( conf_get_int(conf,CONF_logtimerotation)/*cfg.logtimerotation*/*1000), NULL) ; + if( conf_get_int(conf,CONF_logtimerotation) > 0 ) { + SetTimer(hwnd, TIMER_LOGROTATION, (int)( conf_get_int(conf,CONF_logtimerotation)*1000), NULL) ; logevent(NULL, "Start log rotation" ); } @@ -3257,7 +3259,7 @@ else if((UINT_PTR)wParam == TIMER_DND){ KillTimer(hwnd, TIMER_DND) ; recupNomFichierDragDrop(hwnd, &hDropInf) ; if( hDropInf != NULL ) { free(hDropInf) ; hDropInf = NULL ; } - InvalidateRect( hwnd, NULL, TRUE ) ; + InvalidateRect( hwnd, NULL, true ) ; } else if((UINT_PTR)wParam == TIMER_AUTOCOMMAND) { // Autocommand au demarrage @@ -3267,13 +3269,7 @@ else if((UINT_PTR)wParam == TIMER_AUTOCOMMAND) { // Autocommand au demarrage ValidateRect( hwnd, NULL ) ; AutoCommand = (char*) malloc( strlen(conf_get_str(conf,CONF_autocommand))+10 ) ; strcpy( AutoCommand, conf_get_str(conf,CONF_autocommand) ) ; - - //char bufauto[8192]=""; - //GetSessionField( conf_get_str(conf,CONF_sessionname)/*cfg.sessionname*/, conf_get_str(conf,CONF_folder)/*cfg.folder*/, "Autocommand", bufauto/*cfg.autocommand*/ ) ; - //conf_set_str( conf,CONF_autocommand, bufauto); - //AutoCommand = conf_get_str(conf,CONF_autocommand)/*cfg.autocommand */; // Probleme ou pas ? -//logevent(NULL, AutoCommand ); - } + } char buffer[8192] = "" ; @@ -3298,16 +3294,11 @@ else if((UINT_PTR)wParam == TIMER_AUTOCOMMAND) { // Autocommand au demarrage } } - //if( AutoCommand[i] != '\0' ) { AutoCommand += i ; } del( AutoCommand, 1, i ) ; //AutoCommand += i ; if( strlen( buffer ) > 0 ) { SendAutoCommand( hwnd, buffer ) ; } if( AutoCommand[0] == '\0' ) { free( AutoCommand ) ; AutoCommand = NULL ; - InvalidateRect( hwnd, NULL, TRUE ) ; - - //char bufauto[8192]=""; - //GetSessionField( conf_get_str(conf,CONF_sessionname), conf_get_str(conf,CONF_folder), "Autocommand", bufauto) ; - //conf_set_str( conf,CONF_autocommand,bufauto); + InvalidateRect( hwnd, NULL, true ) ; } else { SetTimer(hwnd, TIMER_AUTOCOMMAND, autocommand_delay, NULL) ; } } @@ -3334,12 +3325,12 @@ else if((UINT_PTR)wParam == TIMER_AUTOPASTE) { // AutoPaste #if (defined IMAGEPORT) && (!defined FDJ) else if( GetBackgroundImageFlag() && ((UINT_PTR)wParam == TIMER_SLIDEBG) ) { // Changement automatique de l'image de fond NextBgImage( hwnd ) ; - InvalidateRect( hwnd, NULL, TRUE ) ; + InvalidateRect( hwnd, NULL, true ) ; } #endif else if((UINT_PTR)wParam == TIMER_REDRAW) { // rafraichissement automatique (bug d'affichage) RefreshBackground( hwnd ) ; // On inhibe cette fonction a cause du probleme de fuite memoire due a l'image de fond !!! - //InvalidateRect( hwnd, NULL, TRUE ) ; // On remplace par + //InvalidateRect( hwnd, NULL, true ) ; // On remplace par } else if((UINT_PTR)wParam == TIMER_ANTIIDLE) { // Envoi de l'anti-idle AntiIdleCount += 1 ; @@ -3411,7 +3402,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation #if (defined IMAGEPORT) && (!defined FDJ) if( GetIconeFlag() == -1 ) conf_set_int( conf, CONF_bg_type, 0 ) ; - if( !GetBackgroundImageFlag() ) conf_set_int( conf, CONF_bg_type,0 ); + if( !GetBackgroundImageFlag() ) conf_set_int( conf, CONF_bg_type, 0 ); #endif if( !PuttyFlag ) if( conf_get_int( conf,CONF_saveonexit) && conf_get_int( conf,CONF_windowstate) ) @@ -4541,7 +4532,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation * current terminal appearance so that WM_PAINT becomes * completely trivial. However, this should do for now. */ -// assert(!wintw_hdc); + //assert(!wintw_hdc); wintw_hdc = hdc; #if (defined IMAGEPORT) && (!defined FDJ) if( GetBackgroundImageFlag() && (!GetPuttyFlag()) ) { @@ -4808,7 +4799,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation { // When using a background image based on the desktop, correct display // may depend on the current position of the window. - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); } sys_cursor_update(); @@ -4848,7 +4839,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation if(textdc || backgrounddc || backgroundblenddc) { - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true ); } break; @@ -5007,8 +4998,12 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation if( conf_get_int(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; #endif #ifdef IMAGEPORT + /* if( ((wParam == SIZE_RESTORED)&&(resizing!=TRUE)) || (wParam == SIZE_MAXIMIZED) ) { if( GetBackgroundImageFlag() && (conf_get_int(conf,CONF_bg_image_abs_fixed)==1) && (conf_get_int(conf,CONF_bg_type)!=0) ) RefreshBackground( hwnd ) ; + }*/ + if( (wParam == SIZE_RESTORED) || (wParam == SIZE_MAXIMIZED) ) { + RefreshBackground( hwnd ) ; } #endif sys_cursor_update(); @@ -5727,11 +5722,8 @@ static void do_text_internal( GetBValue(fg) * 2 / 3); } #if (defined IMAGEPORT) && (!defined FDJ) - HDC hdc = make_hdc(); - // HDC hdc = wintw_hdc ; - //HDC hdc = GetDC(hwnd); // 0.71: peut-être faut-il remplacer hdc par wintw_hdc ? - // hdc ==> /*hdc*/ wintw_hdc - if( GetBackgroundImageFlag() && (!PuttyFlag) ) { + HDC hdc = wintw_hdc ; + if( GetBackgroundImageFlag() && (!GetPuttyFlag()) ) { line_box.left = x; line_box.top = y; line_box.right = x + char_width * len; @@ -5750,11 +5742,11 @@ static void do_text_internal( ClientToScreen(hwnd, &bgloc); if(bg == backgroundcolor) { - // Use fast screen fill for default background. + // Use fast screen fill for default background. BitBlt(textdc, x, y, width, height, backgroundblenddc, bgloc.x, bgloc.y, SRCCOPY); } else { BitBlt(textdc, x, y, width, height, backgrounddc, bgloc.x, bgloc.y, SRCCOPY); - color_blend(textdc, x, y, width, height, bg, conf_get_int(conf,CONF_bg_opacity)); + color_blend(textdc, x, y, width, height, bg, conf_get_int(conf,CONF_bg_opacity)) ; } hdc = textdc; } @@ -5766,17 +5758,17 @@ static void do_text_internal( else SetBkMode(hdc, OPAQUE); } else { - SelectObject(wintw_hdc, fonts[nfont]); - SetTextColor(wintw_hdc, fg); - SetBkColor(wintw_hdc, bg); - if (attr & TATTR_COMBINING) - SetBkMode(wintw_hdc, TRANSPARENT); - else - SetBkMode(wintw_hdc, OPAQUE); - line_box.left = x; - line_box.top = y; - line_box.right = x + char_width * len; - line_box.bottom = y + font_height; + SelectObject(hdc, fonts[nfont]); + SetTextColor(hdc, fg); + SetBkColor(hdc, bg); + if (attr & TATTR_COMBINING) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); + line_box.left = x; + line_box.top = y; + line_box.right = x + char_width * len; + line_box.bottom = y + font_height; } #else SelectObject(wintw_hdc, fonts[nfont]); @@ -5921,7 +5913,7 @@ static void do_text_internal( // ExtTextOutW(hdc, x, // y - font_height * (lattr == LATTR_BOT) + text_adjust, // ETO_CLIPPED | etoFlagOpaque, &line_box, uni_buf, nlen, lpDx); - ExtTextOutW(wintw_hdc, x + xoffset, + ExtTextOutW(hdc, x + xoffset, y - font_height * (lattr == LATTR_BOT) + text_adjust, ETO_CLIPPED | etoFlagOpaque, &line_box, uni_buf, nlen, @@ -5954,7 +5946,7 @@ static void do_text_internal( // ExtTextOut(hdc, x, // y - font_height * (lattr == LATTR_BOT) + text_adjust, // ETO_CLIPPED | etoFlagOpaque, &line_box, directbuf, len, lpDx); - ExtTextOut(wintw_hdc, x + xoffset, + ExtTextOut(hdc, x + xoffset, y - font_height * (lattr == LATTR_BOT) + text_adjust, ETO_CLIPPED | etoFlagOpaque, &line_box, directbuf, len, lpDx_maybe); @@ -6000,7 +5992,7 @@ static void do_text_internal( if( GetBackgroundImageFlag() && (!PuttyFlag) ) // exact_textout(hdc, x, y - font_height * (lattr == LATTR_BOT) + text_adjust, // &line_box, wbuf, len, lpDx, !(attr & TATTR_COMBINING) &&!transBg); - exact_textout(wintw_hdc, x + xoffset, + exact_textout(hdc, x + xoffset, y - font_height * (lattr == LATTR_BOT) + text_adjust, &line_box, wbuf, len, lpDx, !(attr & TATTR_COMBINING) &&!transBg); diff --git a/0.71_My_PuTTY/windows/winnet.c b/0.71_My_PuTTY/windows/winnet.c index ef8fbb2..8e4bda7 100644 --- a/0.71_My_PuTTY/windows/winnet.c +++ b/0.71_My_PuTTY/windows/winnet.c @@ -1836,6 +1836,10 @@ void select_result(WPARAM wParam, LPARAM lParam) if (ret <= 0) { int err = p_WSAGetLastError(); plug_closing(s->plug, winsock_error_string(err), err, 0); +#ifdef ZMODEMPORT + } else if( (!GetPuttyFlag()) && GetZModemFlag() && s->closing) { + return ; +#endif } else { plug_receive(s->plug, 2, buf, ret); } diff --git a/jpeg/jpeglib.h b/jpeg/jpeglib.h index 2a88ed1..c672b39 100644 --- a/jpeg/jpeglib.h +++ b/jpeg/jpeglib.h @@ -9,6 +9,7 @@ * Most applications using the library need only include this file, * and perhaps jerror.h if they want to know the exact error codes. */ +#include #ifndef JPEGLIB_H #define JPEGLIB_H diff --git a/kitty.c b/kitty.c index 0f2c7a3..4307b67 100644 --- a/kitty.c +++ b/kitty.c @@ -2788,11 +2788,11 @@ void RedrawBackground( HWND hwnd ) ; void RefreshBackground( HWND hwnd ) { #if (defined IMAGEPORT) && (!defined FDJ) - if( BackgroundImageFlag ) RedrawBackground( hwnd ) ; + if( BackgroundImageFlag ) RedrawBackground( hwnd ) ; else #endif - InvalidateRect(hwnd, NULL, TRUE) ; - } + InvalidateRect( hwnd, NULL, true ) ; +} #if (defined IMAGEPORT) && (!defined FDJ) /* Changement du fond d'ecran */ diff --git a/kitty_crypt.c b/kitty_crypt.c index 2f77970..61e8f9d 100644 --- a/kitty_crypt.c +++ b/kitty_crypt.c @@ -59,7 +59,7 @@ static char PassPhrase[256] = "" ; char * ManagePassPhrase( const char * st ) { if( st != NULL ) strcpy( PassPhrase, st ) ; return PassPhrase ; - } +} #ifdef NO_PRIVKEY /* Flag utiliser pour essayer une fois une clé privée stockée en interne dans le binaire diff --git a/kitty_image.c b/kitty_image.c index a60cab8..525b66a 100644 --- a/kitty_image.c +++ b/kitty_image.c @@ -9,9 +9,16 @@ #undef IMAGEPORT #endif +#include +#include "kitty_image.h" +#include +#include "jpeg/jpeglib.h" +#include + #ifdef IMAGEPORT #ifdef NO -#include + +#include #include "putty.h" #include "terminal.h" @@ -47,7 +54,6 @@ COLORREF return_colours258(void) ; static BOOL (WINAPI * pAlphaBlend)( HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION ) = 0 ; //static HWND hwnd; -#include "kitty_image.h" HDC textdc = NULL ; HBITMAP textbm = NULL ; @@ -59,7 +65,7 @@ HBITMAP backgroundbm = NULL ; HDC backgroundblenddc = NULL ; HBITMAP backgroundblendbm = NULL; BOOL bBgRelToTerm; -int resizing; +bool resizing; RECT size_before; @@ -370,8 +376,6 @@ static BOOL load_file_bmp(HBITMAP* rawImage, int* style, int* x, int* y) return TRUE; } -#include -#include "jpeg/jpeglib.h" jmp_buf JPEG_bailout; int usePalette = 0; char *loadError = NULL; @@ -596,115 +600,6 @@ if( rawImage == NULL ) res =FALSE ; return res; } -HBITMAP HWND_to_HBITMAP(HWND hWnd) -{ - RECT r; - HDC hdcMem, hdcScr; - HBITMAP hbmMem, hbmOld; - - GetWindowRect(hWnd, &r); - hdcScr = GetWindowDC(hWnd); - hdcMem = CreateCompatibleDC(hdcScr); - hbmMem = CreateCompatibleBitmap(hdcScr, r.right -= r.left, r.bottom -= r.top) ; - hbmOld = (HBITMAP)SelectObject(hdcMem, hbmMem); - BitBlt(hdcMem, 0, 0, r.right, r.bottom, hdcScr, 0, 0, SRCCOPY); - SelectObject(hdcMem, hbmOld); - ReleaseDC(hWnd, hdcScr); - DeleteDC(hdcMem); - return hbmMem; -} - -BOOL HBITMAP_to_JPG(HBITMAP hbm, LPCTSTR jpgfile, int quality) -{ - BITMAP bm; - BITMAPINFO bi; - BYTE *pPixels; - JSAMPROW jrows[1], jrow; - HDC hdcScr, hdcMem1, hdcMem2; - HBITMAP hbmMem, hbmOld1, hbmOld2; - FILE *fp = fopen(jpgfile, "wb"); - struct jpeg_compress_struct jpeg; - struct jpeg_error_mgr jerr; - - if(!hbm) - return 0; - if(!GetObject(hbm, sizeof(bm), &bm)) - return 0; - if(!fp) - return 0; - - ZeroMemory(&bi, sizeof(bi)); - bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bi.bmiHeader.biWidth = bm.bmWidth; - bi.bmiHeader.biHeight = bm.bmHeight; - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 24; - bi.bmiHeader.biCompression = BI_RGB; - - hdcScr = GetDC(0); - hdcMem1 = CreateCompatibleDC(hdcScr); - hbmOld1 = (HBITMAP)SelectObject(hdcMem1,hbm); - hdcMem2 = CreateCompatibleDC(hdcScr); - hbmMem = CreateDIBSection(hdcScr, &bi, DIB_RGB_COLORS, (VOID **)&pPixels, 0, 0); - hbmOld2 = (HBITMAP)SelectObject(hdcMem2, hbmMem); - - BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem1, 0, 0, SRCCOPY); - - SelectObject(hdcMem1, hbmOld1); - SelectObject(hdcMem2, hbmOld2); - ReleaseDC(0, hdcScr); - DeleteDC(hdcMem1); - DeleteDC(hdcMem2); - - jpeg.err = jpeg_std_error(&jerr); - jpeg_create_compress(&jpeg); - jpeg_stdio_dest(&jpeg, fp); - jpeg.image_width = bm.bmWidth; - jpeg.image_height = bm.bmHeight; - jpeg.input_components = 3; - jpeg.in_color_space = JCS_RGB; - jpeg.dct_method = JDCT_FLOAT; - jpeg_set_defaults(&jpeg); - jpeg_set_quality(&jpeg, (quality < 0 || quality > 100) ? 100 : quality, TRUE); - jpeg_start_compress(&jpeg, TRUE); - - char *comment=NULL ; - if( comment ) { - jpeg_write_marker(&jpeg, JPEG_COM, (const JOCTET*)comment, strlen(comment)); - } - - while(jpeg.next_scanline < jpeg.image_height) - { - unsigned int i, j, tmp; - - jrow = &pPixels[(jpeg.image_height - jpeg.next_scanline - 1) * ((((bm.bmWidth * 24) + 31) / 32) * 4)]; - - for(i = 0; i < jpeg.image_width; i++) - { - j = i * 3; - tmp = jrow[j]; - jrow[j] = jrow[j + 2]; - jrow[j + 2] = tmp; - } - jrows[0] = jrow; - jpeg_write_scanlines(&jpeg, jrows, 1); - } - - jpeg_finish_compress(&jpeg); - jpeg_destroy_compress(&jpeg); - DeleteObject(hbmMem); - fclose(fp); - return 1; -} - -void MakeScreenShot() { -HBITMAP hbm = HWND_to_HBITMAP(GetDesktopWindow()); - if(hbm) { - HBITMAP_to_JPG(hbm, "screenshot.jpg", 85) ; - DeleteObject(hbm); - } -} - static HBITMAP CreateDIBSectionWithFileMapping(HDC dc, int width, int height, HANDLE fmap) { BITMAPINFOHEADER BMI; @@ -769,16 +664,14 @@ int screenCaptureAll( LPCSTR fname, int quality ) { /******************************/ -void init_dc_blend(void) -{ +void init_dc_blend(void) { //HMODULE * msimg32_dll = LoadLibrary("msimg32.dll"); HMODULE msimg32_dll = LoadLibrary("msimg32.dll"); if(msimg32_dll) pAlphaBlend = GetProcAddress(msimg32_dll, "AlphaBlend"); - if(pAlphaBlend) - { + if(pAlphaBlend) { HDC hdc = GetDC(hwnd); // Create one pixel size bitmap for use in color_blend. @@ -865,7 +758,6 @@ void color_blend( } } -#include static void color_opacity_gradient( HDC destDc, int x, int y, int width, int height, COLORREF alphacolor, int style ) { int i, alphacolorR, alphacolorG, alphacolorB, bk_opacity, opacity, h, w ; double l ; @@ -1472,13 +1364,17 @@ void clean_bg(void) { void RedrawBackground( HWND hwnd ) { if( 1 && // On inhibe cette fonction a cause du probleme de fuite memoire due a l'image de fond !!! , mais probleme de rafraichissement ? - (get_param("BACKGROUNDIMAGE"))&&(!get_param("PUTTY"))&&(conf_get_int(conf,CONF_bg_type)/*cfg.bg_type*/ != 0) ) + (get_param("BACKGROUNDIMAGE"))&&(!get_param("PUTTY"))&&(conf_get_int(conf,CONF_bg_type) != 0) ) { clean_bg() ; load_bg_bmp(); // Apparement c'est ça qui faisait la fuite memoire !!! } + /* + InvalidateRect(hwnd, NULL, true) ; RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); - InvalidateRect(hwnd, NULL, TRUE) ; + */ + RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN | RDW_UPDATENOW ) ; + } @@ -1510,3 +1406,111 @@ void BackgroundImagePatch( int num ) { #endif +HBITMAP HWND_to_HBITMAP(HWND hWnd) +{ + RECT r; + HDC hdcMem, hdcScr; + HBITMAP hbmMem, hbmOld; + + GetWindowRect(hWnd, &r); + hdcScr = GetWindowDC(hWnd); + hdcMem = CreateCompatibleDC(hdcScr); + hbmMem = CreateCompatibleBitmap(hdcScr, r.right -= r.left, r.bottom -= r.top) ; + hbmOld = (HBITMAP)SelectObject(hdcMem, hbmMem); + BitBlt(hdcMem, 0, 0, r.right, r.bottom, hdcScr, 0, 0, SRCCOPY); + SelectObject(hdcMem, hbmOld); + ReleaseDC(hWnd, hdcScr); + DeleteDC(hdcMem); + return hbmMem; +} + +BOOL HBITMAP_to_JPG(HBITMAP hbm, LPCTSTR jpgfile, int quality) +{ + BITMAP bm; + BITMAPINFO bi; + BYTE *pPixels; + JSAMPROW jrows[1], jrow; + HDC hdcScr, hdcMem1, hdcMem2; + HBITMAP hbmMem, hbmOld1, hbmOld2; + FILE *fp = fopen(jpgfile, "wb"); + struct jpeg_compress_struct jpeg; + struct jpeg_error_mgr jerr; + + if(!hbm) + return 0; + if(!GetObject(hbm, sizeof(bm), &bm)) + return 0; + if(!fp) + return 0; + + ZeroMemory(&bi, sizeof(bi)); + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bi.bmiHeader.biWidth = bm.bmWidth; + bi.bmiHeader.biHeight = bm.bmHeight; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 24; + bi.bmiHeader.biCompression = BI_RGB; + + hdcScr = GetDC(0); + hdcMem1 = CreateCompatibleDC(hdcScr); + hbmOld1 = (HBITMAP)SelectObject(hdcMem1,hbm); + hdcMem2 = CreateCompatibleDC(hdcScr); + hbmMem = CreateDIBSection(hdcScr, &bi, DIB_RGB_COLORS, (VOID **)&pPixels, 0, 0); + hbmOld2 = (HBITMAP)SelectObject(hdcMem2, hbmMem); + + BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem1, 0, 0, SRCCOPY); + + SelectObject(hdcMem1, hbmOld1); + SelectObject(hdcMem2, hbmOld2); + ReleaseDC(0, hdcScr); + DeleteDC(hdcMem1); + DeleteDC(hdcMem2); + + jpeg.err = jpeg_std_error(&jerr); + jpeg_create_compress(&jpeg); + jpeg_stdio_dest(&jpeg, fp); + jpeg.image_width = bm.bmWidth; + jpeg.image_height = bm.bmHeight; + jpeg.input_components = 3; + jpeg.in_color_space = JCS_RGB; + jpeg.dct_method = JDCT_FLOAT; + jpeg_set_defaults(&jpeg); + jpeg_set_quality(&jpeg, (quality < 0 || quality > 100) ? 100 : quality, TRUE); + jpeg_start_compress(&jpeg, TRUE); + + char *comment=NULL ; + if( comment ) { + jpeg_write_marker(&jpeg, JPEG_COM, (const JOCTET*)comment, strlen(comment)); + } + + while(jpeg.next_scanline < jpeg.image_height) + { + unsigned int i, j, tmp; + + jrow = &pPixels[(jpeg.image_height - jpeg.next_scanline - 1) * ((((bm.bmWidth * 24) + 31) / 32) * 4)]; + + for(i = 0; i < jpeg.image_width; i++) + { + j = i * 3; + tmp = jrow[j]; + jrow[j] = jrow[j + 2]; + jrow[j + 2] = tmp; + } + jrows[0] = jrow; + jpeg_write_scanlines(&jpeg, jrows, 1); + } + + jpeg_finish_compress(&jpeg); + jpeg_destroy_compress(&jpeg); + DeleteObject(hbmMem); + fclose(fp); + return 1; +} + +void MakeScreenShot() { +HBITMAP hbm = HWND_to_HBITMAP(GetDesktopWindow()); + if(hbm) { + HBITMAP_to_JPG(hbm, "screenshot.jpg", 85) ; + DeleteObject(hbm); + } +} diff --git a/kitty_image.h b/kitty_image.h index bf52251..475f6a9 100644 --- a/kitty_image.h +++ b/kitty_image.h @@ -11,17 +11,18 @@ extern HBITMAP colorinpixelbm; extern HDC backgrounddc; extern BOOL bBgRelToTerm; -extern int resizing; +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 init_dc_blend(void); -void MakeScreenShot(); int screenCapturePart(int x, int y, int w, int h, LPCSTR fname,int quality) ; int screenCaptureClientRect( HWND hwnd, LPCSTR fname, int quality ) ; int screenCaptureWinRect( HWND hwnd, LPCSTR fname, int quality ) ; int screenCaptureAll( LPCSTR fname, int quality ) ; #endif + +void MakeScreenShot(); diff --git a/kitty_savedump.c b/kitty_savedump.c index 7cd2869..2f91878 100644 --- a/kitty_savedump.c +++ b/kitty_savedump.c @@ -1,874 +1,870 @@ - -static char SaveKeyPressed[4096] = "" ; - -void WriteCountUpAndPath(void) ; -void SaveDumpPortableConfig( FILE * fp ) ; -int GetAutoStoreSSHKeyFlag(void) ; -int GetUserPassSSHNoSave(void) ; - -// Buffer contenant du texte a ecrire au besoin dans le fichier kitty.dmp -static char * DebugText = NULL ; - -void set_debug_text( const char * txt ) { - if( DebugText!=NULL ) { free( DebugText ) ; DebugText = NULL ; } - if( txt != NULL ) { - DebugText = (char*) malloc( strlen(txt)+1 ) ; - strcpy( DebugText, txt ) ; - } - } - -void addkeypressed( UINT message, WPARAM wParam, LPARAM lParam, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) { - char buffer[256], c=' ' ; - int p ; - - if( message==WM_KEYDOWN ) c='v' ; else if( message==WM_KEYUP ) c='^' ; - - if( shift_flag ) shift_flag = 1 ; - if( control_flag ) control_flag = 1 ; - if( alt_flag ) alt_flag = 1 ; - if( altgr_flag ) altgr_flag = 1 ; - if( win_flag ) win_flag = 1 ; - - if( wParam=='\r' ) - sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (\\r)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0 ) ; - else if( wParam=='\n' ) - sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (\\n)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0 ) ; - else if( (wParam>=32) && (wParam<=111 ) ) - sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (%c)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0, wParam ) ; - else if( (wParam>=VK_F1 /*70 112*/) && (wParam<=VK_F24 /*87 135*/) ) - sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (F%d)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0, wParam-VK_F1+1 ) ; - else - sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0 ) ; - - if( strlen(SaveKeyPressed) > 4000 ) { - if( (p=poss("\n",SaveKeyPressed)) > 0 ) { - del( SaveKeyPressed, 1, p ); - } - } - strcat( SaveKeyPressed, buffer ) ; - } - -#include -void PrintProcessNameAndID( DWORD processID, FILE * fp ) { - TCHAR szProcessName[MAX_PATH] = TEXT(""); - DWORD SizeOfImage = 0 ; - - // Get a handle to the process. - HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID ); - - // Get the process name. - if (NULL != hProcess ) { - HMODULE hMod; - DWORD cbNeeded; - MODULEINFO modinfo ; - if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) ) { - GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName)/sizeof(TCHAR) ) ; - GetModuleInformation( hProcess, hMod, &modinfo, sizeof( modinfo ) ) ; - SizeOfImage = modinfo.SizeOfImage ; - } - } - - // Print the process name and identifier. - fprintf( fp, TEXT("%05u %u \t%s\n"), (unsigned int)processID, (unsigned int)SizeOfImage, szProcessName ) ; - CloseHandle( hProcess ); - } - -void PrintWindowSettings( FILE * fp ) { - int ret ; - RECT r ; - char buffer[MAX_VALUE_NAME] ; - - GetOSInfo( buffer ) ; - fprintf( fp, "OSVersion=%s\n", buffer ) ; - if( IsWow64() ) { fprintf( fp, "64 bits System\n" ) ; } else { fprintf( fp, "32 bits System\n" ) ; } - - ret = GetWindowText( MainHwnd, buffer, MAX_VALUE_NAME ) ; buffer[ret]='\0'; - ret = GetWindowTextLength( MainHwnd ) ; - fprintf( fp, "Title (length)=%s (%d)\n", buffer, ret ) ; - if( GetWindowRect( MainHwnd, &r ) ) { - fprintf( fp, "WindowRect.left=%ld\n", r.left ) ; - fprintf( fp, "WindowRect.right=%ld\n", r.right ) ; - fprintf( fp, "WindowRect.top=%ld\n", r.top ) ; - fprintf( fp, "WindowRect.bottom=%ld\n", r.bottom ) ; - } - if( GetClientRect( MainHwnd, &r ) ) { - fprintf( fp, "ClientRect.left=%ld\n", r.left ) ; - fprintf( fp, "ClientRect.right=%ld\n", r.right ) ; - fprintf( fp, "ClientRect.top=%ld\n", r.top ) ; - fprintf( fp, "ClientRect.bottom=%ld\n", r.bottom ) ; - } - - ret = GetWindowModuleFileName( MainHwnd, buffer, MAX_VALUE_NAME ) ; buffer[ret]='\0'; - fprintf( fp, "WindowModuleFileName=%s\n", buffer ) ; - - WINDOWINFO wi ; - wi.cbSize = sizeof( WINDOWINFO ) ; - if( GetWindowInfo( MainHwnd, &wi ) ) { - fprintf( fp, "WindowInfo.cbSize=%lu\n", wi.cbSize ) ; - fprintf( fp, "WindowInfo.rcWindow.left=%ld\n", wi.rcWindow.left ) ; - fprintf( fp, "WindowInfo.rcWindow.right=%ld\n", wi.rcWindow.right ) ; - fprintf( fp, "WindowInfo.rcWindow.top=%ld\n", wi.rcWindow.top ) ; - fprintf( fp, "WindowInfo.rcWindow.bottom=%ld\n", wi.rcWindow.bottom ) ; - fprintf( fp, "WindowInfo.rcClient.left=%ld\n", wi.rcWindow.left ) ; - fprintf( fp, "WindowInfo.rcClient.right=%ld\n", wi.rcWindow.right ) ; - fprintf( fp, "WindowInfo.rcClient.top=%ld\n", wi.rcWindow.top ) ; - fprintf( fp, "WindowInfo.rcClient.bottom=%ld\n", wi.rcWindow.bottom ) ; - fprintf( fp, "WindowInfo.dwStyle=%lu\n", wi.dwStyle ) ; - fprintf( fp, "WindowInfo.dwExStyle=%lu\n", wi.dwExStyle ) ; - fprintf( fp, "WindowInfo.dwWindowStatus=%lu\n", wi.dwWindowStatus ) ; - fprintf( fp, "WindowInfo.cxWindowBorders=%u\n", wi.cxWindowBorders ) ; - fprintf( fp, "WindowInfo.cyWindowBorders=%u\n", wi.cyWindowBorders ) ; - fprintf( fp, "WindowInfo.wCreatorVersion=%d\n", wi.wCreatorVersion ) ; - } - - WINDOWPLACEMENT wp; - wp.length=sizeof(WINDOWPLACEMENT) ; - if( GetWindowPlacement( MainHwnd, &wp ) ) { - fprintf( fp, "WindowPlacement.length=%u\n", wp.length ) ; - fprintf( fp, "WindowPlacement.flags=%u\n", wp.flags ) ; - fprintf( fp, "WindowPlacement.showCmd=%u\n", wp.showCmd ) ; - fprintf( fp, "WindowPlacement.ptMinPosition.x=%ld\n", wp.ptMinPosition.x ) ; - fprintf( fp, "WindowPlacement.ptMinPosition.y=%ld\n", wp.ptMinPosition.y ) ; - fprintf( fp, "WindowPlacement.ptMaxPosition.x=%ld\n", wp.ptMaxPosition.x ) ; - fprintf( fp, "WindowPlacement.ptMaxPosition.y=%ld\n", wp.ptMaxPosition.y ) ; - fprintf( fp, "WindowPlacement.rcNormalPosition.left=%ld\n", wp.rcNormalPosition.left ) ; - fprintf( fp, "WindowPlacement.rcNormalPosition.right=%ld\n", wp.rcNormalPosition.right ) ; - fprintf( fp, "WindowPlacement.rcNormalPosition.top=%ld\n", wp.rcNormalPosition.top ) ; - fprintf( fp, "WindowPlacement.rcNormalPosition.bottom=%ld\n", wp.rcNormalPosition.bottom ) ; - } - - fprintf( fp, "IsIconic=%d\n", IsIconic( MainHwnd ) ) ; - fprintf( fp, "IsWindow=%d\n", IsWindow( MainHwnd ) ) ; - fprintf( fp, "IsWindowUnicode=%d\n", IsWindowUnicode( MainHwnd ) ) ; - fprintf( fp, "IsWindowVisible=%d\n", IsWindowVisible( MainHwnd ) ) ; - fprintf( fp, "IsZoomed=%d\n", IsZoomed( MainHwnd ) ) ; - - fprintf( fp, "ScaleX=%d\n", GetDeviceCaps(GetDC(MainHwnd),LOGPIXELSX) ) ; - fprintf( fp, "ScaleY=%d\n", GetDeviceCaps(GetDC(MainHwnd),LOGPIXELSY) ) ; - } - -DWORD PrintAllProcess( FILE * fp ) { - DWORD aProcesses[1024], cbNeeded, cProcesses; - unsigned int i; - - if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) ) return 0 ; - - // Calculate how many process identifiers were returned. - cProcesses = cbNeeded / sizeof(DWORD); - - // Print the name and process identifier for each process. - printf( "ID MEM \tMODULE\n" ); - if( cProcesses > 0 ) - for ( i = 0; i < cProcesses; i++ ) - if( aProcesses[i] != 0 ) - PrintProcessNameAndID( aProcesses[i], fp ) ; - return cProcesses ; - } - -void SaveDumpListFile( FILE * fp, const char * directory ) { - DIR *dir ; - struct dirent *de ; - char buffer[MAX_VALUE_NAME] ; - - /* fprintf( fp, " ===> Listing directory %s\n", directory ) ; */ - if( ( dir=opendir( directory ) ) != NULL ) { - while( ( de=readdir( dir ) ) != NULL ) { - if( strcmp(de->d_name,".")&&strcmp(de->d_name,"..") ) { - sprintf( buffer, "%s\\%s", directory, de->d_name ) ; - if( GetFileAttributes( buffer ) & FILE_ATTRIBUTE_DIRECTORY ) { - strcat( buffer, "\\" ) ; - fprintf( fp, "%s\n", buffer ) ; - SaveDumpListFile( fp, buffer ) ; - } - else { fprintf( fp, "%s\n", buffer ) ; } - } - } - closedir( dir ) ; - } -} - -void SaveDumpListConf( FILE *fp, const char *directory ) { - char buffer[4096], fullpath[MAX_VALUE_NAME] ; - FILE *fp2 ; - DIR *dir ; - struct dirent *de ; - if( ( dir=opendir( directory ) ) != NULL ) { - while( ( de=readdir( dir ) ) != NULL ) { - if( strcmp(de->d_name,".")&&strcmp(de->d_name,"..") ) { - sprintf( fullpath, "%s\\%s", directory, de->d_name ) ; - if( GetFileAttributes( fullpath ) & FILE_ATTRIBUTE_DIRECTORY ) - SaveDumpListConf( fp, fullpath ) ; - else { - fprintf( fp, "[%s]\n", fullpath ) ; - if( ( fp2 = fopen( fullpath, "r" ) ) != NULL ) { - while( fgets( buffer, 4095, fp2 ) != NULL ) fputs( buffer, fp ) ; - fclose( fp2 ) ; - } - fprintf( fp, "\n\n" ) ; - } - } - } - closedir( dir ) ; - } - } - -void kitty_term_copyall(Terminal *term) ; -void SaveDumpClipBoard( FILE *fp ) { - char *pst = NULL ; - if( term==NULL ) return ; - kitty_term_copyall(term) ; - if( OpenClipboard(NULL) ) { - HGLOBAL hglb ; - if( (hglb = GetClipboardData( CF_TEXT ) ) != NULL ) { - if( ( pst = GlobalLock( hglb ) ) != NULL ) { - //fputs( pst, fp ) ; - fwrite( pst, 1, strlen(pst), fp ) ; - GlobalUnlock( hglb ) ; - } - } - CloseClipboard(); - } - } - -//#include -void SaveDumpEnvironment( FILE *fp ) { - int i = 0 ; - while( environ[i] ) { - fprintf( fp, "%s\n", environ[i] ) ; - i++; - } - } - -void SaveDumpConfig( FILE *fp, Conf * conf ) { - char *buf=NULL ; - CountUp(); - fprintf( fp, "MASTER_PASSWORD=%s\n", MASTER_PASSWORD ) ; - fprintf( fp, "[[PuTTY structure configuration]]\n" ) ; - - /* Basic options */ - fprintf( fp, "host=%s\n", conf_get_str(conf,CONF_host) ) ; - fprintf( fp, "port=%d\n", conf_get_int(conf,CONF_port) ) ; - fprintf( fp, "protocol=%d\n", conf_get_int(conf,CONF_protocol) ) ; - fprintf( fp, "addressfamily=%d\n", conf_get_int(conf,CONF_addressfamily) ) ; - fprintf( fp, "close_on_exit=%d\n", conf_get_int(conf,CONF_close_on_exit) ) ; - fprintf( fp, "warn_on_close=%d\n", conf_get_bool(conf,CONF_warn_on_close) ) ; - fprintf( fp, "ping_interval=%d\n", conf_get_int(conf,CONF_ping_interval) ) ; - fprintf( fp, "tcp_nodelay=%d\n", conf_get_bool(conf,CONF_tcp_nodelay) ) ; - fprintf( fp, "tcp_keepalives=%d\n", conf_get_bool(conf,CONF_tcp_keepalives) ) ; - fprintf( fp, "loghost=%s\n", conf_get_str(conf,CONF_loghost) ) ; - - /* Proxy options */ - fprintf( fp, "proxy_exclude_list=%s\n", conf_get_str(conf,CONF_proxy_exclude_list) ) ; - fprintf( fp, "proxy_dns=%d\n", conf_get_int(conf,CONF_proxy_dns) ) ; - fprintf( fp, "even_proxy_localhost=%d\n", conf_get_bool(conf,CONF_even_proxy_localhost) ) ; - fprintf( fp, "proxy_type=%d\n", conf_get_int(conf,CONF_proxy_type) ) ; - fprintf( fp, "proxy_host=%s\n", conf_get_str(conf,CONF_proxy_host) ) ; - fprintf( fp, "proxy_port=%d\n", conf_get_int(conf,CONF_proxy_port) ) ; - fprintf( fp, "proxy_username=%s\n", conf_get_str(conf,CONF_proxy_username) ) ; - fprintf( fp, "proxy_password=%s\n", conf_get_str(conf,CONF_proxy_password) ) ; - fprintf( fp, "proxy_telnet_command=%s\n", conf_get_str(conf,CONF_proxy_telnet_command) ) ; - fprintf( fp, "proxy_log_to_term=%d\n", conf_get_int(conf,CONF_proxy_log_to_term) ) ; - - /* SSH options */ - fprintf( fp, "remote_cmd=%s\n", conf_get_str(conf,CONF_remote_cmd) ) ; - fprintf( fp, "remote_cmd2=%s\n", conf_get_str(conf,CONF_remote_cmd2) ) ; - fprintf( fp, "nopty=%d\n", conf_get_bool(conf,CONF_nopty) ) ; - fprintf( fp, "compression=%d\n", conf_get_bool(conf,CONF_compression) ) ; - //fprintf( fp, "ssh_kexlist=%d\n", conf_get_int(conf,CONF_ssh_kexlist) ) ; - //fprintf( fp, "ssh_hklist=%d\n", conf_get_int(conf,CONF_ssh_hklist) ) ; - fprintf( fp, "ssh_rekey_time=%d\n", conf_get_int(conf,CONF_ssh_rekey_time) ) ; - fprintf( fp, "ssh_rekey_data=%s\n", conf_get_str(conf,CONF_ssh_rekey_data) ) ; - fprintf( fp, "tryagent=%d\n", conf_get_bool(conf,CONF_tryagent) ) ; - fprintf( fp, "agentfwd=%d\n", conf_get_bool(conf,CONF_agentfwd) ) ; - fprintf( fp, "change_username=%d\n", conf_get_bool(conf,CONF_change_username) ) ; - //fprintf( fp, "ssh_cipherlist=%d\n", conf_get_int(conf,CONF_ssh_cipherlist) ) ; - fprintf( fp, "keyfile=%s\n", conf_get_filename(conf,CONF_keyfile)->path ) ; - fprintf( fp, "sshprot=%d\n", conf_get_int(conf,CONF_sshprot) ) ; - fprintf( fp, "ssh2_des_cbc=%d\n", conf_get_bool(conf,CONF_ssh2_des_cbc) ) ; - fprintf( fp, "ssh_no_userauth=%d\n", conf_get_bool(conf,CONF_ssh_no_userauth) ) ; - fprintf( fp, "ssh_show_banner=%d\n", conf_get_bool(conf,CONF_ssh_show_banner) ) ; - fprintf( fp, "try_tis_auth=%d\n", conf_get_bool(conf,CONF_try_tis_auth) ) ; - fprintf( fp, "try_ki_auth=%d\n", conf_get_bool(conf,CONF_try_ki_auth) ) ; - fprintf( fp, "try_gssapi_auth=%d\n", conf_get_bool(conf,CONF_try_gssapi_auth) ) ; - fprintf( fp, "try_gssapi_kex=%d\n", conf_get_bool(conf,CONF_try_gssapi_kex) ) ; - fprintf( fp, "gssapifwd=%d\n", conf_get_bool(conf,CONF_gssapifwd) ) ; - fprintf( fp, "gssapirekey=%d\n", conf_get_int(conf,CONF_gssapirekey) ) ; - //fprintf( fp, "ssh_gsslist=%d\n", conf_get_int(conf,CONF_ssh_gsslist) ) ; - fprintf( fp, "ssh_gss_custom=%s\n", conf_get_filename(conf,CONF_ssh_gss_custom)->path ) ; - fprintf( fp, "ssh_subsys=%d\n", conf_get_bool(conf,CONF_ssh_subsys) ) ; - //fprintf( fp, "ssh_subsys2=%d\n", conf_get_bool(conf,CONF_ssh_subsys2) ) ; // N'est pas lu dans settings.c - fprintf( fp, "ssh_no_shell=%d\n", conf_get_bool(conf,CONF_ssh_no_shell) ) ; - //fprintf( fp, "ssh_nc_host=%s\n", conf_get_str(conf,CONF_ssh_nc_host) ) ; // N'est pas lu dans settings.c - //fprintf( fp, "ssh_nc_port=%d\n", conf_get_int(conf,CONF_ssh_nc_port) ) ; // N'est pas lu dans settings.c - - /* Telnet options */ - fprintf( fp, "termtype=%s\n", conf_get_str(conf,CONF_termtype ) ) ; - fprintf( fp, "termspeed=%s\n", conf_get_str(conf,CONF_termspeed ) ) ; - //fprintf( fp, "ttymodes=%s\n", conf_get_str(conf,CONF_ttymodes ) ) ; - //fprintf( fp, "environmt=%s\n", conf_get_str(conf,CONF_environmt ) ) ; - fprintf( fp, "username=%s\n", conf_get_str(conf,CONF_username ) ) ; - fprintf( fp, "username_from_env=%d\n", conf_get_bool(conf,CONF_username_from_env) ) ; - fprintf( fp, "localusername=%s\n", conf_get_str(conf,CONF_localusername ) ) ; - fprintf( fp, "rfc_environ=%d\n", conf_get_bool(conf,CONF_rfc_environ) ) ; - fprintf( fp, "passive_telnet=%d\n", conf_get_bool(conf,CONF_passive_telnet) ) ; - - /* Serial port options */ - fprintf( fp, "serline=%s\n", conf_get_str(conf,CONF_serline) ) ; - fprintf( fp, "serspeed=%d\n", conf_get_int(conf,CONF_serspeed) ) ; - fprintf( fp, "serdatabits=%d\n", conf_get_int(conf,CONF_serdatabits) ) ; - fprintf( fp, "serstopbits=%d\n", conf_get_int(conf,CONF_serstopbits) ) ; - fprintf( fp, "serparity=%d\n", conf_get_int(conf,CONF_serparity) ) ; - fprintf( fp, "serflow=%d\n", conf_get_int(conf,CONF_serflow) ) ; - - /* Keyboard options */ - fprintf( fp, "bksp_is_delete=%d\n", conf_get_bool(conf,CONF_bksp_is_delete) ) ; - fprintf( fp, "rxvt_homeend=%d\n", conf_get_bool(conf,CONF_rxvt_homeend) ) ; - fprintf( fp, "funky_type=%d\n", conf_get_int(conf,CONF_funky_type) ) ; - fprintf( fp, "no_applic_c=%d\n", conf_get_bool(conf,CONF_no_applic_c) ) ; - fprintf( fp, "no_applic_k=%d\n", conf_get_bool(conf,CONF_no_applic_k) ) ; - fprintf( fp, "no_mouse_rep=%d\n", conf_get_bool(conf,CONF_no_mouse_rep) ) ; - fprintf( fp, "no_remote_resize=%d\n", conf_get_bool(conf,CONF_no_remote_resize) ) ; - fprintf( fp, "no_alt_screen=%d\n", conf_get_bool(conf,CONF_no_alt_screen) ) ; - fprintf( fp, "no_remote_wintitle=%d\n", conf_get_bool(conf,CONF_no_remote_wintitle) ) ; - fprintf( fp, "no_remote_clearscroll=%d\n", conf_get_bool(conf,CONF_no_remote_clearscroll) ) ; - fprintf( fp, "no_dbackspace=%d\n", conf_get_bool(conf,CONF_no_dbackspace) ) ; - fprintf( fp, "no_remote_charset=%d\n", conf_get_bool(conf,CONF_no_remote_charset) ) ; - fprintf( fp, "remote_qtitle_action=%d\n", conf_get_int(conf,CONF_remote_qtitle_action) ) ; - fprintf( fp, "app_cursor=%d\n", conf_get_bool(conf,CONF_app_cursor) ) ; - fprintf( fp, "app_keypad=%d\n", conf_get_bool(conf,CONF_app_keypad) ) ; - fprintf( fp, "nethack_keypad=%d\n", conf_get_bool(conf,CONF_nethack_keypad) ) ; - fprintf( fp, "telnet_keyboard=%d\n", conf_get_bool(conf,CONF_telnet_keyboard) ) ; - fprintf( fp, "telnet_newline=%d\n", conf_get_bool(conf,CONF_telnet_newline) ) ; - fprintf( fp, "alt_f4=%d\n", conf_get_bool(conf,CONF_alt_f4) ) ; - fprintf( fp, "alt_space=%d\n", conf_get_bool(conf,CONF_alt_space) ) ; - fprintf( fp, "alt_only=%d\n", conf_get_bool(conf,CONF_alt_only) ) ; - fprintf( fp, "localecho=%d\n", conf_get_int(conf,CONF_localecho) ) ; - fprintf( fp, "localedit=%d\n", conf_get_int(conf,CONF_localedit) ) ; - - fprintf( fp, "alwaysontop=%d\n", conf_get_bool(conf,CONF_alwaysontop) ) ; - fprintf( fp, "fullscreenonaltenter=%d\n", conf_get_bool(conf,CONF_fullscreenonaltenter) ) ; - fprintf( fp, "scroll_on_key=%d\n", conf_get_bool(conf,CONF_scroll_on_key) ) ; - fprintf( fp, "scroll_on_disp=%d\n", conf_get_bool(conf,CONF_scroll_on_disp) ) ; - fprintf( fp, "erase_to_scrollback=%d\n", conf_get_bool(conf,CONF_erase_to_scrollback) ) ; - fprintf( fp, "compose_key=%d\n", conf_get_bool(conf,CONF_compose_key) ) ; - fprintf( fp, "ctrlaltkeys=%d\n", conf_get_bool(conf,CONF_ctrlaltkeys) ) ; - //fprintf( fp, "osx_option_meta=%d\n", conf_get_bool(conf,CONF_osx_option_meta) ) ; // N'est pas lu dans settings.c - //fprintf( fp, "osx_command_meta=%d\n", conf_get_bool(conf,CONF_osx_command_meta) ) ; // N'est pas lu dans settings.c - fprintf( fp, "wintitle=%s\n", conf_get_str(conf,CONF_wintitle) ) ; - - /* Terminal options */ - fprintf( fp, "savelines=%d\n", conf_get_int(conf,CONF_savelines) ) ; - fprintf( fp, "dec_om=%d\n", conf_get_bool(conf,CONF_dec_om) ) ; - fprintf( fp, "wrap_mode=%d\n", conf_get_bool(conf,CONF_wrap_mode) ) ; - fprintf( fp, "lfhascr=%d\n", conf_get_bool(conf,CONF_lfhascr) ) ; - fprintf( fp, "cursor_type=%d\n", conf_get_int(conf,CONF_cursor_type) ) ; - fprintf( fp, "blink_cur=%d\n", conf_get_bool(conf,CONF_blink_cur) ) ; - fprintf( fp, "beep=%d\n", conf_get_int(conf,CONF_beep) ) ; - fprintf( fp, "beep_ind=%d\n", conf_get_int(conf,CONF_beep_ind) ) ; - fprintf( fp, "bellovl=%d\n", conf_get_bool(conf,CONF_bellovl) ) ; - fprintf( fp, "bellovl_n=%d\n", conf_get_int(conf,CONF_bellovl_n) ) ; - fprintf( fp, "bellovl_t=%d\n", conf_get_int(conf,CONF_bellovl_t) ) ; - fprintf( fp, "bellovl_s=%d\n", conf_get_int(conf,CONF_bellovl_s) ) ; - fprintf( fp, "bell_wavefile=%s\n", conf_get_filename(conf,CONF_bell_wavefile)->path ) ; - fprintf( fp, "scrollbar=%d\n", conf_get_bool(conf,CONF_scrollbar) ) ; - fprintf( fp, "scrollbar_in_fullscreen=%d\n", conf_get_bool(conf,CONF_scrollbar_in_fullscreen) ) ; - fprintf( fp, "resize_action=%d\n", conf_get_int(conf,CONF_resize_action) ) ; - fprintf( fp, "bce=%d\n", conf_get_bool(conf,CONF_bce) ) ; - fprintf( fp, "blinktext=%d\n", conf_get_bool(conf,CONF_blinktext) ) ; - fprintf( fp, "win_name_always=%d\n", conf_get_bool(conf,CONF_win_name_always) ) ; - fprintf( fp, "width=%d\n", conf_get_int(conf,CONF_width) ) ; - fprintf( fp, "height=%d\n", conf_get_int(conf,CONF_height) ) ; - fprintf( fp, "font_quality=%d\n", conf_get_int(conf,CONF_font_quality) ) ; - fprintf( fp, "logfilename=%s\n", conf_get_filename(conf,CONF_logfilename)->path ) ; - fprintf( fp, "logtype=%d\n", conf_get_int(conf,CONF_logtype) ) ; - fprintf( fp, "logxfovr=%d\n", conf_get_int(conf,CONF_logxfovr) ) ; - fprintf( fp, "logflush=%d\n", conf_get_bool(conf,CONF_logflush) ) ; - fprintf( fp, "logheader=%d\n", conf_get_bool(conf,CONF_logheader) ) ; - fprintf( fp, "logomitpass=%d\n", conf_get_bool(conf,CONF_logomitpass) ) ; - fprintf( fp, "logomitdata=%d\n", conf_get_bool(conf,CONF_logomitdata) ) ; - fprintf( fp, "hide_mouseptr=%d\n", conf_get_bool(conf,CONF_hide_mouseptr) ) ; - fprintf( fp, "sunken_edge=%d\n", conf_get_bool(conf,CONF_sunken_edge) ) ; - fprintf( fp, "window_border=%d\n", conf_get_int(conf,CONF_window_border) ) ; - fprintf( fp, "answerback=%s\n", conf_get_str(conf,CONF_answerback) ) ; - fprintf( fp, "printer=%s\n", conf_get_str(conf,CONF_printer) ) ; - fprintf( fp, "arabicshaping=%d\n", conf_get_bool(conf,CONF_arabicshaping) ) ; - fprintf( fp, "bidi=%d\n", conf_get_bool(conf,CONF_bidi) ) ; - - /* Colour options */ - fprintf( fp, "ansi_colour=%d\n", conf_get_bool(conf,CONF_ansi_colour) ) ; - fprintf( fp, "xterm_256_colour=%d\n", conf_get_bool(conf,CONF_xterm_256_colour) ) ; - fprintf( fp, "true_colour=%d\n", conf_get_bool(conf,CONF_true_colour) ) ; - fprintf( fp, "system_colour=%d\n", conf_get_bool(conf,CONF_system_colour) ) ; - fprintf( fp, "try_palette%d\n", conf_get_bool(conf,CONF_try_palette) ) ; - fprintf( fp, "bold_style=%d\n", conf_get_int(conf,CONF_bold_style) ) ; - - /* Selection options */ - fprintf( fp, "mouse_is_xterm=%d\n", conf_get_int(conf,CONF_mouse_is_xterm) ) ; - fprintf( fp, "rect_select=%d\n", conf_get_bool(conf,CONF_rect_select) ) ; - fprintf( fp, "rawcnp=%d\n", conf_get_bool(conf,CONF_rawcnp) ) ; - fprintf( fp, "utf8linedraw=%d\n", conf_get_bool(conf,CONF_utf8linedraw) ) ; - fprintf( fp, "rtf_paste=%d\n", conf_get_bool(conf,CONF_rtf_paste) ) ; - fprintf( fp, "mouse_override=%d\n", conf_get_bool(conf,CONF_mouse_override) ) ; - //fprintf( fp, "wordness=%d\n", conf_get_int(conf,CONF_wordness) ) ; - fprintf( fp, "mouseautocopy=%d\n", conf_get_bool(conf,CONF_mouseautocopy) ) ; - fprintf( fp, "mousepaste=%d\n", conf_get_int(conf,CONF_mousepaste) ) ; - fprintf( fp, "ctrlshiftins=%d\n", conf_get_int(conf,CONF_ctrlshiftins) ) ; - fprintf( fp, "ctrlshiftcv=%d\n", conf_get_int(conf,CONF_ctrlshiftcv) ) ; - fprintf( fp, "mousepaste_custom=%s\n", conf_get_str(conf,CONF_mousepaste_custom) ) ; - fprintf( fp, "ctrlshiftins_custom=%s\n", conf_get_str(conf,CONF_ctrlshiftins_custom) ) ; - fprintf( fp, "ctrlshiftcv_custom=%s\n", conf_get_str(conf,CONF_ctrlshiftcv_custom) ) ; - - /* translations */ - fprintf( fp, "vtmode=%d\n", conf_get_int(conf,CONF_vtmode) ) ; - fprintf( fp, "line_codepage=%s\n", conf_get_str(conf,CONF_line_codepage) ) ; - fprintf( fp, "cjk_ambig_wide=%d\n", conf_get_bool(conf,CONF_cjk_ambig_wide) ) ; - fprintf( fp, "utf8_override=%d\n", conf_get_bool(conf,CONF_utf8_override) ) ; - fprintf( fp, "xlat_capslockcyr=%d\n", conf_get_bool(conf,CONF_xlat_capslockcyr) ) ; - - /* X11 forwarding */ - fprintf( fp, "x11_forward=%d\n", conf_get_bool(conf,CONF_x11_forward) ) ; - fprintf( fp, "x11_display=%s\n", conf_get_str(conf,CONF_x11_display) ) ; - fprintf( fp, "x11_auth=%d\n", conf_get_int(conf,CONF_x11_auth) ) ; - fprintf( fp, "xauthfile=%s\n", conf_get_filename(conf,CONF_xauthfile)->path ) ; - - /* port forwarding */ - fprintf( fp, "lport_acceptall=%d\n", conf_get_bool(conf,CONF_lport_acceptall) ) ; - fprintf( fp, "rport_acceptall=%d\n", conf_get_bool(conf,CONF_rport_acceptall) ) ; - fprintf( fp, "portfwd=\n") ; - char *key, *val; - for( val = conf_get_str_strs(conf, CONF_portfwd, NULL, &key ) ; - val != NULL; - val = conf_get_str_strs(conf, CONF_portfwd, key, &key) ) { - if (!strcmp(val, "D")) fprintf( fp, " D%s\t\n", key+1 ) ; - else fprintf( fp, " %s\t%s\n", key, val); - } - - /* SSH bug compatibility modes */ - fprintf( fp, "sshbug_ignore1=%d\n", conf_get_int(conf,CONF_sshbug_ignore1) ) ; - fprintf( fp, "sshbug_plainpw1=%d\n", conf_get_int(conf,CONF_sshbug_plainpw1) ) ; - fprintf( fp, "sshbug_rsa1=%d\n", conf_get_int(conf,CONF_sshbug_rsa1) ) ; - fprintf( fp, "sshbug_hmac2=%d\n", conf_get_int(conf,CONF_sshbug_hmac2) ) ; - fprintf( fp, "sshbug_derivekey2=%d\n", conf_get_int(conf,CONF_sshbug_derivekey2) ) ; - fprintf( fp, "sshbug_rsapad2=%d\n", conf_get_int(conf,CONF_sshbug_rsapad2) ) ; - fprintf( fp, "sshbug_pksessid2=%d\n", conf_get_int(conf,CONF_sshbug_pksessid2) ) ; - fprintf( fp, "sshbug_rekey2=%d\n", conf_get_int(conf,CONF_sshbug_rekey2) ) ; - fprintf( fp, "sshbug_maxpkt2=%d\n", conf_get_int(conf,CONF_sshbug_maxpkt2) ) ; - fprintf( fp, "sshbug_ignore2=%d\n", conf_get_int(conf,CONF_sshbug_ignore2) ) ; - fprintf( fp, "sshbug_oldgex2=%d\n", conf_get_int(conf,CONF_sshbug_oldgex2) ) ; - fprintf( fp, "sshbug_winadj=%d\n", conf_get_int(conf,CONF_sshbug_winadj) ) ; - fprintf( fp, "sshbug_chanreq=%d\n", conf_get_int(conf,CONF_sshbug_chanreq) ) ; - fprintf( fp, "ssh_simple=%d\n", conf_get_bool(conf,CONF_ssh_simple) ) ; - fprintf( fp, "ssh_connection_sharing=%d\n", conf_get_bool(conf,CONF_ssh_connection_sharing) ) ; - fprintf( fp, "ssh_connection_sharing_upstream=%d\n", conf_get_bool(conf,CONF_ssh_connection_sharing_upstream) ) ; - fprintf( fp, "ssh_connection_sharing_downstream=%d\n", conf_get_bool(conf,CONF_ssh_connection_sharing_downstream) ) ; - //X(STR, STR, ssh_manual_hostkeys) - - /* Options for pterm. Should split out into platform-dependent part. */ - fprintf( fp, "stamp_utmp=%d\n", conf_get_bool(conf,CONF_stamp_utmp) ) ; - fprintf( fp, "login_shell=%d\n", conf_get_bool(conf,CONF_login_shell) ) ; - fprintf( fp, "scrollbar_on_left=%d\n", conf_get_bool(conf,CONF_scrollbar_on_left) ) ; - fprintf( fp, "shadowbold=%d\n", conf_get_bool(conf,CONF_shadowbold) ) ; - // X(FONT, NONE, boldfont) - // X(FONT, NONE, widefont) - // X(FONT, NONE, wideboldfont) - fprintf( fp, "shadowboldoffset=%d\n", conf_get_int(conf,CONF_shadowboldoffset) ) ; - fprintf( fp, "crhaslf=%d\n", conf_get_bool(conf,CONF_crhaslf) ) ; - fprintf( fp, "winclass=%s\n", conf_get_str(conf,CONF_winclass) ) ; - -#ifdef PERSOPORT - /* PERSOPORT Options */ - //fprintf( fp, "bcdelay=%d\n", conf_get_int(conf,CONF_bcdelay) ) ; // Non present systematiquement - //fprintf( fp, "initdelay=%d\n", conf_get_int(conf,CONF_initdelay) ) ; // Non present systematiquement - fprintf( fp, "transparencynumber=%d\n", conf_get_int(conf,CONF_transparencynumber) ) ; - fprintf( fp, "sendtotray=%d\n", conf_get_int(conf,CONF_sendtotray) ) ; - fprintf( fp, "maximize=%d\n", conf_get_int(conf,CONF_maximize) ) ; - fprintf( fp, "fullscreen=%d\n", conf_get_int(conf,CONF_fullscreen) ) ; - fprintf( fp, "saveonexit=%d\n", conf_get_int(conf,CONF_saveonexit) ) ; - fprintf( fp, "icone=%d\n", conf_get_int(conf,CONF_icone) ) ; - fprintf( fp, "iconefile=%s\n", conf_get_filename(conf,CONF_iconefile)->path ) ; - fprintf( fp, "sftpconnect=%s\n", conf_get_str(conf,CONF_sftpconnect) ) ; - fprintf( fp, "folder=%s\n", conf_get_str(conf,CONF_folder) ) ; - /* On decrypte le password */ - char bufpass[4096] ; - memcpy( bufpass, conf_get_str(conf,CONF_password), 4095 ) ; bufpass[4095]='\0'; - MASKPASS(bufpass); - fprintf( fp, "password=%s\n", bufpass ) ; - memset(bufpass,0,strlen(bufpass)); - - fprintf( fp, "autocommand=%s\n", conf_get_str(conf,CONF_autocommand) ) ; - fprintf( fp, "autocommandout=%s\n", conf_get_str(conf,CONF_autocommandout) ) ; - fprintf( fp, "antiidle=%s\n", conf_get_str(conf,CONF_antiidle) ) ; - fprintf( fp, "sessionname=%s\n", conf_get_str(conf,CONF_sessionname) ) ; - fprintf( fp, "logtimerotation=%d\n", conf_get_int(conf,CONF_logtimerotation) ) ; - fprintf( fp, "logtimestamp=%s\n", conf_get_str(conf,CONF_logtimestamp) ) ; - fprintf( fp, "scriptfile=%s\n", conf_get_filename(conf,CONF_scriptfile)->path ) ; - fprintf( fp, "scriptfilecontent=%s", conf_get_str(conf,CONF_scriptfilecontent) ) ; - /* On decrypte le script */ - buf=(char*)malloc( strlen(conf_get_str(conf,CONF_scriptfilecontent)) + 20 ) ; - strcpy( buf, conf_get_str(conf,CONF_scriptfilecontent) ) ; - long l=decryptstring( buf, MASTER_PASSWORD ) ; - int i; - for( i=0; ipath ) ; - fprintf( fp, "ScriptMode=%d\n", conf_get_int(conf,CONF_script_mode) ) ; - fprintf( fp, "ScriptLineDelay=%d\n", conf_get_int(conf,CONF_script_line_delay) ) ; - fprintf( fp, "ScriptCharDelay=%d\n", conf_get_int(conf,CONF_script_char_delay) ) ; - fprintf( fp, "ScriptCondLine=%s\n", conf_get_str(conf,CONF_script_cond_line) ) ; - fprintf( fp, "ScriptCondUse=%d\n", conf_get_int(conf,CONF_script_cond_use) ) ; - fprintf( fp, "ScriptCRLF=%d\n", conf_get_int(conf,CONF_script_crlf) ) ; - fprintf( fp, "ScriptEnable=%d\n", conf_get_int(conf,CONF_script_enable) ) ; - fprintf( fp, "ScriptExcept=%d\n", conf_get_int(conf,CONF_script_except) ) ; - fprintf( fp, "ScriptTimeout=%d\n", conf_get_int(conf,CONF_script_timeout) ) ; - fprintf( fp, "ScriptWait=%s\n", conf_get_str(conf,CONF_script_waitfor) ) ; - fprintf( fp, "ScriptHalt=%s\n", conf_get_str(conf,CONF_script_halton) ) ; -#endif -#ifdef CYGTERMPORT - /* Cygterm options */ - fprintf( fp, "cygautopath=%d\n", conf_get_int(conf,CONF_cygautopath) ) ; - fprintf( fp, "cygterm64=%d\n", conf_get_int(conf,CONF_cygterm64) ) ; - fprintf( fp, "cygcmd=%s\n", conf_get_str(conf,CONF_cygcmd) ) ; - fprintf( fp, "alt_metabit=%d\n", conf_get_int(conf,CONF_alt_metabit) ) ; -#endif -#if (defined IMAGEPORT) && (!defined FDJ) - /* Image Options */ - fprintf( fp, "bg_opacity=%d\n", conf_get_int(conf,CONF_bg_opacity) ) ; - fprintf( fp, "bg_slideshow=%d\n", conf_get_int(conf,CONF_bg_slideshow) ) ; - fprintf( fp, "bg_type=%d\n", conf_get_int(conf,CONF_bg_type) ) ; - fprintf( fp, "bg_image_filename=%s\n", conf_get_filename(conf,CONF_bg_image_filename)->path ) ; - fprintf( fp, "bg_image_style=%d\n", conf_get_int(conf,CONF_bg_image_style) ) ; - fprintf( fp, "bg_image_abs_x=%d\n", conf_get_int(conf,CONF_bg_image_abs_x) ) ; - fprintf( fp, "bg_image_abs_y=%d\n", conf_get_int(conf,CONF_bg_image_abs_y) ) ; - fprintf( fp, "bg_image_abs_fixed=%d\n", conf_get_int(conf,CONF_bg_image_abs_fixed) ) ; -#endif -#ifdef RECONNECTPORT - /* Reconnect Options */ - fprintf( fp, "wakeup_reconnect=%d\n", conf_get_int(conf,CONF_wakeup_reconnect) ) ; - fprintf( fp, "failure_reconnect=%d\n", conf_get_int(conf,CONF_failure_reconnect) ) ; -#endif -#ifdef HYPERLINKPORT - /* Hyperlink Options */ - fprintf( fp, "url_ctrl_click=%d\n", conf_get_int(conf,CONF_url_ctrl_click) ) ; - fprintf( fp, "url_underline=%d\n", conf_get_int(conf,CONF_url_underline) ) ; - fprintf( fp, "url_defbrowser=%d\n", conf_get_int(conf,CONF_url_defbrowser) ) ; - fprintf( fp, "url_defregex=%d\n", conf_get_int(conf,CONF_url_defregex) ) ; - fprintf( fp, "url_browser=%s\n", conf_get_filename(conf,CONF_url_browser)->path ) ; - fprintf( fp, "url_regex=%s\n", conf_get_str(conf,CONF_url_regex) ) ; - fprintf( fp, "urlhack_default_regex=%s\n", urlhack_default_regex ) ; - fprintf( fp, "urlhack_liberal_regex=%s\n", urlhack_liberal_regex ) ; -#endif -#ifdef TUTTYPORT - /* TuTTY port Options */ - fprintf( fp, "window_closable=%d\n", conf_get_int(conf,CONF_window_closable) ) ; - fprintf( fp, "window_minimizable=%d\n", conf_get_int(conf,CONF_window_minimizable) ) ; - fprintf( fp, "window_maximizable=%d\n", conf_get_int(conf,CONF_window_maximizable) ) ; - fprintf( fp, "window_has_sysmenu=%d\n", conf_get_int(conf,CONF_window_has_sysmenu) ) ; - fprintf( fp, "bottom_buttons=%d\n", conf_get_int(conf,CONF_bottom_buttons) ) ; - fprintf( fp, "bold_colour=%d\n", conf_get_int(conf,CONF_bold_colour) ) ; - fprintf( fp, "under_colour=%d\n", conf_get_int(conf,CONF_under_colour) ) ; - fprintf( fp, "sel_colour=%d\n", conf_get_int(conf,CONF_sel_colour) ) ; -#endif -#ifdef ZMODEMPORT - /* ZModem Options */ - fprintf( fp, "rzcommand=%s\n", conf_get_filename(conf,CONF_rzcommand)->path ) ; - fprintf( fp, "rzoptions=%s\n", conf_get_str(conf,CONF_rzoptions) ) ; - fprintf( fp, "szcommand=%s\n", conf_get_filename(conf,CONF_szcommand)->path ) ; - fprintf( fp, "szoptions=%s\n", conf_get_str(conf,CONF_szoptions) ) ; - fprintf( fp, "zdownloaddir=%s\n", conf_get_str(conf,CONF_zdownloaddir) ) ; -#endif -#ifdef PORTKNOCKINGPORT - /* Port knocking Options */ - fprintf( fp, "portknocking=%s\n", conf_get_str(conf,CONF_portknockingoptions) ) ; -#endif -#ifdef DISABLEALTGRPORT - /* Disable AltGr Options */ - fprintf( fp, "disablealtgr=%d\n", conf_get_int(conf,CONF_disablealtgr) ) ; -#endif - - fprintf( fp, "\n[[KiTTY specific configuration]]\n" ) ; - fprintf( fp, "IniFileFlag=%d - ",IniFileFlag) ; - switch(IniFileFlag) { - case 0: fprintf( fp, "Registry\n" ) ; break ; - case 1: fprintf( fp, "File\n" ) ; break ; - case 2: fprintf( fp, "Directory\n" ) ; break ; - } - - fprintf( fp, "internal_delay=%d\ninit_delay=%d\nautocommand_delay=%d\nbetween_char_delay=%d\nProtectFlag=%d\n",internal_delay,init_delay,autocommand_delay,between_char_delay,ProtectFlag ); - - fprintf( fp, "HyperlinkFlag=%d\n", HyperlinkFlag ); - if( AutoCommand!= NULL ) fprintf( fp, "AutoCommand=%s\n", AutoCommand ) ; - if( ScriptCommand!= NULL ) fprintf( fp, "ScriptCommand=%s\n", ScriptCommand ) ; - if( PasteCommand!= NULL ) fprintf( fp, "PasteCommand=%s\n", PasteCommand ) ; - fprintf( fp, "PasteCommandFlag=%d\n", PasteCommandFlag ); - if( ScriptFileContent!= NULL ) { - char * pst = ScriptFileContent ; - fprintf( fp, "ScriptFileContent=" ) ; - while( strlen(pst) > 0 ) { fprintf( fp, "%s|", pst ) ; pst=pst+strlen(pst)+1 ; } - fprintf( fp, "\n" ) ; - } - if( IconFile!= NULL ) fprintf( fp, "IconFile=%s\n", IconFile ) ; - fprintf( fp, "AutoStoreSSHKeyFlag=%d\nDirectoryBrowseFlag=%d\nVisibleFlag=%d\nShortcutsFlag=%d\nMouseShortcutsFlag=%d\nIconeFlag=%d\nNumberOfIcons=%d\nSizeFlag=%d\nCapsLockFlag=%d\nTitleBarFlag=%d\nCtrlTabFlag=%d\nRuTTYFlag=%d\n" - ,GetAutoStoreSSHKeyFlag(),DirectoryBrowseFlag,VisibleFlag,ShortcutsFlag,MouseShortcutsFlag,IconeFlag,NumberOfIcons,SizeFlag,CapsLockFlag,TitleBarFlag,CtrlTabFlag,RuttyFlag); - //static HINSTANCE hInstIcons = NULL ; - fprintf( fp, "WinHeight=%d\nWinrolFlag=%d\nAutoSendToTray=%d\nNoKittyFileFlag=%d\nConfigBoxHeight=%d\nConfigBoxWindowHeight=%d\nConfigBoxNoExitFlag=%d\nUserPassSSHNoSave=%d\nPuttyFlag=%d\n",WinHeight,WinrolFlag,AutoSendToTray,NoKittyFileFlag,ConfigBoxHeight,ConfigBoxWindowHeight,ConfigBoxNoExitFlag,GetUserPassSSHNoSave(),PuttyFlag); - - fprintf( fp,"BackgroundImageFlag=%d\n",BackgroundImageFlag ); -#ifdef RECONNECTPORT - fprintf( fp,"AutoreconnectFlag=%d\nReconnectDelay=%d\n",AutoreconnectFlag,ReconnectDelay ); -#endif -#ifdef CYGTERMPORT - fprintf( fp,"CygTermFlag=%d\n",cygterm_get_flag() ); -#endif -#ifdef ADBPORT - fprintf( fp,"ADBFlag=%d\n",GetADBFlag() ); -#endif - if( PasswordConf!= NULL ) fprintf( fp, "PasswordConf=%s\n", PasswordConf ) ; - fprintf( fp, "SessionFilterFlag=%d\nSessionsInDefaultFlag=%d\nDefaultSettingsFlag=%d\nImageViewerFlag=%d\nImageSlideDelay=%d\nMaxBlinkingTime=%d\nPrintCharSize=%d\nPrintMaxLinePerPage=%d\nPrintMaxCharPerLine=%d\nReadOnlyFlag=%d\n" - ,SessionFilterFlag,SessionsInDefaultFlag,DefaultSettingsFlag,ImageViewerFlag,ImageSlideDelay,MaxBlinkingTime,PrintCharSize,PrintMaxLinePerPage,PrintMaxCharPerLine,GetReadOnlyFlag()); - fprintf( fp, "AntiIdleCount=%d\nAntiIdleCountMax=%d\nIconeNum=%d\n" - ,AntiIdleCount,AntiIdleCountMax,IconeNum); - fprintf( fp, "AntiIdleStr=%s\nInitialDirectory=%s\nConfigDirectory=%s\nBuildVersionTime=%s\n",AntiIdleStr,InitialDirectory,ConfigDirectory,BuildVersionTime); - if( WinSCPPath!= NULL ) fprintf( fp, "WinSCPPath=%s\n", WinSCPPath ) ; - if( PSCPPath!= NULL ) fprintf( fp, "PSCPPath=%s\n", PSCPPath ) ; - if( PlinkPath!= NULL ) fprintf( fp, "PlinkPath=%s\n", PlinkPath ) ; - if( KittyIniFile!= NULL ) fprintf( fp, "KittyIniFile=%s\n", KittyIniFile ) ; - if( KittySavFile!= NULL ) fprintf( fp, "KittySavFile=%s\n", KittySavFile ) ; - if( KiTTYClassName != NULL ) fprintf( fp, "KiTTYClassName=%s\n", KiTTYClassName ) ; - if( CtHelperPath!= NULL ) fprintf( fp, "CtHelperPath=%s\n", CtHelperPath ) ; - if( strlen(ManagePassPhrase(NULL))>0 ) fprintf( fp, "PassPhrase=%s\n", ManagePassPhrase(NULL)) ; - } - -// recupere la configuration des shortcuts -void SaveShortCuts( FILE *fp ) { - int i ; - fprintf( fp, "autocommand=%d\n", shortcuts_tab.autocommand ) ; - fprintf( fp, "command=%d\n", shortcuts_tab.command ) ; - fprintf( fp, "editor=%d\n", shortcuts_tab.editor ) ; - fprintf( fp, "editorclipboard=%d\n", shortcuts_tab.editorclipboard ) ; - fprintf( fp, "getfile=%d\n", shortcuts_tab.getfile ) ; - fprintf( fp, "imagechange=%d\n", shortcuts_tab.imagechange ) ; - fprintf( fp, "input=%d\n", shortcuts_tab.input ) ; - fprintf( fp, "inputm=%d\n", shortcuts_tab.inputm ) ; - fprintf( fp, "print=%d\n", shortcuts_tab.print ) ; - fprintf( fp, "printall=%d\n", shortcuts_tab.printall ) ; - fprintf( fp, "protect=%d\n", shortcuts_tab.protect ) ; - fprintf( fp, "script=%d\n", shortcuts_tab.script ) ; - fprintf( fp, "sendfile=%d\n", shortcuts_tab.sendfile ) ; - fprintf( fp, "rollup=%d\n", shortcuts_tab.rollup ) ; - fprintf( fp, "tray=%d\n", shortcuts_tab.tray ) ; - fprintf( fp, "viewer=%d\n", shortcuts_tab.viewer ) ; - fprintf( fp, "visible=%d\n", shortcuts_tab.visible ) ; - fprintf( fp, "winscp=%d\n", shortcuts_tab.winscp ) ; - fprintf( fp, "showportforward=%d\n", shortcuts_tab.showportforward ) ; - fprintf( fp, "duplicate=%d\n", shortcuts_tab.duplicate ) ; - - fprintf( fp, "\nNbShortCuts=%d\n", NbShortCuts ) ; - if( NbShortCuts>0 ) { - for( i=0 ; ipath ) ) { - fputs( "\n@ Private key file @\n\n", fpout ) ; - SaveDebugFile( conf_get_filename(conf,CONF_keyfile)->path, fpout ) ; - } -#ifdef RUTTYPORT - if( existfile( conf_get_filename(conf,CONF_script_filename)->path ) ) { - fputs( "\n@ RuTTY script file @\n\n", fpout ) ; - SaveDebugFile( conf_get_filename(conf,CONF_script_filename)->path, fpout ) ; - } -#endif -#if (defined IMAGEPORT) - fputs( "\n@ ScreenShot @\n\n", fpout ) ; - SaveScreenShot( fpout ) ; fflush( fpout ) ; -#endif - - fclose( fpout ) ; - - sprintf( buffer, "%s\\%s", InitialDirectory, filename ) ; - sprintf( buffer2, "%s\\%s", InitialDirectory, "kitty.dmp.bcr" ) ; - bcrypt_file_base64( buffer, buffer2, "9bis", 80 ) ; unlink( buffer ) ; rename( buffer2, buffer ) ; - } - } -void SaveDump(void) { - SaveDumpFile("kitty.dmp") ; -} + +static char SaveKeyPressed[4096] = "" ; + +void WriteCountUpAndPath(void) ; +void SaveDumpPortableConfig( FILE * fp ) ; +int GetAutoStoreSSHKeyFlag(void) ; +int GetUserPassSSHNoSave(void) ; + +// Buffer contenant du texte a ecrire au besoin dans le fichier kitty.dmp +static char * DebugText = NULL ; + +void set_debug_text( const char * txt ) { + if( DebugText!=NULL ) { free( DebugText ) ; DebugText = NULL ; } + if( txt != NULL ) { + DebugText = (char*) malloc( strlen(txt)+1 ) ; + strcpy( DebugText, txt ) ; + } + } + +void addkeypressed( UINT message, WPARAM wParam, LPARAM lParam, int shift_flag, int control_flag, int alt_flag, int altgr_flag, int win_flag ) { + char buffer[256], c=' ' ; + int p ; + + if( message==WM_KEYDOWN ) c='v' ; else if( message==WM_KEYUP ) c='^' ; + + if( shift_flag ) shift_flag = 1 ; + if( control_flag ) control_flag = 1 ; + if( alt_flag ) alt_flag = 1 ; + if( altgr_flag ) altgr_flag = 1 ; + if( win_flag ) win_flag = 1 ; + + if( wParam=='\r' ) + sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (\\r)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0 ) ; + else if( wParam=='\n' ) + sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (\\n)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0 ) ; + else if( (wParam>=32) && (wParam<=111 ) ) + sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (%c)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0, wParam ) ; + else if( (wParam>=VK_F1 /*70 112*/) && (wParam<=VK_F24 /*87 135*/) ) + sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d (F%d)\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0, wParam-VK_F1+1 ) ; + else + sprintf( buffer, "%d%d%d%d%d %d%c %03d(%02X)/%d\n",shift_flag,control_flag,alt_flag,altgr_flag,win_flag, message,c, wParam, wParam, 0 ) ; + + if( strlen(SaveKeyPressed) > 4000 ) { + if( (p=poss("\n",SaveKeyPressed)) > 0 ) { + del( SaveKeyPressed, 1, p ); + } + } + strcat( SaveKeyPressed, buffer ) ; + } + +#include +void PrintProcessNameAndID( DWORD processID, FILE * fp ) { + TCHAR szProcessName[MAX_PATH] = TEXT(""); + DWORD SizeOfImage = 0 ; + + // Get a handle to the process. + HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID ); + + // Get the process name. + if (NULL != hProcess ) { + HMODULE hMod; + DWORD cbNeeded; + MODULEINFO modinfo ; + if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) ) { + GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName)/sizeof(TCHAR) ) ; + GetModuleInformation( hProcess, hMod, &modinfo, sizeof( modinfo ) ) ; + SizeOfImage = modinfo.SizeOfImage ; + } + } + + // Print the process name and identifier. + fprintf( fp, TEXT("%05u %u \t%s\n"), (unsigned int)processID, (unsigned int)SizeOfImage, szProcessName ) ; + CloseHandle( hProcess ); + } + +void PrintWindowSettings( FILE * fp ) { + int ret ; + RECT r ; + char buffer[MAX_VALUE_NAME] ; + + GetOSInfo( buffer ) ; + fprintf( fp, "OSVersion=%s\n", buffer ) ; + if( IsWow64() ) { fprintf( fp, "64 bits System\n" ) ; } else { fprintf( fp, "32 bits System\n" ) ; } + + ret = GetWindowText( MainHwnd, buffer, MAX_VALUE_NAME ) ; buffer[ret]='\0'; + ret = GetWindowTextLength( MainHwnd ) ; + fprintf( fp, "Title (length)=%s (%d)\n", buffer, ret ) ; + if( GetWindowRect( MainHwnd, &r ) ) { + fprintf( fp, "WindowRect.left=%ld\n", r.left ) ; + fprintf( fp, "WindowRect.right=%ld\n", r.right ) ; + fprintf( fp, "WindowRect.top=%ld\n", r.top ) ; + fprintf( fp, "WindowRect.bottom=%ld\n", r.bottom ) ; + } + if( GetClientRect( MainHwnd, &r ) ) { + fprintf( fp, "ClientRect.left=%ld\n", r.left ) ; + fprintf( fp, "ClientRect.right=%ld\n", r.right ) ; + fprintf( fp, "ClientRect.top=%ld\n", r.top ) ; + fprintf( fp, "ClientRect.bottom=%ld\n", r.bottom ) ; + } + + ret = GetWindowModuleFileName( MainHwnd, buffer, MAX_VALUE_NAME ) ; buffer[ret]='\0'; + fprintf( fp, "WindowModuleFileName=%s\n", buffer ) ; + + WINDOWINFO wi ; + wi.cbSize = sizeof( WINDOWINFO ) ; + if( GetWindowInfo( MainHwnd, &wi ) ) { + fprintf( fp, "WindowInfo.cbSize=%lu\n", wi.cbSize ) ; + fprintf( fp, "WindowInfo.rcWindow.left=%ld\n", wi.rcWindow.left ) ; + fprintf( fp, "WindowInfo.rcWindow.right=%ld\n", wi.rcWindow.right ) ; + fprintf( fp, "WindowInfo.rcWindow.top=%ld\n", wi.rcWindow.top ) ; + fprintf( fp, "WindowInfo.rcWindow.bottom=%ld\n", wi.rcWindow.bottom ) ; + fprintf( fp, "WindowInfo.rcClient.left=%ld\n", wi.rcWindow.left ) ; + fprintf( fp, "WindowInfo.rcClient.right=%ld\n", wi.rcWindow.right ) ; + fprintf( fp, "WindowInfo.rcClient.top=%ld\n", wi.rcWindow.top ) ; + fprintf( fp, "WindowInfo.rcClient.bottom=%ld\n", wi.rcWindow.bottom ) ; + fprintf( fp, "WindowInfo.dwStyle=%lu\n", wi.dwStyle ) ; + fprintf( fp, "WindowInfo.dwExStyle=%lu\n", wi.dwExStyle ) ; + fprintf( fp, "WindowInfo.dwWindowStatus=%lu\n", wi.dwWindowStatus ) ; + fprintf( fp, "WindowInfo.cxWindowBorders=%u\n", wi.cxWindowBorders ) ; + fprintf( fp, "WindowInfo.cyWindowBorders=%u\n", wi.cyWindowBorders ) ; + fprintf( fp, "WindowInfo.wCreatorVersion=%d\n", wi.wCreatorVersion ) ; + } + + WINDOWPLACEMENT wp; + wp.length=sizeof(WINDOWPLACEMENT) ; + if( GetWindowPlacement( MainHwnd, &wp ) ) { + fprintf( fp, "WindowPlacement.length=%u\n", wp.length ) ; + fprintf( fp, "WindowPlacement.flags=%u\n", wp.flags ) ; + fprintf( fp, "WindowPlacement.showCmd=%u\n", wp.showCmd ) ; + fprintf( fp, "WindowPlacement.ptMinPosition.x=%ld\n", wp.ptMinPosition.x ) ; + fprintf( fp, "WindowPlacement.ptMinPosition.y=%ld\n", wp.ptMinPosition.y ) ; + fprintf( fp, "WindowPlacement.ptMaxPosition.x=%ld\n", wp.ptMaxPosition.x ) ; + fprintf( fp, "WindowPlacement.ptMaxPosition.y=%ld\n", wp.ptMaxPosition.y ) ; + fprintf( fp, "WindowPlacement.rcNormalPosition.left=%ld\n", wp.rcNormalPosition.left ) ; + fprintf( fp, "WindowPlacement.rcNormalPosition.right=%ld\n", wp.rcNormalPosition.right ) ; + fprintf( fp, "WindowPlacement.rcNormalPosition.top=%ld\n", wp.rcNormalPosition.top ) ; + fprintf( fp, "WindowPlacement.rcNormalPosition.bottom=%ld\n", wp.rcNormalPosition.bottom ) ; + } + + fprintf( fp, "IsIconic=%d\n", IsIconic( MainHwnd ) ) ; + fprintf( fp, "IsWindow=%d\n", IsWindow( MainHwnd ) ) ; + fprintf( fp, "IsWindowUnicode=%d\n", IsWindowUnicode( MainHwnd ) ) ; + fprintf( fp, "IsWindowVisible=%d\n", IsWindowVisible( MainHwnd ) ) ; + fprintf( fp, "IsZoomed=%d\n", IsZoomed( MainHwnd ) ) ; + + fprintf( fp, "ScaleX=%d\n", GetDeviceCaps(GetDC(MainHwnd),LOGPIXELSX) ) ; + fprintf( fp, "ScaleY=%d\n", GetDeviceCaps(GetDC(MainHwnd),LOGPIXELSY) ) ; + } + +DWORD PrintAllProcess( FILE * fp ) { + DWORD aProcesses[1024], cbNeeded, cProcesses; + unsigned int i; + + if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) ) return 0 ; + + // Calculate how many process identifiers were returned. + cProcesses = cbNeeded / sizeof(DWORD); + + // Print the name and process identifier for each process. + printf( "ID MEM \tMODULE\n" ); + if( cProcesses > 0 ) + for ( i = 0; i < cProcesses; i++ ) + if( aProcesses[i] != 0 ) + PrintProcessNameAndID( aProcesses[i], fp ) ; + return cProcesses ; + } + +void SaveDumpListFile( FILE * fp, const char * directory ) { + DIR *dir ; + struct dirent *de ; + char buffer[MAX_VALUE_NAME] ; + + /* fprintf( fp, " ===> Listing directory %s\n", directory ) ; */ + if( ( dir=opendir( directory ) ) != NULL ) { + while( ( de=readdir( dir ) ) != NULL ) { + if( strcmp(de->d_name,".")&&strcmp(de->d_name,"..") ) { + sprintf( buffer, "%s\\%s", directory, de->d_name ) ; + if( GetFileAttributes( buffer ) & FILE_ATTRIBUTE_DIRECTORY ) { + strcat( buffer, "\\" ) ; + fprintf( fp, "%s\n", buffer ) ; + SaveDumpListFile( fp, buffer ) ; + } + else { fprintf( fp, "%s\n", buffer ) ; } + } + } + closedir( dir ) ; + } +} + +void SaveDumpListConf( FILE *fp, const char *directory ) { + char buffer[4096], fullpath[MAX_VALUE_NAME] ; + FILE *fp2 ; + DIR *dir ; + struct dirent *de ; + if( ( dir=opendir( directory ) ) != NULL ) { + while( ( de=readdir( dir ) ) != NULL ) { + if( strcmp(de->d_name,".")&&strcmp(de->d_name,"..") ) { + sprintf( fullpath, "%s\\%s", directory, de->d_name ) ; + if( GetFileAttributes( fullpath ) & FILE_ATTRIBUTE_DIRECTORY ) + SaveDumpListConf( fp, fullpath ) ; + else { + fprintf( fp, "[%s]\n", fullpath ) ; + if( ( fp2 = fopen( fullpath, "r" ) ) != NULL ) { + while( fgets( buffer, 4095, fp2 ) != NULL ) fputs( buffer, fp ) ; + fclose( fp2 ) ; + } + fprintf( fp, "\n\n" ) ; + } + } + } + closedir( dir ) ; + } + } + +void kitty_term_copyall(Terminal *term) ; +void SaveDumpClipBoard( FILE *fp ) { + char *pst = NULL ; + if( term==NULL ) return ; + kitty_term_copyall(term) ; + if( OpenClipboard(NULL) ) { + HGLOBAL hglb ; + if( (hglb = GetClipboardData( CF_TEXT ) ) != NULL ) { + if( ( pst = GlobalLock( hglb ) ) != NULL ) { + //fputs( pst, fp ) ; + fwrite( pst, 1, strlen(pst), fp ) ; + GlobalUnlock( hglb ) ; + } + } + CloseClipboard(); + } + } + +//#include +void SaveDumpEnvironment( FILE *fp ) { + int i = 0 ; + while( environ[i] ) { + fprintf( fp, "%s\n", environ[i] ) ; + i++; + } + } + +void SaveDumpConfig( FILE *fp, Conf * conf ) { + char *buf=NULL ; + CountUp(); + fprintf( fp, "MASTER_PASSWORD=%s\n", MASTER_PASSWORD ) ; + fprintf( fp, "[[PuTTY structure configuration]]\n" ) ; + + /* Basic options */ + fprintf( fp, "host=%s\n", conf_get_str(conf,CONF_host) ) ; + fprintf( fp, "port=%d\n", conf_get_int(conf,CONF_port) ) ; + fprintf( fp, "protocol=%d\n", conf_get_int(conf,CONF_protocol) ) ; + fprintf( fp, "addressfamily=%d\n", conf_get_int(conf,CONF_addressfamily) ) ; + fprintf( fp, "close_on_exit=%d\n", conf_get_int(conf,CONF_close_on_exit) ) ; + fprintf( fp, "warn_on_close=%d\n", conf_get_bool(conf,CONF_warn_on_close) ) ; + fprintf( fp, "ping_interval=%d\n", conf_get_int(conf,CONF_ping_interval) ) ; + fprintf( fp, "tcp_nodelay=%d\n", conf_get_bool(conf,CONF_tcp_nodelay) ) ; + fprintf( fp, "tcp_keepalives=%d\n", conf_get_bool(conf,CONF_tcp_keepalives) ) ; + fprintf( fp, "loghost=%s\n", conf_get_str(conf,CONF_loghost) ) ; + + /* Proxy options */ + fprintf( fp, "proxy_exclude_list=%s\n", conf_get_str(conf,CONF_proxy_exclude_list) ) ; + fprintf( fp, "proxy_dns=%d\n", conf_get_int(conf,CONF_proxy_dns) ) ; + fprintf( fp, "even_proxy_localhost=%d\n", conf_get_bool(conf,CONF_even_proxy_localhost) ) ; + fprintf( fp, "proxy_type=%d\n", conf_get_int(conf,CONF_proxy_type) ) ; + fprintf( fp, "proxy_host=%s\n", conf_get_str(conf,CONF_proxy_host) ) ; + fprintf( fp, "proxy_port=%d\n", conf_get_int(conf,CONF_proxy_port) ) ; + fprintf( fp, "proxy_username=%s\n", conf_get_str(conf,CONF_proxy_username) ) ; + fprintf( fp, "proxy_password=%s\n", conf_get_str(conf,CONF_proxy_password) ) ; + fprintf( fp, "proxy_telnet_command=%s\n", conf_get_str(conf,CONF_proxy_telnet_command) ) ; + fprintf( fp, "proxy_log_to_term=%d\n", conf_get_int(conf,CONF_proxy_log_to_term) ) ; + + /* SSH options */ + fprintf( fp, "remote_cmd=%s\n", conf_get_str(conf,CONF_remote_cmd) ) ; + fprintf( fp, "remote_cmd2=%s\n", conf_get_str(conf,CONF_remote_cmd2) ) ; + fprintf( fp, "nopty=%d\n", conf_get_bool(conf,CONF_nopty) ) ; + fprintf( fp, "compression=%d\n", conf_get_bool(conf,CONF_compression) ) ; + //fprintf( fp, "ssh_kexlist=%d\n", conf_get_int(conf,CONF_ssh_kexlist) ) ; + //fprintf( fp, "ssh_hklist=%d\n", conf_get_int(conf,CONF_ssh_hklist) ) ; + fprintf( fp, "ssh_rekey_time=%d\n", conf_get_int(conf,CONF_ssh_rekey_time) ) ; + fprintf( fp, "ssh_rekey_data=%s\n", conf_get_str(conf,CONF_ssh_rekey_data) ) ; + fprintf( fp, "tryagent=%d\n", conf_get_bool(conf,CONF_tryagent) ) ; + fprintf( fp, "agentfwd=%d\n", conf_get_bool(conf,CONF_agentfwd) ) ; + fprintf( fp, "change_username=%d\n", conf_get_bool(conf,CONF_change_username) ) ; + //fprintf( fp, "ssh_cipherlist=%d\n", conf_get_int(conf,CONF_ssh_cipherlist) ) ; + fprintf( fp, "keyfile=%s\n", conf_get_filename(conf,CONF_keyfile)->path ) ; + fprintf( fp, "sshprot=%d\n", conf_get_int(conf,CONF_sshprot) ) ; + fprintf( fp, "ssh2_des_cbc=%d\n", conf_get_bool(conf,CONF_ssh2_des_cbc) ) ; + fprintf( fp, "ssh_no_userauth=%d\n", conf_get_bool(conf,CONF_ssh_no_userauth) ) ; + fprintf( fp, "ssh_show_banner=%d\n", conf_get_bool(conf,CONF_ssh_show_banner) ) ; + fprintf( fp, "try_tis_auth=%d\n", conf_get_bool(conf,CONF_try_tis_auth) ) ; + fprintf( fp, "try_ki_auth=%d\n", conf_get_bool(conf,CONF_try_ki_auth) ) ; + fprintf( fp, "try_gssapi_auth=%d\n", conf_get_bool(conf,CONF_try_gssapi_auth) ) ; + fprintf( fp, "try_gssapi_kex=%d\n", conf_get_bool(conf,CONF_try_gssapi_kex) ) ; + fprintf( fp, "gssapifwd=%d\n", conf_get_bool(conf,CONF_gssapifwd) ) ; + fprintf( fp, "gssapirekey=%d\n", conf_get_int(conf,CONF_gssapirekey) ) ; + //fprintf( fp, "ssh_gsslist=%d\n", conf_get_int(conf,CONF_ssh_gsslist) ) ; + fprintf( fp, "ssh_gss_custom=%s\n", conf_get_filename(conf,CONF_ssh_gss_custom)->path ) ; + fprintf( fp, "ssh_subsys=%d\n", conf_get_bool(conf,CONF_ssh_subsys) ) ; + //fprintf( fp, "ssh_subsys2=%d\n", conf_get_bool(conf,CONF_ssh_subsys2) ) ; // N'est pas lu dans settings.c + fprintf( fp, "ssh_no_shell=%d\n", conf_get_bool(conf,CONF_ssh_no_shell) ) ; + //fprintf( fp, "ssh_nc_host=%s\n", conf_get_str(conf,CONF_ssh_nc_host) ) ; // N'est pas lu dans settings.c + //fprintf( fp, "ssh_nc_port=%d\n", conf_get_int(conf,CONF_ssh_nc_port) ) ; // N'est pas lu dans settings.c + + /* Telnet options */ + fprintf( fp, "termtype=%s\n", conf_get_str(conf,CONF_termtype ) ) ; + fprintf( fp, "termspeed=%s\n", conf_get_str(conf,CONF_termspeed ) ) ; + //fprintf( fp, "ttymodes=%s\n", conf_get_str(conf,CONF_ttymodes ) ) ; + //fprintf( fp, "environmt=%s\n", conf_get_str(conf,CONF_environmt ) ) ; + fprintf( fp, "username=%s\n", conf_get_str(conf,CONF_username ) ) ; + fprintf( fp, "username_from_env=%d\n", conf_get_bool(conf,CONF_username_from_env) ) ; + fprintf( fp, "localusername=%s\n", conf_get_str(conf,CONF_localusername ) ) ; + fprintf( fp, "rfc_environ=%d\n", conf_get_bool(conf,CONF_rfc_environ) ) ; + fprintf( fp, "passive_telnet=%d\n", conf_get_bool(conf,CONF_passive_telnet) ) ; + + /* Serial port options */ + fprintf( fp, "serline=%s\n", conf_get_str(conf,CONF_serline) ) ; + fprintf( fp, "serspeed=%d\n", conf_get_int(conf,CONF_serspeed) ) ; + fprintf( fp, "serdatabits=%d\n", conf_get_int(conf,CONF_serdatabits) ) ; + fprintf( fp, "serstopbits=%d\n", conf_get_int(conf,CONF_serstopbits) ) ; + fprintf( fp, "serparity=%d\n", conf_get_int(conf,CONF_serparity) ) ; + fprintf( fp, "serflow=%d\n", conf_get_int(conf,CONF_serflow) ) ; + + /* Keyboard options */ + fprintf( fp, "bksp_is_delete=%d\n", conf_get_bool(conf,CONF_bksp_is_delete) ) ; + fprintf( fp, "rxvt_homeend=%d\n", conf_get_bool(conf,CONF_rxvt_homeend) ) ; + fprintf( fp, "funky_type=%d\n", conf_get_int(conf,CONF_funky_type) ) ; + fprintf( fp, "no_applic_c=%d\n", conf_get_bool(conf,CONF_no_applic_c) ) ; + fprintf( fp, "no_applic_k=%d\n", conf_get_bool(conf,CONF_no_applic_k) ) ; + fprintf( fp, "no_mouse_rep=%d\n", conf_get_bool(conf,CONF_no_mouse_rep) ) ; + fprintf( fp, "no_remote_resize=%d\n", conf_get_bool(conf,CONF_no_remote_resize) ) ; + fprintf( fp, "no_alt_screen=%d\n", conf_get_bool(conf,CONF_no_alt_screen) ) ; + fprintf( fp, "no_remote_wintitle=%d\n", conf_get_bool(conf,CONF_no_remote_wintitle) ) ; + fprintf( fp, "no_remote_clearscroll=%d\n", conf_get_bool(conf,CONF_no_remote_clearscroll) ) ; + fprintf( fp, "no_dbackspace=%d\n", conf_get_bool(conf,CONF_no_dbackspace) ) ; + fprintf( fp, "no_remote_charset=%d\n", conf_get_bool(conf,CONF_no_remote_charset) ) ; + fprintf( fp, "remote_qtitle_action=%d\n", conf_get_int(conf,CONF_remote_qtitle_action) ) ; + fprintf( fp, "app_cursor=%d\n", conf_get_bool(conf,CONF_app_cursor) ) ; + fprintf( fp, "app_keypad=%d\n", conf_get_bool(conf,CONF_app_keypad) ) ; + fprintf( fp, "nethack_keypad=%d\n", conf_get_bool(conf,CONF_nethack_keypad) ) ; + fprintf( fp, "telnet_keyboard=%d\n", conf_get_bool(conf,CONF_telnet_keyboard) ) ; + fprintf( fp, "telnet_newline=%d\n", conf_get_bool(conf,CONF_telnet_newline) ) ; + fprintf( fp, "alt_f4=%d\n", conf_get_bool(conf,CONF_alt_f4) ) ; + fprintf( fp, "alt_space=%d\n", conf_get_bool(conf,CONF_alt_space) ) ; + fprintf( fp, "alt_only=%d\n", conf_get_bool(conf,CONF_alt_only) ) ; + fprintf( fp, "localecho=%d\n", conf_get_int(conf,CONF_localecho) ) ; + fprintf( fp, "localedit=%d\n", conf_get_int(conf,CONF_localedit) ) ; + + fprintf( fp, "alwaysontop=%d\n", conf_get_bool(conf,CONF_alwaysontop) ) ; + fprintf( fp, "fullscreenonaltenter=%d\n", conf_get_bool(conf,CONF_fullscreenonaltenter) ) ; + fprintf( fp, "scroll_on_key=%d\n", conf_get_bool(conf,CONF_scroll_on_key) ) ; + fprintf( fp, "scroll_on_disp=%d\n", conf_get_bool(conf,CONF_scroll_on_disp) ) ; + fprintf( fp, "erase_to_scrollback=%d\n", conf_get_bool(conf,CONF_erase_to_scrollback) ) ; + fprintf( fp, "compose_key=%d\n", conf_get_bool(conf,CONF_compose_key) ) ; + fprintf( fp, "ctrlaltkeys=%d\n", conf_get_bool(conf,CONF_ctrlaltkeys) ) ; + //fprintf( fp, "osx_option_meta=%d\n", conf_get_bool(conf,CONF_osx_option_meta) ) ; // N'est pas lu dans settings.c + //fprintf( fp, "osx_command_meta=%d\n", conf_get_bool(conf,CONF_osx_command_meta) ) ; // N'est pas lu dans settings.c + fprintf( fp, "wintitle=%s\n", conf_get_str(conf,CONF_wintitle) ) ; + + /* Terminal options */ + fprintf( fp, "savelines=%d\n", conf_get_int(conf,CONF_savelines) ) ; + fprintf( fp, "dec_om=%d\n", conf_get_bool(conf,CONF_dec_om) ) ; + fprintf( fp, "wrap_mode=%d\n", conf_get_bool(conf,CONF_wrap_mode) ) ; + fprintf( fp, "lfhascr=%d\n", conf_get_bool(conf,CONF_lfhascr) ) ; + fprintf( fp, "cursor_type=%d\n", conf_get_int(conf,CONF_cursor_type) ) ; + fprintf( fp, "blink_cur=%d\n", conf_get_bool(conf,CONF_blink_cur) ) ; + fprintf( fp, "beep=%d\n", conf_get_int(conf,CONF_beep) ) ; + fprintf( fp, "beep_ind=%d\n", conf_get_int(conf,CONF_beep_ind) ) ; + fprintf( fp, "bellovl=%d\n", conf_get_bool(conf,CONF_bellovl) ) ; + fprintf( fp, "bellovl_n=%d\n", conf_get_int(conf,CONF_bellovl_n) ) ; + fprintf( fp, "bellovl_t=%d\n", conf_get_int(conf,CONF_bellovl_t) ) ; + fprintf( fp, "bellovl_s=%d\n", conf_get_int(conf,CONF_bellovl_s) ) ; + fprintf( fp, "bell_wavefile=%s\n", conf_get_filename(conf,CONF_bell_wavefile)->path ) ; + fprintf( fp, "scrollbar=%d\n", conf_get_bool(conf,CONF_scrollbar) ) ; + fprintf( fp, "scrollbar_in_fullscreen=%d\n", conf_get_bool(conf,CONF_scrollbar_in_fullscreen) ) ; + fprintf( fp, "resize_action=%d\n", conf_get_int(conf,CONF_resize_action) ) ; + fprintf( fp, "bce=%d\n", conf_get_bool(conf,CONF_bce) ) ; + fprintf( fp, "blinktext=%d\n", conf_get_bool(conf,CONF_blinktext) ) ; + fprintf( fp, "win_name_always=%d\n", conf_get_bool(conf,CONF_win_name_always) ) ; + fprintf( fp, "width=%d\n", conf_get_int(conf,CONF_width) ) ; + fprintf( fp, "height=%d\n", conf_get_int(conf,CONF_height) ) ; + fprintf( fp, "font_quality=%d\n", conf_get_int(conf,CONF_font_quality) ) ; + fprintf( fp, "logfilename=%s\n", conf_get_filename(conf,CONF_logfilename)->path ) ; + fprintf( fp, "logtype=%d\n", conf_get_int(conf,CONF_logtype) ) ; + fprintf( fp, "logxfovr=%d\n", conf_get_int(conf,CONF_logxfovr) ) ; + fprintf( fp, "logflush=%d\n", conf_get_bool(conf,CONF_logflush) ) ; + fprintf( fp, "logheader=%d\n", conf_get_bool(conf,CONF_logheader) ) ; + fprintf( fp, "logomitpass=%d\n", conf_get_bool(conf,CONF_logomitpass) ) ; + fprintf( fp, "logomitdata=%d\n", conf_get_bool(conf,CONF_logomitdata) ) ; + fprintf( fp, "hide_mouseptr=%d\n", conf_get_bool(conf,CONF_hide_mouseptr) ) ; + fprintf( fp, "sunken_edge=%d\n", conf_get_bool(conf,CONF_sunken_edge) ) ; + fprintf( fp, "window_border=%d\n", conf_get_int(conf,CONF_window_border) ) ; + fprintf( fp, "answerback=%s\n", conf_get_str(conf,CONF_answerback) ) ; + fprintf( fp, "printer=%s\n", conf_get_str(conf,CONF_printer) ) ; + fprintf( fp, "arabicshaping=%d\n", conf_get_bool(conf,CONF_arabicshaping) ) ; + fprintf( fp, "bidi=%d\n", conf_get_bool(conf,CONF_bidi) ) ; + + /* Colour options */ + fprintf( fp, "ansi_colour=%d\n", conf_get_bool(conf,CONF_ansi_colour) ) ; + fprintf( fp, "xterm_256_colour=%d\n", conf_get_bool(conf,CONF_xterm_256_colour) ) ; + fprintf( fp, "true_colour=%d\n", conf_get_bool(conf,CONF_true_colour) ) ; + fprintf( fp, "system_colour=%d\n", conf_get_bool(conf,CONF_system_colour) ) ; + fprintf( fp, "try_palette%d\n", conf_get_bool(conf,CONF_try_palette) ) ; + fprintf( fp, "bold_style=%d\n", conf_get_int(conf,CONF_bold_style) ) ; + + /* Selection options */ + fprintf( fp, "mouse_is_xterm=%d\n", conf_get_int(conf,CONF_mouse_is_xterm) ) ; + fprintf( fp, "rect_select=%d\n", conf_get_bool(conf,CONF_rect_select) ) ; + fprintf( fp, "rawcnp=%d\n", conf_get_bool(conf,CONF_rawcnp) ) ; + fprintf( fp, "utf8linedraw=%d\n", conf_get_bool(conf,CONF_utf8linedraw) ) ; + fprintf( fp, "rtf_paste=%d\n", conf_get_bool(conf,CONF_rtf_paste) ) ; + fprintf( fp, "mouse_override=%d\n", conf_get_bool(conf,CONF_mouse_override) ) ; + //fprintf( fp, "wordness=%d\n", conf_get_int(conf,CONF_wordness) ) ; + fprintf( fp, "mouseautocopy=%d\n", conf_get_bool(conf,CONF_mouseautocopy) ) ; + fprintf( fp, "mousepaste=%d\n", conf_get_int(conf,CONF_mousepaste) ) ; + fprintf( fp, "ctrlshiftins=%d\n", conf_get_int(conf,CONF_ctrlshiftins) ) ; + fprintf( fp, "ctrlshiftcv=%d\n", conf_get_int(conf,CONF_ctrlshiftcv) ) ; + fprintf( fp, "mousepaste_custom=%s\n", conf_get_str(conf,CONF_mousepaste_custom) ) ; + fprintf( fp, "ctrlshiftins_custom=%s\n", conf_get_str(conf,CONF_ctrlshiftins_custom) ) ; + fprintf( fp, "ctrlshiftcv_custom=%s\n", conf_get_str(conf,CONF_ctrlshiftcv_custom) ) ; + + /* translations */ + fprintf( fp, "vtmode=%d\n", conf_get_int(conf,CONF_vtmode) ) ; + fprintf( fp, "line_codepage=%s\n", conf_get_str(conf,CONF_line_codepage) ) ; + fprintf( fp, "cjk_ambig_wide=%d\n", conf_get_bool(conf,CONF_cjk_ambig_wide) ) ; + fprintf( fp, "utf8_override=%d\n", conf_get_bool(conf,CONF_utf8_override) ) ; + fprintf( fp, "xlat_capslockcyr=%d\n", conf_get_bool(conf,CONF_xlat_capslockcyr) ) ; + + /* X11 forwarding */ + fprintf( fp, "x11_forward=%d\n", conf_get_bool(conf,CONF_x11_forward) ) ; + fprintf( fp, "x11_display=%s\n", conf_get_str(conf,CONF_x11_display) ) ; + fprintf( fp, "x11_auth=%d\n", conf_get_int(conf,CONF_x11_auth) ) ; + fprintf( fp, "xauthfile=%s\n", conf_get_filename(conf,CONF_xauthfile)->path ) ; + + /* port forwarding */ + fprintf( fp, "lport_acceptall=%d\n", conf_get_bool(conf,CONF_lport_acceptall) ) ; + fprintf( fp, "rport_acceptall=%d\n", conf_get_bool(conf,CONF_rport_acceptall) ) ; + fprintf( fp, "portfwd=\n") ; + char *key, *val; + for( val = conf_get_str_strs(conf, CONF_portfwd, NULL, &key ) ; + val != NULL; + val = conf_get_str_strs(conf, CONF_portfwd, key, &key) ) { + if (!strcmp(val, "D")) fprintf( fp, " D%s\t\n", key+1 ) ; + else fprintf( fp, " %s\t%s\n", key, val); + } + + /* SSH bug compatibility modes */ + fprintf( fp, "sshbug_ignore1=%d\n", conf_get_int(conf,CONF_sshbug_ignore1) ) ; + fprintf( fp, "sshbug_plainpw1=%d\n", conf_get_int(conf,CONF_sshbug_plainpw1) ) ; + fprintf( fp, "sshbug_rsa1=%d\n", conf_get_int(conf,CONF_sshbug_rsa1) ) ; + fprintf( fp, "sshbug_hmac2=%d\n", conf_get_int(conf,CONF_sshbug_hmac2) ) ; + fprintf( fp, "sshbug_derivekey2=%d\n", conf_get_int(conf,CONF_sshbug_derivekey2) ) ; + fprintf( fp, "sshbug_rsapad2=%d\n", conf_get_int(conf,CONF_sshbug_rsapad2) ) ; + fprintf( fp, "sshbug_pksessid2=%d\n", conf_get_int(conf,CONF_sshbug_pksessid2) ) ; + fprintf( fp, "sshbug_rekey2=%d\n", conf_get_int(conf,CONF_sshbug_rekey2) ) ; + fprintf( fp, "sshbug_maxpkt2=%d\n", conf_get_int(conf,CONF_sshbug_maxpkt2) ) ; + fprintf( fp, "sshbug_ignore2=%d\n", conf_get_int(conf,CONF_sshbug_ignore2) ) ; + fprintf( fp, "sshbug_oldgex2=%d\n", conf_get_int(conf,CONF_sshbug_oldgex2) ) ; + fprintf( fp, "sshbug_winadj=%d\n", conf_get_int(conf,CONF_sshbug_winadj) ) ; + fprintf( fp, "sshbug_chanreq=%d\n", conf_get_int(conf,CONF_sshbug_chanreq) ) ; + fprintf( fp, "ssh_simple=%d\n", conf_get_bool(conf,CONF_ssh_simple) ) ; + fprintf( fp, "ssh_connection_sharing=%d\n", conf_get_bool(conf,CONF_ssh_connection_sharing) ) ; + fprintf( fp, "ssh_connection_sharing_upstream=%d\n", conf_get_bool(conf,CONF_ssh_connection_sharing_upstream) ) ; + fprintf( fp, "ssh_connection_sharing_downstream=%d\n", conf_get_bool(conf,CONF_ssh_connection_sharing_downstream) ) ; + //X(STR, STR, ssh_manual_hostkeys) + + /* Options for pterm. Should split out into platform-dependent part. */ + fprintf( fp, "stamp_utmp=%d\n", conf_get_bool(conf,CONF_stamp_utmp) ) ; + fprintf( fp, "login_shell=%d\n", conf_get_bool(conf,CONF_login_shell) ) ; + fprintf( fp, "scrollbar_on_left=%d\n", conf_get_bool(conf,CONF_scrollbar_on_left) ) ; + fprintf( fp, "shadowbold=%d\n", conf_get_bool(conf,CONF_shadowbold) ) ; + // X(FONT, NONE, boldfont) + // X(FONT, NONE, widefont) + // X(FONT, NONE, wideboldfont) + fprintf( fp, "shadowboldoffset=%d\n", conf_get_int(conf,CONF_shadowboldoffset) ) ; + fprintf( fp, "crhaslf=%d\n", conf_get_bool(conf,CONF_crhaslf) ) ; + fprintf( fp, "winclass=%s\n", conf_get_str(conf,CONF_winclass) ) ; + +#ifdef PERSOPORT + /* PERSOPORT Options */ + //fprintf( fp, "bcdelay=%d\n", conf_get_int(conf,CONF_bcdelay) ) ; // Non present systematiquement + //fprintf( fp, "initdelay=%d\n", conf_get_int(conf,CONF_initdelay) ) ; // Non present systematiquement + fprintf( fp, "transparencynumber=%d\n", conf_get_int(conf,CONF_transparencynumber) ) ; + fprintf( fp, "sendtotray=%d\n", conf_get_int(conf,CONF_sendtotray) ) ; + fprintf( fp, "maximize=%d\n", conf_get_int(conf,CONF_maximize) ) ; + fprintf( fp, "fullscreen=%d\n", conf_get_int(conf,CONF_fullscreen) ) ; + fprintf( fp, "saveonexit=%d\n", conf_get_int(conf,CONF_saveonexit) ) ; + fprintf( fp, "icone=%d\n", conf_get_int(conf,CONF_icone) ) ; + fprintf( fp, "iconefile=%s\n", conf_get_filename(conf,CONF_iconefile)->path ) ; + fprintf( fp, "sftpconnect=%s\n", conf_get_str(conf,CONF_sftpconnect) ) ; + fprintf( fp, "folder=%s\n", conf_get_str(conf,CONF_folder) ) ; + /* On decrypte le password */ + char bufpass[4096] ; + memcpy( bufpass, conf_get_str(conf,CONF_password), 4095 ) ; bufpass[4095]='\0'; + MASKPASS(bufpass); + fprintf( fp, "password=%s\n", bufpass ) ; + memset(bufpass,0,strlen(bufpass)); + + fprintf( fp, "autocommand=%s\n", conf_get_str(conf,CONF_autocommand) ) ; + fprintf( fp, "autocommandout=%s\n", conf_get_str(conf,CONF_autocommandout) ) ; + fprintf( fp, "antiidle=%s\n", conf_get_str(conf,CONF_antiidle) ) ; + fprintf( fp, "sessionname=%s\n", conf_get_str(conf,CONF_sessionname) ) ; + fprintf( fp, "logtimerotation=%d\n", conf_get_int(conf,CONF_logtimerotation) ) ; + fprintf( fp, "logtimestamp=%s\n", conf_get_str(conf,CONF_logtimestamp) ) ; + fprintf( fp, "scriptfile=%s\n", conf_get_filename(conf,CONF_scriptfile)->path ) ; + fprintf( fp, "scriptfilecontent=%s", conf_get_str(conf,CONF_scriptfilecontent) ) ; + /* On decrypte le script */ + buf=(char*)malloc( strlen(conf_get_str(conf,CONF_scriptfilecontent)) + 20 ) ; + strcpy( buf, conf_get_str(conf,CONF_scriptfilecontent) ) ; + long l=decryptstring( buf, MASTER_PASSWORD ) ; + int i; + for( i=0; ipath ) ; + fprintf( fp, "ScriptMode=%d\n", conf_get_int(conf,CONF_script_mode) ) ; + fprintf( fp, "ScriptLineDelay=%d\n", conf_get_int(conf,CONF_script_line_delay) ) ; + fprintf( fp, "ScriptCharDelay=%d\n", conf_get_int(conf,CONF_script_char_delay) ) ; + fprintf( fp, "ScriptCondLine=%s\n", conf_get_str(conf,CONF_script_cond_line) ) ; + fprintf( fp, "ScriptCondUse=%d\n", conf_get_int(conf,CONF_script_cond_use) ) ; + fprintf( fp, "ScriptCRLF=%d\n", conf_get_int(conf,CONF_script_crlf) ) ; + fprintf( fp, "ScriptEnable=%d\n", conf_get_int(conf,CONF_script_enable) ) ; + fprintf( fp, "ScriptExcept=%d\n", conf_get_int(conf,CONF_script_except) ) ; + fprintf( fp, "ScriptTimeout=%d\n", conf_get_int(conf,CONF_script_timeout) ) ; + fprintf( fp, "ScriptWait=%s\n", conf_get_str(conf,CONF_script_waitfor) ) ; + fprintf( fp, "ScriptHalt=%s\n", conf_get_str(conf,CONF_script_halton) ) ; +#endif +#ifdef CYGTERMPORT + /* Cygterm options */ + fprintf( fp, "cygautopath=%d\n", conf_get_int(conf,CONF_cygautopath) ) ; + fprintf( fp, "cygterm64=%d\n", conf_get_int(conf,CONF_cygterm64) ) ; + fprintf( fp, "cygcmd=%s\n", conf_get_str(conf,CONF_cygcmd) ) ; + fprintf( fp, "alt_metabit=%d\n", conf_get_int(conf,CONF_alt_metabit) ) ; +#endif +#if (defined IMAGEPORT) && (!defined FDJ) + /* Image Options */ + fprintf( fp, "bg_opacity=%d\n", conf_get_int(conf,CONF_bg_opacity) ) ; + fprintf( fp, "bg_slideshow=%d\n", conf_get_int(conf,CONF_bg_slideshow) ) ; + fprintf( fp, "bg_type=%d\n", conf_get_int(conf,CONF_bg_type) ) ; + fprintf( fp, "bg_image_filename=%s\n", conf_get_filename(conf,CONF_bg_image_filename)->path ) ; + fprintf( fp, "bg_image_style=%d\n", conf_get_int(conf,CONF_bg_image_style) ) ; + fprintf( fp, "bg_image_abs_x=%d\n", conf_get_int(conf,CONF_bg_image_abs_x) ) ; + fprintf( fp, "bg_image_abs_y=%d\n", conf_get_int(conf,CONF_bg_image_abs_y) ) ; + fprintf( fp, "bg_image_abs_fixed=%d\n", conf_get_int(conf,CONF_bg_image_abs_fixed) ) ; +#endif +#ifdef RECONNECTPORT + /* Reconnect Options */ + fprintf( fp, "wakeup_reconnect=%d\n", conf_get_int(conf,CONF_wakeup_reconnect) ) ; + fprintf( fp, "failure_reconnect=%d\n", conf_get_int(conf,CONF_failure_reconnect) ) ; +#endif +#ifdef HYPERLINKPORT + /* Hyperlink Options */ + fprintf( fp, "url_ctrl_click=%d\n", conf_get_int(conf,CONF_url_ctrl_click) ) ; + fprintf( fp, "url_underline=%d\n", conf_get_int(conf,CONF_url_underline) ) ; + fprintf( fp, "url_defbrowser=%d\n", conf_get_int(conf,CONF_url_defbrowser) ) ; + fprintf( fp, "url_defregex=%d\n", conf_get_int(conf,CONF_url_defregex) ) ; + fprintf( fp, "url_browser=%s\n", conf_get_filename(conf,CONF_url_browser)->path ) ; + fprintf( fp, "url_regex=%s\n", conf_get_str(conf,CONF_url_regex) ) ; + fprintf( fp, "urlhack_default_regex=%s\n", urlhack_default_regex ) ; + fprintf( fp, "urlhack_liberal_regex=%s\n", urlhack_liberal_regex ) ; +#endif +#ifdef TUTTYPORT + /* TuTTY port Options */ + fprintf( fp, "window_closable=%d\n", conf_get_int(conf,CONF_window_closable) ) ; + fprintf( fp, "window_minimizable=%d\n", conf_get_int(conf,CONF_window_minimizable) ) ; + fprintf( fp, "window_maximizable=%d\n", conf_get_int(conf,CONF_window_maximizable) ) ; + fprintf( fp, "window_has_sysmenu=%d\n", conf_get_int(conf,CONF_window_has_sysmenu) ) ; + fprintf( fp, "bottom_buttons=%d\n", conf_get_int(conf,CONF_bottom_buttons) ) ; + fprintf( fp, "bold_colour=%d\n", conf_get_int(conf,CONF_bold_colour) ) ; + fprintf( fp, "under_colour=%d\n", conf_get_int(conf,CONF_under_colour) ) ; + fprintf( fp, "sel_colour=%d\n", conf_get_int(conf,CONF_sel_colour) ) ; +#endif +#ifdef ZMODEMPORT + /* ZModem Options */ + fprintf( fp, "rzcommand=%s\n", conf_get_filename(conf,CONF_rzcommand)->path ) ; + fprintf( fp, "rzoptions=%s\n", conf_get_str(conf,CONF_rzoptions) ) ; + fprintf( fp, "szcommand=%s\n", conf_get_filename(conf,CONF_szcommand)->path ) ; + fprintf( fp, "szoptions=%s\n", conf_get_str(conf,CONF_szoptions) ) ; + fprintf( fp, "zdownloaddir=%s\n", conf_get_str(conf,CONF_zdownloaddir) ) ; +#endif +#ifdef PORTKNOCKINGPORT + /* Port knocking Options */ + fprintf( fp, "portknocking=%s\n", conf_get_str(conf,CONF_portknockingoptions) ) ; +#endif +#ifdef DISABLEALTGRPORT + /* Disable AltGr Options */ + fprintf( fp, "disablealtgr=%d\n", conf_get_int(conf,CONF_disablealtgr) ) ; +#endif + + fprintf( fp, "\n[[KiTTY specific configuration]]\n" ) ; + fprintf( fp, "IniFileFlag=%d - ",IniFileFlag) ; + switch(IniFileFlag) { + case 0: fprintf( fp, "Registry\n" ) ; break ; + case 1: fprintf( fp, "File\n" ) ; break ; + case 2: fprintf( fp, "Directory\n" ) ; break ; + } + + fprintf( fp, "internal_delay=%d\ninit_delay=%d\nautocommand_delay=%d\nbetween_char_delay=%d\nProtectFlag=%d\n",internal_delay,init_delay,autocommand_delay,between_char_delay,ProtectFlag ); + + fprintf( fp, "HyperlinkFlag=%d\n", HyperlinkFlag ); + if( AutoCommand!= NULL ) fprintf( fp, "AutoCommand=%s\n", AutoCommand ) ; + if( ScriptCommand!= NULL ) fprintf( fp, "ScriptCommand=%s\n", ScriptCommand ) ; + if( PasteCommand!= NULL ) fprintf( fp, "PasteCommand=%s\n", PasteCommand ) ; + fprintf( fp, "PasteCommandFlag=%d\n", PasteCommandFlag ); + if( ScriptFileContent!= NULL ) { + char * pst = ScriptFileContent ; + fprintf( fp, "ScriptFileContent=" ) ; + while( strlen(pst) > 0 ) { fprintf( fp, "%s|", pst ) ; pst=pst+strlen(pst)+1 ; } + fprintf( fp, "\n" ) ; + } + if( IconFile!= NULL ) fprintf( fp, "IconFile=%s\n", IconFile ) ; + fprintf( fp, "AutoStoreSSHKeyFlag=%d\nDirectoryBrowseFlag=%d\nVisibleFlag=%d\nShortcutsFlag=%d\nMouseShortcutsFlag=%d\nIconeFlag=%d\nNumberOfIcons=%d\nSizeFlag=%d\nCapsLockFlag=%d\nTitleBarFlag=%d\nCtrlTabFlag=%d\nRuTTYFlag=%d\n" + ,GetAutoStoreSSHKeyFlag(),DirectoryBrowseFlag,VisibleFlag,ShortcutsFlag,MouseShortcutsFlag,IconeFlag,NumberOfIcons,SizeFlag,CapsLockFlag,TitleBarFlag,CtrlTabFlag,RuttyFlag); + //static HINSTANCE hInstIcons = NULL ; + fprintf( fp, "WinHeight=%d\nWinrolFlag=%d\nAutoSendToTray=%d\nNoKittyFileFlag=%d\nConfigBoxHeight=%d\nConfigBoxWindowHeight=%d\nConfigBoxNoExitFlag=%d\nUserPassSSHNoSave=%d\nPuttyFlag=%d\n",WinHeight,WinrolFlag,AutoSendToTray,NoKittyFileFlag,ConfigBoxHeight,ConfigBoxWindowHeight,ConfigBoxNoExitFlag,GetUserPassSSHNoSave(),PuttyFlag); + + fprintf( fp,"BackgroundImageFlag=%d\n",BackgroundImageFlag ); +#ifdef RECONNECTPORT + fprintf( fp,"AutoreconnectFlag=%d\nReconnectDelay=%d\n",AutoreconnectFlag,ReconnectDelay ); +#endif +#ifdef CYGTERMPORT + fprintf( fp,"CygTermFlag=%d\n",cygterm_get_flag() ); +#endif +#ifdef ADBPORT + fprintf( fp,"ADBFlag=%d\n",GetADBFlag() ); +#endif + if( PasswordConf!= NULL ) fprintf( fp, "PasswordConf=%s\n", PasswordConf ) ; + fprintf( fp, "SessionFilterFlag=%d\nSessionsInDefaultFlag=%d\nDefaultSettingsFlag=%d\nImageViewerFlag=%d\nImageSlideDelay=%d\nMaxBlinkingTime=%d\nPrintCharSize=%d\nPrintMaxLinePerPage=%d\nPrintMaxCharPerLine=%d\nReadOnlyFlag=%d\n" + ,SessionFilterFlag,SessionsInDefaultFlag,DefaultSettingsFlag,ImageViewerFlag,ImageSlideDelay,MaxBlinkingTime,PrintCharSize,PrintMaxLinePerPage,PrintMaxCharPerLine,GetReadOnlyFlag()); + fprintf( fp, "AntiIdleCount=%d\nAntiIdleCountMax=%d\nIconeNum=%d\n" + ,AntiIdleCount,AntiIdleCountMax,IconeNum); + fprintf( fp, "AntiIdleStr=%s\nInitialDirectory=%s\nConfigDirectory=%s\nBuildVersionTime=%s\n",AntiIdleStr,InitialDirectory,ConfigDirectory,BuildVersionTime); + if( WinSCPPath!= NULL ) fprintf( fp, "WinSCPPath=%s\n", WinSCPPath ) ; + if( PSCPPath!= NULL ) fprintf( fp, "PSCPPath=%s\n", PSCPPath ) ; + if( PlinkPath!= NULL ) fprintf( fp, "PlinkPath=%s\n", PlinkPath ) ; + if( KittyIniFile!= NULL ) fprintf( fp, "KittyIniFile=%s\n", KittyIniFile ) ; + if( KittySavFile!= NULL ) fprintf( fp, "KittySavFile=%s\n", KittySavFile ) ; + if( KiTTYClassName != NULL ) fprintf( fp, "KiTTYClassName=%s\n", KiTTYClassName ) ; + if( CtHelperPath!= NULL ) fprintf( fp, "CtHelperPath=%s\n", CtHelperPath ) ; + if( strlen(ManagePassPhrase(NULL))>0 ) fprintf( fp, "PassPhrase=%s\n", ManagePassPhrase(NULL)) ; +} + +// recupere la configuration des shortcuts +void SaveShortCuts( FILE *fp ) { + int i ; + fprintf( fp, "autocommand=%d\n", shortcuts_tab.autocommand ) ; + fprintf( fp, "command=%d\n", shortcuts_tab.command ) ; + fprintf( fp, "editor=%d\n", shortcuts_tab.editor ) ; + fprintf( fp, "editorclipboard=%d\n", shortcuts_tab.editorclipboard ) ; + fprintf( fp, "getfile=%d\n", shortcuts_tab.getfile ) ; + fprintf( fp, "imagechange=%d\n", shortcuts_tab.imagechange ) ; + fprintf( fp, "input=%d\n", shortcuts_tab.input ) ; + fprintf( fp, "inputm=%d\n", shortcuts_tab.inputm ) ; + fprintf( fp, "print=%d\n", shortcuts_tab.print ) ; + fprintf( fp, "printall=%d\n", shortcuts_tab.printall ) ; + fprintf( fp, "protect=%d\n", shortcuts_tab.protect ) ; + fprintf( fp, "script=%d\n", shortcuts_tab.script ) ; + fprintf( fp, "sendfile=%d\n", shortcuts_tab.sendfile ) ; + fprintf( fp, "rollup=%d\n", shortcuts_tab.rollup ) ; + fprintf( fp, "tray=%d\n", shortcuts_tab.tray ) ; + fprintf( fp, "viewer=%d\n", shortcuts_tab.viewer ) ; + fprintf( fp, "visible=%d\n", shortcuts_tab.visible ) ; + fprintf( fp, "winscp=%d\n", shortcuts_tab.winscp ) ; + fprintf( fp, "showportforward=%d\n", shortcuts_tab.showportforward ) ; + fprintf( fp, "duplicate=%d\n", shortcuts_tab.duplicate ) ; + + fprintf( fp, "\nNbShortCuts=%d\n", NbShortCuts ) ; + if( NbShortCuts>0 ) { + for( i=0 ; ipath ) ) { + fputs( "\n@ Private key file @\n\n", fpout ) ; + SaveDebugFile( conf_get_filename(conf,CONF_keyfile)->path, fpout ) ; + } +#ifdef RUTTYPORT + if( existfile( conf_get_filename(conf,CONF_script_filename)->path ) ) { + fputs( "\n@ RuTTY script file @\n\n", fpout ) ; + SaveDebugFile( conf_get_filename(conf,CONF_script_filename)->path, fpout ) ; + } +#endif + fputs( "\n@ ScreenShot @\n\n", fpout ) ; + SaveScreenShot( fpout ) ; fflush( fpout ) ; + + fclose( fpout ) ; + + sprintf( buffer, "%s\\%s", InitialDirectory, filename ) ; + sprintf( buffer2, "%s\\%s", InitialDirectory, "kitty.dmp.bcr" ) ; + bcrypt_file_base64( buffer, buffer2, "9bis", 80 ) ; unlink( buffer ) ; rename( buffer2, buffer ) ; + } + } +void SaveDump(void) { + SaveDumpFile("kitty.dmp") ; +} diff --git a/kitty_settings.c b/kitty_settings.c index 5c21322..9efb2a2 100644 --- a/kitty_settings.c +++ b/kitty_settings.c @@ -66,7 +66,6 @@ void save_open_settings_forced(char *filename, Conf *conf) { // BEGIN COPY/PASTE int i; const char *p; - write_setting_i_forced(sesskey, "Present", 1); write_setting_s_forced(sesskey, "HostName", conf_get_str(conf, CONF_host)); write_setting_filename_forced(sesskey, "LogFileName", conf_get_filename(conf, CONF_logfilename)); @@ -246,6 +245,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { write_setting_b_forced(sesskey, "RectSelect", conf_get_bool(conf, CONF_rect_select)); write_setting_b_forced(sesskey, "PasteControls", conf_get_bool(conf, CONF_paste_controls)); write_setting_b_forced(sesskey, "MouseOverride", conf_get_bool(conf, CONF_mouse_override)); + for (i = 0; i < 256; i += 32) { char buf[20], buf2[256]; int j; @@ -258,6 +258,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { } write_setting_s_forced(sesskey, buf, buf2); } + write_setting_b_forced(sesskey, "MouseAutocopy", conf_get_bool(conf, CONF_mouseautocopy)); write_clip_setting_forced(sesskey, "MousePaste", conf, @@ -1123,6 +1124,7 @@ void write_setting_i_forced(void *handle, const char *key, int value) { if( CryptFileFlag ) { cryptstring(buf,MASTER_PASSWORD); } //fprintf( (FILE*)handle, "%s\\%i\\\n", key, value ) ; fprintf( (FILE*)handle, "%s\n", buf ) ; + fflush(handle); } void write_setting_s_forced(void *handle, const char *key, const char *value) { @@ -1134,6 +1136,7 @@ void write_setting_s_forced(void *handle, const char *key, const char *value) { sprintf( buf, "%s\\%s\\", key, p ) ; if( CryptFileFlag ) { cryptstring(buf,MASTER_PASSWORD); } fprintf( (FILE*)handle, "%s\n", buf ) ; + fflush(handle); free(buf); free(p); } @@ -1147,6 +1150,7 @@ void write_setting_filename_forced(void *handle, const char *key, Filename *valu sprintf( buf, "%s\\%s\\", key, p ) ; if( CryptFileFlag ) { cryptstring(buf,MASTER_PASSWORD); } fprintf( (FILE*)handle, "%s\n", buf ) ; + fflush(handle); free(buf) ; free(p); } @@ -1163,6 +1167,7 @@ void write_setting_fontspec_forced(void *handle, const char *name, FontSpec *fon settingname = dupcat(name, "Height", NULL); write_setting_i_forced(handle, settingname, font->height); sfree(settingname); + fflush(handle); } static void wmap_forced(void *handle, char const *outkey, Conf *conf, int primary,int include_values) { diff --git a/zmodem/winpzmodem.c b/zmodem/winpzmodem.c index 186ff6e..44e9d2b 100644 --- a/zmodem/winpzmodem.c +++ b/zmodem/winpzmodem.c @@ -335,8 +335,9 @@ static int xyz_SpawnProcess(Terminal *term, const char *incommand, const char *i } p--; } +debug_log("%s %s\n",incommand,inparams); sprintf(params, "%s %s", p, inparams); - +debug_log("%s %s\n",incommand,params); if (!CreateProcess(incommand,params,NULL, NULL,TRUE,CREATE_NEW_CONSOLE, NULL,conf_get_str(term->conf,CONF_zdownloaddir),&si,&term->xyz_Internals->pi)) { //DWORD err = GetLastError(); @@ -388,13 +389,20 @@ int xyz_ReceiveData(Terminal *term, const u_char *buffer, int len) OutputDebugString(debugbuff); } #endif - - //if( ! +// if( ! WriteFile(term->xyz_Internals->write_stdin,buffer,len,&written,NULL) ; - //) { char buf[1024]; sprintf(buf, "Unable to write %d characters", len); MessageBox(NULL,buf,"Error",MB_OK|MB_ICONERROR); } +// ) { char buf[1024]; sprintf(buf, "Unable to write %d characters", len); MessageBox(NULL,buf,"Error",MB_OK|MB_ICONERROR); } return 0 ; } #endif + + + +/* +E:\DEV\MinGW\msys\1.0\home\cyril\putty-0.71\zmodem\rz.exe rz.exe -e -v + +E:\DEV\MinGW\msys\1.0\home\cyril\putty-0.71\zmodem\sz.exe sz.exe -e -v "E:\DEV\windiff.exe" +*/