home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!utcsri!torn!cunews!hobbit.gandalf.ca!tobrien
- From: tobrien@gandalf.ca (Tony Obrien)
- Subject: Re: Why can't I hook INT 21h???
- Message-ID: <1992Aug18.123800.16274@gandalf.ca>
- Organization: Gandalf Data Ltd.
- References: <14339@mindlink.bc.ca> <eoq.25.0@vthnw.cvm.msu.edu>
- Date: Tue, 18 Aug 1992 12:38:00 GMT
- Lines: 64
-
- In <eoq.25.0@vthnw.cvm.msu.edu> eoq@vthnw.cvm.msu.edu (Edward Quillen) writes:
-
- >In article <14339@mindlink.bc.ca> Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins) writes:
- >>From: Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins)
- >>Subject: Why can't I hook INT 21h???
- >>Date: 17 Aug 92 17:41:03 GMT
- >>Okay, maybe someone could help me here. I am trying to write a TSR
- >>that hooks interrupt 21h but whenever I try and hook that vector I
- >>get an invalid command.com error and my system crashes. I am using
- >>TC++ 3.0 and I have tryed both using their set vect routine as
- >>well as manually changing the interrupt vector table but in both
- >>cases the same thing happens...crash! Even if I write an ISR for
- >>INT 21h that simply returns control to the original ISR the system
- >>crahes. For example, even this crashes my system:
- >>
- >>#include <dos.h>
- >>#include <stdio.h>
- >>
- >>void interrupt new21handler(void);
- >>void interrupt (*old21handler)();
- >>
- >>void main(void)
- >>{
- >> disable();
- >> old21handler=getvect(0x21);
- >> setvect(0x21, new21handler);
- >> enable();
- >> keep(0, 4000);
- >>}
- >>
- >>void interrupt new21handler(void)
- >>{
- >> (old21handler)();
- >>}
- >>
- >>Anyone know what's wrong here??? As far as I can see this program should
- >>basically do nothing but take up memory but instead, it crahes the system when
- >>run. Any info would be greatly appreciated.
- >>
- >>...Charlie Hutchins
-
- >Please post replies to this ? because I've always wanted to hook INT 21h
- >but have never been able to. Thanks!!!
-
- >+++++++++++++++++++++++++++++++++++++++++++++++++
- >+++ ED (Edward Quillen) (517) 336-1293 +++
- >+++ Vet Teaching Hosp. System Admin. +++
- >+++ Email: quillen@cps.msu.edu +++
-
-
-
- Two things to consider:
- 1. Beware of the "version" of your compiler...for example Microsoft 6.0
- exhibits an improper coding of the "GETVECT" routine and returns the correct
- offset but the RONG segment!!!! (By the bye...MS6.AX revision seems to do
- this OK.
-
- 2. You might also try using "_far" in front of the routine prototypea and
- instances.
-
- Luck,
- tob
-
- >+++++++++++++++++++++++++++++++++++++++++++++++++
-