diff --git a/0.74_My_PuTTY/config.c b/0.74_My_PuTTY/config.c index d5242d7..7655036 100644 --- a/0.74_My_PuTTY/config.c +++ b/0.74_My_PuTTY/config.c @@ -1252,7 +1252,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, MASKPASS( GetCryptSaltFlag(), buffer ) ; conf_set_str( conf, CONF_password, buffer ) ; memset( buffer, 0, strlen(buffer) ) ; - } + } char sessionname[1024]; strcpy(sessionname,ssd->savedsession); if( strcmp(FileExtension,"") ) { strcat(sessionname,FileExtension); } @@ -1264,7 +1264,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, MASKPASS( GetCryptSaltFlag(), buffer ) ; conf_set_str( conf, CONF_password, buffer ) ; memset( buffer, 0, strlen(buffer) ) ; - } + } #else char *errmsg = save_settings(ssd->savedsession, conf); #endif diff --git a/0.74_My_PuTTY/version.h b/0.74_My_PuTTY/version.h index 0e7de03..fc2fb43 100644 --- a/0.74_My_PuTTY/version.h +++ b/0.74_My_PuTTY/version.h @@ -1,5 +1,5 @@ #define RELEASE 0.74 #define TEXTVER "Release 0.74" #define SSHVER "-Release-0.74" -#define BINARY_VERSION 0,74,4,8 +#define BINARY_VERSION 0,74,4,9 #define SOURCE_COMMIT "unavailable" diff --git a/0.74_My_PuTTY/windows/version_minor.txt b/0.74_My_PuTTY/windows/version_minor.txt index 45a4fb7..ec63514 100644 --- a/0.74_My_PuTTY/windows/version_minor.txt +++ b/0.74_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -8 +9 diff --git a/0.74_My_PuTTY/windows/winpgnt.c b/0.74_My_PuTTY/windows/winpgnt.c index 8a05033..bbada0e 100644 --- a/0.74_My_PuTTY/windows/winpgnt.c +++ b/0.74_My_PuTTY/windows/winpgnt.c @@ -31,6 +31,8 @@ extern int DirectoryBrowseFlag ; #include "../../kitty_crypt.h" #include "../../kitty_commun.h" +#include "../../kitty_store.h" +#include "../storage.h" static char pphrase[2048]=""; #endif @@ -713,6 +715,40 @@ static void update_sessions(void) if (!putty_path) return; +#ifdef MOD_PERSO + if( IniFileFlag==2 ) { + SetInitialSessPath(); + for(num_entries = GetMenuItemCount(session_menu); + num_entries > initial_menuitems_count; + num_entries--) + RemoveMenu(session_menu, 0, MF_BYPOSITION); + + index_key = 0; + index_menu = 0; + + settings_e *handle; + sb = strbuf_new(); + if ((handle = enum_settings_start()) != NULL) { + while (enum_settings_next(handle, sb)) { + + if( !strcmp(FileExtension,"") || !strcmp(FileExtension,sb->s+strlen(sb->s)-strlen(FileExtension)) ) { + + memset(&mii, 0, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID; + mii.fType = MFT_STRING; + mii.fState = MFS_ENABLED; + mii.wID = (index_menu * 16) + IDM_SESSIONS_BASE; + mii.dwTypeData = sb->s; + InsertMenuItem(session_menu, index_menu, true, &mii); + index_menu++; + } + strbuf_clear(sb); + } + enum_settings_finish(handle); + } + } else { +#endif if(ERROR_SUCCESS != RegOpenKey(HKEY_CURRENT_USER, PUTTY_REGKEY, &hkey)) return; @@ -743,9 +779,12 @@ static void update_sessions(void) index_key++; } strbuf_free(sb); - RegCloseKey(hkey); +#ifdef MOD_PERSO + } +#endif + if(index_menu == 0) { mii.cbSize = sizeof(mii); mii.fMask = MIIM_TYPE | MIIM_STATE; @@ -1207,6 +1246,7 @@ int WINAPI Agent_WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show #ifdef MOD_PERSO IniFileFlag = 0 ; DirectoryBrowseFlag = 0 ; + loadPath() ; LoadParametersLight() ; #endif diff --git a/0.74_My_PuTTY/windows/winplink.c b/0.74_My_PuTTY/windows/winplink.c index 2f4efb7..656381e 100644 --- a/0.74_My_PuTTY/windows/winplink.c +++ b/0.74_My_PuTTY/windows/winplink.c @@ -345,18 +345,17 @@ int main(int argc, char **argv) { printf( "Switching folder to %s\n", argv[i] ) ; printf( "%s\n",SetSessPath( argv[i] ) ); SetSessPath( argv[i] ) ; - } - else { + } else { arv[arc]=(char*)malloc( strlen(argv[i]) +1 ) ; strcpy(arv[arc],argv[i]) ; arc++ ; - } } + } ret = plink_main( arc, arv ) ; for( i=0 ; i 0 ) { ConfigDirectory = (char*)malloc( strlen(buffer) + 1 ) ; strcpy( ConfigDirectory, buffer ) ; - } } } - else DirectoryBrowseFlag = 0 ; - } - else if( (fp = fopen( "kitty.ini", "r" )) != NULL ) { + } else DirectoryBrowseFlag = 0 ; + } else if( (fp = fopen( "kitty.ini", "r" )) != NULL ) { IniFile = (char*)malloc(11) ; strcpy(IniFile,"kitty.ini"); strcpy(INIT_SECTION,"KiTTY"); fclose(fp ) ; @@ -208,22 +206,20 @@ int LoadParametersLight( void ) { if( !stricmp( buffer, "registry" ) ) IniFileFlag = SAVEMODE_REG ; else if( !stricmp( buffer, "file" ) ) IniFileFlag = SAVEMODE_FILE ; else if( !stricmp( buffer, "dir" ) ) { IniFileFlag = SAVEMODE_DIR ; ret = 1 ; } - } + } if( IniFileFlag == SAVEMODE_DIR ) { if( readINI( "kitty.ini", "KiTTY", "browsedirectory", buffer ) ) { if( !stricmp( buffer, "NO" )&&(IniFileFlag==SAVEMODE_DIR) ) DirectoryBrowseFlag = 0 ; else DirectoryBrowseFlag = 1 ; - } + } if( readINI( "kitty.ini", "KiTTY", "configdir", buffer ) ) { if( strlen( buffer ) > 0 ) { ConfigDirectory = (char*)malloc( strlen(buffer) + 1 ) ; strcpy( ConfigDirectory, buffer ) ; - } } } - else DirectoryBrowseFlag = 0 ; - } - else + } else DirectoryBrowseFlag = 0 ; + } else #endif if( (fp = fopen( "putty.ini", "r" )) != NULL ) { IniFile = (char*)malloc(11) ; strcpy(IniFile,"putty.ini"); @@ -236,22 +232,20 @@ int LoadParametersLight( void ) { if( !stricmp( buffer, "registry" ) ) IniFileFlag = SAVEMODE_REG ; else if( !stricmp( buffer, "file" ) ) IniFileFlag = SAVEMODE_FILE ; else if( !stricmp( buffer, "dir" ) ) { IniFileFlag = SAVEMODE_DIR ; DirectoryBrowseFlag = 1 ; ret = 1 ; } - } + } if( IniFileFlag == SAVEMODE_DIR ) { if( readINI( "putty.ini", "PuTTY", "browsedirectory", buffer ) ) { if( !stricmp( buffer, "NO" )&&(IniFileFlag==SAVEMODE_DIR) ) DirectoryBrowseFlag = 0 ; else DirectoryBrowseFlag = 1 ; - } + } if( readINI( "putty.ini", "PuTTY", "configdir", buffer ) ) { if( strlen( buffer ) > 0 ) { ConfigDirectory = (char*)malloc( strlen(buffer) + 1 ) ; strcpy( ConfigDirectory, buffer ) ; - } } } - else DirectoryBrowseFlag = 0 ; - } - else { + } else DirectoryBrowseFlag = 0 ; + } else { #ifndef FLJ sprintf( buffer, "%s/KiTTY/kitty.ini", getenv("APPDATA") ); if( (fp = fopen( buffer, "r" )) != NULL ) { @@ -261,13 +255,13 @@ int LoadParametersLight( void ) { fclose(fp); } else { #endif - sprintf( buffer, "%s/PuTTY/putty.ini", getenv("APPDATA") ); - if( (fp = fopen( buffer, "r" )) != NULL ) { - IniFile = (char*)malloc(strlen(buffer)+1) ; - strcpy(IniFile,buffer); - strcpy(INIT_SECTION,"PuTTY"); - fclose(fp); - } + sprintf( buffer, "%s/PuTTY/putty.ini", getenv("APPDATA") ); + if( (fp = fopen( buffer, "r" )) != NULL ) { + IniFile = (char*)malloc(strlen(buffer)+1) ; + strcpy(IniFile,buffer); + strcpy(INIT_SECTION,"PuTTY"); + fclose(fp); + } #ifndef FLJ } #endif diff --git a/kitty_store.c b/kitty_store.c index 36a1759..144edfe 100644 --- a/kitty_store.c +++ b/kitty_store.c @@ -410,17 +410,16 @@ char * SetSessPath( const char * dec ) { i=strlen(sesspath)-1 ; while( (sesspath[i]!='\\') && (i>0) ) i--; sesspath[i]='\0'; - } } - else { + } else { strcat( sesspath, "\\" ) ; strcat( sesspath, dec ) ; - } + } CleanFolderName( sesspath ) ; pst = sesspath+strlen(initialsesspath ) ; while( pst[0]=='\\' ) pst++ ; return pst ; - } +} char * SetInitialSessPath( void ) { return strcpy( sesspath, initialsesspath ) ; } diff --git a/kitty_store.h b/kitty_store.h index 833991c..a670b81 100644 --- a/kitty_store.h +++ b/kitty_store.h @@ -64,6 +64,7 @@ void SettingsLoad( HSettingsList list, const char * filename ) ; void SettingsSave( HSettingsList list, const char * filename ) ; int loadPath() ; +char * SetInitialSessPath( void ) ; char * GetSessPath( void ) ; bool SessPathIsInitial( void ) ; bool IsThereDefaultSessionFile( void ) ;