reino@cs.eur.nl (Reino de Boer) (04/03/91)
In <23315@teda.Teradyne.COM> mikel@teda.Teradyne.COM (Mikel Lechner) writes: >In article <28075@rouge.usl.edu> anon@rouge.usl.edu (Anonymous NNTP Posting) writes: >> >> Another problem I am having is how to spawn a child process from >>within the interrupt handler I am using as the TSR. I am using Turbo C and >>have tried the 'spawn' function without luck. >Now another consideration. If you call DOS to EXEC a program from the TSR, >the TSR will not be the parent of the program. Instead the program >that was interrupted will be the parent of the new program. This might >have implications for the interrupted program. Using my home-made TSR-library (TP6.0), I tried to pop up the following: procedure popup; begin swapvectors; exec( getenv( 'COMSPEC' ), '' ); swapvectors; if doserror <> 0 then begin writeln( 'doserror = ', doserror ); while readkey = #0 do end end; and immediately ran into the problem I should have thought of in the first place: The program you are interrupting (let's call it IP) is (in general) using all available memory, which fails the above call to exec with doserror = 8 (Not enough memory). I tried to popup the above code while running an IP using very little memory, and everything went well. Why bring this all up ??? Because, even if you get all the critical section/error flags, psp's, dta's, local stack, etc. right, you still have to deal with the above-mentioned problem. I haven't tried the following, but with some :-) thought (and programming) I think it solves the above-mentioned problem: From comp.binaries.ibm.pc, volume 02, issue 046 (READ.ME): SWAP.COM This program allows you to shell out of your favorite editor and compile a program without worrying about running out of memory. SWAP works by swapping main memory to expanded memory (EMS V3.2 or better) or to disk, freeing main memory. Then starts your compiler or whatever. This program is from an article called "Swap" in Dr. Dobb's Journal (Vol 14, No 4, April 1989, pages 44-48). Included is the assembly source code (SWAP.ASM) and the executable (SWAP.COM). You can remake the executable by the following commands: MASM SWAP; LINK SWAP; EXE2BIN SWAP SWAP.COM SWAP has the following command line options: SWAP [options] command [command-parameters] [>filename] Brackets indicate optional parameters. SWAP options are: -C Copy redirected output to console. -D Disk file C:\SWAP.DAT is used instead of expanded memory. -F Forces SWAP to continue even if an interrupt vector points to the swappee. -Q Quiet operation. Informational messages are not displayed. "command" is any command that can be issued at the DOS prompt. "command-parameters" are parameters or options for the command. "filename" is a DOS file or device to which output from the command be directed. The thing to do would be to reprogram the (in cbip 02/046) included SWAP.ASM to be an external callable function (let's call it swapexec) and in your TSR do something like: {$L SWAPEXEC} procedure swapexec( command, args : string ); external; procedure popup; begin swapvectors; swapexec( getenv( 'COMSPEC' ), '' ); swapvectors; if doserror <> 0 then begin writeln( 'doserror = ', doserror ); while readkey = #0 do end end; Hope this helps -- Reino -- Reino R. A. de Boer "We want to build the right product right, right?" Erasmus University Rotterdam ( Informatica ) e-mail: reino@cs.eur.nl