Index


1. General information
2. proxycygterm.exe
3. proxywinconsole.exe
4. Other uses for the wrappers proxycygterm.exe and proxywinconsole.exe

1. General information

Proxy32 built-in terminal can connect its user to different local or remote shells. There are three connection modes:

TELNET-TERMINAL and COM-PORT-TERMINAL are straightforward and will not be discussed here.

When using IPC to connect to local Windows shell, Proxy32 SHELL-TERMINAL starts local "shell" process via supplied command line and then communicates with the "shell" process using STDIN/STDOUT/STDERR streams in byte-oriented UTF-8/ASCII mode.

While such STDIN/STDOUT/STDERR interface in SHELL-TERMINAL allows to connect terminal window directly to cmd, plink and psftp, it does not allow to connect directly to CYGWIN shells (CYGWIN bash/ssh/sftp/telnet/ftp/screen/mc) that require allocation of CYGWIN TTY to be executed. It also does not allow to connect directly to Windows PowerShell (and to some other windows command line tools), as PowerShell requires allocation of Windows Console window for its execution.

For creation of SHELL-TERMINAL launcher user has to supply command line to start local interactive text mode process which new terminal will be running. For example:

2. proxycygterm.exe

To be able to connect to CYGWIN shells (CYGWIN bash/ssh/sftp/telnet/ftp/screen/mc), Proxy32 SHELL-TERMINAL uses intermediate process (or wrapper) called proxycygterm.exe. proxycygterm.exe creates CYGWIN TTY and starts CYGWIN shell on it, then it communicates (on PTY side) with Proxy32 SHELL-TERMINAL using STDIN/STDOUT/STDERR streams in byte-oriented UTF-8/ASCII mode.

I have derived "proxycygterm" code from "cygterm" code in March 2006 to use it as new Proxy32 to CYGWIN TTY interface. Source code of "proxycygterm" is published here (as "cygterm" code is licensed under GPL). GPL source code of unmodified CYGWIN binaries that Proxy32.exe installs is located here.

On resize of Proxy32 terminal it sends Telnet NAWS command to STDIN of proxycygterm.exe to resize slave TTY to match new size of the Proxty32 terminal. If SHELL-TERMINAL command line does not contain word "proxycygterm" then NAWS command is not sent to STDIN of SHELL-TERMINAL shell process. If shell process exited or died, Proxy32 terminal disconnects. If user "disconnects" Proxy32 terminal manually, shell process and all process tree it has created is killed.

For creation of SHELL-TERMINAL launcher user has to supply command line to start local interactive text mode process which new terminal will be running. For example:

3. proxywinconsole.exe

I have written and included into Proxy32 installation new console wrapper that is similar to proxycygterm.exe (but closed source). As proxycygterm.exe creates CYGWIN TTY internally and wraps it into STDIN/STDOUT/STDERR external interface, the same way new wrapper proxywinconsole.exe creates hidden MS Windows console and wraps it into STDIN/STDOUT/STDERR external interface (UTF-8 byte streams). It also has Ctrl-C handler on STDIN. Hidden console window has fixed 80 columns width, but when run in the SHELL-TERMINAL it has no limit on the number of lines in the scroll back buffer. proxywinconsole.exe can be used the same way as proxycygterm.exe, but for windows command line applications (that cannot run without native MS Windows console window attached).

For creation of SHELL-TERMINAL launcher user has to supply command line to start local interactive text mode process which new terminal will be running. For example:

Wrapper has handler to pass Ctrl-C (ASCII 03) from its STDIN to wrapped child process (cmd or powershell), so Ctrl-C can be used to interrupt long powershell and cmd printouts.

Wrapper also supports UTF8 on STDIN/STDOUT streams to use Unicode for non-English languages support.

Wrapper does not support console color attributes.

This wrapper is intended to attract MS Windows sysadmins who use MS Windows powershell, cmd, net, reg and other MS Windows command line tools.

Current Limitations of the proxywinconsole.exe wrapper:

4. Other uses for the wrappers proxycygterm.exe and proxywinconsole.exe

Another obvious benefit of proxywinconsole.exe wrapper is its ability to run cmd or powershell from CYGWIN bash command line and from bash scripts.

Also, before it was impossible to connect to powershell or cmd via CYGWIN OpenSSH ssh server. Now it is working. First, one need to connect to CYGWIN OpenSSH sshd server on PC. This will provide bash prompt. Then simply start my wrapper from the bash prompt to start working with cmd/powershell via CYGWIN OpenSSH sshd server on PC.

Fig.1. Working with PowerShell via OpenSSH ssh server.

Fig.1. Working with PowerShell via OpenSSH ssh server.

Google search for "access powershell via CYGWIN OpenSSH server" returns a lot of people's frustration because of inability to run powershell via CYGWIN OpenSSH sshd server on PC.

powershell and CYGWIN OpenSSH sshd server on PC, link 1
powershell and CYGWIN OpenSSH sshd server on PC, link 2
powershell and CYGWIN OpenSSH sshd server on PC, link 3
powershell and CYGWIN OpenSSH sshd server on PC, link 4
powershell and CYGWIN OpenSSH sshd server on PC, link 5
There is even full blown commercial SSH server just to give folks access to powershell remotely!
Commercial POWERSHELL SSH SERVER

Also, this MinTTY development thread discusses problem that can be partially solved by using proxywinconsole.exe.

Fig.2. Working with PowerShell in MinTTY terminal.

Fig.2. Working with PowerShell in MinTTY terminal.

Fig.3. Working with PowerShell in CYGWIN terminal.

Fig.3. Working with PowerShell in CYGWIN terminal.


1. General information
2. proxycygterm.exe
3. proxywinconsole.exe
4. Other uses for the wrappers proxycygterm.exe and proxywinconsole.exe


Index