- bug fix: export ktx file

- bug fix: issue when wrong password input
This commit is contained in:
cyd01
2019-05-11 23:32:18 +02:00
parent 22c146d3b4
commit dc1ce29a51
14 changed files with 1082 additions and 1072 deletions
+6
View File
@@ -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
+2 -2
View File
@@ -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
-7
View File
@@ -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)
+1 -1
View File
@@ -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);
+48 -56
View File
@@ -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);
+4
View File
@@ -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);
}
+1
View File
@@ -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 <stdio.h>
#ifndef JPEGLIB_H
#define JPEGLIB_H
+3 -3
View File
@@ -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 */
+1 -1
View File
@@ -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
+125 -121
View File
@@ -9,9 +9,16 @@
#undef IMAGEPORT
#endif
#include <windows.h>
#include "kitty_image.h"
#include <setjmp.h>
#include "jpeg/jpeglib.h"
#include <stdio.h>
#ifdef IMAGEPORT
#ifdef NO
#include <windows.h>
#include <math.h>
#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 <setjmp.h>
#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 <math.h>
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);
}
}
+3 -2
View File
@@ -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();
+870 -874
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -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) {
+12 -4
View File
@@ -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"
*/