-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | KTAGS | 2 | ||||
-rw-r--r-- | help/kinsole.rtf | 4 | ||||
-rw-r--r-- | help/kinsole.xml | 5 | ||||
-rw-r--r-- | install/install.cpp | 10 | ||||
-rw-r--r-- | install/install.rc | 10 | ||||
-rw-r--r-- | kinsole.cpp | 4 | ||||
-rw-r--r-- | kinsole.rc | 10 |
8 files changed, 30 insertions, 17 deletions
@@ -1,19 +1,19 @@ -Copyright (c) 1998-2004 Klever Group (http://www.klever.net/) +Copyright (c) 1998-2005 Klever Group (http://www.klever.net/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -1,12 +1,12 @@ help-license-date ./help/kinsole.xml /<license\s/;" kind:d help-news ./help/kinsole.xml /<newsfor\s/ -install-version ./install/install.cpp /^#define\s\+KINAME\s\+"/;" kind:v +install-version ./install/install.cpp /^#define\s\+VERSION\s\+"/;" kind:v install-vsinfo-date install/install.rc /^\s\+VALUE\s\+"LegalCopyright",/;" kind:d install-vsinfo-numeric-version install/install.rc /^\s\+FILEVERSION\s\+/;" kind:v install-vsinfo-string-version install/install.rc /^\s\+VALUE\s\+"FileVersion",/;" kind:v kinsole-version kinsole.cpp /^#define\s\+DAMN_KIN_VERSION\s\+"/;" kind:v license-date COPYING :1;" kind:d usage-date kinsole.cpp /, Copyright (c) /;" kind:d vsinfo-date kinsole.rc /VALUE\s\+"LegalCopyright",/;" kind:d vsinfo-numeric-version kinsole.rc /^\s\+FILEVERSION\s\+/;" kind:v vsinfo-string-version kinsole.rc /^\s\+VALUE\s\+"FileVersion",/;" kind:v diff --git a/help/kinsole.rtf b/help/kinsole.rtf index f0b6c8a..f3eeb2d 100644 --- a/help/kinsole.rtf +++ b/help/kinsole.rtf @@ -1,97 +1,99 @@ {\rtf1\ansi
@{\footnote
THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.
DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD
}
{\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl;
\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
\pard\plain\keepn
#{\footnote About}
${\footnote About KINSole}
{ \f1\fs18\b\sb120 About KINSole}
\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b KINSole} is our {\i Win32} implementation of client side of the {\i telnet} protocol described in details in the {\uldb {\b RFC854}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc854.txt")} and related RFCs (namely {\uldb {\b RFC855}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc855.txt")}, {\uldb {\b RFC857}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc857.txt")}, {\uldb {\b RFC1091}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc1091.txt")}, {\uldb {\b RFC1073}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc1073.txt")}, {\uldb {\b RFC1572}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc1572.txt")} and others). It uses {\i Win32} console and, therefore, can be run both windowed and in fullscreen mode.
\par\sa120\sb120\qj\pard \f1\fs18\sb120
\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}}
{
-\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) 1998-2004 {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}
+\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) 1998-2005 {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}
\par\qj\sb120\sa120Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}
\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}
\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}
\page
\pard\plain\keepn
#{\footnote News}
${\footnote What's new}
{ \f1\fs18\b\sb120 What's New}
+\par\pard\plain\f1\fs24\qc\cf2\b 1.1.1 - August 6th, 2005
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Fixed uninstall procedure so that it works on XP
\par\pard\plain\f1\fs24\qc\cf2\b 1.1 - July 11th, 2004
\par\pard\plain\fi0\li0\f1\fs18 \bullet No changes in code. License change.
\par\pard\plain\f1\fs24\qc\cf2\b 1.00 Beta 2 - March 7th, 1998
\par\pard\plain\fi0\li0\f1\fs18 \bullet Better copying from {\b KINSole} window.
\par\pard\plain\fi0\li0\f1\fs18 \bullet Better handling of cursor position when resizing window.
\par\pard\plain\fi0\li0\f1\fs18 \bullet Sending {\b CR/LF} pair when pressing {\b ENTER}. This is of help when telnetting to non-telnet ports.
\par\pard\plain\fi0\li0\f1\fs18 \bullet Corrected bug, preventing {\b KINSole} from pasting text to remote twice.
\par\pard\plain\fi0\li0\f1\fs18 \bullet Improved handling of echoing. Previously {\b KINSole} didn't turn echo off on some systems, namely {\b Solaris}.
\par\pard\plain\fi0\li0\f1\fs18 \bullet Typo causing {\b KINSole} not to show diamond characters in {\b VT10x} mode corrected.
\par\pard\plain\fi0\li0\f1\fs18 \bullet {\b GPF} when invoking {\b KINSole} with {\b -t} option fixed.
\par\pard\plain\fi0\li0\f1\fs18 \bullet Hotkey ({\b Alt-INS}) for copy operation added. Not supposed to work under {\b\cf6 Windows NT}.
\par\pard\plain\fi0\li0\f1\fs18 \bullet {\b Paste} is made aware of local echoing.
\par\pard\plain\fi0\li0\f1\fs18 \bullet Default terminal type when telnetting to non-telnet port is now {\b TTY}.
\par\pard\plain\fi0\li0\f1\fs18 \bullet {\b Timing Mark} telnet option ({\uldb {\b RFC860}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc860.txt")}) implemented ({\b Alt-T}).
\par\pard\plain\fi0\li0\f1\fs18 \bullet Improved handling of window icon when starting from other {\i Win32} command line application.
\page
\pard\plain\keepn
#{\footnote Using}
${\footnote Using KINSole}
{ \f1\fs18\b\sb120 Using {\b KINSole}}
\par\sa120\sb120\qj\pard \f1\fs18\sb120 You may run {\b KINSole} from your MS-DOS prompt by typing '{\i kinsole host port}'.
\par\sa120\sb120\qj\pard \f1\fs18\sb120 If you need to know more about custom options, please proceed to the {\uldb Command Line Options}{\v CmdOptions} section.
\page
\pard\plain\keepn
#{\footnote CmdOptions}
${\footnote Command Line Options}
{ \f1\fs18\b\sb120 Command Line Options}
\par\sa120\sb120\qj\pard \f1\fs18\sb120 Usage:
\par\sa120\sb120\qj\pard \f1\fs18\sb120 KINSole [{\i options} ]{\i host}[ {\i port}]
\par\sa120\sb120\qj\pard \f1\fs18\sb120 Available options are:\pard
\par \fi0\li0 \bullet {\b -r {\i ##}} or {\b -{\i ##}} - Try to set the number of rows in console screen buffer.
\par \fi0\li0 \bullet {\b -c {\i ##}} - Try to set the number of columns in console screenbuffer.
\par \fi0\li0 \bullet
\par\sa120\sb120\qj\f1\fs16 Note: Changing of console's screenbuffer size either from command line or on remote host's request (ESC[?3h vt100/vt102 control sequence) may not work when in fullscreen mode.
\par \fi0\li0 \bullet {\b -l {\i username}} - Pass username to remote server in environment if remote server allows.
\par \fi0\li0 \bullet {\b -e {\i var}={\i val}} - Pass environment variable to remote server.
\par \fi0\li0 \bullet {\b -v {\i var}={\i val}} - Pass user environment variable to remote server.
\par \fi0\li0 \bullet {\b -t {\i termtype}} - Change preferred terminal type to pass to remote server. This option does not really force specific terminal emulation. Final decision on terminal type is left up to server. Both sides are supposed to negotiate terminal type when connecting so that both sides may feel satisfied. Default preference is {\b vt102}.\pard
\page
\pard\plain\keepn
#{\footnote HotKeys}
${\footnote Hot Keys}
{ \f1\fs18\b\sb120 Hot Keys}
\par\sa120\sb120\qj\pard \f1\fs18\sb120 While running {\b KINSole} you may use these key combinations:\pard
\par \fi0\li0 \bullet {\b Alt-X/Alt-Q} - Terminate telnet session and leave {\b KINSole}.
\par \fi0\li0 \bullet {\b Alt-Y} - Send {\b AYT (Are You There)} telnet command. Remote host (if it supports telnet protocol as it's supposed to) should provide you with visible/printable/audible feedback stating that it's alive. You may want to use it when running program which takes unusually long time to finish and you suspect that your connection is dead.
\par \fi0\li0 \bullet {\b Shift-INS} Paste text from Windows Clipboard.
\par \fi0\li0 \bullet {\b Ctrl-Break} Send {\b IP (Interrupt Process)} telnet command. Usually effectively equivalent to Ctrl-C, but it's up to server to decide what to do in each case.
\par \fi0\li0 \bullet {\b Alt-INS} - Invoke {\b copying} from {\b KINSole} screen buffer.
\par \fi0\li0 \bullet {\b Alt-T} - Send {\b TIMING-MARK} request. As soon as response comes {\b KINSole} will flash window thrice or beep if window handle is not available for some reason.\pard
\page
\pard\plain\keepn
#{\footnote Notes}
${\footnote Notes}
{ \f1\fs18\b\sb120 Notes}
\par\sa120\sb120\qj\pard \f1\fs18\sb120 A few things you may want to know about this release:\pard
\par \fi0\li0 \bullet Only two terminal emulation modules are included in this release - one for dumb terminal and one for vt100/102. If you try to select ANSI terminal type vt100 emulation will be selected, which is actually close enough to ANSI so you shouldn't suffer too much. Why would one want to use ANSI terminal emulation, anyway?
\par \fi0\li0 \bullet Telnet {\b LINEMODE} option ({\uldb {\b RFC1184}}{\v %!ExecFile("http://www.rfc-editor.org/rfc/rfc1184.txt")}) is still to come.
\par \fi0\li0 \bullet Pasting of text using console toolbar button may cause {\b KINSole} to lock up. Use {\b Shift-INS} instead.\pard
\page
}
\ No newline at end of file diff --git a/help/kinsole.xml b/help/kinsole.xml index c08aa01..c7f7dd8 100644 --- a/help/kinsole.xml +++ b/help/kinsole.xml @@ -1,72 +1,75 @@ <?xml version="1.0"?>
<winhelp>
<topic id="About" title="About KINSole">
<heading scroll="no">About KINSole</heading>
<p><kin>KINSole</kin> is our <term>Win32</term> implementation of client side of the <term>telnet</term> protocol described in details in the <rfc num="854"/> and related RFCs (namely <rfc num="855"/>, <rfc num="857"/>, <rfc num="1091"/>, <rfc num="1073"/>, <rfc num="1572"/> and others). It uses <term>Win32</term> console and, therefore, can be run both windowed and in fullscreen mode.</p>
<p/>
<p><b><i>Enjoy!</i></b></p>
- <license years="1998-2004"/>
+ <license years="1998-2005"/>
<credits/>
</topic>
<topic id="News" title="What's new">
<heading scroll="no">What's New</heading>
+ <newsfor version="1.1.1" date="August 6th, 2005">
+ <ni>Fixed uninstall procedure so that it works on XP</ni>
+ </newsfor>
<newsfor version="1.1" date="July 11th, 2004">
<ni>No changes in code. License change.</ni>
</newsfor>
<newsfor version="1.00 Beta 2" date="March 7th, 1998">
<ni>Better copying from <kin>KINSole</kin> window.</ni>
<ni>Better handling of cursor position when resizing window.</ni>
<ni>Sending <b>CR/LF</b> pair when pressing <b>ENTER</b>. This is of help when telnetting to non-telnet ports.</ni>
<ni>Corrected bug, preventing <kin>KINSole</kin> from pasting text to remote twice.</ni>
<ni>Improved handling of echoing. Previously <kin>KINSole</kin> didn't turn echo off on some systems, namely <b>Solaris</b>.</ni>
<ni>Typo causing <kin>KINSole</kin> not to show diamond characters in <b>VT10x</b> mode corrected.</ni>
<ni><b>GPF</b> when invoking <kin>KINSole</kin> with <b>-t</b> option fixed.</ni>
<ni>Hotkey (<b>Alt-INS</b>) for copy operation added. Not supposed to work under <product>Windows NT</product>.</ni>
<ni><b>Paste</b> is made aware of local echoing.</ni>
<ni>Default terminal type when telnetting to non-telnet port is now <b>TTY</b>.</ni>
<ni><b>Timing Mark</b> telnet option (<rfc num="860"/>) implemented (<b>Alt-T</b>).</ni>
<ni>Improved handling of window icon when starting from other <term>Win32</term> command line application.</ni>
</newsfor>
</topic>
<topic id="Using" title="Using KINSole">
<heading scroll="no">Using <kin>KINSole</kin></heading>
<p>You may run <kin>KINSole</kin> from your MS-DOS prompt by typing '<i>kinsole host port</i>'.</p>
<p>If you need to know more about custom options, please proceed to the <a href="#CmdOptions">Command Line Options</a> section.</p>
</topic>
<topic id="CmdOptions" title="Command Line Options">
<heading scroll="no">Command Line Options</heading>
<p>Usage:</p>
<p>KINSole [<i>options</i> ]<i>host</i>[ <i>port</i>]</p>
<p>Available options are:</p>
<ul>
<li><b>-r <i>##</i></b> or <b>-<i>##</i></b> - Try to set the number of rows in console screen buffer.</li>
<li><b>-c <i>##</i></b> - Try to set the number of columns in console screenbuffer.</li>
<li><note>Note: Changing of console's screenbuffer size either from command line or on remote host's request (ESC[?3h vt100/vt102 control sequence) may not work when in fullscreen mode.</note></li>
<li><b>-l <i>username</i></b> - Pass username to remote server in environment if remote server allows.</li>
<li><b>-e <i>var</i>=<i>val</i></b> - Pass environment variable to remote server.</li>
<li><b>-v <i>var</i>=<i>val</i></b> - Pass user environment variable to remote server.</li>
<li><b>-t <i>termtype</i></b> - Change preferred terminal type to pass to remote server. This option does not really force specific terminal emulation. Final decision on terminal type is left up to server. Both sides are supposed to negotiate terminal type when connecting so that both sides may feel satisfied. Default preference is <b>vt102</b>.</li>
</ul>
</topic>
<topic id="HotKeys" title="Hot Keys">
<heading scroll="no">Hot Keys</heading>
<p>While running <kin>KINSole</kin> you may use these key combinations:</p>
<ul>
<li><b>Alt-X/Alt-Q</b> - Terminate telnet session and leave <kin>KINSole</kin>.</li>
<li><b>Alt-Y</b> - Send <b>AYT (Are You There)</b> telnet command. Remote host (if it supports telnet protocol as it's supposed to) should provide you with visible/printable/audible feedback stating that it's alive. You may want to use it when running program which takes unusually long time to finish and you suspect that your connection is dead.</li>
<li><b>Shift-INS</b> Paste text from Windows Clipboard.</li>
<li><b>Ctrl-Break</b> Send <b>IP (Interrupt Process)</b> telnet command. Usually effectively equivalent to Ctrl-C, but it's up to server to decide what to do in each case.</li>
<li><b>Alt-INS</b> - Invoke <b>copying</b> from <kin>KINSole</kin> screen buffer.</li>
<li><b>Alt-T</b> - Send <b>TIMING-MARK</b> request. As soon as response comes <kin>KINSole</kin> will flash window thrice or beep if window handle is not available for some reason.</li>
</ul>
</topic>
<topic id="Notes" title="Notes">
<heading scroll="no">Notes</heading>
<p>A few things you may want to know about this release:</p>
<ul>
<li>Only two terminal emulation modules are included in this release - one for dumb terminal and one for vt100/102. If you try to select ANSI terminal type vt100 emulation will be selected, which is actually close enough to ANSI so you shouldn't suffer too much. Why would one want to use ANSI terminal emulation, anyway?</li>
<li>Telnet <b>LINEMODE</b> option (<rfc num="1184"/>) is still to come.</li>
<li>Pasting of text using console toolbar button may cause <kin>KINSole</kin> to lock up. Use <b>Shift-INS</b> instead.</li>
</ul>
</topic>
</winhelp>
diff --git a/install/install.cpp b/install/install.cpp index aa474d5..bbc2b3b 100644 --- a/install/install.cpp +++ b/install/install.cpp @@ -1,65 +1,73 @@ #include "resource.h" #include "../shared-code/install.h"
-#define KINAME "KINSole 1.1"
+#define VERSION "1.1.1"
+#define KINAME "KINSole " VERSION
#define SKINAME "KINSole" BOOL Install(void) {
STRING tPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group",SKINAME "Path");
STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath");
LPCSTR qPath = ((LPCSTR)tPath)?(LPCSTR)tPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings");
STRING path = REQUESTPATH(" " KINAME,"Note: KINSole program file will be installed into your windows directory so that you can rely on it's presence in your search path\nEnter destination path:",qPath);
if(!path)
return NULL;
STRING winDir(_MAX_PATH);
GetWindowsDirectory(winDir,_MAX_PATH);
INSTALLFILE("KINSole.ex_",winDir,"KINSole.exe");
MAKE_PATH(path);
STRING shortPath = GET_SHORT_PATH(path);
if(!shortPath){
MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK);
return FALSE;
}
if(!(
INSTALLFILE("KINSole.hl_",path,"KINSole.hlp") &&
INSTALLFILE("KINSole.cn_",path,"KINSole.cnt")
)){
MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK);
return FALSE;
}
ADDMENU("Klever Group","KINSole Help",path,SKINAME ".hlp");
strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group", SKINAME "Path",path);
strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath",path);
FILE* inf=CREATE_INF_FILE(path, SKINAME ".INF");
if(!inf){
MessageBox(NULL,"Failed to install " KINAME,NULL,MB_ICONERROR|MB_OK);
return FALSE;
}
INF_FILE_HEADER(inf);
INF_FILE_SECTION(inf,"Uninstall");
fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n");
INF_FILE_SECTION(inf,"kFiles");
INF_REMOVE_ROOT(inf,SKINAME "Files",shortPath);
INF_REMOVE_HELP_FILE(inf,SKINAME "Files",SKINAME);
INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".inf");
INF_REMOVE_ROOT(inf,SKINAME "WFiles",winDir);
INF_REMOVE_FILE(inf,SKINAME "WFiles",SKINAME ".exe");
INF_FILE_SECTION(inf,"kReg");
INF_UNINSTALL_REG(inf,SKINAME);
INF_FILE_SECTION(inf,"kMenu");
INF_MENU_GROUP(inf,1,"Klever Group");
INF_MENU_ITEM(inf,1,"KINSole Help");
fclose(inf);
REG_UNINSTALL_COMMAND(SKINAME,"Klever " KINAME,shortPath,SKINAME ".INF","Uninstall");
+ REG_UNINSTALL_ICON(SKINAME,path,SKINAME ".exe",0);
+ REG_UNINSTALL_COMMENT(SKINAME,"Klever " KINAME);
+ REG_UNINSTALL_VERSION(SKINAME,VERSION);
+ REG_UNINSTALL_LOCATION(SKINAME,path);
+ REG_UNINSTALL_PUBLISHER(SKINAME,"Klever Group");
+ REG_UNINSTALL_URLS(SKINAME,"http://www.klever.net/","http://kin.klever.net/kinsole/");
+
MessageBox(NULL,KINAME " installed successfully, you may now run it from command line, read documentation in 'Programs/Klever Group' menu or simply remove it using Control Panel Add/Remove Programs applet."," Rejoice!",MB_ICONINFORMATION|MB_OK);
return TRUE; } diff --git a/install/install.rc b/install/install.rc index 04ae8f4..4b81d3e 100644 --- a/install/install.rc +++ b/install/install.rc @@ -1,182 +1,182 @@ //Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
#if defined(APSTUDIO_INVOKED) || defined(FALSE)
#if defined(APSTUDIO_INVOKED)
IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74
#else
IDD_INSTALLING DIALOGEX 0, 0, 200, 74
#endif
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER |
BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME
CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT |
ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32
LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45,
186,7,WS_EX_DLGMODALFRAME
END
#endif
IDD_PATH DIALOGEX 0, 0, 255, 73
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
WS_VISIBLE | WS_CAPTION
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
LTEXT "",IDC_PROMPT,7,7,241,30
EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL
PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12
DEFPUSHBUTTON "OK",IDOK,69,52,50,14
PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"IDD_INSTALLING$(FALSE)", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 193
TOPMARGIN, 7
BOTTOMMARGIN, 67
HORZGUIDE, 39
END
IDD_PATH, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 248
VERTGUIDE, 202
VERTGUIDE, 208
TOPMARGIN, 7
BOTTOMMARGIN, 66
HORZGUIDE, 37
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""custom.rch""\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico"
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,1,0,0
- PRODUCTVERSION 1,1,0,0
+ FILEVERSION 1,1,1,0
+ PRODUCTVERSION 1,1,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
VALUE "FileDescription", "INSTALL: KINSole, telnet client\0"
- VALUE "FileVersion", "1, 1, 0, 0\0"
+ VALUE "FileVersion", "1, 1, 1, 0\0"
VALUE "InternalName", "INSTALL\0"
- VALUE "LegalCopyright", "Copyright © 1998-2004 Klever Group (http://www.klever.net/)\0"
+ VALUE "LegalCopyright", "Copyright © 1998-2005 Klever Group (http://www.klever.net/)\0"
VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
VALUE "OriginalFilename", "INSTALL.EXE\0"
VALUE "ProductName", "KINSole\0"
- VALUE "ProductVersion", "1, 1, 0, 0\0"
+ VALUE "ProductVersion", "1, 1, 1, 0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "custom.rch"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
diff --git a/kinsole.cpp b/kinsole.cpp index 01286f3..7fa3f8b 100644 --- a/kinsole.cpp +++ b/kinsole.cpp @@ -1,736 +1,736 @@ #include <stdio.h>
#ifdef _DEBUG
#include <afxwin.h>
#else
#define ASSERT(f) ((void)0)
#define VERIFY(f) ((void)(f))
#define TRACE0(sz)
#define TRACE1(sz, p1)
#define TRACE2(sz, p1, p2)
#define TRACE3(sz, p1, p2, p3)
#endif
#include <winsock.h>
#include "resource.h"
#include "windowsx.h"
#define DAMN_KIN_NAME "KINSole"
-#define DAMN_KIN_VERSION "1.1"
+#define DAMN_KIN_VERSION "1.1.1"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
enum {
WM_USERSOCKET = WM_USER+16,
WM_USERKEY,
WM_USERNOP
};
enum {
tnIAC = 255,
tnSE = 240,
tnNOP = 241,
tnDM = 242,
tnBreak = 243,
tnIP = 244,
tnAO = 245,
tnAYT = 246,
tnEC = 247,
tnEL = 248,
tnGA = 249,
tnSB = 250,
tnWILL = 251,
tnWONT = 252,
tnDO = 253,
tnDONT = 254
};
WSADATA wsaData;
ATOM wsaWC = NULL;
HWND wsaW = NULL;
CHAR remoteHost[256];
CHAR remoteProt[256];
sockaddr_in remoteSIN;
SOCKET telnetSocket;
HANDLE hConsoleInput;
HANDLE hConsoleOutput;
HWND hConsoleWindow;
HANDLE hConsoleThread;
DWORD consoleThreadID;
HANDLE hDispatchThread;
DWORD dispatchThreadID;
BOOL bTelnet,bTermPulled;
enum _cState {
cstateNone = 0, cstateIAC, cstateDO, cstateSB, cstateSBData,
cstateSBDataIAC, cstateWILL, cstateDONT,cstateWONT,
} connState = cstateNone;
BYTE negOption = 0;
BOOL SelectSocket() {
return WSAAsyncSelect(telnetSocket,wsaW,WM_USERSOCKET,FD_READ|FD_OOB|FD_CLOSE)!=SOCKET_ERROR;
}
BOOL ShowWill(BYTE o)
{
TRACE1("We're WILLing to %d\n",(WORD)o);
static
BYTE d[3] = {tnIAC,tnWILL,0};
d[2] = o;
BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d);
SelectSocket();
return rv;
}
BOOL ShowUnwill(BYTE o)
{
TRACE1("We're NOT WILLing to %d\n",(WORD)o);
static
BYTE d[3] = {tnIAC,tnWONT,0};
d[2] = o;
BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d);
SelectSocket();
return rv;
}
BOOL BegDo(BYTE o)
{
TRACE1("We beg to DO %d\n",(WORD)o);
static
BYTE d[3] = {tnIAC,tnDO,0};
d[2] = o;
BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d);
SelectSocket();
return rv;
}
BOOL BegDont(BYTE o)
{
TRACE1("We beg DONT'T %d\n",(WORD)o);
static
BYTE d[3] = {tnIAC,tnDONT,0};
d[2] = o;
BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d);
SelectSocket();
return rv;
}
BOOL SubNegotiate(BYTE o,LPBYTE data,UINT size)
{
LPBYTE d = new BYTE[3+size*2+2];
int ds = 0;
d[ds++]=tnIAC; d[ds++]=tnSB; d[ds++]=o;
for(UINT tmp=0;tmp<size;tmp++)
if(data[tmp]!=tnIAC)
d[ds++]=data[tmp];
else{
d[ds++]=tnIAC; d[ds++]=tnIAC;
}
d[ds++]=tnIAC;d[ds++]=tnSE;
BOOL rv = send(telnetSocket,(char*)d,ds,0)==ds;
delete d;
SelectSocket();
return rv;
}
BOOL SendLiteral(CHAR c)
{
BYTE d[2] = {tnIAC,0};
BOOL rv = FALSE;
if(c==tnIAC){
d[1]=c;
rv = send(telnetSocket,(char*)d,2,0)==2;
}else
rv = send(telnetSocket,&c,1,0)==1;
return rv;
}
BOOL SendLiteral(LPCTSTR c,UINT size)
{
for(UINT tmp=0;tmp<size;tmp++)
SendLiteral(c[tmp]);
return TRUE;
}
BOOL SendLiteral(LPCTSTR c)
{
return SendLiteral(c,strlen(c));
}
BOOL SendCommand(BYTE c)
{
TRACE1("Issuing %d command\n",(WORD)c);
static
BYTE d[2] = {tnIAC,0};
d[1] = c;
BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d);
SelectSocket();
return rv;
}
BOOL CALLBACK consoleCtrlHandler(DWORD dwCtrlType)
{
switch(dwCtrlType){
case CTRL_BREAK_EVENT:
SendCommand(tnIP);
return TRUE;
case CTRL_CLOSE_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
PostMessage(wsaW,WM_QUIT,0,0);
return TRUE;
}
return FALSE;
}
#include "options.cpp"
BOOL ProcessConsoleInput()
{
INPUT_RECORD ir[512];
DWORD got;
while(GetNumberOfConsoleInputEvents(hConsoleInput,&got) && got){
VERIFY(ReadConsoleInput(hConsoleInput,ir,(sizeof(ir)/sizeof(*ir)),&got));
for(DWORD tmp=0;tmp<got;tmp++){
if(ir[tmp].EventType==KEY_EVENT && ir[tmp].Event.KeyEvent.bKeyDown){
if((
ir[tmp].Event.KeyEvent.wVirtualKeyCode=='X' ||
ir[tmp].Event.KeyEvent.wVirtualKeyCode=='Q'
) && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)
){
PostMessage(wsaW,WM_QUIT,0,0);
return FALSE;
}else if(
ir[tmp].Event.KeyEvent.wVirtualKeyCode=='O'
&& ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)
){
SendCommand(tnAO);
}else if(
ir[tmp].Event.KeyEvent.wVirtualKeyCode=='Y'
&& ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)
){
SendCommand(tnAYT);
}else if(
ir[tmp].Event.KeyEvent.wVirtualKeyCode=='T'
&& ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)
){
BegDo(toTimingMark);
}else if(
ir[tmp].Event.KeyEvent.wVirtualKeyCode==VK_INSERT
&& ir[tmp].Event.KeyEvent.dwControlKeyState&SHIFT_PRESSED
){
if(IsClipboardFormatAvailable(CF_OEMTEXT)){
ASSERT(wsaW);
if(OpenClipboard(wsaW)){
HANDLE h = GetClipboardData(CF_OEMTEXT);
LPVOID gl = GlobalLock(h);
TerminalIn((LPCTSTR)gl);
GlobalUnlock(h);
// GlobalFree(h);
CloseClipboard();
}
}
}else if(
ir[tmp].Event.KeyEvent.wVirtualKeyCode==VK_INSERT
&& ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED)
){
if(hConsoleWindow)
SendNotifyMessage(hConsoleWindow,WM_COMMAND,MAKELONG(0xE003,0),NULL);
}else
TerminalIn(ir[tmp].Event.KeyEvent);
}
}
}
return TRUE;
}
ULONG CALLBACK ConsoleThreadProc(LPVOID)
{
for(;;){
DWORD eves;
if(!(GetNumberOfConsoleInputEvents(hConsoleInput,&eves) && eves))
WaitForSingleObject(hConsoleInput,INFINITE);
ASSERT(wsaW);
SendMessage(wsaW,WM_USERKEY,0,0);
}
return 0;
}
BOOL SINTelnet(sockaddr_in& sin)
{
protoent* pe = getprotobyname("tcp");
short proto = pe?pe->p_proto:6;
telnetSocket = socket(sin.sin_family,SOCK_STREAM,proto);
if(telnetSocket==INVALID_SOCKET){
printf("Failed to create socket\n");
return FALSE;
}
static
BOOL bOOBInline = FALSE;
if(setsockopt(telnetSocket,SOL_SOCKET,SO_OOBINLINE,(const char*)&bOOBInline,sizeof(bOOBInline))){
TRACE0("Failed to setsockopt for OOB data\n");
}
printf("Trying %s..",inet_ntoa(sin.sin_addr));
if(connect(telnetSocket,(sockaddr*)&sin,sizeof(sin))){
switch(WSAGetLastError()){
case WSAECONNREFUSED: printf("\nConnection refused\n"); break;
case WSAEHOSTUNREACH: printf("\nNo route to host\n"); break;
case WSAENETDOWN: printf("\nNetwork is down\n"); break;
case WSAENETUNREACH: printf("\nNetwork is unreachable\n"); break;
case WSAETIMEDOUT: printf("\nConnection timed out\n"); break;
default: printf("\nFailed to connect\n"); break;
}
return FALSE;
}
printf("\nConnected. Alt-X/Alt-Q - Close telnet connection\n");
//*** hConsoleInput = ::GetStdHandle(STD_INPUT_HANDLE);
//*** hConsoleOutput = ::GetStdHandle(STD_OUTPUT_HANDLE);
hConsoleInput = CreateFile("CONIN$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,OPEN_EXISTING,0,NULL);
hConsoleOutput = CreateFile("CONOUT$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,OPEN_EXISTING,0,NULL);
ASSERT(hConsoleInput!=INVALID_HANDLE_VALUE &&
hConsoleOutput!=INVALID_HANDLE_VALUE);
if(!(bTelnet || bTermPulled))
TerminalPullType("TTY");
InitOptionsTable();
TRACE0("Connected\n");
VERIFY(SetConsoleCtrlHandler(&consoleCtrlHandler,TRUE));
hConsoleThread = CreateThread(NULL,0,ConsoleThreadProc,NULL,0,&consoleThreadID);
ASSERT(hConsoleThread);
if(bTelnet){
AskDo(toSuppressGA);
AskWill(toTerminalType);
AskWill(toNAWS);
AskUnwill(toEcho);
AskDo(toEcho);
if(Envars && nEnvars)
AskWill(toNewEnviron); // *** Or better (what's better?)
// AskWill(toLineMode);
// *** STATUS
}
MSG msg;
int rvgm;
PostMessage(wsaW,WM_USERNOP,0,0);
VERIFY(SelectSocket());
while(rvgm=GetMessage(&msg,NULL,NULL,NULL)){
if(rvgm<0)
break; // Some wheeping needed
TranslateMessage(&msg);
DispatchMessage(&msg);
// LRESULT CALLBACK WSWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
// WSWndProc(msg.hwnd,msg.message,msg.wParam,msg.lParam);
VERIFY(SelectSocket());
}
VERIFY(TerminateThread(hConsoleThread,0xFFFFFFFF));
VERIFY(SetConsoleCtrlHandler(&consoleCtrlHandler,FALSE));
closesocket(telnetSocket);
return TRUE;
}
BOOL Telnet(LPCTSTR hostName,UINT port)
{
memset(&remoteSIN,0,sizeof(remoteSIN));
remoteSIN.sin_family = AF_INET;
remoteSIN.sin_port = htons(port);
remoteSIN.sin_addr.s_addr = inet_addr(hostName);
if(remoteSIN.sin_addr.s_addr==INADDR_NONE){
hostent* he = gethostbyname(hostName);
if(!he){
printf("Failed to resolve host name\n");
return FALSE;
}
ASSERT(he->h_addrtype==AF_INET);
ASSERT(he->h_length==sizeof(remoteSIN.sin_addr));
memmove(&remoteSIN.sin_addr,*he->h_addr_list,sizeof(remoteSIN.sin_addr));
}
strcpy(remoteHost,hostName);
return SINTelnet(remoteSIN);
}
void ProcessIACByte(BYTE c)
{
connState = cstateNone;
switch(c){
case tnIAC:
TerminalOut(c);
break;
case tnSE:
TRACE0("SE\n");break;
case tnNOP:
TRACE0("NOP\n");break;
case tnDM:
TRACE0("DM\n");break;
case tnBreak:
TRACE0("Break\n");break;
case tnIP:
TRACE0("IP\n");break;
case tnAO:
TRACE0("AO\n");break;
case tnAYT:
TRACE0("AYT\n");break;
case tnEC:
TRACE0("EC\n");break;
case tnEL:
TRACE0("EL\n");break;
case tnGA:
TRACE0("GA\n");break;
case tnSB:
connState = cstateSB;
break;
case tnWILL:
connState = cstateWILL;
break;
case tnWONT:
connState = cstateWONT;
break;
case tnDO:
connState = cstateDO;
break;
case tnDONT:
connState = cstateDONT;
break;
default:
TRACE1("Unknown OpCode = %d\n",(WORD)c);
break;
}
}
void ProcessNetByte(BYTE c)
{
// TRACE1("<%d>",connState);
switch(connState){
case cstateWONT:
ProcessWONT(c);
break;
case cstateDO:
ProcessDO(c);
break;
case cstateWILL:
ProcessWILL(c);
break;
case cstateDONT:
ProcessDONT(c);
break;
case cstateSB:
negOption = c;
connState = cstateSBData;
break;
case cstateSBData:
case cstateSBDataIAC:
ProcessSBData(c);
break;
case cstateIAC:
ProcessIACByte(c);
break;
case cstateNone:
default:
ASSERT(connState==cstateNone);
if(c==tnIAC)
connState=cstateIAC;
else
TerminalOut(c);
break;
}
}
LRESULT WSMessage(WPARAM wP,LPARAM lP)
{
if(WSAGETSELECTERROR(lP)){
TRACE0("SelectError\n");
PostMessage(wsaW,WM_QUIT,0,0);
return 0;
}
if(WSAGETSELECTEVENT(lP)&FD_READ){
//?? TRACE0("FD_READ\n");
BYTE input[80*12];
int got;
TerminalPreO();
//?? TRACE0("rv\n");
got=recv(telnetSocket,(CHAR*)input,sizeof(input),0);
//?? TRACE1("/rv %d\n",got);
for(int tmp=0;tmp<got;tmp++)
ProcessNetByte(input[tmp]);
TerminalPostO();
//?? TRACE0("/FD_READ\n");
return 0;
}
if(WSAGETSELECTEVENT(lP)&FD_OOB){
TRACE0("OOB\n");
}
if(WSAGETSELECTEVENT(lP)&FD_CLOSE){
TRACE0("CLOSE\n");
PostMessage(wsaW,WM_QUIT,0,0);
return 0;
}
VERIFY(SelectSocket());
return 0;
}
LRESULT CALLBACK WSWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch(uMsg){
case WM_USERSOCKET:
return WSMessage(wParam,lParam);
case WM_USERKEY:
return ProcessConsoleInput();
default:
TRACE0("DEFWINDOWPROC\n");
return ::DefWindowProc(hWnd,uMsg,wParam,lParam);
}
return 0;
}
BOOL InitializeWinsock()
{
if(WSAStartup(0x101,&wsaData)){
printf("Failed to initialize winsock services\n");
return FALSE;
}
WNDCLASS wc;
memset(&wc,0,sizeof(wc));
wc.lpfnWndProc=WSWndProc; wc.hInstance=::GetModuleHandle(NULL);
wc.lpszClassName = "_WSTFWC_";
wsaWC = RegisterClass(&wc);
if(!wsaWC){
printf("Failed to initialize winsock services - 1\n");
return FALSE;
}
wsaW = ::CreateWindow("_WSTFWC_","KIN Sole Mio",0,0,0,0,0,NULL,NULL,::GetModuleHandle(NULL),NULL);
if(!wsaW){
printf("Failed to initialize winsock services\n");
return FALSE;
}
return TRUE;
}
void DeinitializeWinsock()
{
if(wsaW)
::DestroyWindow(wsaW);
wsaW=NULL;
if(wsaWC)
::UnregisterClass("_WSTFWC_",::GetModuleHandle(NULL));
wsaWC=NULL;
WSACleanup();
}
HWND GetThisConsoleWnd()
{
DWORD pid = GetCurrentProcessId();
CHAR title[512];
CHAR* t = title;
if(!GetConsoleTitle(title,sizeof(title)))
t = NULL;
HWND hrv = FindWindowEx(NULL,NULL,"tty",t);
HWND nopro = NULL;
UINT nopros=0;
do{
DWORD wpid;
if(!GetWindowThreadProcessId(hrv,&wpid))
continue;
if(wpid==pid)
return hrv;
nopro=hrv;
nopros++;
hrv = FindWindowEx(NULL,hrv,"tty",t);
}while(hrv);
if(nopros==1){
ASSERT(nopro);
return nopro;
}
return NULL;
}
main(int argc,char*argv[])
{
if(argc<2){
usagebye:
printf(
- DAMN_KIN_NAME " " DAMN_KIN_VERSION ", Copyright (c) 1998-2004 Klever Group (http://www.klever.net/)\n\n"
+ DAMN_KIN_NAME " " DAMN_KIN_VERSION ", Copyright (c) 1998-2005 Klever Group (http://www.klever.net/)\n\n"
"Usage:\t" DAMN_KIN_NAME " [<options> ]<host-name/ip-address>[ <port>]\n\n"
"Options are:\n"
"-r## or -##\tSet number of rows in console screenbuffer\n"
"-c##\t\tSet number of columns in console screenbuffer\n"
"\tnote: changing console screenbuffer size may not work properly\n"
"\twhen in full-screen mode\n"
"-l<user>\tPass username to remote server in environment\n"
"-e<var>=<val>\tPass environment variable to remote server\n"
"-v<var>=<val>\tPass user environment variable to remote server\n"
"-t<termtype>\tChange preferred terminal type\n"
"\tnote: there are only two different terminal emulations in this\n"
"\trelease - one for dumb terminal and one for vt terminal\n"
);
CleanEnvars();
return 1;
}
if(!InitializeWinsock()){
DeinitializeWinsock();
return 2;
}
CONSOLE_SCREEN_BUFFER_INFO csbi;
int ac = 0;
CHAR *ho = NULL, *po = NULL;
HANDLE hConsole = CreateFile("CONOUT$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,OPEN_EXISTING,0,NULL);
ASSERT(hConsole);
// *** GetStdHandle(STD_OUTPUT_HANDLE); // *?*?* Do something about redirections and not only here.
VERIFY(GetConsoleScreenBufferInfo(hConsole,&csbi));
BOOL bSized=FALSE;
bTermPulled=FALSE;
for(int tmp=1;tmp<argc;tmp++){
char* v = argv[tmp];
ASSERT(v && *v);
if((*v)=='/' || (*v)=='-'){
int lines = atoi(&v[1]);
if(lines){
if(lines<csbi.dwSize.Y){
SMALL_RECT wi = {0,0,csbi.dwSize.X-1,lines-1};
VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi));
}
COORD ns = {csbi.dwSize.X,lines};
if(SetConsoleScreenBufferSize(hConsole,ns))
bSized=TRUE;
}else if(v[1]=='r'){
int lines = atoi(&v[2]);
if(lines){
if(lines<csbi.dwSize.Y){
SMALL_RECT wi = {0,0,csbi.dwSize.X-1,lines-1};
VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi));
}
COORD ns = {csbi.dwSize.X,lines};
if(SetConsoleScreenBufferSize(hConsole,ns))
bSized=TRUE;
}else
goto usagebye;
}else if(v[1]=='c'){
int rows = atoi(&v[2]);
if(rows){
if(rows<csbi.dwSize.X){
SMALL_RECT wi = {0,0,rows-1,csbi.dwSize.Y-1};
VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi));
}
COORD ns = {rows,csbi.dwSize.Y};
if(SetConsoleScreenBufferSize(hConsole,ns))
bSized=TRUE;
}else
goto usagebye;
}else if(v[1]=='l'){
CHAR* vv = &v[2];
VERIFY(AddEnvar(nesbVar,"USER",vv));
}else if(v[1]=='e'){ // -e<name>=<value> VAR
CHAR* n = &v[2];
CHAR* vv = strchr(&v[2],'=');
if(!vv)
goto usagebye;
*(vv++)=0;
VERIFY(AddEnvar(nesbVar,n,vv));
}else if(v[1]=='v'){ // -v<name>=<value> USERVAR
CHAR* n = &v[2];
CHAR* vv = strchr(n,'=');
if(!vv)
goto usagebye;
*(vv++)=0;
VERIFY(AddEnvar(nesbUserVar,n,vv));
}else if(v[1]=='t'){ // -t<ttype> -t<tname>=<ttype>
CHAR* n = &v[2];
CHAR* nn = strchr(n,'=');
if(nn){
*(nn++)=0;
if(!*nn)
nn=NULL;
}
if(!TerminalPullType(nn?nn:n,nn?n:NULL)){
printf("Available terminal types are:");
TerminalPrintTypes();
printf("\n");
goto usagebye;
}
bTermPulled=TRUE;
}else if(v[1]=='#'){
int cp = atoi(&v[2]);
#ifdef _DEBUG
TRACE2("SetCP(%d)=%d\n",cp,SetConsoleCP(cp));
TRACE2("SetOutCP(%d)=%d\n",cp,SetConsoleOutputCP(cp));
#else
SetConsoleCP(cp);
SetConsoleOutputCP(cp);
#endif
TRACE2("CP,OCP=%d,%d\n",GetConsoleCP(),GetConsoleOutputCP());
}else
goto usagebye;
}else{
if(ac==0){
ho = v;
ac++;
}else if(ac==1){
po = v;
ac++;
}else
goto usagebye;
}
}
if(!ho)
goto usagebye;
servent* se = getservbyname("telnet","tcp");
UINT port = po?atol(po):(se?ntohs(se->s_port):23);
if(port==23 || (se && port==ntohs(se->s_port)))
bTelnet = TRUE;
if(po && !port){
se = getservbyname(po,"tcp");
if(!se){
printf("Failed to resolve tcp-service port name\n");
DeinitializeWinsock();
return 2;
}
port = ntohs(se->s_port);
if(!stricmp(po,"telnet"))
bTelnet = TRUE;
else
bTelnet = FALSE;
}else{
se = getservbyport(htons(port),"tcp");
if(se){
po = se->s_name;
if(!stricmp(po,"telnet"))
bTelnet=TRUE;
}else{
VERIFY(_itoa(port,remoteProt,10));
po = NULL;
bTelnet=FALSE;
}
}
if(po)
strcpy(remoteProt,po);
HICON hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_IKON));
LONG oldBIcon = NULL, oldSIcon = NULL;
hConsoleWindow = GetThisConsoleWnd();
if(hConsoleWindow){
oldBIcon = SendMessage(hConsoleWindow,WM_SETICON,ICON_BIG,(LPARAM)hIcon);
oldSIcon = SendMessage(hConsoleWindow,WM_SETICON,ICON_SMALL,(LPARAM)hIcon);
}
Telnet(ho,port);
CleanEnvars();
if(hConsoleWindow){
SendMessage(hConsoleWindow,WM_SETICON,ICON_BIG,(LPARAM)oldBIcon);
SendMessage(hConsoleWindow,WM_SETICON,ICON_SMALL,(LPARAM)oldSIcon);
}
Sleep(150);
if(bSized){
CONSOLE_SCREEN_BUFFER_INFO CSBI;
VERIFY(GetConsoleScreenBufferInfo(hConsole,&CSBI));
if(CSBI.dwSize.Y>csbi.dwSize.Y || CSBI.dwSize.X>csbi.dwSize.X){
SMALL_RECT wi = {0,0,csbi.dwSize.X-1,csbi.dwSize.Y-1};
VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi));
}
COORD ns = {csbi.dwSize.X,csbi.dwSize.Y};
VERIFY(SetConsoleScreenBufferSize(hConsole,ns));
}
Sleep(100);
DeinitializeWinsock();
Sleep(100);
return 0;
}
@@ -1,115 +1,115 @@ //Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_IKON ICON DISCARDABLE "res/kinsole.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,1,0,0
- PRODUCTVERSION 1,1,0,0
+ FILEVERSION 1,1,1,0
+ PRODUCTVERSION 1,1,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x29L
#else
FILEFLAGS 0x28L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x3L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Klever Group (http://www.klever.net)\0"
VALUE "FileDescription", "KINSole, telnet client\0"
- VALUE "FileVersion", "1, 1, 0, 0\0"
+ VALUE "FileVersion", "1, 1, 1, 0\0"
VALUE "InternalName", "KINSOLE\0"
- VALUE "LegalCopyright", "Copyright © 1998-2004 Klever Group (http://www.klever.net/)\0"
+ VALUE "LegalCopyright", "Copyright © 1998-2005 Klever Group (http://www.klever.net/)\0"
VALUE "LegalTrademarks", "Klever Group (http://www.klevernet/)\0"
VALUE "OriginalFilename", "KINSOLE.EXE\0"
VALUE "ProductName", "KINSole\0"
- VALUE "ProductVersion", "1, 1, 0, 0\0"
+ VALUE "ProductVersion", "1, 1, 1, 0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
|