-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 @@ | |||
1 | Copyright (c) 1998-2004 Klever Group (http://www.klever.net/) | 1 | Copyright (c) 1998-2005 Klever Group (http://www.klever.net/) |
2 | 2 | ||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
4 | this software and associated documentation files (the "Software"), to deal in | 4 | this software and associated documentation files (the "Software"), to deal in |
5 | the Software without restriction, including without limitation the rights to | 5 | the Software without restriction, including without limitation the rights to |
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
7 | of the Software, and to permit persons to whom the Software is furnished to do | 7 | of the Software, and to permit persons to whom the Software is furnished to do |
8 | so, subject to the following conditions: | 8 | so, subject to the following conditions: |
9 | 9 | ||
10 | The above copyright notice and this permission notice shall be included in all | 10 | The above copyright notice and this permission notice shall be included in all |
11 | copies or substantial portions of the Software. | 11 | copies or substantial portions of the Software. |
12 | 12 | ||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
19 | SOFTWARE. | 19 | SOFTWARE. |
@@ -1,12 +1,12 @@ | |||
1 | help-license-date ./help/kinsole.xml /<license\s/;"kind:d | 1 | help-license-date ./help/kinsole.xml /<license\s/;"kind:d |
2 | help-news ./help/kinsole.xml/<newsfor\s/ | 2 | help-news ./help/kinsole.xml/<newsfor\s/ |
3 | install-version ./install/install.cpp /^#define\s\+KINAME\s\+"/;"kind:v | 3 | install-version ./install/install.cpp /^#define\s\+VERSION\s\+"/;"kind:v |
4 | install-vsinfo-date install/install.rc /^\s\+VALUE\s\+"LegalCopyright",/;"kind:d | 4 | install-vsinfo-date install/install.rc /^\s\+VALUE\s\+"LegalCopyright",/;"kind:d |
5 | install-vsinfo-numeric-version install/install.rc /^\s\+FILEVERSION\s\+/;"kind:v | 5 | install-vsinfo-numeric-version install/install.rc /^\s\+FILEVERSION\s\+/;"kind:v |
6 | install-vsinfo-string-version install/install.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v | 6 | install-vsinfo-string-version install/install.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v |
7 | kinsole-version kinsole.cpp /^#define\s\+DAMN_KIN_VERSION\s\+"/;"kind:v | 7 | kinsole-version kinsole.cpp /^#define\s\+DAMN_KIN_VERSION\s\+"/;"kind:v |
8 | license-date COPYING :1;"kind:d | 8 | license-date COPYING :1;"kind:d |
9 | usage-date kinsole.cpp /, Copyright (c) /;"kind:d | 9 | usage-date kinsole.cpp /, Copyright (c) /;"kind:d |
10 | vsinfo-date kinsole.rc /VALUE\s\+"LegalCopyright",/;"kind:d | 10 | vsinfo-date kinsole.rc /VALUE\s\+"LegalCopyright",/;"kind:d |
11 | vsinfo-numeric-version kinsole.rc /^\s\+FILEVERSION\s\+/;"kind:v | 11 | vsinfo-numeric-version kinsole.rc /^\s\+FILEVERSION\s\+/;"kind:v |
12 | vsinfo-string-version kinsole.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v | 12 | 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 @@ | |||
1 | {\rtf1\ansi | 1 | {\rtf1\ansi |
2 | @{\footnote | 2 | @{\footnote |
3 | THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT. | 3 | THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT. |
4 | DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD | 4 | DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD |
5 | } | 5 | } |
6 | {\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl; | 6 | {\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl; |
7 | \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0; | 7 | \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0; |
8 | \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; | 8 | \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; |
9 | \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; | 9 | \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; |
10 | \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} | 10 | \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} |
11 | 11 | ||
12 | \pard\plain\keepn | 12 | \pard\plain\keepn |
13 | #{\footnote About} | 13 | #{\footnote About} |
14 | ${\footnote About KINSole} | 14 | ${\footnote About KINSole} |
15 | { \f1\fs18\b\sb120 About KINSole} | 15 | { \f1\fs18\b\sb120 About KINSole} |
16 | \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. | 16 | \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. |
17 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 | 17 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 |
18 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}} | 18 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}} |
19 | { | 19 | { |
20 | \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/")} | 20 | \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/")} |
21 | \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: | 21 | \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: |
22 | \par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | 22 | \par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
23 | \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. | 23 | \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. |
24 | } | 24 | } |
25 | \par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")} | 25 | \par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")} |
26 | \par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")} | 26 | \par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")} |
27 | \page | 27 | \page |
28 | 28 | ||
29 | \pard\plain\keepn | 29 | \pard\plain\keepn |
30 | #{\footnote News} | 30 | #{\footnote News} |
31 | ${\footnote What's new} | 31 | ${\footnote What's new} |
32 | { \f1\fs18\b\sb120 What's New} | 32 | { \f1\fs18\b\sb120 What's New} |
33 | \par\pard\plain\f1\fs24\qc\cf2\b 1.1.1 - August 6th, 2005 | ||
34 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Fixed uninstall procedure so that it works on XP | ||
33 | \par\pard\plain\f1\fs24\qc\cf2\b 1.1 - July 11th, 2004 | 35 | \par\pard\plain\f1\fs24\qc\cf2\b 1.1 - July 11th, 2004 |
34 | \par\pard\plain\fi0\li0\f1\fs18 \bullet No changes in code. License change. | 36 | \par\pard\plain\fi0\li0\f1\fs18 \bullet No changes in code. License change. |
35 | \par\pard\plain\f1\fs24\qc\cf2\b 1.00 Beta 2 - March 7th, 1998 | 37 | \par\pard\plain\f1\fs24\qc\cf2\b 1.00 Beta 2 - March 7th, 1998 |
36 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Better copying from {\b KINSole} window. | 38 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Better copying from {\b KINSole} window. |
37 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Better handling of cursor position when resizing window. | 39 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Better handling of cursor position when resizing window. |
38 | \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. | 40 | \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. |
39 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Corrected bug, preventing {\b KINSole} from pasting text to remote twice. | 41 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Corrected bug, preventing {\b KINSole} from pasting text to remote twice. |
40 | \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}. | 42 | \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}. |
41 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Typo causing {\b KINSole} not to show diamond characters in {\b VT10x} mode corrected. | 43 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Typo causing {\b KINSole} not to show diamond characters in {\b VT10x} mode corrected. |
42 | \par\pard\plain\fi0\li0\f1\fs18 \bullet {\b GPF} when invoking {\b KINSole} with {\b -t} option fixed. | 44 | \par\pard\plain\fi0\li0\f1\fs18 \bullet {\b GPF} when invoking {\b KINSole} with {\b -t} option fixed. |
43 | \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}. | 45 | \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}. |
44 | \par\pard\plain\fi0\li0\f1\fs18 \bullet {\b Paste} is made aware of local echoing. | 46 | \par\pard\plain\fi0\li0\f1\fs18 \bullet {\b Paste} is made aware of local echoing. |
45 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Default terminal type when telnetting to non-telnet port is now {\b TTY}. | 47 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Default terminal type when telnetting to non-telnet port is now {\b TTY}. |
46 | \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}). | 48 | \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}). |
47 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Improved handling of window icon when starting from other {\i Win32} command line application. | 49 | \par\pard\plain\fi0\li0\f1\fs18 \bullet Improved handling of window icon when starting from other {\i Win32} command line application. |
48 | \page | 50 | \page |
49 | 51 | ||
50 | \pard\plain\keepn | 52 | \pard\plain\keepn |
51 | #{\footnote Using} | 53 | #{\footnote Using} |
52 | ${\footnote Using KINSole} | 54 | ${\footnote Using KINSole} |
53 | { \f1\fs18\b\sb120 Using {\b KINSole}} | 55 | { \f1\fs18\b\sb120 Using {\b KINSole}} |
54 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 You may run {\b KINSole} from your MS-DOS prompt by typing '{\i kinsole host port}'. | 56 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 You may run {\b KINSole} from your MS-DOS prompt by typing '{\i kinsole host port}'. |
55 | \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. | 57 | \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. |
56 | \page | 58 | \page |
57 | 59 | ||
58 | \pard\plain\keepn | 60 | \pard\plain\keepn |
59 | #{\footnote CmdOptions} | 61 | #{\footnote CmdOptions} |
60 | ${\footnote Command Line Options} | 62 | ${\footnote Command Line Options} |
61 | { \f1\fs18\b\sb120 Command Line Options} | 63 | { \f1\fs18\b\sb120 Command Line Options} |
62 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 Usage: | 64 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 Usage: |
63 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 KINSole [{\i options} ]{\i host}[ {\i port}] | 65 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 KINSole [{\i options} ]{\i host}[ {\i port}] |
64 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 Available options are:\pard | 66 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 Available options are:\pard |
65 | \par \fi0\li0 \bullet {\b -r {\i ##}} or {\b -{\i ##}} - Try to set the number of rows in console screen buffer. | 67 | \par \fi0\li0 \bullet {\b -r {\i ##}} or {\b -{\i ##}} - Try to set the number of rows in console screen buffer. |
66 | \par \fi0\li0 \bullet {\b -c {\i ##}} - Try to set the number of columns in console screenbuffer. | 68 | \par \fi0\li0 \bullet {\b -c {\i ##}} - Try to set the number of columns in console screenbuffer. |
67 | \par \fi0\li0 \bullet | 69 | \par \fi0\li0 \bullet |
68 | \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. | 70 | \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. |
69 | \par \fi0\li0 \bullet {\b -l {\i username}} - Pass username to remote server in environment if remote server allows. | 71 | \par \fi0\li0 \bullet {\b -l {\i username}} - Pass username to remote server in environment if remote server allows. |
70 | \par \fi0\li0 \bullet {\b -e {\i var}={\i val}} - Pass environment variable to remote server. | 72 | \par \fi0\li0 \bullet {\b -e {\i var}={\i val}} - Pass environment variable to remote server. |
71 | \par \fi0\li0 \bullet {\b -v {\i var}={\i val}} - Pass user environment variable to remote server. | 73 | \par \fi0\li0 \bullet {\b -v {\i var}={\i val}} - Pass user environment variable to remote server. |
72 | \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 | 74 | \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 |
73 | \page | 75 | \page |
74 | 76 | ||
75 | \pard\plain\keepn | 77 | \pard\plain\keepn |
76 | #{\footnote HotKeys} | 78 | #{\footnote HotKeys} |
77 | ${\footnote Hot Keys} | 79 | ${\footnote Hot Keys} |
78 | { \f1\fs18\b\sb120 Hot Keys} | 80 | { \f1\fs18\b\sb120 Hot Keys} |
79 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 While running {\b KINSole} you may use these key combinations:\pard | 81 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 While running {\b KINSole} you may use these key combinations:\pard |
80 | \par \fi0\li0 \bullet {\b Alt-X/Alt-Q} - Terminate telnet session and leave {\b KINSole}. | 82 | \par \fi0\li0 \bullet {\b Alt-X/Alt-Q} - Terminate telnet session and leave {\b KINSole}. |
81 | \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. | 83 | \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. |
82 | \par \fi0\li0 \bullet {\b Shift-INS} Paste text from Windows Clipboard. | 84 | \par \fi0\li0 \bullet {\b Shift-INS} Paste text from Windows Clipboard. |
83 | \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. | 85 | \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. |
84 | \par \fi0\li0 \bullet {\b Alt-INS} - Invoke {\b copying} from {\b KINSole} screen buffer. | 86 | \par \fi0\li0 \bullet {\b Alt-INS} - Invoke {\b copying} from {\b KINSole} screen buffer. |
85 | \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 | 87 | \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 |
86 | \page | 88 | \page |
87 | 89 | ||
88 | \pard\plain\keepn | 90 | \pard\plain\keepn |
89 | #{\footnote Notes} | 91 | #{\footnote Notes} |
90 | ${\footnote Notes} | 92 | ${\footnote Notes} |
91 | { \f1\fs18\b\sb120 Notes} | 93 | { \f1\fs18\b\sb120 Notes} |
92 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 A few things you may want to know about this release:\pard | 94 | \par\sa120\sb120\qj\pard \f1\fs18\sb120 A few things you may want to know about this release:\pard |
93 | \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? | 95 | \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? |
94 | \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. | 96 | \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. |
95 | \par \fi0\li0 \bullet Pasting of text using console toolbar button may cause {\b KINSole} to lock up. Use {\b Shift-INS} instead.\pard | 97 | \par \fi0\li0 \bullet Pasting of text using console toolbar button may cause {\b KINSole} to lock up. Use {\b Shift-INS} instead.\pard |
96 | \page | 98 | \page |
97 | } \ No newline at end of file | 99 | } \ 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 @@ | |||
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | <winhelp> | 2 | <winhelp> |
3 | <topic id="About" title="About KINSole"> | 3 | <topic id="About" title="About KINSole"> |
4 | <heading scroll="no">About KINSole</heading> | 4 | <heading scroll="no">About KINSole</heading> |
5 | <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> | 5 | <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> |
6 | <p/> | 6 | <p/> |
7 | <p><b><i>Enjoy!</i></b></p> | 7 | <p><b><i>Enjoy!</i></b></p> |
8 | <license years="1998-2004"/> | 8 | <license years="1998-2005"/> |
9 | <credits/> | 9 | <credits/> |
10 | </topic> | 10 | </topic> |
11 | <topic id="News" title="What's new"> | 11 | <topic id="News" title="What's new"> |
12 | <heading scroll="no">What's New</heading> | 12 | <heading scroll="no">What's New</heading> |
13 | <newsfor version="1.1.1" date="August 6th, 2005"> | ||
14 | <ni>Fixed uninstall procedure so that it works on XP</ni> | ||
15 | </newsfor> | ||
13 | <newsfor version="1.1" date="July 11th, 2004"> | 16 | <newsfor version="1.1" date="July 11th, 2004"> |
14 | <ni>No changes in code. License change.</ni> | 17 | <ni>No changes in code. License change.</ni> |
15 | </newsfor> | 18 | </newsfor> |
16 | <newsfor version="1.00 Beta 2" date="March 7th, 1998"> | 19 | <newsfor version="1.00 Beta 2" date="March 7th, 1998"> |
17 | <ni>Better copying from <kin>KINSole</kin> window.</ni> | 20 | <ni>Better copying from <kin>KINSole</kin> window.</ni> |
18 | <ni>Better handling of cursor position when resizing window.</ni> | 21 | <ni>Better handling of cursor position when resizing window.</ni> |
19 | <ni>Sending <b>CR/LF</b> pair when pressing <b>ENTER</b>. This is of help when telnetting to non-telnet ports.</ni> | 22 | <ni>Sending <b>CR/LF</b> pair when pressing <b>ENTER</b>. This is of help when telnetting to non-telnet ports.</ni> |
20 | <ni>Corrected bug, preventing <kin>KINSole</kin> from pasting text to remote twice.</ni> | 23 | <ni>Corrected bug, preventing <kin>KINSole</kin> from pasting text to remote twice.</ni> |
21 | <ni>Improved handling of echoing. Previously <kin>KINSole</kin> didn't turn echo off on some systems, namely <b>Solaris</b>.</ni> | 24 | <ni>Improved handling of echoing. Previously <kin>KINSole</kin> didn't turn echo off on some systems, namely <b>Solaris</b>.</ni> |
22 | <ni>Typo causing <kin>KINSole</kin> not to show diamond characters in <b>VT10x</b> mode corrected.</ni> | 25 | <ni>Typo causing <kin>KINSole</kin> not to show diamond characters in <b>VT10x</b> mode corrected.</ni> |
23 | <ni><b>GPF</b> when invoking <kin>KINSole</kin> with <b>-t</b> option fixed.</ni> | 26 | <ni><b>GPF</b> when invoking <kin>KINSole</kin> with <b>-t</b> option fixed.</ni> |
24 | <ni>Hotkey (<b>Alt-INS</b>) for copy operation added. Not supposed to work under <product>Windows NT</product>.</ni> | 27 | <ni>Hotkey (<b>Alt-INS</b>) for copy operation added. Not supposed to work under <product>Windows NT</product>.</ni> |
25 | <ni><b>Paste</b> is made aware of local echoing.</ni> | 28 | <ni><b>Paste</b> is made aware of local echoing.</ni> |
26 | <ni>Default terminal type when telnetting to non-telnet port is now <b>TTY</b>.</ni> | 29 | <ni>Default terminal type when telnetting to non-telnet port is now <b>TTY</b>.</ni> |
27 | <ni><b>Timing Mark</b> telnet option (<rfc num="860"/>) implemented (<b>Alt-T</b>).</ni> | 30 | <ni><b>Timing Mark</b> telnet option (<rfc num="860"/>) implemented (<b>Alt-T</b>).</ni> |
28 | <ni>Improved handling of window icon when starting from other <term>Win32</term> command line application.</ni> | 31 | <ni>Improved handling of window icon when starting from other <term>Win32</term> command line application.</ni> |
29 | </newsfor> | 32 | </newsfor> |
30 | </topic> | 33 | </topic> |
31 | <topic id="Using" title="Using KINSole"> | 34 | <topic id="Using" title="Using KINSole"> |
32 | <heading scroll="no">Using <kin>KINSole</kin></heading> | 35 | <heading scroll="no">Using <kin>KINSole</kin></heading> |
33 | <p>You may run <kin>KINSole</kin> from your MS-DOS prompt by typing '<i>kinsole host port</i>'.</p> | 36 | <p>You may run <kin>KINSole</kin> from your MS-DOS prompt by typing '<i>kinsole host port</i>'.</p> |
34 | <p>If you need to know more about custom options, please proceed to the <a href="#CmdOptions">Command Line Options</a> section.</p> | 37 | <p>If you need to know more about custom options, please proceed to the <a href="#CmdOptions">Command Line Options</a> section.</p> |
35 | </topic> | 38 | </topic> |
36 | <topic id="CmdOptions" title="Command Line Options"> | 39 | <topic id="CmdOptions" title="Command Line Options"> |
37 | <heading scroll="no">Command Line Options</heading> | 40 | <heading scroll="no">Command Line Options</heading> |
38 | <p>Usage:</p> | 41 | <p>Usage:</p> |
39 | <p>KINSole [<i>options</i> ]<i>host</i>[ <i>port</i>]</p> | 42 | <p>KINSole [<i>options</i> ]<i>host</i>[ <i>port</i>]</p> |
40 | <p>Available options are:</p> | 43 | <p>Available options are:</p> |
41 | <ul> | 44 | <ul> |
42 | <li><b>-r <i>##</i></b> or <b>-<i>##</i></b> - Try to set the number of rows in console screen buffer.</li> | 45 | <li><b>-r <i>##</i></b> or <b>-<i>##</i></b> - Try to set the number of rows in console screen buffer.</li> |
43 | <li><b>-c <i>##</i></b> - Try to set the number of columns in console screenbuffer.</li> | 46 | <li><b>-c <i>##</i></b> - Try to set the number of columns in console screenbuffer.</li> |
44 | <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> | 47 | <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> |
45 | <li><b>-l <i>username</i></b> - Pass username to remote server in environment if remote server allows.</li> | 48 | <li><b>-l <i>username</i></b> - Pass username to remote server in environment if remote server allows.</li> |
46 | <li><b>-e <i>var</i>=<i>val</i></b> - Pass environment variable to remote server.</li> | 49 | <li><b>-e <i>var</i>=<i>val</i></b> - Pass environment variable to remote server.</li> |
47 | <li><b>-v <i>var</i>=<i>val</i></b> - Pass user environment variable to remote server.</li> | 50 | <li><b>-v <i>var</i>=<i>val</i></b> - Pass user environment variable to remote server.</li> |
48 | <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> | 51 | <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> |
49 | </ul> | 52 | </ul> |
50 | </topic> | 53 | </topic> |
51 | <topic id="HotKeys" title="Hot Keys"> | 54 | <topic id="HotKeys" title="Hot Keys"> |
52 | <heading scroll="no">Hot Keys</heading> | 55 | <heading scroll="no">Hot Keys</heading> |
53 | <p>While running <kin>KINSole</kin> you may use these key combinations:</p> | 56 | <p>While running <kin>KINSole</kin> you may use these key combinations:</p> |
54 | <ul> | 57 | <ul> |
55 | <li><b>Alt-X/Alt-Q</b> - Terminate telnet session and leave <kin>KINSole</kin>.</li> | 58 | <li><b>Alt-X/Alt-Q</b> - Terminate telnet session and leave <kin>KINSole</kin>.</li> |
56 | <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> | 59 | <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> |
57 | <li><b>Shift-INS</b> Paste text from Windows Clipboard.</li> | 60 | <li><b>Shift-INS</b> Paste text from Windows Clipboard.</li> |
58 | <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> | 61 | <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> |
59 | <li><b>Alt-INS</b> - Invoke <b>copying</b> from <kin>KINSole</kin> screen buffer.</li> | 62 | <li><b>Alt-INS</b> - Invoke <b>copying</b> from <kin>KINSole</kin> screen buffer.</li> |
60 | <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> | 63 | <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> |
61 | </ul> | 64 | </ul> |
62 | </topic> | 65 | </topic> |
63 | <topic id="Notes" title="Notes"> | 66 | <topic id="Notes" title="Notes"> |
64 | <heading scroll="no">Notes</heading> | 67 | <heading scroll="no">Notes</heading> |
65 | <p>A few things you may want to know about this release:</p> | 68 | <p>A few things you may want to know about this release:</p> |
66 | <ul> | 69 | <ul> |
67 | <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> | 70 | <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> |
68 | <li>Telnet <b>LINEMODE</b> option (<rfc num="1184"/>) is still to come.</li> | 71 | <li>Telnet <b>LINEMODE</b> option (<rfc num="1184"/>) is still to come.</li> |
69 | <li>Pasting of text using console toolbar button may cause <kin>KINSole</kin> to lock up. Use <b>Shift-INS</b> instead.</li> | 72 | <li>Pasting of text using console toolbar button may cause <kin>KINSole</kin> to lock up. Use <b>Shift-INS</b> instead.</li> |
70 | </ul> | 73 | </ul> |
71 | </topic> | 74 | </topic> |
72 | </winhelp> | 75 | </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 @@ | |||
1 | #include "resource.h" | 1 | #include "resource.h" |
2 | #include "../shared-code/install.h" | 2 | #include "../shared-code/install.h" |
3 | 3 | ||
4 | #define KINAME"KINSole 1.1" | 4 | #define VERSION "1.1.1" |
5 | #define KINAME"KINSole " VERSION | ||
5 | #define SKINAME"KINSole" | 6 | #define SKINAME"KINSole" |
6 | 7 | ||
7 | BOOL Install(void) | 8 | BOOL Install(void) |
8 | { | 9 | { |
9 | STRING tPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group",SKINAME "Path"); | 10 | STRING tPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group",SKINAME "Path"); |
10 | STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath"); | 11 | STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath"); |
11 | LPCSTR qPath = ((LPCSTR)tPath)?(LPCSTR)tPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings"); | 12 | LPCSTR qPath = ((LPCSTR)tPath)?(LPCSTR)tPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings"); |
12 | 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); | 13 | 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); |
13 | if(!path) | 14 | if(!path) |
14 | return NULL; | 15 | return NULL; |
15 | STRING winDir(_MAX_PATH); | 16 | STRING winDir(_MAX_PATH); |
16 | 17 | ||
17 | GetWindowsDirectory(winDir,_MAX_PATH); | 18 | GetWindowsDirectory(winDir,_MAX_PATH); |
18 | INSTALLFILE("KINSole.ex_",winDir,"KINSole.exe"); | 19 | INSTALLFILE("KINSole.ex_",winDir,"KINSole.exe"); |
19 | MAKE_PATH(path); | 20 | MAKE_PATH(path); |
20 | STRING shortPath = GET_SHORT_PATH(path); | 21 | STRING shortPath = GET_SHORT_PATH(path); |
21 | if(!shortPath){ | 22 | if(!shortPath){ |
22 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); | 23 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); |
23 | return FALSE; | 24 | return FALSE; |
24 | } | 25 | } |
25 | if(!( | 26 | if(!( |
26 | INSTALLFILE("KINSole.hl_",path,"KINSole.hlp") && | 27 | INSTALLFILE("KINSole.hl_",path,"KINSole.hlp") && |
27 | INSTALLFILE("KINSole.cn_",path,"KINSole.cnt") | 28 | INSTALLFILE("KINSole.cn_",path,"KINSole.cnt") |
28 | )){ | 29 | )){ |
29 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); | 30 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); |
30 | return FALSE; | 31 | return FALSE; |
31 | } | 32 | } |
32 | ADDMENU("Klever Group","KINSole Help",path,SKINAME ".hlp"); | 33 | ADDMENU("Klever Group","KINSole Help",path,SKINAME ".hlp"); |
33 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group", SKINAME "Path",path); | 34 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group", SKINAME "Path",path); |
34 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath",path); | 35 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath",path); |
35 | FILE* inf=CREATE_INF_FILE(path, SKINAME ".INF"); | 36 | FILE* inf=CREATE_INF_FILE(path, SKINAME ".INF"); |
36 | if(!inf){ | 37 | if(!inf){ |
37 | MessageBox(NULL,"Failed to install " KINAME,NULL,MB_ICONERROR|MB_OK); | 38 | MessageBox(NULL,"Failed to install " KINAME,NULL,MB_ICONERROR|MB_OK); |
38 | return FALSE; | 39 | return FALSE; |
39 | } | 40 | } |
40 | INF_FILE_HEADER(inf); | 41 | INF_FILE_HEADER(inf); |
41 | INF_FILE_SECTION(inf,"Uninstall"); | 42 | INF_FILE_SECTION(inf,"Uninstall"); |
42 | fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n"); | 43 | fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n"); |
43 | 44 | ||
44 | INF_FILE_SECTION(inf,"kFiles"); | 45 | INF_FILE_SECTION(inf,"kFiles"); |
45 | INF_REMOVE_ROOT(inf,SKINAME "Files",shortPath); | 46 | INF_REMOVE_ROOT(inf,SKINAME "Files",shortPath); |
46 | INF_REMOVE_HELP_FILE(inf,SKINAME "Files",SKINAME); | 47 | INF_REMOVE_HELP_FILE(inf,SKINAME "Files",SKINAME); |
47 | INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".inf"); | 48 | INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".inf"); |
48 | 49 | ||
49 | INF_REMOVE_ROOT(inf,SKINAME "WFiles",winDir); | 50 | INF_REMOVE_ROOT(inf,SKINAME "WFiles",winDir); |
50 | INF_REMOVE_FILE(inf,SKINAME "WFiles",SKINAME ".exe"); | 51 | INF_REMOVE_FILE(inf,SKINAME "WFiles",SKINAME ".exe"); |
51 | 52 | ||
52 | INF_FILE_SECTION(inf,"kReg"); | 53 | INF_FILE_SECTION(inf,"kReg"); |
53 | INF_UNINSTALL_REG(inf,SKINAME); | 54 | INF_UNINSTALL_REG(inf,SKINAME); |
54 | 55 | ||
55 | INF_FILE_SECTION(inf,"kMenu"); | 56 | INF_FILE_SECTION(inf,"kMenu"); |
56 | INF_MENU_GROUP(inf,1,"Klever Group"); | 57 | INF_MENU_GROUP(inf,1,"Klever Group"); |
57 | INF_MENU_ITEM(inf,1,"KINSole Help"); | 58 | INF_MENU_ITEM(inf,1,"KINSole Help"); |
58 | fclose(inf); | 59 | fclose(inf); |
59 | 60 | ||
60 | REG_UNINSTALL_COMMAND(SKINAME,"Klever " KINAME,shortPath,SKINAME ".INF","Uninstall"); | 61 | REG_UNINSTALL_COMMAND(SKINAME,"Klever " KINAME,shortPath,SKINAME ".INF","Uninstall"); |
62 | REG_UNINSTALL_ICON(SKINAME,path,SKINAME ".exe",0); | ||
63 | REG_UNINSTALL_COMMENT(SKINAME,"Klever " KINAME); | ||
64 | REG_UNINSTALL_VERSION(SKINAME,VERSION); | ||
65 | REG_UNINSTALL_LOCATION(SKINAME,path); | ||
66 | REG_UNINSTALL_PUBLISHER(SKINAME,"Klever Group"); | ||
67 | REG_UNINSTALL_URLS(SKINAME,"http://www.klever.net/","http://kin.klever.net/kinsole/"); | ||
68 | |||
61 | 69 | ||
62 | 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); | 70 | 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); |
63 | 71 | ||
64 | return TRUE; | 72 | return TRUE; |
65 | } | 73 | } |
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 @@ | |||
1 | //Microsoft Developer Studio generated resource script. | 1 | //Microsoft Developer Studio generated resource script. |
2 | // | 2 | // |
3 | #include "resource.h" | 3 | #include "resource.h" |
4 | 4 | ||
5 | #define APSTUDIO_READONLY_SYMBOLS | 5 | #define APSTUDIO_READONLY_SYMBOLS |
6 | ///////////////////////////////////////////////////////////////////////////// | 6 | ///////////////////////////////////////////////////////////////////////////// |
7 | // | 7 | // |
8 | // Generated from the TEXTINCLUDE 2 resource. | 8 | // Generated from the TEXTINCLUDE 2 resource. |
9 | // | 9 | // |
10 | #include "afxres.h" | 10 | #include "afxres.h" |
11 | 11 | ||
12 | ///////////////////////////////////////////////////////////////////////////// | 12 | ///////////////////////////////////////////////////////////////////////////// |
13 | #undef APSTUDIO_READONLY_SYMBOLS | 13 | #undef APSTUDIO_READONLY_SYMBOLS |
14 | 14 | ||
15 | ///////////////////////////////////////////////////////////////////////////// | 15 | ///////////////////////////////////////////////////////////////////////////// |
16 | // English (U.S.) resources | 16 | // English (U.S.) resources |
17 | 17 | ||
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
19 | #ifdef _WIN32 | 19 | #ifdef _WIN32 |
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US |
21 | #pragma code_page(1252) | 21 | #pragma code_page(1252) |
22 | #endif //_WIN32 | 22 | #endif //_WIN32 |
23 | 23 | ||
24 | ///////////////////////////////////////////////////////////////////////////// | 24 | ///////////////////////////////////////////////////////////////////////////// |
25 | // | 25 | // |
26 | // Dialog | 26 | // Dialog |
27 | // | 27 | // |
28 | 28 | ||
29 | #if defined(APSTUDIO_INVOKED) || defined(FALSE) | 29 | #if defined(APSTUDIO_INVOKED) || defined(FALSE) |
30 | #if defined(APSTUDIO_INVOKED) | 30 | #if defined(APSTUDIO_INVOKED) |
31 | IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74 | 31 | IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74 |
32 | #else | 32 | #else |
33 | IDD_INSTALLING DIALOGEX 0, 0, 200, 74 | 33 | IDD_INSTALLING DIALOGEX 0, 0, 200, 74 |
34 | #endif | 34 | #endif |
35 | STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | 35 | STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP |
36 | FONT 8, "MS Sans Serif", 0, 0, 0x1 | 36 | FONT 8, "MS Sans Serif", 0, 0, 0x1 |
37 | BEGIN | 37 | BEGIN |
38 | PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER | | 38 | PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER | |
39 | BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME | 39 | BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME |
40 | CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT | | 40 | CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT | |
41 | ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32 | 41 | ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32 |
42 | LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY | 42 | LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY |
43 | CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45, | 43 | CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45, |
44 | 186,7,WS_EX_DLGMODALFRAME | 44 | 186,7,WS_EX_DLGMODALFRAME |
45 | END | 45 | END |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | IDD_PATH DIALOGEX 0, 0, 255, 73 | 48 | IDD_PATH DIALOGEX 0, 0, 255, 73 |
49 | STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP | | 49 | STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP | |
50 | WS_VISIBLE | WS_CAPTION | 50 | WS_VISIBLE | WS_CAPTION |
51 | EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | 51 | EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE |
52 | FONT 8, "MS Sans Serif", 0, 0, 0x1 | 52 | FONT 8, "MS Sans Serif", 0, 0, 0x1 |
53 | BEGIN | 53 | BEGIN |
54 | LTEXT "",IDC_PROMPT,7,7,241,30 | 54 | LTEXT "",IDC_PROMPT,7,7,241,30 |
55 | EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL | 55 | EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL |
56 | PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12 | 56 | PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12 |
57 | DEFPUSHBUTTON "OK",IDOK,69,52,50,14 | 57 | DEFPUSHBUTTON "OK",IDOK,69,52,50,14 |
58 | PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14 | 58 | PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14 |
59 | END | 59 | END |
60 | 60 | ||
61 | 61 | ||
62 | ///////////////////////////////////////////////////////////////////////////// | 62 | ///////////////////////////////////////////////////////////////////////////// |
63 | // | 63 | // |
64 | // DESIGNINFO | 64 | // DESIGNINFO |
65 | // | 65 | // |
66 | 66 | ||
67 | #ifdef APSTUDIO_INVOKED | 67 | #ifdef APSTUDIO_INVOKED |
68 | GUIDELINES DESIGNINFO DISCARDABLE | 68 | GUIDELINES DESIGNINFO DISCARDABLE |
69 | BEGIN | 69 | BEGIN |
70 | "IDD_INSTALLING$(FALSE)", DIALOG | 70 | "IDD_INSTALLING$(FALSE)", DIALOG |
71 | BEGIN | 71 | BEGIN |
72 | LEFTMARGIN, 7 | 72 | LEFTMARGIN, 7 |
73 | RIGHTMARGIN, 193 | 73 | RIGHTMARGIN, 193 |
74 | TOPMARGIN, 7 | 74 | TOPMARGIN, 7 |
75 | BOTTOMMARGIN, 67 | 75 | BOTTOMMARGIN, 67 |
76 | HORZGUIDE, 39 | 76 | HORZGUIDE, 39 |
77 | END | 77 | END |
78 | 78 | ||
79 | IDD_PATH, DIALOG | 79 | IDD_PATH, DIALOG |
80 | BEGIN | 80 | BEGIN |
81 | LEFTMARGIN, 7 | 81 | LEFTMARGIN, 7 |
82 | RIGHTMARGIN, 248 | 82 | RIGHTMARGIN, 248 |
83 | VERTGUIDE, 202 | 83 | VERTGUIDE, 202 |
84 | VERTGUIDE, 208 | 84 | VERTGUIDE, 208 |
85 | TOPMARGIN, 7 | 85 | TOPMARGIN, 7 |
86 | BOTTOMMARGIN, 66 | 86 | BOTTOMMARGIN, 66 |
87 | HORZGUIDE, 37 | 87 | HORZGUIDE, 37 |
88 | END | 88 | END |
89 | END | 89 | END |
90 | #endif // APSTUDIO_INVOKED | 90 | #endif // APSTUDIO_INVOKED |
91 | 91 | ||
92 | 92 | ||
93 | #ifdef APSTUDIO_INVOKED | 93 | #ifdef APSTUDIO_INVOKED |
94 | ///////////////////////////////////////////////////////////////////////////// | 94 | ///////////////////////////////////////////////////////////////////////////// |
95 | // | 95 | // |
96 | // TEXTINCLUDE | 96 | // TEXTINCLUDE |
97 | // | 97 | // |
98 | 98 | ||
99 | 1 TEXTINCLUDE DISCARDABLE | 99 | 1 TEXTINCLUDE DISCARDABLE |
100 | BEGIN | 100 | BEGIN |
101 | "resource.h\0" | 101 | "resource.h\0" |
102 | END | 102 | END |
103 | 103 | ||
104 | 2 TEXTINCLUDE DISCARDABLE | 104 | 2 TEXTINCLUDE DISCARDABLE |
105 | BEGIN | 105 | BEGIN |
106 | "#include ""afxres.h""\r\n" | 106 | "#include ""afxres.h""\r\n" |
107 | "\0" | 107 | "\0" |
108 | END | 108 | END |
109 | 109 | ||
110 | 3 TEXTINCLUDE DISCARDABLE | 110 | 3 TEXTINCLUDE DISCARDABLE |
111 | BEGIN | 111 | BEGIN |
112 | "#include ""custom.rch""\0" | 112 | "#include ""custom.rch""\0" |
113 | END | 113 | END |
114 | 114 | ||
115 | #endif // APSTUDIO_INVOKED | 115 | #endif // APSTUDIO_INVOKED |
116 | 116 | ||
117 | 117 | ||
118 | ///////////////////////////////////////////////////////////////////////////// | 118 | ///////////////////////////////////////////////////////////////////////////// |
119 | // | 119 | // |
120 | // Icon | 120 | // Icon |
121 | // | 121 | // |
122 | 122 | ||
123 | // Icon with lowest ID value placed first to ensure application icon | 123 | // Icon with lowest ID value placed first to ensure application icon |
124 | // remains consistent on all systems. | 124 | // remains consistent on all systems. |
125 | IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico" | 125 | IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico" |
126 | 126 | ||
127 | #ifndef _MAC | 127 | #ifndef _MAC |
128 | ///////////////////////////////////////////////////////////////////////////// | 128 | ///////////////////////////////////////////////////////////////////////////// |
129 | // | 129 | // |
130 | // Version | 130 | // Version |
131 | // | 131 | // |
132 | 132 | ||
133 | VS_VERSION_INFO VERSIONINFO | 133 | VS_VERSION_INFO VERSIONINFO |
134 | FILEVERSION 1,1,0,0 | 134 | FILEVERSION 1,1,1,0 |
135 | PRODUCTVERSION 1,1,0,0 | 135 | PRODUCTVERSION 1,1,1,0 |
136 | FILEFLAGSMASK 0x3fL | 136 | FILEFLAGSMASK 0x3fL |
137 | #ifdef _DEBUG | 137 | #ifdef _DEBUG |
138 | FILEFLAGS 0x1L | 138 | FILEFLAGS 0x1L |
139 | #else | 139 | #else |
140 | FILEFLAGS 0x0L | 140 | FILEFLAGS 0x0L |
141 | #endif | 141 | #endif |
142 | FILEOS 0x40004L | 142 | FILEOS 0x40004L |
143 | FILETYPE 0x1L | 143 | FILETYPE 0x1L |
144 | FILESUBTYPE 0x0L | 144 | FILESUBTYPE 0x0L |
145 | BEGIN | 145 | BEGIN |
146 | BLOCK "StringFileInfo" | 146 | BLOCK "StringFileInfo" |
147 | BEGIN | 147 | BEGIN |
148 | BLOCK "040904b0" | 148 | BLOCK "040904b0" |
149 | BEGIN | 149 | BEGIN |
150 | VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0" | 150 | VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0" |
151 | VALUE "FileDescription", "INSTALL: KINSole, telnet client\0" | 151 | VALUE "FileDescription", "INSTALL: KINSole, telnet client\0" |
152 | VALUE "FileVersion", "1, 1, 0, 0\0" | 152 | VALUE "FileVersion", "1, 1, 1, 0\0" |
153 | VALUE "InternalName", "INSTALL\0" | 153 | VALUE "InternalName", "INSTALL\0" |
154 | VALUE "LegalCopyright", "Copyright © 1998-2004 Klever Group (http://www.klever.net/)\0" | 154 | VALUE "LegalCopyright", "Copyright © 1998-2005 Klever Group (http://www.klever.net/)\0" |
155 | VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0" | 155 | VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0" |
156 | VALUE "OriginalFilename", "INSTALL.EXE\0" | 156 | VALUE "OriginalFilename", "INSTALL.EXE\0" |
157 | VALUE "ProductName", "KINSole\0" | 157 | VALUE "ProductName", "KINSole\0" |
158 | VALUE "ProductVersion", "1, 1, 0, 0\0" | 158 | VALUE "ProductVersion", "1, 1, 1, 0\0" |
159 | END | 159 | END |
160 | END | 160 | END |
161 | BLOCK "VarFileInfo" | 161 | BLOCK "VarFileInfo" |
162 | BEGIN | 162 | BEGIN |
163 | VALUE "Translation", 0x409, 1200 | 163 | VALUE "Translation", 0x409, 1200 |
164 | END | 164 | END |
165 | END | 165 | END |
166 | 166 | ||
167 | #endif // !_MAC | 167 | #endif // !_MAC |
168 | 168 | ||
169 | #endif // English (U.S.) resources | 169 | #endif // English (U.S.) resources |
170 | ///////////////////////////////////////////////////////////////////////////// | 170 | ///////////////////////////////////////////////////////////////////////////// |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | #ifndef APSTUDIO_INVOKED | 174 | #ifndef APSTUDIO_INVOKED |
175 | ///////////////////////////////////////////////////////////////////////////// | 175 | ///////////////////////////////////////////////////////////////////////////// |
176 | // | 176 | // |
177 | // Generated from the TEXTINCLUDE 3 resource. | 177 | // Generated from the TEXTINCLUDE 3 resource. |
178 | // | 178 | // |
179 | #include "custom.rch" | 179 | #include "custom.rch" |
180 | ///////////////////////////////////////////////////////////////////////////// | 180 | ///////////////////////////////////////////////////////////////////////////// |
181 | #endif // not APSTUDIO_INVOKED | 181 | #endif // not APSTUDIO_INVOKED |
182 | 182 | ||
diff --git a/kinsole.cpp b/kinsole.cpp index 01286f3..7fa3f8b 100644 --- a/kinsole.cpp +++ b/kinsole.cpp | |||
@@ -1,736 +1,736 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | 2 | ||
3 | #ifdef_DEBUG | 3 | #ifdef_DEBUG |
4 | #include <afxwin.h> | 4 | #include <afxwin.h> |
5 | #else | 5 | #else |
6 | #define ASSERT(f) ((void)0) | 6 | #define ASSERT(f) ((void)0) |
7 | #define VERIFY(f) ((void)(f)) | 7 | #define VERIFY(f) ((void)(f)) |
8 | #define TRACE0(sz) | 8 | #define TRACE0(sz) |
9 | #define TRACE1(sz, p1) | 9 | #define TRACE1(sz, p1) |
10 | #define TRACE2(sz, p1, p2) | 10 | #define TRACE2(sz, p1, p2) |
11 | #define TRACE3(sz, p1, p2, p3) | 11 | #define TRACE3(sz, p1, p2, p3) |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | #include <winsock.h> | 14 | #include <winsock.h> |
15 | #include "resource.h" | 15 | #include "resource.h" |
16 | #include "windowsx.h" | 16 | #include "windowsx.h" |
17 | 17 | ||
18 | #define DAMN_KIN_NAME "KINSole" | 18 | #define DAMN_KIN_NAME "KINSole" |
19 | #define DAMN_KIN_VERSION"1.1" | 19 | #define DAMN_KIN_VERSION"1.1.1" |
20 | 20 | ||
21 | #ifdef _DEBUG | 21 | #ifdef _DEBUG |
22 | #define new DEBUG_NEW | 22 | #define new DEBUG_NEW |
23 | #undef THIS_FILE | 23 | #undef THIS_FILE |
24 | static char THIS_FILE[] = __FILE__; | 24 | static char THIS_FILE[] = __FILE__; |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | enum { | 27 | enum { |
28 | WM_USERSOCKET = WM_USER+16, | 28 | WM_USERSOCKET = WM_USER+16, |
29 | WM_USERKEY, | 29 | WM_USERKEY, |
30 | WM_USERNOP | 30 | WM_USERNOP |
31 | }; | 31 | }; |
32 | enum { | 32 | enum { |
33 | tnIAC = 255, | 33 | tnIAC = 255, |
34 | tnSE = 240, | 34 | tnSE = 240, |
35 | tnNOP = 241, | 35 | tnNOP = 241, |
36 | tnDM = 242, | 36 | tnDM = 242, |
37 | tnBreak = 243, | 37 | tnBreak = 243, |
38 | tnIP = 244, | 38 | tnIP = 244, |
39 | tnAO = 245, | 39 | tnAO = 245, |
40 | tnAYT = 246, | 40 | tnAYT = 246, |
41 | tnEC = 247, | 41 | tnEC = 247, |
42 | tnEL = 248, | 42 | tnEL = 248, |
43 | tnGA = 249, | 43 | tnGA = 249, |
44 | tnSB = 250, | 44 | tnSB = 250, |
45 | tnWILL = 251, | 45 | tnWILL = 251, |
46 | tnWONT = 252, | 46 | tnWONT = 252, |
47 | tnDO = 253, | 47 | tnDO = 253, |
48 | tnDONT = 254 | 48 | tnDONT = 254 |
49 | }; | 49 | }; |
50 | 50 | ||
51 | WSADATA wsaData; | 51 | WSADATA wsaData; |
52 | ATOM wsaWC = NULL; | 52 | ATOM wsaWC = NULL; |
53 | HWND wsaW = NULL; | 53 | HWND wsaW = NULL; |
54 | 54 | ||
55 | CHAR remoteHost[256]; | 55 | CHAR remoteHost[256]; |
56 | CHAR remoteProt[256]; | 56 | CHAR remoteProt[256]; |
57 | sockaddr_in remoteSIN; | 57 | sockaddr_in remoteSIN; |
58 | 58 | ||
59 | 59 | ||
60 | SOCKET telnetSocket; | 60 | SOCKET telnetSocket; |
61 | HANDLE hConsoleInput; | 61 | HANDLE hConsoleInput; |
62 | HANDLE hConsoleOutput; | 62 | HANDLE hConsoleOutput; |
63 | HWND hConsoleWindow; | 63 | HWND hConsoleWindow; |
64 | HANDLE hConsoleThread; | 64 | HANDLE hConsoleThread; |
65 | DWORD consoleThreadID; | 65 | DWORD consoleThreadID; |
66 | HANDLE hDispatchThread; | 66 | HANDLE hDispatchThread; |
67 | DWORD dispatchThreadID; | 67 | DWORD dispatchThreadID; |
68 | BOOL bTelnet,bTermPulled; | 68 | BOOL bTelnet,bTermPulled; |
69 | 69 | ||
70 | enum_cState { | 70 | enum_cState { |
71 | cstateNone = 0, cstateIAC, cstateDO, cstateSB, cstateSBData, | 71 | cstateNone = 0, cstateIAC, cstateDO, cstateSB, cstateSBData, |
72 | cstateSBDataIAC, cstateWILL, cstateDONT,cstateWONT, | 72 | cstateSBDataIAC, cstateWILL, cstateDONT,cstateWONT, |
73 | }connState = cstateNone; | 73 | }connState = cstateNone; |
74 | BYTE negOption = 0; | 74 | BYTE negOption = 0; |
75 | 75 | ||
76 | 76 | ||
77 | BOOL SelectSocket() { | 77 | BOOL SelectSocket() { |
78 | return WSAAsyncSelect(telnetSocket,wsaW,WM_USERSOCKET,FD_READ|FD_OOB|FD_CLOSE)!=SOCKET_ERROR; | 78 | return WSAAsyncSelect(telnetSocket,wsaW,WM_USERSOCKET,FD_READ|FD_OOB|FD_CLOSE)!=SOCKET_ERROR; |
79 | } | 79 | } |
80 | 80 | ||
81 | BOOL ShowWill(BYTE o) | 81 | BOOL ShowWill(BYTE o) |
82 | { | 82 | { |
83 | TRACE1("We're WILLing to %d\n",(WORD)o); | 83 | TRACE1("We're WILLing to %d\n",(WORD)o); |
84 | static | 84 | static |
85 | BYTE d[3] = {tnIAC,tnWILL,0}; | 85 | BYTE d[3] = {tnIAC,tnWILL,0}; |
86 | d[2] = o; | 86 | d[2] = o; |
87 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); | 87 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); |
88 | SelectSocket(); | 88 | SelectSocket(); |
89 | return rv; | 89 | return rv; |
90 | } | 90 | } |
91 | BOOL ShowUnwill(BYTE o) | 91 | BOOL ShowUnwill(BYTE o) |
92 | { | 92 | { |
93 | TRACE1("We're NOT WILLing to %d\n",(WORD)o); | 93 | TRACE1("We're NOT WILLing to %d\n",(WORD)o); |
94 | static | 94 | static |
95 | BYTE d[3] = {tnIAC,tnWONT,0}; | 95 | BYTE d[3] = {tnIAC,tnWONT,0}; |
96 | d[2] = o; | 96 | d[2] = o; |
97 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); | 97 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); |
98 | SelectSocket(); | 98 | SelectSocket(); |
99 | return rv; | 99 | return rv; |
100 | } | 100 | } |
101 | BOOL BegDo(BYTE o) | 101 | BOOL BegDo(BYTE o) |
102 | { | 102 | { |
103 | TRACE1("We beg to DO %d\n",(WORD)o); | 103 | TRACE1("We beg to DO %d\n",(WORD)o); |
104 | static | 104 | static |
105 | BYTE d[3] = {tnIAC,tnDO,0}; | 105 | BYTE d[3] = {tnIAC,tnDO,0}; |
106 | d[2] = o; | 106 | d[2] = o; |
107 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); | 107 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); |
108 | SelectSocket(); | 108 | SelectSocket(); |
109 | return rv; | 109 | return rv; |
110 | } | 110 | } |
111 | BOOL BegDont(BYTE o) | 111 | BOOL BegDont(BYTE o) |
112 | { | 112 | { |
113 | TRACE1("We beg DONT'T %d\n",(WORD)o); | 113 | TRACE1("We beg DONT'T %d\n",(WORD)o); |
114 | static | 114 | static |
115 | BYTE d[3] = {tnIAC,tnDONT,0}; | 115 | BYTE d[3] = {tnIAC,tnDONT,0}; |
116 | d[2] = o; | 116 | d[2] = o; |
117 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); | 117 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); |
118 | SelectSocket(); | 118 | SelectSocket(); |
119 | return rv; | 119 | return rv; |
120 | } | 120 | } |
121 | BOOL SubNegotiate(BYTE o,LPBYTE data,UINT size) | 121 | BOOL SubNegotiate(BYTE o,LPBYTE data,UINT size) |
122 | { | 122 | { |
123 | LPBYTE d = new BYTE[3+size*2+2]; | 123 | LPBYTE d = new BYTE[3+size*2+2]; |
124 | int ds = 0; | 124 | int ds = 0; |
125 | d[ds++]=tnIAC; d[ds++]=tnSB; d[ds++]=o; | 125 | d[ds++]=tnIAC; d[ds++]=tnSB; d[ds++]=o; |
126 | for(UINT tmp=0;tmp<size;tmp++) | 126 | for(UINT tmp=0;tmp<size;tmp++) |
127 | if(data[tmp]!=tnIAC) | 127 | if(data[tmp]!=tnIAC) |
128 | d[ds++]=data[tmp]; | 128 | d[ds++]=data[tmp]; |
129 | else{ | 129 | else{ |
130 | d[ds++]=tnIAC; d[ds++]=tnIAC; | 130 | d[ds++]=tnIAC; d[ds++]=tnIAC; |
131 | } | 131 | } |
132 | d[ds++]=tnIAC;d[ds++]=tnSE; | 132 | d[ds++]=tnIAC;d[ds++]=tnSE; |
133 | BOOL rv = send(telnetSocket,(char*)d,ds,0)==ds; | 133 | BOOL rv = send(telnetSocket,(char*)d,ds,0)==ds; |
134 | delete d; | 134 | delete d; |
135 | SelectSocket(); | 135 | SelectSocket(); |
136 | return rv; | 136 | return rv; |
137 | } | 137 | } |
138 | BOOL SendLiteral(CHAR c) | 138 | BOOL SendLiteral(CHAR c) |
139 | { | 139 | { |
140 | BYTE d[2] = {tnIAC,0}; | 140 | BYTE d[2] = {tnIAC,0}; |
141 | BOOL rv = FALSE; | 141 | BOOL rv = FALSE; |
142 | if(c==tnIAC){ | 142 | if(c==tnIAC){ |
143 | d[1]=c; | 143 | d[1]=c; |
144 | rv = send(telnetSocket,(char*)d,2,0)==2; | 144 | rv = send(telnetSocket,(char*)d,2,0)==2; |
145 | }else | 145 | }else |
146 | rv = send(telnetSocket,&c,1,0)==1; | 146 | rv = send(telnetSocket,&c,1,0)==1; |
147 | return rv; | 147 | return rv; |
148 | } | 148 | } |
149 | BOOL SendLiteral(LPCTSTR c,UINT size) | 149 | BOOL SendLiteral(LPCTSTR c,UINT size) |
150 | { | 150 | { |
151 | for(UINT tmp=0;tmp<size;tmp++) | 151 | for(UINT tmp=0;tmp<size;tmp++) |
152 | SendLiteral(c[tmp]); | 152 | SendLiteral(c[tmp]); |
153 | return TRUE; | 153 | return TRUE; |
154 | } | 154 | } |
155 | BOOL SendLiteral(LPCTSTR c) | 155 | BOOL SendLiteral(LPCTSTR c) |
156 | { | 156 | { |
157 | return SendLiteral(c,strlen(c)); | 157 | return SendLiteral(c,strlen(c)); |
158 | } | 158 | } |
159 | BOOL SendCommand(BYTE c) | 159 | BOOL SendCommand(BYTE c) |
160 | { | 160 | { |
161 | TRACE1("Issuing %d command\n",(WORD)c); | 161 | TRACE1("Issuing %d command\n",(WORD)c); |
162 | static | 162 | static |
163 | BYTE d[2] = {tnIAC,0}; | 163 | BYTE d[2] = {tnIAC,0}; |
164 | d[1] = c; | 164 | d[1] = c; |
165 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); | 165 | BOOL rv = send(telnetSocket,(char*)d,sizeof(d),0)==sizeof(d); |
166 | SelectSocket(); | 166 | SelectSocket(); |
167 | return rv; | 167 | return rv; |
168 | 168 | ||
169 | } | 169 | } |
170 | 170 | ||
171 | BOOL CALLBACK consoleCtrlHandler(DWORD dwCtrlType) | 171 | BOOL CALLBACK consoleCtrlHandler(DWORD dwCtrlType) |
172 | { | 172 | { |
173 | switch(dwCtrlType){ | 173 | switch(dwCtrlType){ |
174 | case CTRL_BREAK_EVENT: | 174 | case CTRL_BREAK_EVENT: |
175 | SendCommand(tnIP); | 175 | SendCommand(tnIP); |
176 | return TRUE; | 176 | return TRUE; |
177 | case CTRL_CLOSE_EVENT: | 177 | case CTRL_CLOSE_EVENT: |
178 | case CTRL_LOGOFF_EVENT: | 178 | case CTRL_LOGOFF_EVENT: |
179 | case CTRL_SHUTDOWN_EVENT: | 179 | case CTRL_SHUTDOWN_EVENT: |
180 | PostMessage(wsaW,WM_QUIT,0,0); | 180 | PostMessage(wsaW,WM_QUIT,0,0); |
181 | return TRUE; | 181 | return TRUE; |
182 | } | 182 | } |
183 | return FALSE; | 183 | return FALSE; |
184 | } | 184 | } |
185 | 185 | ||
186 | #include "options.cpp" | 186 | #include "options.cpp" |
187 | 187 | ||
188 | BOOL ProcessConsoleInput() | 188 | BOOL ProcessConsoleInput() |
189 | { | 189 | { |
190 | INPUT_RECORD ir[512]; | 190 | INPUT_RECORD ir[512]; |
191 | DWORD got; | 191 | DWORD got; |
192 | while(GetNumberOfConsoleInputEvents(hConsoleInput,&got) && got){ | 192 | while(GetNumberOfConsoleInputEvents(hConsoleInput,&got) && got){ |
193 | VERIFY(ReadConsoleInput(hConsoleInput,ir,(sizeof(ir)/sizeof(*ir)),&got)); | 193 | VERIFY(ReadConsoleInput(hConsoleInput,ir,(sizeof(ir)/sizeof(*ir)),&got)); |
194 | for(DWORD tmp=0;tmp<got;tmp++){ | 194 | for(DWORD tmp=0;tmp<got;tmp++){ |
195 | if(ir[tmp].EventType==KEY_EVENT && ir[tmp].Event.KeyEvent.bKeyDown){ | 195 | if(ir[tmp].EventType==KEY_EVENT && ir[tmp].Event.KeyEvent.bKeyDown){ |
196 | if(( | 196 | if(( |
197 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='X' || | 197 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='X' || |
198 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='Q' | 198 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='Q' |
199 | ) && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) | 199 | ) && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) |
200 | ){ | 200 | ){ |
201 | PostMessage(wsaW,WM_QUIT,0,0); | 201 | PostMessage(wsaW,WM_QUIT,0,0); |
202 | return FALSE; | 202 | return FALSE; |
203 | }else if( | 203 | }else if( |
204 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='O' | 204 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='O' |
205 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) | 205 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) |
206 | ){ | 206 | ){ |
207 | SendCommand(tnAO); | 207 | SendCommand(tnAO); |
208 | }else if( | 208 | }else if( |
209 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='Y' | 209 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='Y' |
210 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) | 210 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) |
211 | ){ | 211 | ){ |
212 | SendCommand(tnAYT); | 212 | SendCommand(tnAYT); |
213 | }else if( | 213 | }else if( |
214 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='T' | 214 | ir[tmp].Event.KeyEvent.wVirtualKeyCode=='T' |
215 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) | 215 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) |
216 | ){ | 216 | ){ |
217 | BegDo(toTimingMark); | 217 | BegDo(toTimingMark); |
218 | }else if( | 218 | }else if( |
219 | ir[tmp].Event.KeyEvent.wVirtualKeyCode==VK_INSERT | 219 | ir[tmp].Event.KeyEvent.wVirtualKeyCode==VK_INSERT |
220 | && ir[tmp].Event.KeyEvent.dwControlKeyState&SHIFT_PRESSED | 220 | && ir[tmp].Event.KeyEvent.dwControlKeyState&SHIFT_PRESSED |
221 | ){ | 221 | ){ |
222 | if(IsClipboardFormatAvailable(CF_OEMTEXT)){ | 222 | if(IsClipboardFormatAvailable(CF_OEMTEXT)){ |
223 | ASSERT(wsaW); | 223 | ASSERT(wsaW); |
224 | if(OpenClipboard(wsaW)){ | 224 | if(OpenClipboard(wsaW)){ |
225 | HANDLE h = GetClipboardData(CF_OEMTEXT); | 225 | HANDLE h = GetClipboardData(CF_OEMTEXT); |
226 | LPVOID gl = GlobalLock(h); | 226 | LPVOID gl = GlobalLock(h); |
227 | TerminalIn((LPCTSTR)gl); | 227 | TerminalIn((LPCTSTR)gl); |
228 | GlobalUnlock(h); | 228 | GlobalUnlock(h); |
229 | // GlobalFree(h); | 229 | // GlobalFree(h); |
230 | CloseClipboard(); | 230 | CloseClipboard(); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | }else if( | 233 | }else if( |
234 | ir[tmp].Event.KeyEvent.wVirtualKeyCode==VK_INSERT | 234 | ir[tmp].Event.KeyEvent.wVirtualKeyCode==VK_INSERT |
235 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) | 235 | && ir[tmp].Event.KeyEvent.dwControlKeyState&(LEFT_ALT_PRESSED|RIGHT_ALT_PRESSED) |
236 | ){ | 236 | ){ |
237 | if(hConsoleWindow) | 237 | if(hConsoleWindow) |
238 | SendNotifyMessage(hConsoleWindow,WM_COMMAND,MAKELONG(0xE003,0),NULL); | 238 | SendNotifyMessage(hConsoleWindow,WM_COMMAND,MAKELONG(0xE003,0),NULL); |
239 | }else | 239 | }else |
240 | TerminalIn(ir[tmp].Event.KeyEvent); | 240 | TerminalIn(ir[tmp].Event.KeyEvent); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | return TRUE; | 245 | return TRUE; |
246 | } | 246 | } |
247 | 247 | ||
248 | ULONG CALLBACK ConsoleThreadProc(LPVOID) | 248 | ULONG CALLBACK ConsoleThreadProc(LPVOID) |
249 | { | 249 | { |
250 | for(;;){ | 250 | for(;;){ |
251 | DWORD eves; | 251 | DWORD eves; |
252 | if(!(GetNumberOfConsoleInputEvents(hConsoleInput,&eves) && eves)) | 252 | if(!(GetNumberOfConsoleInputEvents(hConsoleInput,&eves) && eves)) |
253 | WaitForSingleObject(hConsoleInput,INFINITE); | 253 | WaitForSingleObject(hConsoleInput,INFINITE); |
254 | ASSERT(wsaW); | 254 | ASSERT(wsaW); |
255 | SendMessage(wsaW,WM_USERKEY,0,0); | 255 | SendMessage(wsaW,WM_USERKEY,0,0); |
256 | } | 256 | } |
257 | return 0; | 257 | return 0; |
258 | } | 258 | } |
259 | 259 | ||
260 | BOOL SINTelnet(sockaddr_in& sin) | 260 | BOOL SINTelnet(sockaddr_in& sin) |
261 | { | 261 | { |
262 | protoent* pe = getprotobyname("tcp"); | 262 | protoent* pe = getprotobyname("tcp"); |
263 | short proto = pe?pe->p_proto:6; | 263 | short proto = pe?pe->p_proto:6; |
264 | telnetSocket = socket(sin.sin_family,SOCK_STREAM,proto); | 264 | telnetSocket = socket(sin.sin_family,SOCK_STREAM,proto); |
265 | if(telnetSocket==INVALID_SOCKET){ | 265 | if(telnetSocket==INVALID_SOCKET){ |
266 | printf("Failed to create socket\n"); | 266 | printf("Failed to create socket\n"); |
267 | return FALSE; | 267 | return FALSE; |
268 | } | 268 | } |
269 | static | 269 | static |
270 | BOOL bOOBInline = FALSE; | 270 | BOOL bOOBInline = FALSE; |
271 | if(setsockopt(telnetSocket,SOL_SOCKET,SO_OOBINLINE,(const char*)&bOOBInline,sizeof(bOOBInline))){ | 271 | if(setsockopt(telnetSocket,SOL_SOCKET,SO_OOBINLINE,(const char*)&bOOBInline,sizeof(bOOBInline))){ |
272 | TRACE0("Failed to setsockopt for OOB data\n"); | 272 | TRACE0("Failed to setsockopt for OOB data\n"); |
273 | } | 273 | } |
274 | printf("Trying %s..",inet_ntoa(sin.sin_addr)); | 274 | printf("Trying %s..",inet_ntoa(sin.sin_addr)); |
275 | if(connect(telnetSocket,(sockaddr*)&sin,sizeof(sin))){ | 275 | if(connect(telnetSocket,(sockaddr*)&sin,sizeof(sin))){ |
276 | switch(WSAGetLastError()){ | 276 | switch(WSAGetLastError()){ |
277 | case WSAECONNREFUSED: printf("\nConnection refused\n"); break; | 277 | case WSAECONNREFUSED: printf("\nConnection refused\n"); break; |
278 | case WSAEHOSTUNREACH: printf("\nNo route to host\n"); break; | 278 | case WSAEHOSTUNREACH: printf("\nNo route to host\n"); break; |
279 | case WSAENETDOWN: printf("\nNetwork is down\n"); break; | 279 | case WSAENETDOWN: printf("\nNetwork is down\n"); break; |
280 | case WSAENETUNREACH: printf("\nNetwork is unreachable\n"); break; | 280 | case WSAENETUNREACH: printf("\nNetwork is unreachable\n"); break; |
281 | case WSAETIMEDOUT: printf("\nConnection timed out\n"); break; | 281 | case WSAETIMEDOUT: printf("\nConnection timed out\n"); break; |
282 | default: printf("\nFailed to connect\n"); break; | 282 | default: printf("\nFailed to connect\n"); break; |
283 | } | 283 | } |
284 | return FALSE; | 284 | return FALSE; |
285 | } | 285 | } |
286 | printf("\nConnected. Alt-X/Alt-Q - Close telnet connection\n"); | 286 | printf("\nConnected. Alt-X/Alt-Q - Close telnet connection\n"); |
287 | //***hConsoleInput = ::GetStdHandle(STD_INPUT_HANDLE); | 287 | //***hConsoleInput = ::GetStdHandle(STD_INPUT_HANDLE); |
288 | //***hConsoleOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); | 288 | //***hConsoleOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); |
289 | hConsoleInput = CreateFile("CONIN$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, | 289 | hConsoleInput = CreateFile("CONIN$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, |
290 | NULL,OPEN_EXISTING,0,NULL); | 290 | NULL,OPEN_EXISTING,0,NULL); |
291 | hConsoleOutput = CreateFile("CONOUT$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, | 291 | hConsoleOutput = CreateFile("CONOUT$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, |
292 | NULL,OPEN_EXISTING,0,NULL); | 292 | NULL,OPEN_EXISTING,0,NULL); |
293 | ASSERT(hConsoleInput!=INVALID_HANDLE_VALUE && | 293 | ASSERT(hConsoleInput!=INVALID_HANDLE_VALUE && |
294 | hConsoleOutput!=INVALID_HANDLE_VALUE); | 294 | hConsoleOutput!=INVALID_HANDLE_VALUE); |
295 | if(!(bTelnet || bTermPulled)) | 295 | if(!(bTelnet || bTermPulled)) |
296 | TerminalPullType("TTY"); | 296 | TerminalPullType("TTY"); |
297 | InitOptionsTable(); | 297 | InitOptionsTable(); |
298 | TRACE0("Connected\n"); | 298 | TRACE0("Connected\n"); |
299 | VERIFY(SetConsoleCtrlHandler(&consoleCtrlHandler,TRUE)); | 299 | VERIFY(SetConsoleCtrlHandler(&consoleCtrlHandler,TRUE)); |
300 | hConsoleThread = CreateThread(NULL,0,ConsoleThreadProc,NULL,0,&consoleThreadID); | 300 | hConsoleThread = CreateThread(NULL,0,ConsoleThreadProc,NULL,0,&consoleThreadID); |
301 | ASSERT(hConsoleThread); | 301 | ASSERT(hConsoleThread); |
302 | if(bTelnet){ | 302 | if(bTelnet){ |
303 | AskDo(toSuppressGA); | 303 | AskDo(toSuppressGA); |
304 | AskWill(toTerminalType); | 304 | AskWill(toTerminalType); |
305 | AskWill(toNAWS); | 305 | AskWill(toNAWS); |
306 | AskUnwill(toEcho); | 306 | AskUnwill(toEcho); |
307 | AskDo(toEcho); | 307 | AskDo(toEcho); |
308 | if(Envars && nEnvars) | 308 | if(Envars && nEnvars) |
309 | AskWill(toNewEnviron);// *** Or better (what's better?) | 309 | AskWill(toNewEnviron);// *** Or better (what's better?) |
310 | //AskWill(toLineMode); | 310 | //AskWill(toLineMode); |
311 | // *** STATUS | 311 | // *** STATUS |
312 | } | 312 | } |
313 | MSG msg; | 313 | MSG msg; |
314 | int rvgm; | 314 | int rvgm; |
315 | PostMessage(wsaW,WM_USERNOP,0,0); | 315 | PostMessage(wsaW,WM_USERNOP,0,0); |
316 | VERIFY(SelectSocket()); | 316 | VERIFY(SelectSocket()); |
317 | while(rvgm=GetMessage(&msg,NULL,NULL,NULL)){ | 317 | while(rvgm=GetMessage(&msg,NULL,NULL,NULL)){ |
318 | if(rvgm<0) | 318 | if(rvgm<0) |
319 | break;// Some wheeping needed | 319 | break;// Some wheeping needed |
320 | TranslateMessage(&msg); | 320 | TranslateMessage(&msg); |
321 | DispatchMessage(&msg); | 321 | DispatchMessage(&msg); |
322 | //LRESULT CALLBACK WSWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); | 322 | //LRESULT CALLBACK WSWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); |
323 | // WSWndProc(msg.hwnd,msg.message,msg.wParam,msg.lParam); | 323 | // WSWndProc(msg.hwnd,msg.message,msg.wParam,msg.lParam); |
324 | VERIFY(SelectSocket()); | 324 | VERIFY(SelectSocket()); |
325 | } | 325 | } |
326 | VERIFY(TerminateThread(hConsoleThread,0xFFFFFFFF)); | 326 | VERIFY(TerminateThread(hConsoleThread,0xFFFFFFFF)); |
327 | VERIFY(SetConsoleCtrlHandler(&consoleCtrlHandler,FALSE)); | 327 | VERIFY(SetConsoleCtrlHandler(&consoleCtrlHandler,FALSE)); |
328 | closesocket(telnetSocket); | 328 | closesocket(telnetSocket); |
329 | return TRUE; | 329 | return TRUE; |
330 | } | 330 | } |
331 | 331 | ||
332 | BOOL Telnet(LPCTSTR hostName,UINT port) | 332 | BOOL Telnet(LPCTSTR hostName,UINT port) |
333 | { | 333 | { |
334 | memset(&remoteSIN,0,sizeof(remoteSIN)); | 334 | memset(&remoteSIN,0,sizeof(remoteSIN)); |
335 | remoteSIN.sin_family = AF_INET; | 335 | remoteSIN.sin_family = AF_INET; |
336 | remoteSIN.sin_port = htons(port); | 336 | remoteSIN.sin_port = htons(port); |
337 | 337 | ||
338 | remoteSIN.sin_addr.s_addr = inet_addr(hostName); | 338 | remoteSIN.sin_addr.s_addr = inet_addr(hostName); |
339 | if(remoteSIN.sin_addr.s_addr==INADDR_NONE){ | 339 | if(remoteSIN.sin_addr.s_addr==INADDR_NONE){ |
340 | hostent* he = gethostbyname(hostName); | 340 | hostent* he = gethostbyname(hostName); |
341 | if(!he){ | 341 | if(!he){ |
342 | printf("Failed to resolve host name\n"); | 342 | printf("Failed to resolve host name\n"); |
343 | return FALSE; | 343 | return FALSE; |
344 | } | 344 | } |
345 | ASSERT(he->h_addrtype==AF_INET); | 345 | ASSERT(he->h_addrtype==AF_INET); |
346 | ASSERT(he->h_length==sizeof(remoteSIN.sin_addr)); | 346 | ASSERT(he->h_length==sizeof(remoteSIN.sin_addr)); |
347 | memmove(&remoteSIN.sin_addr,*he->h_addr_list,sizeof(remoteSIN.sin_addr)); | 347 | memmove(&remoteSIN.sin_addr,*he->h_addr_list,sizeof(remoteSIN.sin_addr)); |
348 | } | 348 | } |
349 | strcpy(remoteHost,hostName); | 349 | strcpy(remoteHost,hostName); |
350 | return SINTelnet(remoteSIN); | 350 | return SINTelnet(remoteSIN); |
351 | } | 351 | } |
352 | 352 | ||
353 | 353 | ||
354 | void ProcessIACByte(BYTE c) | 354 | void ProcessIACByte(BYTE c) |
355 | { | 355 | { |
356 | connState = cstateNone; | 356 | connState = cstateNone; |
357 | switch(c){ | 357 | switch(c){ |
358 | case tnIAC: | 358 | case tnIAC: |
359 | TerminalOut(c); | 359 | TerminalOut(c); |
360 | break; | 360 | break; |
361 | case tnSE: | 361 | case tnSE: |
362 | TRACE0("SE\n");break; | 362 | TRACE0("SE\n");break; |
363 | case tnNOP: | 363 | case tnNOP: |
364 | TRACE0("NOP\n");break; | 364 | TRACE0("NOP\n");break; |
365 | case tnDM: | 365 | case tnDM: |
366 | TRACE0("DM\n");break; | 366 | TRACE0("DM\n");break; |
367 | case tnBreak: | 367 | case tnBreak: |
368 | TRACE0("Break\n");break; | 368 | TRACE0("Break\n");break; |
369 | case tnIP: | 369 | case tnIP: |
370 | TRACE0("IP\n");break; | 370 | TRACE0("IP\n");break; |
371 | case tnAO: | 371 | case tnAO: |
372 | TRACE0("AO\n");break; | 372 | TRACE0("AO\n");break; |
373 | case tnAYT: | 373 | case tnAYT: |
374 | TRACE0("AYT\n");break; | 374 | TRACE0("AYT\n");break; |
375 | case tnEC: | 375 | case tnEC: |
376 | TRACE0("EC\n");break; | 376 | TRACE0("EC\n");break; |
377 | case tnEL: | 377 | case tnEL: |
378 | TRACE0("EL\n");break; | 378 | TRACE0("EL\n");break; |
379 | case tnGA: | 379 | case tnGA: |
380 | TRACE0("GA\n");break; | 380 | TRACE0("GA\n");break; |
381 | case tnSB: | 381 | case tnSB: |
382 | connState = cstateSB; | 382 | connState = cstateSB; |
383 | break; | 383 | break; |
384 | case tnWILL: | 384 | case tnWILL: |
385 | connState = cstateWILL; | 385 | connState = cstateWILL; |
386 | break; | 386 | break; |
387 | case tnWONT: | 387 | case tnWONT: |
388 | connState = cstateWONT; | 388 | connState = cstateWONT; |
389 | break; | 389 | break; |
390 | case tnDO: | 390 | case tnDO: |
391 | connState = cstateDO; | 391 | connState = cstateDO; |
392 | break; | 392 | break; |
393 | case tnDONT: | 393 | case tnDONT: |
394 | connState = cstateDONT; | 394 | connState = cstateDONT; |
395 | break; | 395 | break; |
396 | default: | 396 | default: |
397 | TRACE1("Unknown OpCode = %d\n",(WORD)c); | 397 | TRACE1("Unknown OpCode = %d\n",(WORD)c); |
398 | break; | 398 | break; |
399 | } | 399 | } |
400 | } | 400 | } |
401 | 401 | ||
402 | void ProcessNetByte(BYTE c) | 402 | void ProcessNetByte(BYTE c) |
403 | { | 403 | { |
404 | //TRACE1("<%d>",connState); | 404 | //TRACE1("<%d>",connState); |
405 | switch(connState){ | 405 | switch(connState){ |
406 | case cstateWONT: | 406 | case cstateWONT: |
407 | ProcessWONT(c); | 407 | ProcessWONT(c); |
408 | break; | 408 | break; |
409 | case cstateDO: | 409 | case cstateDO: |
410 | ProcessDO(c); | 410 | ProcessDO(c); |
411 | break; | 411 | break; |
412 | case cstateWILL: | 412 | case cstateWILL: |
413 | ProcessWILL(c); | 413 | ProcessWILL(c); |
414 | break; | 414 | break; |
415 | case cstateDONT: | 415 | case cstateDONT: |
416 | ProcessDONT(c); | 416 | ProcessDONT(c); |
417 | break; | 417 | break; |
418 | case cstateSB: | 418 | case cstateSB: |
419 | negOption = c; | 419 | negOption = c; |
420 | connState = cstateSBData; | 420 | connState = cstateSBData; |
421 | break; | 421 | break; |
422 | case cstateSBData: | 422 | case cstateSBData: |
423 | case cstateSBDataIAC: | 423 | case cstateSBDataIAC: |
424 | ProcessSBData(c); | 424 | ProcessSBData(c); |
425 | break; | 425 | break; |
426 | case cstateIAC: | 426 | case cstateIAC: |
427 | ProcessIACByte(c); | 427 | ProcessIACByte(c); |
428 | break; | 428 | break; |
429 | case cstateNone: | 429 | case cstateNone: |
430 | default: | 430 | default: |
431 | ASSERT(connState==cstateNone); | 431 | ASSERT(connState==cstateNone); |
432 | if(c==tnIAC) | 432 | if(c==tnIAC) |
433 | connState=cstateIAC; | 433 | connState=cstateIAC; |
434 | else | 434 | else |
435 | TerminalOut(c); | 435 | TerminalOut(c); |
436 | break; | 436 | break; |
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | LRESULT WSMessage(WPARAM wP,LPARAM lP) | 440 | LRESULT WSMessage(WPARAM wP,LPARAM lP) |
441 | { | 441 | { |
442 | if(WSAGETSELECTERROR(lP)){ | 442 | if(WSAGETSELECTERROR(lP)){ |
443 | TRACE0("SelectError\n"); | 443 | TRACE0("SelectError\n"); |
444 | PostMessage(wsaW,WM_QUIT,0,0); | 444 | PostMessage(wsaW,WM_QUIT,0,0); |
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | if(WSAGETSELECTEVENT(lP)&FD_READ){ | 447 | if(WSAGETSELECTEVENT(lP)&FD_READ){ |
448 | //?? TRACE0("FD_READ\n"); | 448 | //?? TRACE0("FD_READ\n"); |
449 | BYTE input[80*12]; | 449 | BYTE input[80*12]; |
450 | int got; | 450 | int got; |
451 | TerminalPreO(); | 451 | TerminalPreO(); |
452 | //?? TRACE0("rv\n"); | 452 | //?? TRACE0("rv\n"); |
453 | got=recv(telnetSocket,(CHAR*)input,sizeof(input),0); | 453 | got=recv(telnetSocket,(CHAR*)input,sizeof(input),0); |
454 | //?? TRACE1("/rv %d\n",got); | 454 | //?? TRACE1("/rv %d\n",got); |
455 | for(int tmp=0;tmp<got;tmp++) | 455 | for(int tmp=0;tmp<got;tmp++) |
456 | ProcessNetByte(input[tmp]); | 456 | ProcessNetByte(input[tmp]); |
457 | TerminalPostO(); | 457 | TerminalPostO(); |
458 | //?? TRACE0("/FD_READ\n"); | 458 | //?? TRACE0("/FD_READ\n"); |
459 | return 0; | 459 | return 0; |
460 | } | 460 | } |
461 | if(WSAGETSELECTEVENT(lP)&FD_OOB){ | 461 | if(WSAGETSELECTEVENT(lP)&FD_OOB){ |
462 | TRACE0("OOB\n"); | 462 | TRACE0("OOB\n"); |
463 | } | 463 | } |
464 | if(WSAGETSELECTEVENT(lP)&FD_CLOSE){ | 464 | if(WSAGETSELECTEVENT(lP)&FD_CLOSE){ |
465 | TRACE0("CLOSE\n"); | 465 | TRACE0("CLOSE\n"); |
466 | PostMessage(wsaW,WM_QUIT,0,0); | 466 | PostMessage(wsaW,WM_QUIT,0,0); |
467 | return 0; | 467 | return 0; |
468 | } | 468 | } |
469 | VERIFY(SelectSocket()); | 469 | VERIFY(SelectSocket()); |
470 | return 0; | 470 | return 0; |
471 | } | 471 | } |
472 | 472 | ||
473 | LRESULT CALLBACK WSWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) | 473 | LRESULT CALLBACK WSWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) |
474 | { | 474 | { |
475 | switch(uMsg){ | 475 | switch(uMsg){ |
476 | case WM_USERSOCKET: | 476 | case WM_USERSOCKET: |
477 | return WSMessage(wParam,lParam); | 477 | return WSMessage(wParam,lParam); |
478 | case WM_USERKEY: | 478 | case WM_USERKEY: |
479 | return ProcessConsoleInput(); | 479 | return ProcessConsoleInput(); |
480 | default: | 480 | default: |
481 | TRACE0("DEFWINDOWPROC\n"); | 481 | TRACE0("DEFWINDOWPROC\n"); |
482 | return ::DefWindowProc(hWnd,uMsg,wParam,lParam); | 482 | return ::DefWindowProc(hWnd,uMsg,wParam,lParam); |
483 | } | 483 | } |
484 | return 0; | 484 | return 0; |
485 | } | 485 | } |
486 | 486 | ||
487 | 487 | ||
488 | BOOL InitializeWinsock() | 488 | BOOL InitializeWinsock() |
489 | { | 489 | { |
490 | if(WSAStartup(0x101,&wsaData)){ | 490 | if(WSAStartup(0x101,&wsaData)){ |
491 | printf("Failed to initialize winsock services\n"); | 491 | printf("Failed to initialize winsock services\n"); |
492 | return FALSE; | 492 | return FALSE; |
493 | } | 493 | } |
494 | WNDCLASS wc; | 494 | WNDCLASS wc; |
495 | memset(&wc,0,sizeof(wc)); | 495 | memset(&wc,0,sizeof(wc)); |
496 | wc.lpfnWndProc=WSWndProc; wc.hInstance=::GetModuleHandle(NULL); | 496 | wc.lpfnWndProc=WSWndProc; wc.hInstance=::GetModuleHandle(NULL); |
497 | wc.lpszClassName = "_WSTFWC_"; | 497 | wc.lpszClassName = "_WSTFWC_"; |
498 | wsaWC = RegisterClass(&wc); | 498 | wsaWC = RegisterClass(&wc); |
499 | if(!wsaWC){ | 499 | if(!wsaWC){ |
500 | printf("Failed to initialize winsock services - 1\n"); | 500 | printf("Failed to initialize winsock services - 1\n"); |
501 | return FALSE; | 501 | return FALSE; |
502 | } | 502 | } |
503 | wsaW = ::CreateWindow("_WSTFWC_","KIN Sole Mio",0,0,0,0,0,NULL,NULL,::GetModuleHandle(NULL),NULL); | 503 | wsaW = ::CreateWindow("_WSTFWC_","KIN Sole Mio",0,0,0,0,0,NULL,NULL,::GetModuleHandle(NULL),NULL); |
504 | if(!wsaW){ | 504 | if(!wsaW){ |
505 | printf("Failed to initialize winsock services\n"); | 505 | printf("Failed to initialize winsock services\n"); |
506 | return FALSE; | 506 | return FALSE; |
507 | } | 507 | } |
508 | return TRUE; | 508 | return TRUE; |
509 | } | 509 | } |
510 | void DeinitializeWinsock() | 510 | void DeinitializeWinsock() |
511 | { | 511 | { |
512 | if(wsaW) | 512 | if(wsaW) |
513 | ::DestroyWindow(wsaW); | 513 | ::DestroyWindow(wsaW); |
514 | wsaW=NULL; | 514 | wsaW=NULL; |
515 | if(wsaWC) | 515 | if(wsaWC) |
516 | ::UnregisterClass("_WSTFWC_",::GetModuleHandle(NULL)); | 516 | ::UnregisterClass("_WSTFWC_",::GetModuleHandle(NULL)); |
517 | wsaWC=NULL; | 517 | wsaWC=NULL; |
518 | WSACleanup(); | 518 | WSACleanup(); |
519 | } | 519 | } |
520 | 520 | ||
521 | HWND GetThisConsoleWnd() | 521 | HWND GetThisConsoleWnd() |
522 | { | 522 | { |
523 | DWORD pid = GetCurrentProcessId(); | 523 | DWORD pid = GetCurrentProcessId(); |
524 | CHAR title[512]; | 524 | CHAR title[512]; |
525 | CHAR* t = title; | 525 | CHAR* t = title; |
526 | if(!GetConsoleTitle(title,sizeof(title))) | 526 | if(!GetConsoleTitle(title,sizeof(title))) |
527 | t = NULL; | 527 | t = NULL; |
528 | HWND hrv = FindWindowEx(NULL,NULL,"tty",t); | 528 | HWND hrv = FindWindowEx(NULL,NULL,"tty",t); |
529 | HWND nopro = NULL; | 529 | HWND nopro = NULL; |
530 | UINT nopros=0; | 530 | UINT nopros=0; |
531 | do{ | 531 | do{ |
532 | DWORD wpid; | 532 | DWORD wpid; |
533 | if(!GetWindowThreadProcessId(hrv,&wpid)) | 533 | if(!GetWindowThreadProcessId(hrv,&wpid)) |
534 | continue; | 534 | continue; |
535 | if(wpid==pid) | 535 | if(wpid==pid) |
536 | return hrv; | 536 | return hrv; |
537 | nopro=hrv; | 537 | nopro=hrv; |
538 | nopros++; | 538 | nopros++; |
539 | hrv = FindWindowEx(NULL,hrv,"tty",t); | 539 | hrv = FindWindowEx(NULL,hrv,"tty",t); |
540 | }while(hrv); | 540 | }while(hrv); |
541 | if(nopros==1){ | 541 | if(nopros==1){ |
542 | ASSERT(nopro); | 542 | ASSERT(nopro); |
543 | return nopro; | 543 | return nopro; |
544 | } | 544 | } |
545 | return NULL; | 545 | return NULL; |
546 | } | 546 | } |
547 | 547 | ||
548 | main(int argc,char*argv[]) | 548 | main(int argc,char*argv[]) |
549 | { | 549 | { |
550 | if(argc<2){ | 550 | if(argc<2){ |
551 | usagebye: | 551 | usagebye: |
552 | printf( | 552 | printf( |
553 | DAMN_KIN_NAME " " DAMN_KIN_VERSION ", Copyright (c) 1998-2004 Klever Group (http://www.klever.net/)\n\n" | 553 | DAMN_KIN_NAME " " DAMN_KIN_VERSION ", Copyright (c) 1998-2005 Klever Group (http://www.klever.net/)\n\n" |
554 | "Usage:\t" DAMN_KIN_NAME " [<options> ]<host-name/ip-address>[ <port>]\n\n" | 554 | "Usage:\t" DAMN_KIN_NAME " [<options> ]<host-name/ip-address>[ <port>]\n\n" |
555 | "Options are:\n" | 555 | "Options are:\n" |
556 | "-r## or -##\tSet number of rows in console screenbuffer\n" | 556 | "-r## or -##\tSet number of rows in console screenbuffer\n" |
557 | "-c##\t\tSet number of columns in console screenbuffer\n" | 557 | "-c##\t\tSet number of columns in console screenbuffer\n" |
558 | "\tnote: changing console screenbuffer size may not work properly\n" | 558 | "\tnote: changing console screenbuffer size may not work properly\n" |
559 | "\twhen in full-screen mode\n" | 559 | "\twhen in full-screen mode\n" |
560 | "-l<user>\tPass username to remote server in environment\n" | 560 | "-l<user>\tPass username to remote server in environment\n" |
561 | "-e<var>=<val>\tPass environment variable to remote server\n" | 561 | "-e<var>=<val>\tPass environment variable to remote server\n" |
562 | "-v<var>=<val>\tPass user environment variable to remote server\n" | 562 | "-v<var>=<val>\tPass user environment variable to remote server\n" |
563 | "-t<termtype>\tChange preferred terminal type\n" | 563 | "-t<termtype>\tChange preferred terminal type\n" |
564 | "\tnote: there are only two different terminal emulations in this\n" | 564 | "\tnote: there are only two different terminal emulations in this\n" |
565 | "\trelease - one for dumb terminal and one for vt terminal\n" | 565 | "\trelease - one for dumb terminal and one for vt terminal\n" |
566 | ); | 566 | ); |
567 | CleanEnvars(); | 567 | CleanEnvars(); |
568 | return 1; | 568 | return 1; |
569 | } | 569 | } |
570 | if(!InitializeWinsock()){ | 570 | if(!InitializeWinsock()){ |
571 | DeinitializeWinsock(); | 571 | DeinitializeWinsock(); |
572 | return 2; | 572 | return 2; |
573 | } | 573 | } |
574 | CONSOLE_SCREEN_BUFFER_INFO csbi; | 574 | CONSOLE_SCREEN_BUFFER_INFO csbi; |
575 | int ac = 0; | 575 | int ac = 0; |
576 | CHAR *ho = NULL, *po = NULL; | 576 | CHAR *ho = NULL, *po = NULL; |
577 | HANDLE hConsole = CreateFile("CONOUT$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, | 577 | HANDLE hConsole = CreateFile("CONOUT$",GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, |
578 | NULL,OPEN_EXISTING,0,NULL); | 578 | NULL,OPEN_EXISTING,0,NULL); |
579 | ASSERT(hConsole); | 579 | ASSERT(hConsole); |
580 | // *** GetStdHandle(STD_OUTPUT_HANDLE);// *?*?* Do something about redirections and not only here. | 580 | // *** GetStdHandle(STD_OUTPUT_HANDLE);// *?*?* Do something about redirections and not only here. |
581 | VERIFY(GetConsoleScreenBufferInfo(hConsole,&csbi)); | 581 | VERIFY(GetConsoleScreenBufferInfo(hConsole,&csbi)); |
582 | BOOL bSized=FALSE; | 582 | BOOL bSized=FALSE; |
583 | bTermPulled=FALSE; | 583 | bTermPulled=FALSE; |
584 | for(int tmp=1;tmp<argc;tmp++){ | 584 | for(int tmp=1;tmp<argc;tmp++){ |
585 | char* v = argv[tmp]; | 585 | char* v = argv[tmp]; |
586 | ASSERT(v && *v); | 586 | ASSERT(v && *v); |
587 | if((*v)=='/' || (*v)=='-'){ | 587 | if((*v)=='/' || (*v)=='-'){ |
588 | int lines = atoi(&v[1]); | 588 | int lines = atoi(&v[1]); |
589 | if(lines){ | 589 | if(lines){ |
590 | if(lines<csbi.dwSize.Y){ | 590 | if(lines<csbi.dwSize.Y){ |
591 | SMALL_RECT wi = {0,0,csbi.dwSize.X-1,lines-1}; | 591 | SMALL_RECT wi = {0,0,csbi.dwSize.X-1,lines-1}; |
592 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); | 592 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); |
593 | } | 593 | } |
594 | COORD ns = {csbi.dwSize.X,lines}; | 594 | COORD ns = {csbi.dwSize.X,lines}; |
595 | if(SetConsoleScreenBufferSize(hConsole,ns)) | 595 | if(SetConsoleScreenBufferSize(hConsole,ns)) |
596 | bSized=TRUE; | 596 | bSized=TRUE; |
597 | }else if(v[1]=='r'){ | 597 | }else if(v[1]=='r'){ |
598 | int lines = atoi(&v[2]); | 598 | int lines = atoi(&v[2]); |
599 | if(lines){ | 599 | if(lines){ |
600 | if(lines<csbi.dwSize.Y){ | 600 | if(lines<csbi.dwSize.Y){ |
601 | SMALL_RECT wi = {0,0,csbi.dwSize.X-1,lines-1}; | 601 | SMALL_RECT wi = {0,0,csbi.dwSize.X-1,lines-1}; |
602 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); | 602 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); |
603 | } | 603 | } |
604 | COORD ns = {csbi.dwSize.X,lines}; | 604 | COORD ns = {csbi.dwSize.X,lines}; |
605 | if(SetConsoleScreenBufferSize(hConsole,ns)) | 605 | if(SetConsoleScreenBufferSize(hConsole,ns)) |
606 | bSized=TRUE; | 606 | bSized=TRUE; |
607 | }else | 607 | }else |
608 | goto usagebye; | 608 | goto usagebye; |
609 | }else if(v[1]=='c'){ | 609 | }else if(v[1]=='c'){ |
610 | int rows = atoi(&v[2]); | 610 | int rows = atoi(&v[2]); |
611 | if(rows){ | 611 | if(rows){ |
612 | if(rows<csbi.dwSize.X){ | 612 | if(rows<csbi.dwSize.X){ |
613 | SMALL_RECT wi = {0,0,rows-1,csbi.dwSize.Y-1}; | 613 | SMALL_RECT wi = {0,0,rows-1,csbi.dwSize.Y-1}; |
614 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); | 614 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); |
615 | } | 615 | } |
616 | COORD ns = {rows,csbi.dwSize.Y}; | 616 | COORD ns = {rows,csbi.dwSize.Y}; |
617 | if(SetConsoleScreenBufferSize(hConsole,ns)) | 617 | if(SetConsoleScreenBufferSize(hConsole,ns)) |
618 | bSized=TRUE; | 618 | bSized=TRUE; |
619 | }else | 619 | }else |
620 | goto usagebye; | 620 | goto usagebye; |
621 | }else if(v[1]=='l'){ | 621 | }else if(v[1]=='l'){ |
622 | CHAR* vv = &v[2]; | 622 | CHAR* vv = &v[2]; |
623 | VERIFY(AddEnvar(nesbVar,"USER",vv)); | 623 | VERIFY(AddEnvar(nesbVar,"USER",vv)); |
624 | }else if(v[1]=='e'){ // -e<name>=<value>VAR | 624 | }else if(v[1]=='e'){ // -e<name>=<value>VAR |
625 | CHAR* n = &v[2]; | 625 | CHAR* n = &v[2]; |
626 | CHAR* vv = strchr(&v[2],'='); | 626 | CHAR* vv = strchr(&v[2],'='); |
627 | if(!vv) | 627 | if(!vv) |
628 | goto usagebye; | 628 | goto usagebye; |
629 | *(vv++)=0; | 629 | *(vv++)=0; |
630 | VERIFY(AddEnvar(nesbVar,n,vv)); | 630 | VERIFY(AddEnvar(nesbVar,n,vv)); |
631 | }else if(v[1]=='v'){ // -v<name>=<value>USERVAR | 631 | }else if(v[1]=='v'){ // -v<name>=<value>USERVAR |
632 | CHAR* n = &v[2]; | 632 | CHAR* n = &v[2]; |
633 | CHAR* vv = strchr(n,'='); | 633 | CHAR* vv = strchr(n,'='); |
634 | if(!vv) | 634 | if(!vv) |
635 | goto usagebye; | 635 | goto usagebye; |
636 | *(vv++)=0; | 636 | *(vv++)=0; |
637 | VERIFY(AddEnvar(nesbUserVar,n,vv)); | 637 | VERIFY(AddEnvar(nesbUserVar,n,vv)); |
638 | }else if(v[1]=='t'){// -t<ttype> -t<tname>=<ttype> | 638 | }else if(v[1]=='t'){// -t<ttype> -t<tname>=<ttype> |
639 | CHAR* n = &v[2]; | 639 | CHAR* n = &v[2]; |
640 | CHAR* nn = strchr(n,'='); | 640 | CHAR* nn = strchr(n,'='); |
641 | if(nn){ | 641 | if(nn){ |
642 | *(nn++)=0; | 642 | *(nn++)=0; |
643 | if(!*nn) | 643 | if(!*nn) |
644 | nn=NULL; | 644 | nn=NULL; |
645 | } | 645 | } |
646 | if(!TerminalPullType(nn?nn:n,nn?n:NULL)){ | 646 | if(!TerminalPullType(nn?nn:n,nn?n:NULL)){ |
647 | printf("Available terminal types are:"); | 647 | printf("Available terminal types are:"); |
648 | TerminalPrintTypes(); | 648 | TerminalPrintTypes(); |
649 | printf("\n"); | 649 | printf("\n"); |
650 | goto usagebye; | 650 | goto usagebye; |
651 | } | 651 | } |
652 | bTermPulled=TRUE; | 652 | bTermPulled=TRUE; |
653 | }else if(v[1]=='#'){ | 653 | }else if(v[1]=='#'){ |
654 | int cp = atoi(&v[2]); | 654 | int cp = atoi(&v[2]); |
655 | #ifdef_DEBUG | 655 | #ifdef_DEBUG |
656 | TRACE2("SetCP(%d)=%d\n",cp,SetConsoleCP(cp)); | 656 | TRACE2("SetCP(%d)=%d\n",cp,SetConsoleCP(cp)); |
657 | TRACE2("SetOutCP(%d)=%d\n",cp,SetConsoleOutputCP(cp)); | 657 | TRACE2("SetOutCP(%d)=%d\n",cp,SetConsoleOutputCP(cp)); |
658 | #else | 658 | #else |
659 | SetConsoleCP(cp); | 659 | SetConsoleCP(cp); |
660 | SetConsoleOutputCP(cp); | 660 | SetConsoleOutputCP(cp); |
661 | #endif | 661 | #endif |
662 | TRACE2("CP,OCP=%d,%d\n",GetConsoleCP(),GetConsoleOutputCP()); | 662 | TRACE2("CP,OCP=%d,%d\n",GetConsoleCP(),GetConsoleOutputCP()); |
663 | }else | 663 | }else |
664 | goto usagebye; | 664 | goto usagebye; |
665 | }else{ | 665 | }else{ |
666 | if(ac==0){ | 666 | if(ac==0){ |
667 | ho = v; | 667 | ho = v; |
668 | ac++; | 668 | ac++; |
669 | }else if(ac==1){ | 669 | }else if(ac==1){ |
670 | po = v; | 670 | po = v; |
671 | ac++; | 671 | ac++; |
672 | }else | 672 | }else |
673 | goto usagebye; | 673 | goto usagebye; |
674 | } | 674 | } |
675 | } | 675 | } |
676 | if(!ho) | 676 | if(!ho) |
677 | goto usagebye; | 677 | goto usagebye; |
678 | servent* se = getservbyname("telnet","tcp"); | 678 | servent* se = getservbyname("telnet","tcp"); |
679 | UINT port = po?atol(po):(se?ntohs(se->s_port):23); | 679 | UINT port = po?atol(po):(se?ntohs(se->s_port):23); |
680 | if(port==23 || (se && port==ntohs(se->s_port))) | 680 | if(port==23 || (se && port==ntohs(se->s_port))) |
681 | bTelnet = TRUE; | 681 | bTelnet = TRUE; |
682 | if(po && !port){ | 682 | if(po && !port){ |
683 | se = getservbyname(po,"tcp"); | 683 | se = getservbyname(po,"tcp"); |
684 | if(!se){ | 684 | if(!se){ |
685 | printf("Failed to resolve tcp-service port name\n"); | 685 | printf("Failed to resolve tcp-service port name\n"); |
686 | DeinitializeWinsock(); | 686 | DeinitializeWinsock(); |
687 | return 2; | 687 | return 2; |
688 | } | 688 | } |
689 | port = ntohs(se->s_port); | 689 | port = ntohs(se->s_port); |
690 | if(!stricmp(po,"telnet")) | 690 | if(!stricmp(po,"telnet")) |
691 | bTelnet = TRUE; | 691 | bTelnet = TRUE; |
692 | else | 692 | else |
693 | bTelnet = FALSE; | 693 | bTelnet = FALSE; |
694 | }else{ | 694 | }else{ |
695 | se = getservbyport(htons(port),"tcp"); | 695 | se = getservbyport(htons(port),"tcp"); |
696 | if(se){ | 696 | if(se){ |
697 | po = se->s_name; | 697 | po = se->s_name; |
698 | if(!stricmp(po,"telnet")) | 698 | if(!stricmp(po,"telnet")) |
699 | bTelnet=TRUE; | 699 | bTelnet=TRUE; |
700 | }else{ | 700 | }else{ |
701 | VERIFY(_itoa(port,remoteProt,10)); | 701 | VERIFY(_itoa(port,remoteProt,10)); |
702 | po = NULL; | 702 | po = NULL; |
703 | bTelnet=FALSE; | 703 | bTelnet=FALSE; |
704 | } | 704 | } |
705 | } | 705 | } |
706 | if(po) | 706 | if(po) |
707 | strcpy(remoteProt,po); | 707 | strcpy(remoteProt,po); |
708 | HICON hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_IKON)); | 708 | HICON hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_IKON)); |
709 | LONG oldBIcon = NULL, oldSIcon = NULL; | 709 | LONG oldBIcon = NULL, oldSIcon = NULL; |
710 | hConsoleWindow = GetThisConsoleWnd(); | 710 | hConsoleWindow = GetThisConsoleWnd(); |
711 | if(hConsoleWindow){ | 711 | if(hConsoleWindow){ |
712 | oldBIcon = SendMessage(hConsoleWindow,WM_SETICON,ICON_BIG,(LPARAM)hIcon); | 712 | oldBIcon = SendMessage(hConsoleWindow,WM_SETICON,ICON_BIG,(LPARAM)hIcon); |
713 | oldSIcon = SendMessage(hConsoleWindow,WM_SETICON,ICON_SMALL,(LPARAM)hIcon); | 713 | oldSIcon = SendMessage(hConsoleWindow,WM_SETICON,ICON_SMALL,(LPARAM)hIcon); |
714 | } | 714 | } |
715 | Telnet(ho,port); | 715 | Telnet(ho,port); |
716 | CleanEnvars(); | 716 | CleanEnvars(); |
717 | if(hConsoleWindow){ | 717 | if(hConsoleWindow){ |
718 | SendMessage(hConsoleWindow,WM_SETICON,ICON_BIG,(LPARAM)oldBIcon); | 718 | SendMessage(hConsoleWindow,WM_SETICON,ICON_BIG,(LPARAM)oldBIcon); |
719 | SendMessage(hConsoleWindow,WM_SETICON,ICON_SMALL,(LPARAM)oldSIcon); | 719 | SendMessage(hConsoleWindow,WM_SETICON,ICON_SMALL,(LPARAM)oldSIcon); |
720 | } | 720 | } |
721 | Sleep(150); | 721 | Sleep(150); |
722 | if(bSized){ | 722 | if(bSized){ |
723 | CONSOLE_SCREEN_BUFFER_INFO CSBI; | 723 | CONSOLE_SCREEN_BUFFER_INFO CSBI; |
724 | VERIFY(GetConsoleScreenBufferInfo(hConsole,&CSBI)); | 724 | VERIFY(GetConsoleScreenBufferInfo(hConsole,&CSBI)); |
725 | if(CSBI.dwSize.Y>csbi.dwSize.Y || CSBI.dwSize.X>csbi.dwSize.X){ | 725 | if(CSBI.dwSize.Y>csbi.dwSize.Y || CSBI.dwSize.X>csbi.dwSize.X){ |
726 | SMALL_RECT wi = {0,0,csbi.dwSize.X-1,csbi.dwSize.Y-1}; | 726 | SMALL_RECT wi = {0,0,csbi.dwSize.X-1,csbi.dwSize.Y-1}; |
727 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); | 727 | VERIFY(SetConsoleWindowInfo(hConsole,TRUE,&wi)); |
728 | } | 728 | } |
729 | COORD ns = {csbi.dwSize.X,csbi.dwSize.Y}; | 729 | COORD ns = {csbi.dwSize.X,csbi.dwSize.Y}; |
730 | VERIFY(SetConsoleScreenBufferSize(hConsole,ns)); | 730 | VERIFY(SetConsoleScreenBufferSize(hConsole,ns)); |
731 | } | 731 | } |
732 | Sleep(100); | 732 | Sleep(100); |
733 | DeinitializeWinsock(); | 733 | DeinitializeWinsock(); |
734 | Sleep(100); | 734 | Sleep(100); |
735 | return 0; | 735 | return 0; |
736 | } | 736 | } |
@@ -1,115 +1,115 @@ | |||
1 | //Microsoft Developer Studio generated resource script. | 1 | //Microsoft Developer Studio generated resource script. |
2 | // | 2 | // |
3 | #include "resource.h" | 3 | #include "resource.h" |
4 | 4 | ||
5 | #define APSTUDIO_READONLY_SYMBOLS | 5 | #define APSTUDIO_READONLY_SYMBOLS |
6 | ///////////////////////////////////////////////////////////////////////////// | 6 | ///////////////////////////////////////////////////////////////////////////// |
7 | // | 7 | // |
8 | // Generated from the TEXTINCLUDE 2 resource. | 8 | // Generated from the TEXTINCLUDE 2 resource. |
9 | // | 9 | // |
10 | #include "afxres.h" | 10 | #include "afxres.h" |
11 | 11 | ||
12 | ///////////////////////////////////////////////////////////////////////////// | 12 | ///////////////////////////////////////////////////////////////////////////// |
13 | #undef APSTUDIO_READONLY_SYMBOLS | 13 | #undef APSTUDIO_READONLY_SYMBOLS |
14 | 14 | ||
15 | ///////////////////////////////////////////////////////////////////////////// | 15 | ///////////////////////////////////////////////////////////////////////////// |
16 | // English (U.S.) resources | 16 | // English (U.S.) resources |
17 | 17 | ||
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) |
19 | #ifdef _WIN32 | 19 | #ifdef _WIN32 |
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US |
21 | #pragma code_page(1252) | 21 | #pragma code_page(1252) |
22 | #endif //_WIN32 | 22 | #endif //_WIN32 |
23 | 23 | ||
24 | ///////////////////////////////////////////////////////////////////////////// | 24 | ///////////////////////////////////////////////////////////////////////////// |
25 | // | 25 | // |
26 | // Icon | 26 | // Icon |
27 | // | 27 | // |
28 | 28 | ||
29 | // Icon with lowest ID value placed first to ensure application icon | 29 | // Icon with lowest ID value placed first to ensure application icon |
30 | // remains consistent on all systems. | 30 | // remains consistent on all systems. |
31 | IDI_IKON ICON DISCARDABLE "res/kinsole.ico" | 31 | IDI_IKON ICON DISCARDABLE "res/kinsole.ico" |
32 | 32 | ||
33 | #ifdef APSTUDIO_INVOKED | 33 | #ifdef APSTUDIO_INVOKED |
34 | ///////////////////////////////////////////////////////////////////////////// | 34 | ///////////////////////////////////////////////////////////////////////////// |
35 | // | 35 | // |
36 | // TEXTINCLUDE | 36 | // TEXTINCLUDE |
37 | // | 37 | // |
38 | 38 | ||
39 | 1 TEXTINCLUDE DISCARDABLE | 39 | 1 TEXTINCLUDE DISCARDABLE |
40 | BEGIN | 40 | BEGIN |
41 | "resource.h\0" | 41 | "resource.h\0" |
42 | END | 42 | END |
43 | 43 | ||
44 | 2 TEXTINCLUDE DISCARDABLE | 44 | 2 TEXTINCLUDE DISCARDABLE |
45 | BEGIN | 45 | BEGIN |
46 | "#include ""afxres.h""\r\n" | 46 | "#include ""afxres.h""\r\n" |
47 | "\0" | 47 | "\0" |
48 | END | 48 | END |
49 | 49 | ||
50 | 3 TEXTINCLUDE DISCARDABLE | 50 | 3 TEXTINCLUDE DISCARDABLE |
51 | BEGIN | 51 | BEGIN |
52 | "\r\n" | 52 | "\r\n" |
53 | "\0" | 53 | "\0" |
54 | END | 54 | END |
55 | 55 | ||
56 | #endif // APSTUDIO_INVOKED | 56 | #endif // APSTUDIO_INVOKED |
57 | 57 | ||
58 | 58 | ||
59 | #ifndef _MAC | 59 | #ifndef _MAC |
60 | ///////////////////////////////////////////////////////////////////////////// | 60 | ///////////////////////////////////////////////////////////////////////////// |
61 | // | 61 | // |
62 | // Version | 62 | // Version |
63 | // | 63 | // |
64 | 64 | ||
65 | VS_VERSION_INFO VERSIONINFO | 65 | VS_VERSION_INFO VERSIONINFO |
66 | FILEVERSION 1,1,0,0 | 66 | FILEVERSION 1,1,1,0 |
67 | PRODUCTVERSION 1,1,0,0 | 67 | PRODUCTVERSION 1,1,1,0 |
68 | FILEFLAGSMASK 0x3fL | 68 | FILEFLAGSMASK 0x3fL |
69 | #ifdef _DEBUG | 69 | #ifdef _DEBUG |
70 | FILEFLAGS 0x29L | 70 | FILEFLAGS 0x29L |
71 | #else | 71 | #else |
72 | FILEFLAGS 0x28L | 72 | FILEFLAGS 0x28L |
73 | #endif | 73 | #endif |
74 | FILEOS 0x4L | 74 | FILEOS 0x4L |
75 | FILETYPE 0x1L | 75 | FILETYPE 0x1L |
76 | FILESUBTYPE 0x3L | 76 | FILESUBTYPE 0x3L |
77 | BEGIN | 77 | BEGIN |
78 | BLOCK "StringFileInfo" | 78 | BLOCK "StringFileInfo" |
79 | BEGIN | 79 | BEGIN |
80 | BLOCK "040904b0" | 80 | BLOCK "040904b0" |
81 | BEGIN | 81 | BEGIN |
82 | VALUE "CompanyName", "Klever Group (http://www.klever.net)\0" | 82 | VALUE "CompanyName", "Klever Group (http://www.klever.net)\0" |
83 | VALUE "FileDescription", "KINSole, telnet client\0" | 83 | VALUE "FileDescription", "KINSole, telnet client\0" |
84 | VALUE "FileVersion", "1, 1, 0, 0\0" | 84 | VALUE "FileVersion", "1, 1, 1, 0\0" |
85 | VALUE "InternalName", "KINSOLE\0" | 85 | VALUE "InternalName", "KINSOLE\0" |
86 | VALUE "LegalCopyright", "Copyright © 1998-2004 Klever Group (http://www.klever.net/)\0" | 86 | VALUE "LegalCopyright", "Copyright © 1998-2005 Klever Group (http://www.klever.net/)\0" |
87 | VALUE "LegalTrademarks", "Klever Group (http://www.klevernet/)\0" | 87 | VALUE "LegalTrademarks", "Klever Group (http://www.klevernet/)\0" |
88 | VALUE "OriginalFilename", "KINSOLE.EXE\0" | 88 | VALUE "OriginalFilename", "KINSOLE.EXE\0" |
89 | VALUE "ProductName", "KINSole\0" | 89 | VALUE "ProductName", "KINSole\0" |
90 | VALUE "ProductVersion", "1, 1, 0, 0\0" | 90 | VALUE "ProductVersion", "1, 1, 1, 0\0" |
91 | END | 91 | END |
92 | END | 92 | END |
93 | BLOCK "VarFileInfo" | 93 | BLOCK "VarFileInfo" |
94 | BEGIN | 94 | BEGIN |
95 | VALUE "Translation", 0x409, 1200 | 95 | VALUE "Translation", 0x409, 1200 |
96 | END | 96 | END |
97 | END | 97 | END |
98 | 98 | ||
99 | #endif // !_MAC | 99 | #endif // !_MAC |
100 | 100 | ||
101 | #endif // English (U.S.) resources | 101 | #endif // English (U.S.) resources |
102 | ///////////////////////////////////////////////////////////////////////////// | 102 | ///////////////////////////////////////////////////////////////////////////// |
103 | 103 | ||
104 | 104 | ||
105 | 105 | ||
106 | #ifndef APSTUDIO_INVOKED | 106 | #ifndef APSTUDIO_INVOKED |
107 | ///////////////////////////////////////////////////////////////////////////// | 107 | ///////////////////////////////////////////////////////////////////////////// |
108 | // | 108 | // |
109 | // Generated from the TEXTINCLUDE 3 resource. | 109 | // Generated from the TEXTINCLUDE 3 resource. |
110 | // | 110 | // |
111 | 111 | ||
112 | 112 | ||
113 | ///////////////////////////////////////////////////////////////////////////// | 113 | ///////////////////////////////////////////////////////////////////////////// |
114 | #endif // not APSTUDIO_INVOKED | 114 | #endif // not APSTUDIO_INVOKED |
115 | 115 | ||