[comp.sys.ibm.pc] DOS Program Termination

reb2@ihlpa.UUCP (Brown) (11/20/86)

*** REPLACE THIS LINE WITH YOUR MESSAGE ***

This goes along with my previous posting regarding Ctl-C and
Ctl-Break.  I am trying to write a resident program that
would get control after a program terminates, before going
back to the DOS prompt.  I have been able to do this for
programs which terminate by issuing interrupts, such as
INT20h and INT21h func. 4Ch.  But none of these seem to catch
a program which terminates by pressing Control-Break.
For example, if a sample program issues a INT16h with AX=0,
which results in waiting for a key to be struck, if I press
Control-Break, the program terminates without, as far as I
can tell, and interrupt such as INT20h.

Does anyone know how to trap the above termination condition?

Thanks,

Rick Brown  ihnp4!ihlpa!reb2

mmm@nbires.UUCP (Michelle Melvin) (11/24/86)

The control C handler address is at INT 23h.  There are also serveral
addresses stored in the programs PSP.  If you spawn a program without
executing it, you can modify the terminate address, control c address 
and hard error address.  Once the modifications have been made you can
then let the program execute.  When the program terminates, dos returns 
control to these addresses.  This is a much easier method of traping
program termination then traping the interupt.

Anyway, I wrote a structure of the contents of the PSP.  If there is
enough interest, I will post it.

Lloyd W. Tabb
NBI Engineering
{hao,allegra,ucbvax}!nbires!mmm
(303)-938-9258