Xref: utzoo alt.msdos.programmer:1582 comp.sys.ibm.pc.programmer:1307 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!matrix!venkat From: venkat@matrix.UUCP (D Venkatrangan) Newsgroups: alt.msdos.programmer,comp.sys.ibm.pc.programmer Subject: termination handler address Keywords: int 22h/23h Message-ID: <141@matrix.UUCP> Date: 3 May 90 19:40:09 GMT Distribution: na Organization: Matrix Computer Systems, Nashua, NH Lines: 22 I am attempting to trap the exit of a program so I can clean up things that DOS would not clean up (such as interrupt vectors that were changed). As per well-documented sources, I am replacing int 1bh, int 22h and int 23h vector entries. After initializations, I do see that these entries are changed to entry points within the code. When the program exits (through an exit() call from a C function), I see that my handlers are not being called. I can trace up to the int 21 (function 4ch) instruction without my handlers being called. Are they called as part of the 4ch function processing? In my handler, I do the cleanup that I need to do and then jump to the handler value that I saved before installing my entry. (this old handler I guess is supposed to copy the old values for the int 22h/23h etc. from the PSP of the program). If instead the program does a terminate and stay resident (function 31h), will my termination handler be called as well? If so, is there a way to distinguish whether the call to an exit handler is from function 31h as opposed to function 4ch? If it is the stay resident case, I do not want to do the cleanups. Is there an established way to do this correctly?