Winsock RSHD Version 1.6 Copyright 1994 Denicomp Systems All Rights Reserved DESCRIPTION ----------- Winsock RSHD ("Remote Shell Daemon") is a daemon (server) that accepts requests for command execution from other hosts on the network and executes them on the PC running Winsock RSHD. It runs under Microsoft Windows 3.1 and Windows Sockets compatible TCP/IP stacks. Winsock RSHD is similar to the Unix server of the same name, but provides some special functionality for the Windows environment, such as: - Ability to send keystrokes to the command running under Windows - Support for the "rcp" command to allow copying to and from the PC - Security mechanism to allow/deny access for hosts and users - Ability to capture standard output and standard error output from DOS Command requests can come from hosts running other operating systems such as Unix or from other PC's using the standard "rsh" utility that comes with your TCP/IP package or Winsock RSH, also available from Denicomp Systems. Files can be copied to the PC or from the PC running Winsock RSHD using the standard TCP/IP "rcp" command. This includes the "rcp" command available with Unix or a PC-based "rcp" command such as Winsock RCP, also available from Denicomp Systems. REQUIREMENTS ------------ Winsock RCP requires a PC running Windows 3.1 or higher and a Windows Sockets compatible TCP/IP stack. Winsock RSHD has been tested with the following: Microsoft 32-bit TCP/IP for Windows Wollongong Pathway Access Novell LAN Workplace for DOS Version 4.2 To work with Novell LAN Workplace for DOS, you must have version 4.2 or later and a WINSOCK.DLL file dated 10/07/94 or later. You also must have the file VBRUN300.DLL installed on your system. This file must be in a directory included in your PATH environment variable. This file is NOT included with Winsock RSHD. It can be obtained from a number of BBS systems and online services. If you cannot obtain it, please contact Denicomp Systems for assistance. WINSOCK RSHD INSTALLATION ------------------------- To install with Winsock RSHD, use PKUNZIP to uncompress the distribution file into a directory on your hard disk or onto a diskette. Then use File/Run from the Windows Program Manager menu. Enter the drive and directory name that contains the uncompressed files, followed by "SETUP". For example, if you uncompressed Winsock RSHD into the directory C:\WRSHD, type C:\WRSHD\SETUP. Winsock WRSHD by default will be installed in the C:\WRSHD directory. You can specify a different directory if you wish. The Winsock Utilities group will be created. Icons will be in this group for Winsock RSHD, along with options to view/print the order form and the manual for using Winsock RSHD. If you wish to start Winsock RSHD automatically each time you run Windows, you can copy or move the Winsock RSHD icon to the Windows Start Up program group. WINSOCK RSHD CONFIGURATION -------------------------- You configure Winsock RSHD by double clicking on the Winsock RSHD Configuration icon in the Winsock Utilities program group. Winsock RSHD may work properly without configuration, depending on the TCP/IP software you are using and whether or not you wish to enforce security. You must configure Winsock RSHD if: 1) You are using Microsoft's 32-bit TCP/IP for Windows. You should select Method 2 for the Method of Operation option. 2) You wish to enforce security. That is, you wish to specify which hosts and/or users may or may not access the PC through Winsock RSHD. By default, no security is enforced. Otherwise, configuration is not necessary for Winsock RSHD to run, but you may want to examine the options available. Also note that by using the default Winsock RSHD configuration, you may see "Warning" messages on the Winsock RSHD screen, especially if your TCP/IP software does not support an option called "Reuse Address". You can ignore this warning if you see it; Winsock RSHD will continue to operate properly. You can stop the message by setting all "ReuseAddr" options to -1. In the Winsock RSHD Configuration screen, set the desired options, then click on "OK" to save the configuration and exit. Click on "Cancel" to discard any changes you have made and exit. Click on "Edit Security" to edit the Security File you have specified using the Windows Notepad editor. This only works if you have specified a Security File name. The Winsock RSHD Configuration screen contains the following options: Method of Operation: (Default: Method 1) Winsock RSHD has two methods of operation: Method 1 and 2. The method you should use depends on the TCP/IP stack you are using. Ideally, Winsock RSHD should just work, no matter what TCP/IP stack you are using. However, practice shows that there are some internal differences in Windows Sockets implementations, especially when implementing servers. If the default Method 1 does not work (you receive error messages), try Method 2. If neither method works, you can fiddle with the Advanced Configuration Options explained later or contact Denicomp Systems for assistance. In general, Method 1 should work with most TCP/IP stacks. This includes Wollongong Pathway Access and Novell LAN Workplace for DOS. Method 2 works well with Microsoft's 32-bit TCP/IP for Windows. Although Method 1 will also work with Microsoft's TCP/IP, it has been known to lock up the PC with heavy use, so Method 2 is recommended. Startup Option: (Default: None Checked) The startup options determine how the Winsock RSHD window is displayed when you initially start it. Your options are: Normal: The Winsock RSHD window will display as a normal window. This is the option used if no options are checked. Minimized: The Winsock RSHD window will initially be minimized. Hidden: The Winsock RSHD window will initially be hidden. Note that if you choose this option, there will be no way to view the RSHD window or stop RSHD, since hidden windows do not appear in the Windows Task List. Message Level: (Default: 0) Specifies the level of detail of the messages displayed in the Winsock RSHD window. The default level is 0, which gives the least amount of detail. Level 0 will show you when someone receives an error trying to execute a command or is denied permission. Level 1 provides more detail about the various stages of Winsock RSHD execution. Level 2 provides the highest level of detail. Levels 1 and 2 are useful if you are having problems with Winsock RSHD execution. Security File: (Default: None) Specify the full path name of the Security File used by Winsock RSHD to enforce security (allow and deny users and hosts). The format of this file is explained in more detail later. If you do not specify a Security File, all users and hosts will be granted access to execute commands and transfer files to and from your PC. If the Security File you specify does not exist, NO users or hosts will be granted access. If you do not wish to enforce any security, do not specify a filename. Request Log: (Default: None) This option allows you to log all requests (commands to be executed) in a file you specify. Each time someone attempts to execute a command on the PC, the date and time, the user name, the host name, and the command will be written to this file. Deny Log: (Default: None) This option allows you to log all permission violations in a file you specify. Each time someone is denied permission to execute a command on the PC, the date and time, the user name, the host name, and the command will be written to this file. Error Log: (Default: None) This option allows you to log all command execution errors in a file you specify. Each time someone receives an error trying to execute a command on the PC, the date and time, the user name, the host name, the command, and error message will be written to this file. These are errors that occur after the user has been granted permission to execute the command. For example, an error would be logged if a program was to be run that did not exist. NOTE: Each of the log files may refer to the same file name if you wish. They will not overwrite each other. Each message is appended to the end of the file. You should be sure to periodically delete the log file(s) because they can get large over time on an actively used PC. ADVANCED CONFIGURATION OPTIONS ------------------------------ These configuration options are for advanced users and do not normally require deviations from their default values. Full understanding of them require an understanding of TCP/IP and Windows Sockets operation and programming. Some options refer to TCP/IP option set on "sockets" used by Winsock RSHD. Sockets are connections over the network. Winsock RSHD uses three sockets: Listen: Listens for connections. Conn: Socket created when a connection is made to receive parameters from the "rsh" or "rcp" command. Stderr: Socket created to send error messages back to the remote host. The advanced options are: Port: (Default: 514) Specifies the port number that Winsock RSHD listens to for connections. The standard port for the Remote Shell daemon is 514. RCP Block Size: (Default: 1024) Specifies the number of bytes in a block of data that the Remote Copy (RCP) service of Winsock RSHD processes at one time. When files are copied to the PC, it reads from the network and writes to the disk in blocks of this size. When files are copied from the PC, it reads from the disk and writes to the network in blocks of this size. Note that this is an internal block size only; it does not change any TCP/IP parameters. Listen Backlog: (Default: 5) The number of requests that can be "backlogged" when Winsock RSHD is listening for connections. The minimum is 1; the maximum is usually 5. Listen Shutdown: (Default: 2) Specifies how the "Listen" socket is to be shutdown before it is closed. A value of 0 means that it is not shutdown. A value of 1 halts all receiving before shutting down. A value of 2 halts all sending and receiving before shutting down. Listen Linger: (Default: -1) If this option is set to "0", the TCP/IP "linger" option will be turned off for the "Listen" socket. If this option is set to a value greater than zero, the linger option will be turned on and the timeout value will be set to the value you assign this option. If this option is set to "-1" or does not appear in the configuration file, no linger options will be set; the default linger option specified by your TCP/IP package will be in effect. Listen KeepAlive: (Default: -1) If this option is set to "0", the TCP/IP "keepalive" option will be turned off for the "Listen" socket. If this option is set to "1", the keepalive option will be turned on. If this option is set to "-1" or does not appear in the configuration file, no keepalive option will be set; the default keepalive option specified by your TCP/IP package will be in effect. Listen ReuseAddr: (Default: 1) If this option is set to "0", the TCP/IP "ReuseAddr" option (Reuse Address) will be turned off for the "Listen" socket. If this option is set to "1", the ReuseAddr option will be turned on. If this option is set to "-1" or does not appear in the configuration file, no ReuseAddr option will be set; the default ReuseAddr option specified by your TCP/IP package will be in effect. Connection Shutdown: (Default: -1) Sets the "shutdown" option for the connection socket. See the Listen Shutdown option for an explanation of the valid values. Connection Linger: (Default: -1) Sets the "linger" option for the connection socket. See the Listen Linger option for an explanation of the valid values. Connection KeepAlive: (Default: -1) Sets the "keepalive" option for the connection socket. See the Listen KeepAlive option for an explanation of the valid values. Connection ReuseAddr: (Default: 1) Sets the "ReuseAddr" option for the connection socket. See the Listen ReuseAddr option for an explanation of the valid values. Stderr Linger: (Default: -1) Sets the "linger" option for the standard error socket. See the Listen Linger option for an explanation of the valid values. Stderr KeepAlive: (Default: -1) Sets the "keepalive" option for the standard error socket. See the Listen KeepAlive option for an explanation of the valid values. Stderr ReuseAddr: (Default: 1) Sets the "ReuseAddr" option for the standard error socket. See the Listen ReuseAddr option for an explanation of the valid values. Stderr Shutdown: (Default: 2) Sets the "shutdown" option for the standard error socket. See the Listen Shutdown option for an explanation of the valid values. WINSOCK RSHD SECURITY FILE -------------------------- With Unix, security is enforced on remote command execution using a combination of the password file (/etc/passwd), the hosts file (/etc/hosts), and the host equivalency files (/etc/hosts.equiv and $HOME/.rhosts). Windows 3.1 does not have any security measures at all. If Winsock RSHD did not provide for security, any host and user could execute commands through Winsock RSHD or copy files to and from the PC using the "rcp" command. Winsock RSHD enforces security through its Security File. The name of this file is specified in the Winsock RSHD Configuration as the Security File. If you specify a Security File name and the file does not exist or the file is completely empty, all hosts and users are denied access. Conversely, if you do not specify a Security File, all hosts and users are granted access. So if you do not wish to enforce any security, do not specify a Security File name. You create the Security File using a text editor. It consists of lines that specify who may or may not access the PC using Winsock RSHD. The following are the options available in the Security File: # Any line beginning with # is treated as a comment and is ignored. + A plus sign (+) on a line by itself specifies that ALL hosts and users are granted permission. This is useful if you wish to allow many hosts and users, but deny only a few. Use the deny options on subsequent lines. host You can specify a host that is granted permission by entering the name of the host on a line by itself. ALL users on that host are granted permission, unless you specifically deny those users on subsequent lines. You may also use the IP address of the host instead (the dotted- decimal representation). If you specify the name of the host, that name must appear in the HOSTS file used by your TCP/IP package. !host You can specify a host that is denied permission by entering an exclamation point (!) followed by the name of the host name of the host on a line. ALL users on that host are denied permission, regardless of subsequent lines. You may also use the IP address of the host instead (the dotted- decimal representation). If you specify the name of the host, that name must appear in the HOSTS file used by your TCP/IP package. +user You can specify a user name that is granted permission by entering a plus sign (+) followed by the user name on a line. Do not put any spaces between the plus sign and the user name. That user will be granted permission regardless of the host (as long as the host is not specifically denied). See below for an explanation of the source of the "user name" and how it is validated. -user You can specify a user name that is to be denied permission by entering a minus sign (-) followed by the user name on a line. Do not put any spaces between the plus sign and the user name. That user will be denied permission on all hosts. See below for an explanation of the source of the "user name" and how it is validated. +user@host You can specify a user name and a host that is granted permission by entering a plus sign (+) followed by the user name, an at-sign (@), followed by the host name on a line. Do not put any spaces between the plus sign and the user name or before or after the at-sign. That user on the specified host will be granted permission, but only from that host. You may also use the IP address of the host instead (the dotted- decimal representation). If you specify the name of the host, that name must appear in the HOSTS file used by your TCP/IP package. -user@host You can specify a user name and a host that is denied permission by entering a minus sign (-) followed by the user name, an at-sign (@), followed by the host name on a line. Do not put any spaces between the minus sign and the user name or before or after the at-sign. That user on the specified host will be denied permission, but only when coming from that host. You may also use the IP address of the host instead (the dotted- decimal representation). If you specify the name of the host, that name must appear in the HOSTS file used by your TCP/IP package. If the request is coming from a Unix system, the user name is the login name of the user. If the request is coming from another Windows PC, the method of specifying the user name is determined by the implementation of the "rsh" or "rcp" command you are using. Note that the standard Unix "rsh" command (and the Winsock RSH command available from Denicomp Systems) allows a "-l" option to specify an alternate user name. The "-l" option has meaning on a Unix system, but is not especially useful with Winsock RSHD. However, if you do use the "-l" option to specify an alternate user, as with Unix, that user must be granted permission through the Security File in addition to the login name (Unix) or the name specified in your particular TCP/IP implementation (Windows/DOS). USING THE SECURITY FILE ----------------------- To effectively use the Security File, you must first understand how it is viewed by Winsock RSHD. When Winsock RSHD receives a request, it sequentially processes the lines in the Security File to determine whether or not the host and user is granted or denied access. It looks at each line in the Security File until it determines that either the host or the user is specifically denied permission. Winsock RSHD begins by assuming that permission is denied for the request. It then examines the lines in the Security File to see if any of the lines pertain to this request. Once Winsock RSHD finds a line that denies access to either the user or the host, it stops looking and denies permission. If it finds a line that grants permission to the user and/or host, permission is tentatively granted, but it continues to process the lines in the Security File. If it processes the entire Security File and does not find a line that grants permission to the user and/or the host, permission is denied. If security was tentatively granted at some point and not denied subsequently, permission is granted. For example, let's say that the following is the contents of the Security File: jetty booey eib 192.56.42.3 rs6000 +fred@mars -gary@booey -jackie +robin In this example, if any user on the host "jetty" makes a request, permission will be granted, unless the user is "jackie", since "jackie" is denied access from all hosts (-jackie). If "jackie@jetty" makes a request, Winsock RSHD reads through the Security File and finds the host name "jetty", and tentatively grants permission. However, it continues and finds that the user "jackie" is denied from all hosts, so permission is denied. Also, if any user on the host "booey" makes a request, they are granted permission unless the user is "gary", since "gary@booey" is specifically denied permission (-gary@booey). All other users on the host "booey" are granted permission except "jackie" (-jackie). The user "fred" on the host "mars" is granted permission because of the line "+fred@mars". However, since the host "mars" does not appear on a line by itself, no other users on the host "mars" are granted permission except the user "robin", who is granted permission from ANY host (+robin). THE WINSOCK RSHD WINDOW ----------------------- The Winsock RSHD window displays information about connections to the PC. You can use it to monitor access to the PC. +-----------------------------------------------------------------------------+ | = | Winsock RSHD | ^ | v | +-----------------------------------------------------------------------------+ | | | Status: | | Accepting connections... | | | | Last Connection: | | Connected to rs6000 (89.0.0.10) | | Local User: tomf Remote User: tomf | | | | Last Command: | | <%FO\docs\invoice.doc~%FP~%FX> word | | | | Messages: | | | | | | | | | | | +-----------------------------------------------------------------------------+ The window contains the following sections: Status: The current status of Winsock RSHD. Last Connection: The host name (if found in the HOSTS file on the PC), the IP address, the local user name, and remote user name of the last connection to the PC through Winsock RSHD. Last Command: The last command executed through Winsock RSHD. Messages: A scrolling list of various messages displayed by Winsock RSHD. The messages that display here depend on the Message Level parameter in the Winsock RSHD Configuration. With the default Message Level of 0, you will see notification of any permission violations or command execution errors (i.e. command not found). To stop Winsock RSHD, double-click on the button in the top left corner of the window or click on it once and choose "Close" from the menu. To find the version of Winsock RSHD you are using, click once on the button in the top left corner of the window and choose "About" from the menu. EXECUTING COMMANDS ------------------ With Unix, the "rsh" utility executes the specified command on a remote host and returns the standard output and the standard error output to the requesting host. With Windows, there is no such thing as "standard output" and "standard error". Programs execute in graphical windows, so there is no way to return any output using "rsh". Therefore, when using "rsh" from Unix or another PC to initiate commands on a Windows PC, you will not see any output of the command on your screen. It will display on the PC that received the request. For example, if you used the following command: rsh winpc3 excel This would start Excel on the PC named "winpc3". You would see nothing on your screen as a result of starting Excel. Excel would be running on the screen of the PC named "winpc3". The "rsh" command will NOT wait for the specified command to complete. The system issuing the request will regain control immediately after the command begins, unless the command is a DOS program and Windows is not set up to exclusively execute the DOS command. If you attempt to execute a command that does not exist or Windows returns an error trying to load the program, you will receive a descriptive error message on your screen from Winsock RSHD to tell you that the command was not successfully executed. UNREGISTRED VERSION NOTE: The unregistered version of Winsock RSHD returns a message to the remote host about Winsock RSHD not being registered. This does not occur in the registered version. SENDING KEYSTROKES ------------------ Winsock RSHD provides the ability for you to send keystrokes to the Windows application you initiate using the "rsh" command. It also allows you to specify how the window is to be displayed (i.e. normal, minimized, maximized, or hidden). This provides you with some "remote control" over what the program you run does once it starts. For those of you who program in Microsoft Visual Basic or the Visual Basic for Applications macro language, this is very similar to the "SendKeys" capability of those programming languages. The standard syntax of the "rsh" command is: rsh hostname command This will execute "command" on the host "hostname". Winsock RSHD allows a slight modification of the "rsh" syntax to send keystrokes. This is compatible with all "rsh" commands. The alternative syntax for sending keystrokes is: rsh hostname "" command If the first parameter after the host name begins with a less-than sign (<), that parameter is interpreted as keystrokes to be sent to the command specified in the next parameter. The keystrokes must end with a greater-than sign (>). You must also enclose the entire parameter in quotes so special characters and spaces are not interpreted by the operating system. For example, if you wanted to run the Windows Notepad on the PC named "winpc3" and type "This is a test" on the first line, the command would be: rsh winpc3 "" notepad If you looked at the winpc3's screen, you would see the Windows Notepad with "This is a test" on the first line. NOTE: You cannot send keystrokes to an application that is not designed to run in Microsoft Windows (i.e. MS-DOS programs). SENDING SPECIAL KEYSTROKES -------------------------- Winsock RSHD also allows you to specify special keys in the keystrokes parameter that cannot normally be typed on a command line, such as embedded Enter keys, function keys, ALT keys, etc. Keystrokes are sent sequentially as the appear between the "<" and ">". To send a single character, use the character itself. For example, to send the letter "X", use the letter "X". To send the word "hello", just specify those letters. To specify keys combined with any combination of Shift, Ctrl, and Alt keys, prefix the regular key code with one or more of the following codes: Shift + Control ^ Alt % For example, to send the Alt-F keystroke, specify "%F". To send Ctrl-Alt-D, specify "^%D". To send the Enter key, use the tilde (~). To specify that the Shift, Ctrl, and/or Alt keys should be held down while several other keys are pressed, enclose the key codes in parentheses ( ). For example, to have the Alt key held down while X and D are pressed, use "%(XD)". You could also use "%X%D", but if the Shift, Ctrl, and/or Alt keys need to be held down for a number of keystrokes, the parentheses can make the string shorter. Also, you would want to use the parentheses if the application detects the release of the Shift, Ctrl, and/or Alt keys and that is not desired. The following characters have special meaning in the keystroke parameter, so they must be enclosed inside braces ({ }). Some of these special characters have not been explained yet. Special Character Example + (plus) {+} ^ (caret) {^} % (percent) {%} ~ (tilde) {~} < (less than) {<} > (greater than) {>} [ (left sq. bracket) {[} ] (right sq. bracket) {]} ( (left paren) {(} ) (right paren) {)} @ (at-sign) {@} { (left brace) {{} } (right brace) {}} To send characters that are not normally displayed when you press a key (such as Enter or Tab) and keys that represent actions rather than characters, use the following special codes: Key Code Key Code Backspace {BACKSPACE} or {BS} or {BKSP} Break {BREAK} Caps Lock {CAPSLOCK} Clear {CLEAR} Del {DELETE} or {DEL} Down Arrow {DOWN} End {END} Enter {ENTER} or ~ Esc {ESCAPE} or {ESC} Help {HELP} Home {HOME} Ins {INSERT} Left Arrow {LEFT} Num Lock {NUMLOCK} Page Down {PGDN} Page Up {PGUP} Print Screen {PRTSC} Right Arrow {RIGHT} Scroll Lock {SCROLLLOCK} Tab {TAB} Up Arrow {UP} F1 {F1} F2 {F2} F3 {F3} F4 {F4} F5 {F5} F6 {F6} F7 {F7} F8 {F8} F9 {F9} F10 {F10} F11 {F11} F12 {F12} F13 {F13} F14 {F14} F15 {F15} F16 {F16} You can also specify that a key is to repeat itself a certain number of times, without repeating the key itself in the string. To repeat a keystroke, use the format: {keystroke number} Where "keystroke" is the key to repeat, followed by a single space, then the number of times to repeat the key. For example, to press the down arrow key 8 times, use "{DOWN 8}". To type 30 *'s, use: "{* 30}". PAUSING DURING KEYSTROKES ------------------------- At times it may be necessary to pause for a length of time while sending keystrokes to allow some event to occur before sending the remaining keystrokes. This can be done with the special "{PAUSE #}" construct within the keystroke sequence. This can appear within the keystrokes in the same way special keys, such as {RIGHT} or {LEFT} appear. You specify the number of seconds Winsock RSHD should pause before sending the next set of keystrokes. For example, {PAUSE 5} would pause 5 seconds before sending the remaining keystrokes. You may have multiple pauses within a sequence of keystrokes. For example: <%FOabc.doc~{PAUSE 5}%FP~> This keystroke sequence would send the keystrokes "%FOabc.doc~" to the program, pause 5 seconds, then send "%FP~". Avoid using long pauses if possible. Winsock RSHD will NOT process any other requests during the time it is pausing within keystrokes. KEYSTROKE EXAMPLE ----------------- The following example, will start Microsoft Word, load a file, print it, then exit. rsh winpc3 "<%FO\docs\invoice.doc~%FP~%FX>" word The keystrokes are: %F - Alt-F (Drops down the file menu) O - O (Selects Open) \docs\invoice.doc - Types the filename. ~ - Enter (Loads the File) %F - Alt-F (Drops down the file menu) P - P (Selects Print) ~ - Enter (Accepts the defaults on the Print dialog box) %F - Alt-F (Drops down the file menu) X - X (Selects eXit and Word exits) Note that if this example were being run from a Unix system, you would have to use two backslashes (\\) for every one desired backslash because the Unix shells interpret the backslashes as special characters. The command would then be: rsh winpc3 "<%FO\\docs\\invoice.doc~%FP~%FX>" word KEYSTROKE MACRO FILES --------------------- If your keystroke strings get rather long or complex, you can store them in a keystroke macro file so you don't have to specify all of them each time you use the "rsh" command. To create a keystroke macro file, you must use a text editor (or a word processor, but be sure to save as an ASCII file). Enter the keystrokes as you would on the "rsh" command line, with the following exceptions/reminders: 1) Do not enter "<" as the first character in the file or ">" as the last character. All of the characters you enter in the file will be sent. 2) You may press Enter in the file to enter the keystrokes on multiple lines. The line breaks have NO effect on the keystrokes. They will be treated as if they were entered all on the SAME LINE. That is, you must remember to still use "~" or "{ENTER}" to "press" the Enter key. Pressing Enter in the file will NOT send the Enter key. 3) You CANNOT nest keystroke macros. Your macro file CANNOT contain references to other keystroke macro files. 4) The keystroke macro file MUST reside on the PC running Winsock RSHD. You can create the file on that PC or use "rcp" to copy it to that PC before executing the command. To use a keystroke macro file, you enter the at-sign (@) followed by the filename in braces ({ }) where you would normally specify keystrokes on the "rsh" command line. You will most likely need to specify a full pathname of the keystroke file on the PC running Winsock RSHD, unless you know the working directory of Winsock RSHD on the system running it and the keystroke macro resides in that directory. You may use forward slashes (/) instead of backslashes if you wish; this makes life easier for Unix users because the shell interprets the backslash characters. For example, if you had a macro in the directory \kbmac\printss.mac on the PC running Winsock RSHD, you could use it with this command: rsh winpc2 "<@{/kbmac/printss.mac}>" excel This would run "excel" on winpc2 and send the keystrokes stored in the file \kbmac\printss.mac to it. You can intermix command line keystrokes and macro file keystrokes. That is, you can specify some of the keystrokes on the command line and use some from a macro file. You can also use multiple macro files. For example, let's say we want to print a file using "rsh" through a Windows application called "wintiff". We want to store the keystrokes in a macro file, but don't want to store the filename in the macro file because it can change. To do this you can store the first set of keystrokes in one macro file, specify the filename on the "rsh" command line, then store the remaining keystrokes in a second file. For example, let's say the file is "mypic.tif": rcp mypic.tif winpc2:/tmp rsh winpc2 "<@{/kb/tifprt1.mac}\tmp\mypic.tif~@{/kb/tifprt2.mac}" wintiff This example copies the file "mypic.tif" to the \tmp directory on winpc2. Then it runs "wintiff" and first sends the keystrokes from the file \kb\tifprt1.mac. That macro ends when "wintiff" requires a filename. The keystrokes to "type" the filename come from the "rsh" command line since the tifprt1.mac has ended. Then it continues by sending the keystrokes in the file \kb\tifprt2.mac. That is: @{/kb/tifprt1.mac} - Send keystrokes from \kb\tifprt1.mac \tmp\mypic.tif~ - Type \tmp\mypic.tif and press Enter @{/kb/tifprt2.mac} - Send keystrokes from \kb\tifprt2.mac SPECIFYING THE WINDOW TYPE -------------------------- Winsock RSHD also allows you to specify the window type of the application being run. By default, the application is run "normally", as if you ran it by double-clicking on it's icon (assuming you did not set up the icon to run it minimized). If you want to specify an different method of displaying the application's window, you can specify this inside the keystroke parameter by enclosing the method within square brackets ([ ]). There are two methods of setting the window type. You can use one of the words shown below or you can use a number. The options are: Window Option Displays NORMAL Normal Display as defined by the application MINIMIZE Shows the application as a minimized icon MAXIMIZE Maximizes the application on startup HIDE Hides the application (no icon appears) 0 Same as HIDE 1 Same as NORMAL 2 Same as MINIMIZE 3 Same as MAXIMIZE Other numeric values may be used - they correspond to the Windows' ShowWindow function (for all you programmers). For example, if you want to run the Windows Notepad maximized, viewing the file "heyyou.txt", you would type: rsh winpc3 "<[MAXIMIZE]>%FOheyyou.txt~" notepad This runs the Notepad maximized, then "presses" Alt-F-O (File Open) and types the filename "heyyou.txt" and presses Enter to load it. If you wanted to run some application that does some task and exits, you could run it minimized using: rsh winpc3 "<[MINIMIZE]>" bkgprint Note that Windows does not allow you to send keystrokes to a minimized or hidden application. Therefore, "[MINIMIZE]", "[HIDE]", "[0]", or "[2]" should always appear alone between the "<" and ">". If you specify other keystrokes, the application will not receive them (Windows will beep at you for each keystroke). WAITING FOR COMMANDS TO COMPLETE -------------------------------- By default, Winsock RSHD returns control back to the system issuing the command via "rsh" immediately after the command is started and any keystrokes are sent. If you want the "rsh" command to wait until the command finishes executing, you can use the "[WAIT]" option. This is specified like the Window Type, as explained in the previous section. For example, to execute the command "bkgprint" and wait for it to finish, use: rsh winpc3 "<[WAIT]>" bkgprint As with the Window Type, you can combine options and keystrokes. This runs the above command, but minimizes it and waits: rsh winpc3 "<[MINIMIZE][WAIT]>" bkgprint Note that Winsock RSHD cannot process other command requests when you instruct it to wait for a command to complete. If other users issue commands to the PC while it is waiting, they will be queued until Winsock RSHD can process them. The number of requests that can be queued depends on the "Listen Backlog" parameter explained in the Winsock RSHD Configuration section. EXECUTING "INTERNAL" DOS COMMANDS --------------------------------- Some MS-DOS commands are not actually programs; they are internally recognized by the MS-DOS command interpreter COMMAND.COM. One example of this is the DIR command. If you look in the directory where MS-DOS is installed, there will be no DIR.EXE or DIR.COM. It is part of COMMAND.COM. Winsock RSHD recognizes the MS-DOS internal commands and automatically routes them through COMMAND.COM. If you are using some other command shell and it has internal commands with the same names as those in COMMAND.COM, you will need to prefix your commands with the appropriate shell program name. CAPTURING MS-DOS STANDARD OUTPUT AND STANDARD ERROR --------------------------------------------------- You can optionally capture the standard output and standard error output of MS-DOS commands through Winsock RSHD with the "rsh" command. This allows you to display the output of MS-DOS programs that output to the standard output or standard error on another screen or capture it to a file on another system. To do this, you must tell Winsock RSHD that you are executing an MS-DOS command. Winsock RSHD cannot tell whether the command you issue is a Windows program or an MS-DOS program until it starts executing it (and by then, it's too late!). To capture the standard output/standard error of a command, use the "[DOS]" option in the "rsh" command. For example: rsh winpc3 "<[DOS]>" mem This will run the "mem" command on "winpc3" and display the output on the your screen. The "mem" command displays information on the standard output. Note that some MS-DOS programs do not write to the standard output; instead they directly write to video memory. Output from these programs cannot be captured. Also note that the output of the command is not returned in "real time" as it is output from the program. All output is stored in a file on the PC running Winsock RSHD, then is sent over the network when the program finishes. So programs that display "progress reports" to the standard output will display their messages all at once when run through Winsock RSHD. When a program outputs to both the standard output and standard error, first the standard output is sent over the network, then the standard error. The output MAY not be sent in the order that it would normally display if it were actually running on the PC. A good example of this is the Microsoft C/C++ compiler. It outputs its "banner" (copyright message) to the standard ERROR and displays progress reports and error messages to the standard OUTPUT. Therefore, if you run the C compiler with an "rsh" command, you will actually see the banner LAST since the standard output is sent first and the standard error is sent last. You can reverse the order of the sending of the standard output and standard error by using the "[DOS2]" option. The acts just like the "[DOS]" option, but sends the standard error first. The "[DOS]" and "[DOS2]" options imply the "[WAIT]" option, so there is no need to specify it also. Winsock RSHD must wait for the command to complete to capture its output. COPYING FILES USING RCP ----------------------- Winsock RSHD also provides Remote Copy (RCP) Server capability. This allows you to copy files to and from a PC running Winsock RSHD using the "rcp" command. The "rcp" command is commonly found on Unix systems and in some TCP/IP packages for Windows and DOS. If your TCP/IP package does not provide the "rcp" command, you can use Winsock RCP from Denicomp Systems. The "rcp" command is described in more detail in your TCP/IP package manual or with the manual that comes with Winsock RCP. However, here are a few examples of its use. To copy a file from the host named "srvpc" to your PC or Unix system, use: rcp srvpc:yourfile myfile The file "yourfile" is copied from the host named "srvpc" to the file on your PC named "myfile". The host "srvpc" could be running either Windows and Winsock RSHD or Unix. To copy a file from your PC or Unix system to the PC named "srvpc", use: rcp \lists\xmas.doc srvpc:\word\lists The file \lists\xmas.doc is copied from your system to the file xmas.doc in the directory \word\lists on the PC named "srvpc". To send the entire directory tree from your PC or Unix system to "srvpc", use: rcp -r \share srvpc:\ All of the files and subdirectories in the directory \share is copied to the PC named "srvpc". It will create a \share directory in the root directory (\) of srvpc. If the \share directory contained any subdirectories, they would be created on the other PC and all the files in them would also be copied. To copy all of the files ending with ".xls" from "srvpc" to your PC, use: rcp srvpc:\sheets\*.xls . This copies all of the files ending with ".xls" in the directory \sheets on "srvpc" to the current directory (.) on your PC. You can use drive letters if necessary. For example, to copy a file from the A: drive on the "srvpc" to your PC: rcp srvpc:a:file.txt file.txt This will copy "file.txt" from the A: drive on "srvpc" to the file "file.txt" on your system. NOTE: Winsock RSHD allows you to use both slashes (/) and backslashes (\) for directory separators. It will adjust appropriately. This is especially important for Unix users, since backslashes are interpreted by the shell and must be escaped by using two backslashes for every one backslash. Use slashes instead. NOTES FOR SCO XENIX ------------------- If you are using SCO Xenix with Excelan's LAN Workplace for Xenix, you may receive error messages when using "rsh" and "rcp" to access a PC running Winsock RSHD. These error messages are basically harmless - both commands work even though you receive an error message. When using "rsh", you may receive an error about the "stdio" connection being dropped. If you do, you can stop this message by using the "-n" option of rsh. For example, use: rsh winpc2 -n notepad (If you are specifying keystrokes, they go AFTER the "-n"). When using "rcp", you may receive a socket error 104. There is no work around for this error message. However, the files will all be copied successfully. You can ignore this error message. SHAREWARE NOTE -------------- The unregistered version of Winsock RSHD is different from the registered version in the following two ways: 1) When you execute a command using "rsh", Winsock RSHD will return a message to the rsh command reminding you that Winsock RSHD is not registered. This message will be displayed on the screen requesting the execution of the command. This will not occur in the registered version. 2) At random times on the PC running Winsock RSHD, when Winsock RSHD receives a command request it will require you to click on an "OK" button in a screen that reminds you that Winsock RSHD is not registered. This will also cause the "rsh" or "rcp" command on the requesting system to ALSO PAUSE until "OK" is clicked on the server PC. The command WILL be completed once "OK" is clicked on the server. This will not occur more than once per hour. WINSOCK RSHD CONFIGURATION FILE ------------------------------- Configuration information for Winsock RSHD is stored in the file WRSHD.INI. This file must be placed in the Windows directory (usually \WINDOWS). This file is normally created and modified by the Winsock RSHD Configuration program. However, you may modify it manually using a text editor. This section shows the configuration options that may be placed in the WRSHD.INI file for those who prefer to configure it manually. If WRSHD.INI does not exist in the Windows directory, default values are assumed for all options. No WRSHD.INI file is provided with the Winsock RSHD distribution. If you wish to change any of the default values, you must either use the Configuration program or create the file with your favorite text editor. The WRSHD.INI consists of one section called "[Setup]". The configuration options must appear after a line that contains "[Setup]". The configuration options are specified in the format: Option=Value Each of the options were explained in detail earlier in the section on WINSOCK RSHD CONFIGURATION. The following gives the Option names: The options are: Screen Title Option Name ------------ ----------- Method Method Minimize on Startup MinimizeOnStartup Message Level MessageLevel Security File SecurityFile Request Log RequestLog Deny Log DenyLog Error Log ErrorLog Port Port RCP Block Size RCPBlockSize Listen Shutdown ListenShutdown Listen Backlog ListenBacklog Listen Linger ListenLinger Listen KeepAlive ListenKeepAlive Listen ReuseAddr ListenReuseAddr Connection Linger ConnLinger Connection KeepAlive ConnKeepAlive Connection ReuseAddr ConnReuseAddr Connection Shutdown ConnShutdown Stderr Linger StderrLinger Stderr KeepAlive StderrKeepAlive Stderr ReuseAddr StderrReuseAddr Stderr Shutdown StderrShutdown EXAMPLE WINSOCK RSHD CONFIGURATION FILE --------------------------------------- The following is an example of the contents of a WRSHD.INI file: [Setup] MinimizeOnStartup=1 SecurityFile=C:\WINDOWS\WRSHD.SEC DenyLog=C:\WRSHD\DENY.LOG SUPPORT ------- Support is available via U.S. Mail and Compuserve/Internet. Denicomp Systems P.O. Box 731 Exton, PA 19341 Compuserve: 71612,2333 Internet: 71612.2333@compuserve.com