Prepare for cross-compile

This commit is contained in:
cyd01
2019-11-27 07:54:01 +01:00
parent f07b8d362d
commit cac3a8e13f
8 changed files with 145 additions and 74 deletions
+8 -5
View File
@@ -97,6 +97,7 @@
# TOOLPATH = c:\cygwin\bin\ # or similar, if you're running Windows
# TOOLPATH = /pkg/mingw32msvc/i386-mingw32msvc/bin/
# TOOLPATH = i686-w64-mingw32-
# make -e TOOLPATH=/usr/bin/i686-w64-mingw32- -f MAKEFILE.MINGW putty.exe
CC = $(TOOLPATH)gcc
RC = $(TOOLPATH)windres
# Uncomment the following two lines to compile under Winelib
@@ -107,8 +108,8 @@ RC = $(TOOLPATH)windres
# CFLAGS = -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT \
CFLAGS = -Wall -O2 -D_WINDOWS -DWIN32S_COMPAT \
-D_NO_OLDNAMES -I.././ \
CFLAGS = -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT \
-D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ \
-I../charset/ -I../windows/ -I../unix/
LDFLAGS = -s
RCFLAGS = $(RCINC) --define WIN32=1 --define _WIN32=1 --define WINVER=0x0400 \
@@ -141,7 +142,8 @@ RCFLAGS += -I ../../ -DMOD_PERSO -D$(FDJFLAG)
CFLAGS += -DAUTO_WINSOCK -DCOVERITY -DNO_MULTIMON -DNO_HTMLHELP
CFLAGS += -D$(FDJFLAG)
CFLAGS += -DMOD_PERSO \
CFLAGS += -I.././ -I../../ \
-DMOD_PERSO \
-DMOD_STARTBUTTON \
-DMOD_SAVEDUMP \
-DMOD_DISABLEALTGR \
@@ -157,10 +159,11 @@ CFLAGS += -DMOD_PERSO \
-DMOD_RUTTY \
-DMOD_ADB \
-DMOD_BACKGROUNDIMAGE \
-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
-I../../base64 \
-I../../bcrypt \
-I../../md5 -I../../regex -I../../url -I../../wincrypt -I../../rutty
# -DMOD_CYGTERM \
# -DUSE_CAPI -DMOD_WINCRYPT \
+11 -9
View File
@@ -3255,17 +3255,17 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation
char bufpass[1024]; strcpy(bufpass,conf_get_str(conf,CONF_password)) ;
MASKPASS(bufpass); strcat(buffer,bufpass); memset(bufpass,0,strlen(bufpass));
strcat( buffer, "\\n" ) ;
}
}
}
if( strlen( conf_get_str(conf,CONF_autocommand) ) > 0 ) {
strcat( buffer, "\\n\\p" ) ;
strcat( buffer, conf_get_str(conf,CONF_autocommand) ) ;
strcat( buffer, "\\n" ) ;
}
}
if( strlen(buffer) > 0 ) {
conf_set_str( conf, CONF_autocommand, buffer );
}
}
}
// Envoi automatiquement dans le systeme tray si besoin
if( GetAutoSendToTray() ) ManageToTray( hwnd ) ;
@@ -3284,11 +3284,11 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation
if( strlen( conf_get_str(conf,CONF_autocommand) ) > 0 ) {
SetTimer(hwnd, TIMER_AUTOCOMMAND, autocommand_delay, NULL) ;
}
}
if( conf_get_int(conf,CONF_logtimerotation) > 0 ) {
SetTimer(hwnd, TIMER_LOGROTATION, (int)( conf_get_int(conf,CONF_logtimerotation)*1000), NULL) ;
lp_eventlog(default_logpolicy, "Start log rotation" );
}
}
RefreshBackground( hwnd ) ;
}
@@ -3334,7 +3334,7 @@ else if((UINT_PTR)wParam == TIMER_AUTOCOMMAND) { // Autocommand au demarrage
del( AutoCommand, 1, i ) ; //AutoCommand += i ;
if( strlen( buffer ) > 0 ) { SendAutoCommand( hwnd, buffer ) ; }
if( AutoCommand[0] == '\0' ) {
if( AutoCommand[0] == '\0' ) {
free( AutoCommand ) ; AutoCommand = NULL ;
InvalidateRect( hwnd, NULL, true ) ;
}
@@ -3658,17 +3658,19 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation
SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, 0, SI_INIT ) ;
is_backend_connected = 0 ;
start_backend();
if( (!backend || !is_backend_connected) && GetAutoreconnectFlag() ) {
//if( (!backend || !is_backend_connected) && GetAutoreconnectFlag() ) {
if( (!backend) && GetAutoreconnectFlag() ) {
if ( conf_get_int(conf,CONF_failure_reconnect) && is_backend_first_connected ) {
SetTimer(hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ;
lp_eventlog(default_logpolicy, "Unable to connect, trying to reconnect...") ;
}
break;
}
break;
}
#else
is_backend_connected = 0 ;
start_backend();
#endif
is_backend_connected = 1 ;
SetTimer(hwnd, TIMER_INIT, init_delay, NULL) ;
#else
start_backend();
+65
View File
@@ -0,0 +1,65 @@
#ifndef __BCRYPT
#define __BCRYPT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/* Cas de la construction de la DLL */
#ifdef BUILD_DLL
#define LINKDLL extern "C" __declspec(dllexport)
#define LINKDLLCPP __declspec(dllexport)
#else
#define LINKDLL
#define LINKDLLCPP
#endif
/* code retour
1 si tout va bien
0 en cas d'erreur
*/
LINKDLL void bcrypt_init( const long t ) ;
LINKDLL int bcrypt_string( const char * st_in, char * st_out, const unsigned int length, const char * init_pattern, const char * key, const unsigned int maxlinesize ) ;
LINKDLL int buncrypt_string( const char * st_in, char * st_out, const unsigned int length
, const char * init_pattern, const char * key ) ;
LINKDLL int bcrypt_string_printable( const char * st_in, char * st_out
, const unsigned int length, const char * key, const unsigned int maxlinesize ) ;
LINKDLL int buncrypt_string_printable( const char * st_in, char * st_out
, const unsigned int length, const char * key ) ;
LINKDLL int bcrypt_string_base64( const char * st_in, char * st_out
, const unsigned int length, const char * key, const unsigned int maxlinesize ) ;
LINKDLL int buncrypt_string_base64( const char * st_in, char * st_out
, const unsigned int length, const char * key ) ;
LINKDLL int bcrypt_string_auto( char * st, const unsigned int length
, const char * init_pattern, const char * key, const unsigned int maxlinesize ) ;
LINKDLL int buncrypt_string_auto( char * st, const unsigned int length
, const char * init_pattern, const char * key ) ;
LINKDLL int bcrypt_file( const char * filename_in, const char * filename_out
, const char * init_pattern, const char * key, const int unsigned maxlinesize ) ;
LINKDLL int buncrypt_file( const char * filename_in, const char * filename_out
, const char * init_pattern, const char * key ) ;
LINKDLL int bcrypt_file_printable( const char * filename_in, const char * filename_out
, const char * key, const unsigned int maxlinesize ) ;
LINKDLL int buncrypt_file_printable( const char * filename, const char * filename_out
, const char * key ) ;
LINKDLL int bcrypt_file_base64( const char * filename_in, const char * filename_out
, const char * key, const unsigned int maxlinesize ) ;
LINKDLL int buncrypt_file_base64( const char * filename, const char * filename_out
, const char * key ) ;
LINKDLL int bcrypt_file_auto( const char * filename
, const char * init_pattern, const char * key, const int unsigned maxlinesize ) ;
LINKDLL int buncrypt_file_auto( const char * filename
, const char * init_pattern, const char * key ) ;
#endif
+55 -54
View File
@@ -11,17 +11,17 @@
#include <sys/stat.h>
#include <sys/types.h>
// Include specifiques Windows (windows.h doit imperativement etre declare en premier)
#include <windows.h>
#include <iphlpapi.h>
#include <psapi.h>
// Includes de PuTTY
#include "putty.h"
#include "terminal.h"
#include "ldisc.h"
#include "win_res.h"
// Include specifiques Windows (windows.h doit imperativement etre declare en premier)
#include <windows.h>
#include <psapi.h>
#include <iphlpapi.h>
// Includes de KiTTY
#include "kitty.h"
#include "kitty_commun.h"
@@ -1234,39 +1234,34 @@ void CreateDefaultIniFile( void ) {
writeINI( KittyIniFile, "Agent", "#messageonkeyusage", "no" ) ;
writeINI( KittyIniFile, "Agent", "#askconfirmation", "auto" ) ;
writeINI( KittyIniFile, "ConfigBox", "height", "21" ) ;
writeINI( KittyIniFile, "ConfigBox", "filter", "yes" ) ;
writeINI( KittyIniFile, "ConfigBox", "#default", "yes" ) ;
writeINI( KittyIniFile, "ConfigBox", "#defaultsettings", "yes" ) ;
writeINI( KittyIniFile, "ConfigBox", "filter", "yes" ) ;
writeINI( KittyIniFile, "ConfigBox", "height", "21" ) ;
writeINI( KittyIniFile, "ConfigBox", "#noexit", "no" ) ;
writeINI( KittyIniFile, "ConfigBox", "#windowheight", "600" ) ;
#ifdef MOD_ADB
writeINI( KittyIniFile, INIT_SECTION, "#adb", "yes" ) ;
#endif
writeINI( KittyIniFile, INIT_SECTION, "#antiidle=", " \\k08\\" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#antiidledelay", "60" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#autostoresshkey", "no" ) ;
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
writeINI( KittyIniFile, INIT_SECTION, "backgroundimage", "no" ) ;
#endif
writeINI( KittyIniFile, INIT_SECTION, "#bcdelay", "0" ) ;
writeINI( KittyIniFile, INIT_SECTION, "capslock", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "conf", "yes" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#configdir", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#CtHelperPath", "" ) ;
#ifndef FDJ
writeINI( KittyIniFile, INIT_SECTION, "cygterm", "no" ) ;
#else
writeINI( KittyIniFile, INIT_SECTION, "cygterm", "no" ) ;
#endif
writeINI( KittyIniFile, INIT_SECTION, "icon", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#iconfile", DEFAULT_EXE_FILE ) ;
sprintf( buffer, "%d", NB_ICONES ) ;
writeINI( KittyIniFile, INIT_SECTION, "#numberoficons", buffer ) ;
writeINI( KittyIniFile, INIT_SECTION, "paste", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "print", "yes" ) ;
writeINI( KittyIniFile, INIT_SECTION, "scriptfilefilter", "All files (*.*)|*.*" ) ;
writeINI( KittyIniFile, INIT_SECTION, "size", "no" ) ;
#ifdef FDJ
writeINI( KittyIniFile, INIT_SECTION, "shortcuts", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "mouseshortcuts", "no" ) ;
#else
writeINI( KittyIniFile, INIT_SECTION, "shortcuts", "yes" ) ;
writeINI( KittyIniFile, INIT_SECTION, "mouseshortcuts", "yes" ) ;
#endif
// writeINI( KittyIniFile, INIT_SECTION, "debug", "#no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#downloaddir", "" ) ;
#ifdef MOD_HYPERLINK
#ifdef FDJ
writeINI( KittyIniFile, INIT_SECTION, "hyperlink", "yes" ) ;
@@ -1274,6 +1269,31 @@ void CreateDefaultIniFile( void ) {
writeINI( KittyIniFile, INIT_SECTION, "hyperlink", "no" ) ;
#endif
#endif
writeINI( KittyIniFile, INIT_SECTION, "icon", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#iconfile", DEFAULT_EXE_FILE ) ;
writeINI( KittyIniFile, INIT_SECTION, "mouseshortcuts", "yes" ) ;
sprintf( buffer, "%d", NB_ICONES ) ;
writeINI( KittyIniFile, INIT_SECTION, "#numberoficons", buffer ) ;
writeINI( KittyIniFile, INIT_SECTION, "paste", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#PlinkPath", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#PSCPPath", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#PSCPOptions", "-scp -r" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#remotedir", "" ) ;
#ifdef MOD_PORTABLE
writeINI( KittyIniFile, INIT_SECTION, "savemode", "dir" ) ;
#else
sprintf( buffer, "%s\\%s\\%s", getenv("APPDATA"), INIT_SECTION, DEFAULT_SAV_FILE );
writeINI( KittyIniFile, INIT_SECTION, "sav", buffer ) ;
writeINI( KittyIniFile, INIT_SECTION, "savemode", "registry" ) ;
#endif
writeINI( KittyIniFile, INIT_SECTION, "#scriptfilefilter", "All files (*.*)|*.*" ) ;
#ifdef FDJ
writeINI( KittyIniFile, INIT_SECTION, "shortcuts", "no" ) ;
#else
writeINI( KittyIniFile, INIT_SECTION, "shortcuts", "yes" ) ;
#endif
writeINI( KittyIniFile, INIT_SECTION, "size", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#sshversion", "OpenSSH_5.5" ) ;
#ifndef MOD_NOTRANSPARENCY
#ifdef FDJ
writeINI( KittyIniFile, INIT_SECTION, "transparency", "yes" ) ;
@@ -1281,21 +1301,19 @@ void CreateDefaultIniFile( void ) {
writeINI( KittyIniFile, INIT_SECTION, "transparency", "no" ) ;
#endif
#endif
writeINI( KittyIniFile, INIT_SECTION, "#configdir", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#downloaddir", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#uploaddir", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#remotedir", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#PSCPPath", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#PSCPOptions", "-scp -r" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#PlinkPath", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#WinSCPPath", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#CtHelperPath", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#antiidle=", " \\k08\\" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#antiidledelay", "60" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#sshversion", "OpenSSH_5.5" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#WinSCPProtocol", "sftp" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#autostoresshkey", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#uploaddir", "." ) ;
writeINI( KittyIniFile, INIT_SECTION, "#UserPassSSHNoSave", "no" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#WinSCPPath", "" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#WinSCPProtocol", "sftp" ) ;
#ifdef MOD_ZMODEM
writeINI( KittyIniFile, INIT_SECTION, "zmodem", "yes" ) ;
#endif
writeINI( KittyIniFile, INIT_SECTION, "#ctrltab", "yes" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#KiClassName", "PuTTY" ) ;
writeINI( KittyIniFile, INIT_SECTION, "maxblinkingtime", "5" ) ;
@@ -1306,18 +1324,7 @@ void CreateDefaultIniFile( void ) {
#ifdef MOD_RUTTY
writeINI( KittyIniFile, INIT_SECTION, "#scriptmode", "yes" ) ;
#endif
#ifdef MOD_RUTTY
writeINI( KittyIniFile, INIT_SECTION, "#adb", "yes" ) ;
#endif
#ifdef MOD_PORTABLE
writeINI( KittyIniFile, INIT_SECTION, "savemode", "dir" ) ;
#else
sprintf( buffer, "%s\\%s\\%s", getenv("APPDATA"), INIT_SECTION, DEFAULT_SAV_FILE );
writeINI( KittyIniFile, INIT_SECTION, "sav", buffer ) ;
writeINI( KittyIniFile, INIT_SECTION, "savemode", "registry" ) ;
#endif
writeINI( KittyIniFile, INIT_SECTION, "#bcdelay", "0" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#commanddelay", "0.05" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#initdelay", "2.0" ) ;
writeINI( KittyIniFile, INIT_SECTION, "#internaldelay", "10" ) ;
@@ -1325,9 +1332,6 @@ void CreateDefaultIniFile( void ) {
writeINI( KittyIniFile, INIT_SECTION, "slidedelay", "0" ) ;
writeINI( KittyIniFile, INIT_SECTION, "winroll", "yes" ) ;
writeINI( KittyIniFile, INIT_SECTION, "wintitle", "yes" ) ;
#ifdef MOD_ZMODEM
writeINI( KittyIniFile, INIT_SECTION, "zmodem", "yes" ) ;
#endif
writeINI( KittyIniFile, "Print", "height", "100" ) ;
writeINI( KittyIniFile, "Print", "maxline", "60" ) ;
writeINI( KittyIniFile, "Print", "maxchar", "85" ) ;
@@ -1336,9 +1340,6 @@ void CreateDefaultIniFile( void ) {
writeINI( KittyIniFile, "Launcher", "reload", "yes" ) ;
writeINI( KittyIniFile, "Print", "height", "100" ) ;
writeINI( KittyIniFile, "Print", "maxline", "60" ) ;
writeINI( KittyIniFile, "Print", "maxchar", "85" ) ;
writeINI( KittyIniFile, "Shortcuts", "#switchlogmode", "{SHIFT}{F5}" ) ;
writeINI( KittyIniFile, "Shortcuts", "#showportforward", "{SHIFT}{F6}" ) ;
+1 -1
View File
@@ -277,7 +277,7 @@ void routine_SaveRegistryKey( void * st ) ;
void SetNewIcon( HWND hwnd, char * iconefile, int icone, const int mode ) ;
int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) ;
void InitWinMain( void ) ;
char * getcwd (char * buf, size_t size);
char * getcwd (char * buf, int size);
int chdir(const char *path);
char * InputBox( HINSTANCE hInstance, HWND hwnd ) ;
char *itoa(int value, char *string, int radix);
+3 -3
View File
@@ -3,10 +3,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include "putty.h"
#include "winstuff.h"
#include "putty.h"
#include <windows.h>
// Flag permettant d'activer l'acces a du code particulier permettant d'avoir plus d'info dans le kitty.dmp
extern int debug_flag ;
@@ -76,7 +76,7 @@ extern int is_backend_first_connected ;
void SetSSHConnected( int flag ) ;
PVOID SecureZeroMemory( PVOID ptr, SIZE_T cnt) ;
//PVOID WINAPI SecureZeroMemory( PVOID ptr, SIZE_T cnt) ;
// Fonction permettant de changer le statut du stockage automatique des ssh host keys
void SetAutoStoreSSHKey( void ) ;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef KITTYCRYPT_H
#define KITTYCRYPT_H
#include "bcrypt.h"
#include "nbcrypt.h"
extern char PassKey[1024] ;
+1 -1
View File
@@ -3,8 +3,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include "putty.h"
#include <windows.h>
void SetTransparency( HWND hwnd, int value ) ;
void GetOSInfo( char * version ) ;