Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!interlan!backman From: backman@interlan.UUCP (Larry Backman) Newsgroups: comp.sys.ibm.pc Subject: Re: Dos Calls and Interrupts Message-ID: <119@interlan.UUCP> Date: Mon, 19-Jan-87 08:11:20 EST Article-I.D.: interlan.119 Posted: Mon Jan 19 08:11:20 1987 Date-Received: Tue, 20-Jan-87 00:14:42 EST References: <216700005@orstcs.UUCP> <115@interlan.UUCP> <1501@cit-vax.Caltech.Edu> Reply-To: backman@interlan.UUCP (1014-Larry Backman) Organization: MICOM-Interlan, Boxborough, MA Lines: 40 Keywords: TSR, Control-C >I wonder if a ^C handler could be written that would kill the current >program even if the program isn't doing any dos calls. > >Currently, if you hit ^Break or ^C, a bit is set. Then when you call >dos, it checks the bit. If set, the ^C handler is called, and your >program (by default) is terminated. The problem is that many programs >don't make dos calls, and they can't be killed. For example, if you >are running a Turbo Pascal program that gets into an infinite loop, >you have to reboot the machine. >Would it be possible to write a TSR program that notices when ^C is >hit and sets a bit. >The next time a clock interrupt happens (as described in the article), >both this bit and the dirty bit are checked. If ^C has been hit, and >it is safe to call dos, then the handler should issue a dos terminate >call to terminate the interrupted program. > >Does this make sense? Has such a program been written? Could it be done? >(Can you call terminate from inside the clock interrupt handler?) > I just spent a couple days last week playing the ^Break/^C game from within a NETBIOS application. If a NETBIOS request has been issued and is pending on the network's response, the only keys that work are\ Ctl-Alt-Del. The INT 23 handler does not see the ^Break or ^C until after a NETBIOS request completes. However, if the NETBIOS request is hung, your dead!! The BIOS break interrupt, INT 1B, will see the ^Break key, but not the Control-C key. In my situation, I fortunately have already captured the keyboard at INT 9, and can filter out whatever keystrokes I want from there, and set semaphores from within the keyboard handler that will be later used by an event processor. I also remember going through contortions to be able to terminate from within the clock handler. I don't have code in front of me but as I recall, the trick was to call INT 21 function 49 (FREE MEMORY) twice, first to free the programs allocated memory, and second to free the PSP of the program. At this point we exitted using INT 21 function 4C, Larry Backman Micom - Interlan, Inc.