home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / rmxbeta.zip / rmx / rmx.doc
Text File  |  1994-09-06  |  19KB  |  492 lines

  1. Remote Execution for OS2 - RMX-OS2
  2. **********************************
  3. Before you even look at this, please be aware that the RMX-package is
  4. not finished yet. This release cannot even be considered being beta.
  5. You will, however, (I hope) be able to verify what RMX-OS2 is, and
  6. perhaps give me some assistance in getting it finished. You'll need a
  7. network that supports remote named pipes.
  8.  
  9. As I don't want to get into trouble with any lawyers, I suppose I had
  10. better put this here: 
  11.  
  12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  13. FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  14. OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  15. PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  16. OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  18. TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  19. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  20. REPAIR OR CORRECTION.
  21.  
  22. If there is anything at all you are wondering about, please don't
  23. hesitate to send me mail:
  24.  
  25.     wilf@niksula.hut.fi
  26.  
  27.  
  28.  
  29. What is remote execution?
  30. =========================
  31. The applications in the Windows and OS2 operating systems must run on
  32. the machine where you want their output to appear. It is not possible
  33. to run the application in one computer and "redirect" its output to
  34. another. Even if you have a file server, this is still the case. The
  35. application is only _stored_ on the file-server, when you run the
  36. application it runs on your local machine.  
  37.  
  38. Now, why would you want to have remote execution? Well, you could have
  39. one really powerful machine - say a Pentium - where people run their 
  40. applications and then use cheaper computers, say 486SXs, as
  41. intelligent terminals. And as every X-user knows, being able to run an
  42. application on different computer than where the output is displayed
  43. simply _is_ a useful feature.
  44.  
  45. Providing remote execution as an add-on is what the RMX package is all
  46. about. 
  47.  
  48.  
  49.  
  50. How does RMX work
  51. =================
  52. OS2 is built around dynamic link libraries. Only the very core of OS2
  53. is in the files - e.g. OS2KRNL - found in the root directory of the
  54. boot drive. The rest, including Presentation Manager and Workplace
  55. Shell, are all DLLs. Most functions a PM-program uses for producing
  56. output are collected into a few DLLs. If these DLLs are replaced with
  57. equivalent DLLs it is possible to "move" the execution of a function
  58. to another computer.
  59.  
  60. Technically it would be possible to replace the original DLLs of OS/2
  61. itself, in which case each and every OS2-program could be executed
  62. remotely without any extra hazzle involved, but the amount of work
  63. needed for doing that would be somewhat overwhelming. Eventually I may
  64. do that, however.
  65.  
  66. In order to make an application use the DLLs of RMX, the application
  67. needs to be marked. Marking an application essentially means that it
  68. is patched so that it, instead of using e.g. PMWIN.DLL, will use
  69. RXWIN.DLL. Patching like this is perfectly safe but as the tool does
  70. not yet allow you to "depatch" the application, I suggest you first
  71. make a copy of the original file which you then patch.
  72.  
  73. Even if an application is patched, the application need not be run
  74. remotely and most of RMX need not be present. Only the DLLs whose
  75. name start with RX must be available. When run locally they simply
  76. pass all calls directly through to the real PM-DLLs. In practice this
  77. causes no overhead at all. For those familiar with programming, the
  78. penalty is only the cost of one additional function call.
  79.  
  80. The same terminology is used in RMX as in X. I.e. the computer where
  81. the output of the application is displayed is called the
  82. display-server or simply server. The applications uses the the
  83. services of the server and are hence called clients. The computer
  84. where the clients run is called a CPU-server.
  85.  
  86.  
  87.  
  88. Files
  89. =====
  90. When you unzip the rmx.zip, you'll get the following directory and
  91. file structure. 
  92.  
  93. .\rmx\bin\pmserver.exe
  94. .\rmx\bin\pmengine.exe
  95. .\rmx\bin\rmxmark.exe
  96. .\rmx\bin\rmxstrtr.exe
  97. .\rmx\bin\rmxstart.exe
  98. .\rmx\demo\...
  99. .\rmx\dll\rxctls.dll
  100. .\rmx\dll\rxlpmgr.dll
  101. .\rmx\dll\rxgpi.dll
  102. .\rmx\dll\rxshapi.dll
  103. .\rmx\dll\rxwin.dll
  104. .\rmx\dll\rmxpipe.dll
  105. .\rmx\dll\rmxctls.dll
  106. .\rmx\dll\rmxlpmgr.dll
  107. .\rmx\dll\rmxgpi.dll
  108. .\rmx\dll\rmxshapi.dll
  109. .\rmx\dll\rmxwin.dll
  110. .\rmx\dll\rmxos2b.dll
  111. .\rmx\dll\rmxos2g.dll
  112. .\rmx\dll\rmxos2c.dll
  113. .\rmx\dll\rmxos2s.dll
  114. .\rmx\doc\rmx.doc
  115.  
  116. The following files are needed on the display-server:
  117.     pmserver.exe pmengine.exe rmxstart.exe rmxos2b.dll,
  118.     rmxos2g.dll rmxos2s.dll rmxpipe.dll
  119.  
  120. And the following on the CPU-server:
  121.     rxctls.dll rxlpmgr.dll rxgpi.dll rxshapi.dll rxwin.dll
  122.     rmxctls.dll rmxlpmgr.dll rmxgpi.dll rmxshapi.dll rmxwin.dll 
  123.     rmxos2b.dll rmxos2g.dll rmxos2c.dll rmxpipe.dll
  124.  
  125. The DLLs have to be in a directory that is included in the LIBPATH.
  126. You can of course move all RMX-DLLs to one of the directories that are
  127. in the LIBPATH already, but I'd suggest adding the RMX DLL directory to
  128. the LIBPATH instead.
  129.  
  130. The RMX-directory need not be in the root, it can be moved anywhere.
  131.  
  132. In the following each file of RMX is descibed:
  133.  
  134. pmserver.exe & pmengine.exe
  135. ---------------------------
  136. Pmserver must be running on the display-server if remote execution is
  137. to be used. It simply sits there, idle most of the time, waiting for
  138. remote clients to initiate a connection. When a client connects, the
  139. pmserver starts a pmengine that provides services for that client. So,
  140. for each client there will a separate pmengine. 
  141.  
  142. The pmengines look and feel exactly as the clients that are running on
  143. the CPU-server.
  144.  
  145. You have to specify the engine using the environment variable
  146. RMXENGINE. E.g.: 
  147.  
  148.       [C:\]set RMXENGINE=C:\RMX\BIN\pmengine.exe
  149.       [C:\]start pmserver
  150.  
  151. In general you need not worry about these applications, just start the
  152. pmserver. 
  153.  
  154.  
  155. rmxmark.exe
  156. -----------
  157. This application marks an application for remote execution. Without
  158. any flags, rmxmark marks the application if it is convinced the remote
  159. execution of the application will succeed. Remote execution will
  160. succeed provided the application only uses PM-DLLs rmxmark knows
  161. about, and the application is a true 32-bit executable. 32-bit
  162. applications that use the 16-bit interface of PM-DLLs cannot be
  163. marked. But as rmxmark complains about any 16-bit functions and not
  164. only the ones related to PM, remote execution may still succeed. 
  165.  
  166. If rmxmark refuses to mark an application it can always be forced to
  167. do that by starting it with the flag -f. Whether remote execution
  168. really will work can only be found out by testing. 
  169.  
  170. There is no technical reason for not supporting 16-bit DLLs. I only
  171. thought it would be a waste of time and effort to support them.
  172. However, I've noticed that quite a few applications use the
  173. VIO-functions so I may add support for them. Unless of course IBM
  174. chooses to provide 32-bit character I/O-functions.
  175.  
  176. Of the programs delivered with OS/2 only a fairly small number can be
  177. marked. Mainly because most of them are 16-bit programs. The ones that
  178. can be marked are:
  179.  
  180.     c:\os2\e.exe
  181.     c:\os2\pulse.exe
  182.     c:\os2\apps\jigsaw.exe
  183.  
  184. Unfortunately, atleast for the moment, jigsaw.exe causes a protection
  185. violation when you attempt to open a file. I'm pretty certain the
  186. reason is that it has such a small stack.
  187.  
  188.  
  189. rmxstrtr.exe & rmxstart.exe
  190. ---------------------------
  191. These files are used for starting applications on the CPU-server from
  192. the display-server. These programs are actually not part of RMX, they
  193. are only provided for convenience. They are also named-pipe specific
  194. so they won't be usable under RMXTCPIP (which is not here yet).
  195.  
  196. Anyway, first start rmxstrtr on the CPU-server. It's a deamon
  197. application so it can very well be detached. However, it does write 
  198. some information about what it's doing to the stdout, so you might
  199. want to start it in a command prompt window. When started, it sits
  200. idle while waiting for requests to start applications.
  201.  
  202. Rmxstart.exe is then used to start applications on the CPU-server from
  203. the display-server. Suppose the name of the CPU-server is \\CPU_SERVER
  204. and the name of the display-server is \\MY_DISPLAY and you want to
  205. start the application mine.exe. Then you just issue:
  206.  
  207.     [C:\]rmxstart \\CPU_SERVER mine.exe \\MY_DISPLAY
  208.  
  209. As a result of the the rmxstrtr on \\CPU_SERVER will attempt to start
  210. mine.exe, whose output will be redirected to \\MY_DISPLAY.
  211.  
  212. A few things to keep in mind:
  213.  
  214.     (1) The application will be started with the same environment
  215.         as rmxstrtr.exe has. So make sure the PATH is ok when it
  216.         is started. 
  217.     (2) Rmxstrtr makes no attempt to verify that the application
  218.         can be executed remotely. So, if the application has
  219.         not been marked, it will appear on the CPU-server and not
  220.         on the display-server. 
  221.     (3) The trick of having "." in the LIBPATH won't work properly
  222.         as the current directory, when the applications are started,
  223.         is always the directory from which rmxstrtr was started.
  224.     (4) You can use an absolute path in the application name.
  225.  
  226.  
  227. rxwin.dll rxgpi.dll rxshapi.dll rxctls.dll rxlpmgr.dll
  228. ------------------------------------------------------
  229. These DLLs replace replace pmwin.dll, pmgpi.dll, pmshapi.dll,
  230. pmctls.dll and helpmgr.dll respectively. If the application is run
  231. locally - i.e. run and displayed on the same machine - they "route"
  232. all function calls directly to the correspnding PM-DLLs. If the
  233. application is run remotely they route all function calls to
  234. corresponding RMX-DLLs.
  235.  
  236.  
  237. rmxwin.dll rmxgpi.dll rmxshapi.dll rmxctls.dll rmxlpmgr.dll
  238. -----------------------------------------------------------
  239. These DLLs redirect all function calls to the appropriate pmengine on
  240. the display-server.
  241.  
  242.  
  243. rmxpipe.dll
  244. -----------
  245. The actual transfer of bytes from a client to an engine is outside
  246. RMX. The byte transfer is handled by a DLL that is loaded during
  247. startup. The specification of that DLL - what functions it must
  248. contain and what they should do - is public and available to anyone
  249. interested (mail me if you are). Hence, it is basically quite trivial
  250. to provide support for different networks and/or media.
  251.  
  252. The default implementation of the communications DLL is rmxpipe, which
  253. uses named pipes. I hope I or somebody else will soon write a DLL for
  254. TCP/IP. The DLL to be used _must_ be specified before any applications
  255. or pmserver are started. 
  256.  
  257.     [C:\]set RMXCOMMS=rmxpipe
  258.     [C:\]start pmserver
  259.  
  260. The same DLL must of course be used in both the CPU-server and the
  261. display-server. 
  262.  
  263.  
  264.  
  265. Installation
  266. ============
  267. The following procedure should give you a working environment. Here I
  268. have assumed RMX has been installed in drive C:.
  269.  
  270. Both-computers
  271. --------------
  272. 1) [C:\]unzip rmx.zip
  273.  
  274. 2) Add C:\RMX\DLL; to the LIBPATH in config.sys.
  275.  
  276. 3) Add the following lines to config.sys:
  277.  
  278.    set RMXENGINE=C:\RMX\BIN\pmengine.exe
  279.    set RMXCOMMS=rmxpipe
  280.  
  281. 4) Reboot
  282.  
  283. CPU-server
  284. ----------
  285. [C:\]net share ipc$ (or whatever you have to do to enable remote named pipes)
  286.  
  287. [C:\]cd \rmx\demo
  288.  
  289. [C:\RMX\DEMO]copy C:\OS2\APPS\pulse.exe .
  290.  
  291. [C:\RMX\DEMO]..\bin\rmxmark pulse.exe
  292.  
  293. [C:\RMX\DEMO]..\bin\rmxstrtr
  294.  
  295.  
  296. Display-server
  297. --------------
  298. [C:\]net share ipc$ (or whatever you have to do to enable remote named pipes)
  299.  
  300. [C:\]cd \rmx\bin
  301.  
  302. [C:\RMX\BIN]start pmserver.exe
  303.  
  304. [C:\RMX\BIN]rmxstart \\CPU_SERVER pulse.exe \\MY_DISPLAY
  305.  
  306. Pulse.exe running on \\CPU_SERVER should now appear on \\MY_DISPLAY.
  307. You should of course replace \\CPU_SERVER and \\MY_DISPLAY with
  308. whatever names your computers have.
  309.  
  310. The \RMX\DEMO directory contains original shareware programs that I've
  311. been using while testing RMX. Simply unzip those programs and mark the
  312. executables and use them. Not all of them work perfectly, start with
  313. mine and tetris. Pmps allows you to monitor and kill applications on
  314. another computer.  
  315.  
  316.  
  317.  
  318. Starting remote applications
  319. ============================
  320. The normal way to start a remote execution is through rmxstrtr and
  321. rmxstart. However, there is another way.
  322.  
  323. Before starting a client application set RMXDISPLAY to the computer
  324. where you want your application to appear. E.g.:
  325.  
  326.     [C:\]set RMXDISPLAY=\\MY_DISPLAY
  327.     [C:\]start mine.exe
  328.  
  329. Now the application will appear on the computer \\MY_DISPLAY instead
  330. of in the local computer. If RMXDISPLAY is not defined, the
  331. application will run locally. This is essentially what rmxstrtr.exe
  332. does when it starts an application. Rmxstart.exe tells it what
  333. RMXDISPLAY should be, rmxstrtr sets it to that and starts the
  334. application. 
  335.  
  336. Doing it manually is of course possible only if you have the two
  337. computers next to each other or if you have other way of logging on to
  338. the CPU-server, e.g. telnet over TCP/IP.
  339.  
  340. NOTE: If you manually start an application from a command prompt you
  341.       _have_ to use "start". Otherwise PM (not OS/2 itself) will freeze.  
  342.  
  343.       The reason is, I believe, that as the application is a
  344.       PM-application, the Presentation Manager expects it to create a
  345.       message queue and start receiving messages. As the calls for
  346.       doing that are redirected to the display-server, they will never
  347.       be made on the CPU-server with the effect of PM freezing up.
  348.  
  349.       When the application is terminated (from the dislay-server) PM
  350.       starts working again. 
  351.  
  352.  
  353.  
  354. Performance
  355. ===========
  356. Please be prepared that he applications will run very slowly. I have
  357. debugging code all over the place and I havn't done any optimizations
  358. at all. Optimizing the DLLs and the executables won't have too much
  359. impact, but optimizing the message traffic between the client and the
  360. engine will significantly improve the performance. However, I don't
  361. intend to do much optimization before I'm satisfied with the
  362. functionality. 
  363.  
  364.  
  365.  
  366. Security
  367. ========
  368. Adding remote execution as an add-on has implications on the security.
  369. When pmserver is running, anybody can initate a connection with the
  370. computer and e.g. start a hidden application that monitors keystrokes.
  371. Currently there are no security features in RMX but I have a
  372. specification ready that allows third-parties to implement whatever
  373. security features are felt necessary. I assume the security-issue will
  374. not be particularily important as long as RMX is not finished product,
  375. but if somebody is interested in that specification, let me know and
  376. I'll send it to you.
  377.  
  378.  
  379.  
  380. Debugging
  381. =========
  382. During execution of programs there will be crashes. Occasionally RMX
  383. is able to gracefully handle protection violations and alike and
  384. prevent the application from being terminated. However, problems like
  385. this are always logged to the file rmx.log. If the environment
  386. variable RMXDIR is specified, RMX attempts to create the logfile in
  387. that directory. Otherwise it creates it in the root-directory.
  388.  
  389. If you experience problems, please check that file on both the
  390. CPU-server and the display-server as it might contain an explanation. 
  391.  
  392. If there is nothing useful there then set RMXDEBUG to 1, 2 or 3 (there
  393. is not much difference between them currently, but eventually there
  394. will be) and restart the application.
  395.  
  396.     [C:\]set RMXDEBUG=3
  397.     [C:\]start mine.exe
  398.  
  399. This will cause a LOT of information to be written to rmx.log. Do
  400. whatever you have to do in order to get the problem to appear and then
  401. mail the contents of the log-file to me. Preferably the log-files from
  402. both the CPU-server and the display-server. You need of course to stop
  403. the pmserver, set RMXDEBUG and restart it for the logging to start.
  404.  
  405. Don't have RMXDEBUG set all the time, as it really makes the
  406. applications crawl.
  407.  
  408. If you can do so (you have written it, it is shareware or you trust
  409. me), please send the entire executable that is causing trouble to me, 
  410. along with a description that allows me to regenerate the problem. The
  411. executable need not contain any debug info, nor do I need any source.
  412.  
  413.  
  414.  
  415. Known big misfeatures
  416. =====================
  417. The help doesn't work at in applications.
  418.  
  419. I havn't reverse engineered the default file-open dialog box yet.
  420. Therefore when you run e.g. e.exe remotely the files shown in the
  421. listboxes when you choose [File]->[Open] are the files on the
  422. display-server and not the files on the CPU-server. A workaround is to
  423. have same network drives visible on both machines. With Lan Server
  424. this would be:
  425.  
  426.     CPU-server
  427.     [C:\]net share c=c:\
  428.     [C:\]net use x: \\CPU_SERVER\C
  429.  
  430.     display-server
  431.     [C:\]net use x: \\CPU_SERVER\C
  432.  
  433. This way if you choose a file from X: it will be the same one both the
  434. CPU-server and the display-server. I will provide a transparent
  435. replacement for the default dialog boxes so that there will be no need
  436. for having the same directory visible on both computers.
  437.  
  438. If the client-application is terminated in an uncontrolled fashion,
  439. the pmengine may fail to detect that and not die. In that case it'll
  440. be around until the display-server is booted. However, you'll get the
  441. PID of the engine using pstat and then you can kill it with some 
  442. kill-utility. 
  443.  
  444.  
  445.  
  446. Future
  447. ======
  448. Currently my main effort is directed towards getting all functionality
  449. of the five supported DLLs implemented. Only then will I start
  450. improving the performance.  
  451.  
  452. If there is an application you really would like to use remotely, but
  453. cannot because it uses some DLL that RMX does not support let me know
  454. and I'll see what I can do. In principle the creation of a replacement
  455. DLL is fairly trivial as I have developed a C++ class framework for
  456. doing that, but I really would like to get the current DLLs working
  457. perfectly before jumping on to the next ones.
  458.  
  459. However, don't hold your breath while waiting for upgrades, bug-fixes
  460. etc. as I'm developing RMX only in my sparetime. If things get busy at
  461. work I may not be able to work on this for a longer period of time. Of 
  462. course, if you really like RMX, you can always buy it from me and
  463. continue developing it yourself or aliternatively pay me enough to be
  464. able to work fulltime on it;-)
  465.  
  466. And finally a little bit of vapour-ware:-) 
  467.  
  468. If and when OS/2 is available on PowerPC I hope to be able to provide
  469. an RMX implementation that would allow applications running natively
  470. on a PowerPC computer to display their output on an Intel-computer and
  471. vice versa. 
  472.  
  473. The concept for providing remote execution is in no way OS/2 specific.
  474. Most of the code is portable and providing remote execution for Window
  475. NT or Chicago should not be too big a task. When I have enough space
  476. to install them, I will check how much work it would mean.   
  477.  
  478. Again, if you have any question or statement - e.g. that this document is
  479. incomprehensible - please send mail to
  480.  
  481.     wilf@niksula.hut.fi
  482.  
  483. Cheers,
  484.     Johan
  485.  
  486.  
  487. BTW: I've developed RMX as part of my Master's Thesis which I'm about
  488.      to finish right now. If you are interested in it, let me know and
  489.      I'll mail it to you when it's ready.
  490.  
  491.  
  492.