home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR3 / EXEC33B.ZIP / README.DOC < prev    next >
Text File  |  1993-11-29  |  25KB  |  564 lines

  1.  
  2.                   An EXEC function with memory swap
  3.                    Version 3.3b, released 93-11-29
  4.  
  5.                       Public Domain Software by
  6.                             Thomas Wagner
  7.                        Ferrari electronic GmbH
  8.                   (NOTE: Address change, see below)
  9.  
  10.  
  11. This archive contains the sources for an 'EXEC' function that allows
  12. calling external programs, while optionally swapping out the memory
  13. image to EMS, XMS, or file. When swapping out, only a few K of main
  14. memory remain resident. The code and data stub is about 1k, the actual
  15. memory usage depends on memory fragmentation, and especially on the
  16. size of the environment variables. The resident memory usage
  17. typically ranges from 2K to 7K.
  18.  
  19. The Routines are compatible with 
  20.    Turbo C (Versions 1.x, 2.x, and C++ 1.0)
  21.    Borland C++ (Version 2.0 and above),
  22.    Microsoft C (Versions 5.1 and above), 
  23.    Watcom C (Version 8.0), 
  24.    Turbo Pascal (Versions 4.x to 6.x).
  25.  
  26. EMS (LIM 3.0 or above) or XMS is used automatically if there is
  27. enough space left, otherwise a temporary file is created. If the
  28. "TEMP=" or "TMP=" environment variable is present, the temporary file
  29. is created in the directory specified by this variable, otherwise it
  30. is created in the current directory.
  31.  
  32. For detailed usage and parameter information, see the file "exec.h" (C) 
  33. or "exec.pas" (Pascal).
  34.  
  35. The general format is
  36.  
  37.    retcode = do_exec (filename to execute,
  38.                       program parameter and redirection string,
  39.                       spawn options,
  40.                       memory needed (0xffff to always swap, 0 to never swap),
  41.                       environment pointer/flag)
  42.  
  43. for example:
  44.  
  45.    rc = do_exec ("cl", "-c -Od exec.c >&errout", USE_ALL, 0xffff, NULL);
  46.  
  47. or, for Pascal:
  48.  
  49.    rc := do_exec ('tpc', '/$D+ exec >&errout', USE_ALL, $ffff, false);
  50.  
  51. Redirection for standard input, standard output, and standard error
  52. is optionally handled by parsing the command parameter string for the
  53. standard redirection combinations:
  54.  
  55.    stdin:   <file
  56.    stdout:  >file    or >>file   to append
  57.    stderr:  >&file   or >&>file  to append
  58.  
  59. Redirection is supported by default, to disable it you must change
  60. the define in both spawn.asm and exec.c/exec.pas.
  61.  
  62. If the command to be executed is a BAT file, the command processor
  63. will be invoked automatically. The command processor will also be
  64. invoked if the command is empty. The COMSPEC environment variable is
  65. used to locate the command processor, any parameters present on the
  66. COMSPEC line are inserted into the parameter string.
  67.  
  68. An example:
  69.  
  70.    Given   COMSPEC=C:\DOS\COMMAND.COM /E:960
  71.            PATH=C:\DOS;C:\CMD
  72.            File B.BAT resides in C:\CMD
  73.            do_exec is called with ('b', 'one two >out', ...)
  74.  
  75.    Then the command executed is
  76.            C:\DOS\COMMAND.COM
  77.    with the parameter string
  78.            /E:720 /C C:\CMD\B.BAT one two
  79.    and standard output redirected to file 'out'.
  80.  
  81.  
  82.  
  83.                         CONTENTS
  84.                         ========
  85.  
  86. This archive contains the following files:
  87.  
  88.     README.DOC      This file
  89.     LIESMICH.DOC    German version of this file
  90.  
  91.     GETLANG.EXE     A helper program to extract a single-language
  92.                     version from the dual-language source. All C and
  93.                     Assembler sources (Pascal sources only partially)
  94.                     are commented in both English and German,
  95.                     which makes the code hard to read. For easier
  96.                     reading, you can use GETLANG to eliminate one
  97.                     of the languages.
  98.  
  99.          Usage:   GETLANG language compiler <infile >outfile
  100.             Where    language is 'E' for English or 'D' for German
  101.                      compiler is 'C' for C files, 'A' for Assembler,
  102.                      or 'P' for Pascal.
  103.  
  104.          Samples: GETLANG e a <spawn.asm >spawne.asm
  105.                   GETLANG e c <extest.c >exteste.c
  106.  
  107.     DEUTSCH.BAT     Batch-File to execute GETLANG for all source
  108.                     files, German version
  109.     ENGLISH.BAT     Batch-File to execute GETLANG for all source
  110.                     files, English version
  111.  
  112.     SPAWN.ASM       The main swap/exec function
  113.  
  114.         This file is common to the C and Pascal versions.
  115.         It must be assembled with Turbo-Assembler for use with
  116.         Pascal. The C version can be assembled with TASM (specify 
  117.         /JMASM51 on the command line) or MASM 5.1.
  118.  
  119.         To assemble:
  120.             tasm /DPASCAL spawn,spawnp;     For Turbo Pascal, near calls
  121.             tasm /DPASCAL /DFARCALL spawn,spawnp;  
  122.                                             For Turbo Pascal, far calls
  123.             ?asm spawn;                     For C (default small model)
  124.             ?asm /DMODL=xxx spawn;          For C (model 'xxx')
  125.          Example:
  126.             masm /DMODL=large spawn;            Large model C
  127.             tasm /DMODL=medium /JMASM51 spawn;  Medium model C
  128.  
  129.     SPAWNP.OBJ      SPAWN assembled for use with Pascal, near calls
  130.     SPAWNCS.OBJ     SPAWN assembled for use with C (small model)
  131.     SPAWNCL.OBJ     SPAWN assembled for use with C (large model)
  132.         
  133.         The C files have been assembled with the /MX switch
  134.         for case-sensitive external linking.
  135.  
  136.         Note for Turbo Pascal: You can use the near call version of
  137.         SPAWN even when compiling with "force far calls" by enclosing
  138.         the external definitions of do_spawn and prep_swap in file
  139.         exec.pas with {$F-} and {$F+}.
  140.         To avoid confusion when generating multiple language
  141.         versions, the Pascal OBJ-File was named "spawnp.obj".
  142.  
  143.     CHECKPAT.ASM   Utility function to check and resolve a path 
  144.  
  145.         This file is common to the C and Pascal versions.
  146.         It must be assembled with Turbo-Assembler for use with
  147.         Pascal. The C version can be assembled with TASM (specify 
  148.         /JMASM51 on the command line) or MASM 5.1.
  149.  
  150.         To assemble:
  151.             tasm /DPASCAL checkpat,checkpap;  For Turbo Pascal, near calls
  152.             tasm /DPASCAL /DFARCALL checkpat,checkpap;  
  153.                                               For Turbo Pascal, far calls
  154.             ?asm checkpat;                    For C (default small model)
  155.             ?asm /DMODL=xxx checkpat;         For C (model 'xxx')
  156.          Example:
  157.             masm /DMODL=large checkpat;            Large model C
  158.             tasm /DMODL=medium /JMASM51 checkpat;  Medium model C
  159.  
  160.     CHECKPAP.OBJ    CHECKPAT assembled for use with Pascal, far calls
  161.     CHECKPCS.OBJ    CHECKPAT assembled for use with C (small model)
  162.     CHECKPCL.OBJ    CHECKPAT assembled for use with C (large model)
  163.     CHECKPAT.PAS    Wrapper unit for checkpat (Pascal only)   
  164.  
  165.         The C files have been assembled with the /MX switch
  166.         for case-sensitive external linking.
  167.         The Pascal version must be assembled with the FARCALL switch
  168.         when used with the CHECKPAT.PAS unit. At least Turbo Pascal
  169.         version 5.5 seems to automatically generate a far call if an
  170.         external routine is defined in the interface part of the unit.
  171.  
  172.     EXEC.PAS        Interface routines and documentation for Turbo Pascal
  173.     EXEC.C          Interface routines for C
  174.     EXEC.H          Interface definitions and documentation for C
  175.     COMPAT.H        MS-C/TC Compatibility definitions for C
  176.  
  177.         These files prepare the parameters for the main spawn
  178.         function, and handle the file search and environment 
  179.         processing.
  180.  
  181.     EXTEST.C        C Test program for EXEC
  182.     EXTEST.PAS      Turbo Pascal Test program for EXEC
  183.  
  184.         The EXTEST program tests the functionality of the do_exec
  185.         function. It expects you to input a DOS-command and its
  186.         parameters, separated by a comma. Entering an empty line
  187.         will spawn a copy of COMMAND.COM without parameters.
  188.  
  189.    MAKEPAS          Make-file for Turbo Pascal (Borland Make) 
  190.    MAKETC           Make-file for Borland C++ (Borland Make) 
  191.    MAKEMS           Make-file for Microsoft C (MS NMAKE) 
  192.  
  193.  
  194. The Turbo Pascal version of EXEC.PAS includes replacement functions
  195. for the environment access functions 'envcount', 'envstr', and
  196. 'getenv', plus an additional function, 'putenv'. This function allows
  197. you to add strings to the environment for the spawned process. The
  198. definition is
  199.  
  200.         procedure putenv (envstr: string);
  201.  
  202. with 'envstr' containing a string of the form 'ENVVAR=value'. The '='
  203. is required. To delete an environment string, use 'ENVVAR='. Please
  204. use the environment functions from the EXEC unit only, do not mix them
  205. with calls to the DOS unit functions.
  206.  
  207.  
  208.                         SUPPORT
  209.                         =======
  210.  
  211. This software is in the Public Domain. This means that there is no
  212. restriction whatsoever on private or commercial use. No registration
  213. fees have to be paid, and no licenses are necessary for use. It also
  214. means that the author can not be held liable for any damages caused
  215. by the use of this software. You have the source, please check it out
  216. before use.
  217.  
  218. I will try my best to eliminate any bugs reported to me, and to 
  219. incorporate suggested enhancements and changes. However, my spare 
  220. time is limited, so I can not guarantee continued or individual 
  221. support. Please address all reports or questions to my business 
  222. address: 
  223.  
  224.         Ferrari electronic GmbH
  225.         attn: Thomas Wagner
  226.         Ruhlsdorfer Strasse 138
  227.         D-14513 Teltow
  228.         Germany
  229.  
  230.         Phone: (+49 3328) 474 626
  231.         Fax:   (+49 3328) 438 04-0
  232.         BBS:   (+49 3328) 438 04-8
  233.  
  234.         Internet:    twagner@bix.com
  235.         BIX:         twagner
  236.         Compuserve:  100023,2042
  237.  
  238. But, please, if at all possible, do it in writing. Please do not 
  239. phone unless it is absolutely vital (or you have a business 
  240. proposal). I like to hear about any applications for EXEC, and 
  241. if you are visiting Berlin, I also invite you to drop by for a 
  242. talk. But I am usually not that happy when I am interrupted in my 
  243. paid work by a phone call requesting support for a free product. 
  244.  
  245. I will try to answer all letters and Faxes I receive. However, I am
  246. usually not the fastest in this respect, so please be patient. If you
  247. don't hear for me for a while, send me a short reminder. The
  248. preferred, and the fastest, method to reach me is through our BBS,
  249. and through BIX, where I daily check my mailbox. Send mail to
  250. 'twagner' from BIX, or to 'twagner@bix.com" through the Internet. The
  251. second best way is CompuServe e-mail, which I usually check several
  252. times, but at least once, a week.
  253.  
  254. BIX (tm) is an electronic conferencing system. BIX can be (and is)
  255. accessed from all parts of the world. Although accessing BIX from
  256. outside the US isn't exactly cheap (don't ask me what I have to pay
  257. each month), the wealth of information available there, and the fast
  258. and extensive help the other members can give you on all kinds of 
  259. hard- and software problems, makes it worth every Mark, Peseta, 
  260. Franc, or Ruble you have to spend. New versions and updates of EXEC
  261. will first appear on BIX. 
  262.  
  263. To get more info on joining BIX, call the BIX Customer Service at 
  264. 800-695-4775 (U.S.), or 617-354-4137 (elsewhere) from 12:00 to 23:00
  265. EDT (-4 GMT). BIX access currently is $39 for three months (flat
  266. fee), plus the applicable telecomm charges (Tymnet in the U.S. and
  267. Canada, your local PTT's Packet Net charges from outside the U.S.).
  268. International users living near a BT Tymnet node can access BIX
  269. through international Tymnet at special low rates. Call the BIX
  270. helpline for Tymnet access points and charges. Other international
  271. users will need an account (NUI) with their local packet net. Please
  272. enquire at your post/telecomm office for details.
  273.  
  274. Our BBS is available 24 hours, 7 days a week, and supports up to
  275. 14.400 bps, with V.42bis and MNP5 error correction and compression.
  276.  
  277.  
  278.                         RESTRICTIONS
  279.                         ============
  280.  
  281. The "no return" mode of EXEC is included for completeness only. It
  282. has some disadvantages over the standard compiler functions for
  283. executing without return. In particular, files are not closed, and
  284. interrupt vectors used by the Run-Time-Library are not restored to
  285. the DOS defaults. If possible, use the standard RTL functions for
  286. this mode.
  287.  
  288. The assembler module "spawn" must not be the first module linked.
  289. Either put it into a library, or specify spawn.obj as one of the last
  290. objects in the link command or the Turbo project file. The spawn
  291. module will overwrite about 1k at the start of the program image.
  292. Although the contents of this area will be saved, they may not
  293. contain parts of the spawn module itself, since this could destroy
  294. the code being executed. The do_exec function will check for this
  295. condition, and return an error code if the program code could be in
  296. danger.
  297.  
  298. The calling program may not have interrupt handlers installed when
  299. calling the do_exec function. This includes handlers for Control C
  300. and critical errors. If you want to handle interrupts while the
  301. program is swapped, you will have to modify the spawn module such
  302. that the interrupt handlers are included in the resident part.
  303.  
  304. All open files will stay open during the EXEC call. This reduces the
  305. number of handles available to the child process. The "C_FILE_INFO"
  306. environment variable created by some C compilers on the standard C
  307. spawn call is not supported. If the NO_INHERIT flag is set in
  308. spawn.asm (default), all open files except for the first five
  309. standard handles will be "hidden" from the child, and thus will not
  310. be inherited. This increases the possible number of open files for
  311. the child, although the system-wide open file limit (the config.sys
  312. FILES= value) still must be high enough to support all open files.
  313.  
  314. Internal commands are not automatically processed. You can execute 
  315. those by loading the command interpreter (by passing an empty string 
  316. as the command name). For example:
  317.  
  318. (C)     retcode = do_exec ("dir", "*.*", USE_ALL, 0xffff, environ);
  319.         if (retcode == RC_NOFILE)
  320.            retcode = do_exec ("", "/c dir *.*", USE_ALL, 0xffff, environ);
  321.  
  322. (P)     retcode := do_exec ('dir', '*.*', USE_ALL, $ffff, true);
  323.         if (retcode = RC_NOFILE)
  324.            retcode := do_exec ('', '/c dir *.*', USE_ALL, $ffff, true);
  325.  
  326.  
  327.  
  328.                         CAUTIONS
  329.                         ========
  330.  
  331. The functions should be compatible with DOS versions down to DOS
  332. 2.21, but they have been tested under DOS 3.3, DOS 4.0, DOS 5.0, 
  333. DOS 6.0, and DR-DOS 5.0 only.
  334.  
  335. Compiler compatibility has been tested for Borland C++ 2.0/3.1,
  336. Microsoft C 6.0a, Visual C++ 1.0, and Turbo Pascal 5.5 only. I do not
  337. have access to other compilers. Turbo Pascal 6.0 was reported to work
  338. fine with EXEC. The DOS-extender mode of Turbo Pascal 7.0 (and any
  339. other DOS extender) will not work with EXEC.
  340.  
  341. Spawning a command that exits and stays resident (TSR), like PRINT or
  342. Sidekick, will fragment memory and prevent a return to the calling
  343. program. This should, however, not crash the system. Allocated EMS
  344. or XMS pages are released, a swap file is deleted.
  345.  
  346. If the program memory image is not contiguous, the swapping code has
  347. to use undocumented DOS-internals. In particular, the swapper has to
  348. modify DOS memory control blocks directly. In theory, this could lead
  349. to incompatibilities with later versions of DOS, or with DOS
  350. substitutes or emulators. In practice, no problems have been reported
  351. with any DOS version, including DOS 6.0 and the DR-DOS versions.
  352.  
  353. If the NO_INHERIT flag is set to TRUE in spawn.asm, some undocumented
  354. fields in the PSP are used and modified. This should work with all
  355. DOS versions and clones, but you can set NO_INHERIT to FALSE if you
  356. are afraid of potential problems (but not if you use handle-table
  357. expansion).
  358.  
  359.  
  360.                         Revision History
  361.                         ================
  362.  
  363. Changes for Version 3.3a to 3.3b:
  364.  
  365. Under certain circumstances (the first MCB of a program was the PSP,
  366. not the environment, and unallocated blocks followed), the restored
  367. memory image was incorrect. This bug was reported and fixed by
  368. Giorgio Angelotti.
  369.  
  370. Changes for version 3.3 to 3.3a:
  371.  
  372. Besides the address change, the only significant modification is a
  373. better handling of redirection. Like with DOS, redirection parameters
  374. may now be interspersed with other command line arguments.
  375.  
  376. The Pascal version was buggy in the handling of multiple redirection
  377. and COMSPEC parameters. This was fixed.
  378.  
  379.  
  380. Changes for version 3.2a to 3.3:
  381.  
  382. A new option for Turbo Pascal recognizes the free heap space and
  383. suppresses swapping for this area. For many applications this will
  384. speed up the swapping process, and reduce swap space requirements.
  385. Since this is version dependent (Turbo Pascal version 6 uses a
  386. different heap management scheme than its predecessors), the
  387. preassembled version has this feature disabled. Please set PAS_FREE
  388. in SPAWN.ASM to TRUE, and set TPAS_6 to TRUE or FALSE depending on
  389. your version of Turbo Pascal to use it.
  390.  
  391. The Pascal "putenv" function was buggy. When putting a variable
  392. already in the environment, it produced a duplicate entry instead of
  393. replacing it. Bug reported and fixed by A. Bailey.
  394.  
  395. When determining program name and path, a program with a base name
  396. (without extension) equal to the name of a directory was not found
  397. under certain circumstances. The checkpath function was modified to
  398. correctly handle this case. Bug reported by H. Lembke.
  399.  
  400. An extended handle table would cause the swap-back to fail on a
  401. file-swap if NO_INHERIT was true. This was due to the restoration of
  402. the handle table pointers before allocating and restoring the MCB the
  403. handle table was in. The handle table pointer is now restored after
  404. swapping everything back. Bug reported by H. Lembke.
  405.  
  406. EXEC would fail completely with an extended handle table if
  407. NO_INHERIT was false. The MCB containing the handle table now is not
  408. swapped, which will likely fragment memory, so setting NO_INHERIT to
  409. false when extending the handle table is not recommended. 
  410.  
  411. The C do_exec function now correctly handles NULL pointers to the
  412. command line and parameter strings.
  413.  
  414.  
  415. Changes for version 3.2 to 3.2a:
  416.  
  417. A bug in checkpat.asm that caused incomplete path specs was fixed.
  418.  
  419. A bug in spawn.asm that caused redirected files to stay open even
  420. after program termination was fixed.
  421.  
  422. Changes for version 3.1 to 3.2:
  423.  
  424. The call of a user-defineable function (through a function pointer or
  425. a procedure variable) from do_exec immediately before executing the
  426. external command was added. This function can output messages and
  427. perform additional checks. The previously internal structure
  428. containing the swap parameters was made global for access by this
  429. function. For details see exec.h/exec.pas, and the example in
  430. extest.c/extest.pas.
  431.  
  432. A bug in checkpat.asm that led to erroneous operation of the 'exists'
  433. function when used with Turbo Pascal was fixed.
  434.  
  435. The Pascal version of extest was (finally) brought up to date, and
  436. now corresponds closely to the C version. A sample for the use of the
  437. user-defined call-back function was added in both versions.
  438.  
  439. The definition of the internal routines in exec.c was changed to
  440. "static", initialisation of some variables in do_exec was corrected.
  441.  
  442.  
  443. Changes for version 3.0a to 3.1:
  444.  
  445. The capability to process BAT files and to handle redirection was
  446. added.  The program search order now exactly matches the DOS order
  447. with the exception of internal commands (there is no safe way to
  448. determine whether a command is internal or external). Redirection is
  449. optional.  The interface to do_exec did not change (redirection is
  450. handled by parsing the parameter string), but do_spawn takes three
  451. new parameters if redirection is enabled.
  452.  
  453. A routine was added (checkpat.asm) that checks and resolves a path
  454. name in addition to splitting it. This routine does some thorough
  455. checks on the supplied path and filename, and will handle critical
  456. errors (invalid drive, drive not ready) without user intervention.
  457. This routine is used to process the program file name, the command
  458. processor filename, and the temporary path. This routine is not
  459. dependent on the other EXEC/SPAWN routines, and thus might be
  460. useful for other applications.
  461.  
  462. Several new error codes allow better analysis of error conditions.
  463.  
  464. The temporary file path will now always be a complete path, so that a
  465. change of the default drive and directory while spawned can no longer
  466. cause the swap file to get lost.
  467.  
  468. Any parameters on the COMSPEC= environment string will be inserted
  469. into the command parameters when calling the command processor. This
  470. allows specification of environment size and other parameters when
  471. spawning.
  472.  
  473. The check for file existance was moved to checkpat.asm, and changed
  474. from a 'find first' operation to 'get file attributes'. This seems to
  475. be marginally faster, and avoids compiler dependencies.
  476.  
  477. The GETLANG program was corrected to use stderr to output the usage
  478. information.
  479.  
  480.  
  481. Changes for version 3.0 to 3.0a:
  482.  
  483. A minor bug in EXEC.C was fixed: a '<' was missing in a German
  484. comment, so that GETLANG E would gobble up a large part of the file.
  485.  
  486. A problem (feature? bug?) with the Turbo C/Borland C "stat" function
  487. always returning directories with a "read-only" attribute prevented
  488. the "TEMP" directory from being used. The Write permission for the
  489. directory is no longer checked.
  490.  
  491. The preallocation of the swap file introduced in Version 3.0 to make
  492. sure that the disk can hold the swap file causes a severe slowdown
  493. when the swap drive is a Novell Network drive. Two new "method" flags
  494. were introduced to circumvent this problem:
  495.  
  496.       NO_PREALLOC - never preallocate
  497.       CHECK_NET   - check for network drive, don't preallocate if net
  498.  
  499. If the file is not preallocated, the disk is not checked for
  500. sufficient space at all. Using the "get disk free space" call usually
  501. takes even longer than preallocation. This is not a big problem
  502. though, swapping simply will fail with error code 0x502 when the disk
  503. is full on swapping out.
  504.  
  505. Thanks to Tim Frost ('<' bug) and Tron Hvaring (stat and Novell
  506. problems) for their reports.
  507.  
  508.  
  509. Changes for version 3.0:
  510.  
  511. This is a major rewrite of the code in spawn.asm. The interface for
  512. do_exec and do_spawn has changed, the exec and extest files have been
  513. modified accordingly.
  514.  
  515. The main enhancement is support for XMS.
  516.  
  517. The code in spawn.c was modularized a tad, and a lot of comments were
  518. added. This should help in better understanding the code. Old bugs
  519. (versions 2.4 and 2.5 were buggy in handling non-swapping spawns)
  520. were eliminated.
  521.  
  522. The allocation of swap space has been separated from the actual
  523. swapping. Although not used in the current do_exec routine, this
  524. could be used to issue an informative message about where the
  525. swapping will go to, and to try other paths for the temporary file if
  526. allocation fails. You might elect to add support for this in the
  527. do_exec routine, just be careful not to modify the memory layout
  528. between the calls to prep_swap and do_swap.
  529.  
  530. The MCB blocks are no longer modified in preparation of the swap.
  531. Instead of using an internal chain with undocumented fields in the
  532. MCB, the MCB chain is now parsed multiple times. Since the chain
  533. normally consists of just a few elements, this will not severely
  534. impact execution performance. MCBs are now swapped out and restored
  535. in their original form, including the "unused" fields that are not
  536. really unused in DOS 4.0 and later versions.
  537.  
  538. Saving fragmented memory will now use less EMS space, since the
  539. blocks are packed tight. Previous versions started a new page for
  540. every MCB.
  541.  
  542. Memory blocks located "below" the PSP (including the environment
  543. block, unless it is needed for an environment copy) will now be
  544. swapped, too. This may increase available memory if DOS memory is
  545. fragmented.
  546.  
  547.  
  548. Things not done in this release:
  549.  
  550. The MCB chain still is modified directly. Although some users have
  551. suggested trying to call DOS to allocate the blocks, this has proven
  552. impractical in some tests. If memory is fragmented, getting DOS to
  553. allocate a block at an exact location is rather tedious. I will keep
  554. the suggestion in mind, but the current method works reliably with
  555. all known (and unknown) versions of DOS and its clones.
  556.  
  557. Another good suggestion not implemented in this version is the save
  558. and restore of the interrupt vector table to remove TSRs installed
  559. while the program was swapped out. It would be rather complex to find
  560. and release all memory blocks belonging to the TSR, and without
  561. releasing the TSRs memory, the program can not be swapped back in
  562. anyway, so restoring the interrupt table wouldn't help.
  563.  
  564.