diff --git a/0.74_My_PuTTY/version.h b/0.74_My_PuTTY/version.h index 55d3a36..7274ca3 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,3,2 +#define BINARY_VERSION 0,74,3,3 #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 0cfbf08..00750ed 100644 --- a/0.74_My_PuTTY/windows/version_minor.txt +++ b/0.74_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -2 +3 diff --git a/0.74_My_PuTTY/windows/window.c b/0.74_My_PuTTY/windows/window.c index bab97f1..61a7fe1 100644 --- a/0.74_My_PuTTY/windows/window.c +++ b/0.74_My_PuTTY/windows/window.c @@ -965,7 +965,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) if( existfile(argv[i]) ) { LoadFile = (char*) malloc( strlen(argv[i])+1 ) ; strcpy( LoadFile, argv[i] ) ; - RunPuttyEd( hwnd, LoadFile, true ) ; + RunPuttyEd( hwnd, LoadFile ) ; free( LoadFile ) ; } else { MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; @@ -1112,22 +1112,22 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) CreateFileAssoc() ; return 0 ; } else if( !strcmp(p, "-ed") ) { char buffer[1024]; - sprintf(buffer, "%s|%s|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ; + sprintf(buffer, "%s|%s|0|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ; return Notepad_WinMain(inst, prev, buffer, show) ; } else if( !strcmp(p, "-edb") ) { i++; if( existfile(argv[i]) ) { char buffer[1024]; - sprintf(buffer, "%s|%s|%s", (char*)get_param_str("INI"), (char*)get_param_str("SAV"), argv[i] ) ; + sprintf(buffer, "%s|%s|%s|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV"), argv[i] ) ; return Notepad_WinMain(inst, prev, buffer, show) ; } else { MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; } exit(0); - } else if( !strcmp(p, "-help") ) { + } else if( !strcmp(p, "-help") || !strcmp(p, "-h") ) { SetTextToClipboard(GetHelpMessage()) ; char buffer[1024]; - sprintf(buffer, "%s|%s|2", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ; + sprintf(buffer, "%s|%s|1|1", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ; return Notepad_WinMain(inst, prev, buffer, show) ; #ifdef MOD_LAUNCHER } else if( !strcmp(p, "-launcher") ) { @@ -3334,7 +3334,7 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation // On charge automatiquement au démarrage (-edit) un fichier dans l'editeur connecté if( !PuttyFlag ) if( LoadFile!=NULL ) { - RunPuttyEd( hwnd, LoadFile, true ) ; + RunPuttyEd( hwnd, LoadFile ) ; free( LoadFile ) ; LoadFile = NULL ; } diff --git a/blocnote/notepad.a b/blocnote/notepad.a index fcf485d..2607fbe 100644 Binary files a/blocnote/notepad.a and b/blocnote/notepad.a differ diff --git a/blocnote/notepad.c b/blocnote/notepad.c index e0571c5..346efb1 100644 --- a/blocnote/notepad.c +++ b/blocnote/notepad.c @@ -1,4 +1,5 @@ #include +#include #include "notepad.h" LRESULT CALLBACK Notepad_WndProc(HWND, UINT, WPARAM, LPARAM); @@ -20,6 +21,7 @@ static const char Notepad_szFilenameFilter[] = "Text files, (*.txt, *.log, *.ini static char * IniFile = NULL ; static char * SavFile = NULL ; static char * LoadFile = NULL ; +static bool readonly = false ; #endif BOOL FileExists(LPCTSTR szPath) { @@ -64,7 +66,7 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l #ifdef NOMAIN if( lpCmdLine!=NULL ) { - if( strlen(lpCmdLine) > 0 ) { + if( strlen(lpCmdLine) > 0 ) { char *st = strstr( lpCmdLine, "|" ) ; if( st!=NULL ) { SavFile=(char*)malloc(strlen(st)+1); @@ -77,6 +79,11 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l LoadFile = (char*)malloc(strlen(st)+1); strcpy( LoadFile, st+1 ) ; st[0] = '\0' ; + st = strstr( LoadFile, "|" ); + if( st!=NULL ) { + if( !strcmp(st+1,"1") ) { readonly = true ; } + st[0] = '\0' ; + } } } } @@ -115,25 +122,28 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_SETFONT, Notepad_LoadString(NOTEPAD_STR_SETFONT)); hSMFichier = CreateMenu(); - AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_NEW, Notepad_LoadString(NOTEPAD_STR_NEW)); - AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_OPEN, Notepad_LoadString(NOTEPAD_STR_OPEN)); - AppendMenu(hSMFichier, MF_STRING|MF_GRAYED|MF_DISABLED, NOTEPAD_IDM_SAVE, Notepad_LoadString(NOTEPAD_STR_SAVE)); - AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_SAVEAS, Notepad_LoadString(NOTEPAD_STR_SAVEAS)); + + if( !readonly ) { + AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_NEW, Notepad_LoadString(NOTEPAD_STR_NEW)); + AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_OPEN, Notepad_LoadString(NOTEPAD_STR_OPEN)); + AppendMenu(hSMFichier, MF_STRING|MF_GRAYED|MF_DISABLED, NOTEPAD_IDM_SAVE, Notepad_LoadString(NOTEPAD_STR_SAVE)); + AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_SAVEAS, Notepad_LoadString(NOTEPAD_STR_SAVEAS)); #ifdef NOMAIN - AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); - AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_INI, TEXT("ini file")); - AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_SAV, TEXT("sav file")); - if( ParentWindow!=NULL ) { AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); - AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_RESIZE, TEXT("&Resize")); - } + AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_INI, TEXT("ini file")); + AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_SAV, TEXT("sav file")); + if( ParentWindow!=NULL ) { + AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); + AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_RESIZE, TEXT("&Resize")); + } #endif - AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); + AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL ); + } AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_QUIT, Notepad_LoadString(NOTEPAD_STR_QUIT)); hMenu = CreateMenu(); AppendMenu(hMenu,MF_POPUP,(UINT)hSMFichier,Notepad_LoadString(NOTEPAD_STR_FILE)); - AppendMenu(hMenu,MF_POPUP,(UINT)hSMEdition,Notepad_LoadString(NOTEPAD_STR_EDIT)); + if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hSMEdition,Notepad_LoadString(NOTEPAD_STR_EDIT)); } #ifdef NOMAIN HMENU hSMDelim = CreateMenu() ; @@ -141,17 +151,17 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l AppendMenu(hSMDelim, MF_STRING|MF_CHECKED, NOTEPAD_IDM_SCOLON, Notepad_LoadString(NOTEPAD_STR_SCOLON)); AppendMenu(hSMDelim, MF_STRING|MF_UNCHECKED, NOTEPAD_IDM_SLASH, Notepad_LoadString(NOTEPAD_STR_SLASH)); AppendMenu(hSMDelim, MF_STRING|MF_UNCHECKED, NOTEPAD_IDM_TILDE, Notepad_LoadString(NOTEPAD_STR_TILDE)); - AppendMenu(hMenu,MF_POPUP,(UINT)hSMDelim,Notepad_LoadString(NOTEPAD_STR_DELIM)); + if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hSMDelim,Notepad_LoadString(NOTEPAD_STR_DELIM)); } HMENU hWindows = CreateMenu() ; AppendMenu(hWindows, MF_STRING, NOTEPAD_IDM_RESIZE_ALL, "&Arrange"); AppendMenu(hWindows, MF_STRING, NOTEPAD_IDM_CASCADE_ALL, "&Cascade"); - AppendMenu(hMenu,MF_POPUP,(UINT)hWindows,"&Windows"); + if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hWindows,"&Windows"); } - AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND, Notepad_LoadString(NOTEPAD_STR_SEND)); + if( !readonly ) { AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND, Notepad_LoadString(NOTEPAD_STR_SEND)) ; } //AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND_ALL, Notepad_LoadString(NOTEPAD_STR_SEND_ALL)); #endif - AppendMenu(hMenu,MF_POPUP,(UINT)hSMApropos,Notepad_LoadString(NOTEPAD_STR_HELP)); + if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hSMApropos,Notepad_LoadString(NOTEPAD_STR_HELP)); } //hwnd = CreateWindow(Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL); hwnd = CreateWindowEx(WS_EX_ACCEPTFILES,Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, (int)cxScreen/2, (int)cyScreen/2, NULL, hMenu, hinstance, NULL); @@ -194,11 +204,10 @@ LRESULT CALLBACK Notepad_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa switch (uMsg) { case WM_CREATE: { - if( (LoadFile!=NULL)&&(strlen(LoadFile)>0)&&(!strcmp(LoadFile,"2")) ) { + if( readonly ) { hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | ES_READONLY | ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL, 0, 0, 0, 0, hwnd, NULL, notepad_hinst, NULL); - strcpy(LoadFile,"1"); } else { hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL, diff --git a/blocnote/notepad.rc b/blocnote/notepad.rc index a7120f1..df590cc 100644 --- a/blocnote/notepad.rc +++ b/blocnote/notepad.rc @@ -49,5 +49,5 @@ BEGIN NOTEPAD_FILE_FILTER "Text files, (*.txt, *.ini)|*.txt;*.ini|C/C++ files, (*.c, *.cpp, *.h, *.rc)|*.c;*.cpp;*.h;*.rc|Script files, (*.ksh, *.sh)|*.ksh;*.sh\0SQL files, (*.sql)|*.sql|All files, (*.*)|*.*\0" - NOTEPAD_STR_LICENCE " mNotepad 1.0\nwritten by Cyd, 2016, for the Telnet/SSH client TTY" + NOTEPAD_STR_LICENCE " mNotepad 1.0\nwritten by Cyd, 2020, for the Telnet/SSH client TTY" END diff --git a/blocnote/notepad_64.a b/blocnote/notepad_64.a index 889211a..4a2665e 100644 Binary files a/blocnote/notepad_64.a and b/blocnote/notepad_64.a differ diff --git a/docs/pages/cygtermd.md b/docs/pages/cygtermd.md index 801c685..355707d 100644 --- a/docs/pages/cygtermd.md +++ b/docs/pages/cygtermd.md @@ -1,3 +1,4 @@ +
## About cygtermd, the PuTTYCyg workaround @@ -12,35 +13,44 @@ Download it and put it into your **/bin** Cygwin directory. This feature is also available directly from the command-line. Once the **cygtermd.exe** is put into the **Cygwin** directory just call this command: ``` -kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /home/cyd /bin/bash -login' localhost +kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /home/%USERNAME% /bin/bash -login" localhost ``` -Adapt **C:\cygwin64\bin\cygtermd.exe** and **/home/cyd** with your own settings. You must provide a target hostname (ex: localhost) even if it is not used in this situation. - +Adapt **C:\cygwin64\bin\cygtermd.exe** if it has been installed to a different directory. You must provide a target hostname (ex: localhost) even if it is not used in this situation. + +If you are running this command from PowerShell rather than a Windows shortcut, Start➡Run, or a regular command prompt, you should use single quotes instead of double quotes. +``` +kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /home/%USERNAME% /bin/bash -login' localhost +``` ### Start a **CMD.EXE** into a **KiTTY** terminal It is possible to start directly the Windows command line utility **cmd.exe**: ``` -kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /cygdrive/c/Windows /cygdrive/c/Windows/System32/cmd.exe' localhost +kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /cygdrive/c/Windows /cygdrive/c/Windows/System32/cmd.exe" localhost ``` -Don't forget to choose the rigth codepage in translation tab or use the **-codepage** command line option. +Don't forget to choose the right codepage in translation tab or use the **-codepage** command line option. -It si not necessary to have the full **Cygwin** environment to do this. Just add the **cygtermd.exe** file and the corresponding **cygwin1.dll** library next the **kitty.exe** binary. +It is not necessary to have the full **Cygwin** environment to do this. Just add the **cygtermd.exe** file and the corresponding **cygwin1.dll** library next the **kitty.exe** binary. ### Use **winpty** to start **cmd.exe** or ** PowerShell** Windows utilities -It is also possible to start the Windows command line utility **cmd.exe** from de [winpty tool](https://github.com/rprichard/winpty): +It is also possible to start the Windows command line utility **cmd.exe** from the [winpty tool](https://github.com/rprichard/winpty): Get it and unzip it into your **/usr** Cygwin directory. Then run ``` -kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /cygdrive/c/Windows /usr/bin/winpty.exe /cygdrive/c/Windows/System32/cmd.exe' localhost +kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /usr/bin/winpty.exe C:\Windows\System32\cmd.exe" localhost ``` And now use it to run **PowerShell**: ``` -kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /cygdrive/c /usr/bin/winpty.exe /cygdrive/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe' localhost +kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /usr/bin/winpty.exe C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" localhost +``` + +or **PowerShell 7**: +``` +kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /usr/bin/winpty.exe C:\Program Files\PowerShell\7\pwsh.exe" localhost ``` --- diff --git a/docs/version.txt b/docs/version.txt index 9243766..f6fa7bc 100644 --- a/docs/version.txt +++ b/docs/version.txt @@ -1 +1 @@ -0.74.3.2 \ No newline at end of file +0.74.3.3 \ No newline at end of file diff --git a/kitty.c b/kitty.c index dea83ac..5ed62ab 100644 --- a/kitty.c +++ b/kitty.c @@ -5010,12 +5010,12 @@ int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_ if( key == shortcuts_tab.editor ) { // Lancement d'un putty-ed if( debug_flag ) { debug_logevent( "Start empty internal editor" ) ; } - RunPuttyEd( hwnd, NULL, false ) ; + RunPuttyEd( hwnd, NULL ) ; return 1 ; } if( key == (shortcuts_tab.editorclipboard ) ) { // Lancement d'un putty-ed qui charge le contenu du presse-papier if( debug_flag ) { debug_logevent( "Start internal editor fullfiled with clipboard" ) ; } - term_copyall(term,clips_system,lenof(clips_system)) ; RunPuttyEd( hwnd, "1", false ) ; + term_copyall(term,clips_system,lenof(clips_system)) ; RunPuttyEd( hwnd, "1" ) ; return 1 ; } else if( key == shortcuts_tab.winscp ) { // Lancement de WinSCP SendMessage( hwnd, WM_COMMAND, IDM_WINSCP, 0 ) ; return 1 ; diff --git a/kitty_win.c b/kitty_win.c index 002cd89..be44f0c 100644 --- a/kitty_win.c +++ b/kitty_win.c @@ -396,17 +396,17 @@ void RunCommand( HWND hwnd, const char * cmd ) { } } -void RunPuttyEd( HWND hwnd, char * filename, bool readonly ) { +void RunPuttyEd( HWND hwnd, char * filename ) { char buffer[1024]="", shortname[1024]="" ; if( GetModuleFileName( NULL, (LPTSTR)buffer, 1023 ) ) if( GetShortPathName( buffer, shortname, 1023 ) ) { - strcat( shortname, " -ed" ); - if( filename!=NULL ) if( strlen(filename)>0 ) { - strcat( shortname, "b " ) ; - strcat( shortname, filename ) ; - } - debug_logevent( shortname ) ; - RunCommand( hwnd, shortname ) ; + strcat( shortname, " -ed" ); + if( filename!=NULL ) if( strlen(filename)>0 ) { + strcat( shortname, "b " ) ; + strcat( shortname, filename ) ; } + debug_logevent( shortname ) ; + RunCommand( hwnd, shortname ) ; + } } // Verifie si une mise a jour est disponible sur le site web diff --git a/kitty_win.h b/kitty_win.h index 9d8b29e..6fd4788 100644 --- a/kitty_win.h +++ b/kitty_win.h @@ -29,7 +29,7 @@ int SetTextToClipboard( const char * buf ) ; void RunCommand( HWND hwnd, const char * cmd ) ; // Démarre l'éditeur embarqué -void RunPuttyEd( HWND hwnd, char * filename, bool readonly ) ; +void RunPuttyEd( HWND hwnd, char * filename ) ; // Verifie si une mise a jour est disponible sur le site web void CheckVersionFromWebSite( HWND hwnd ) ;