home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / alt / msdos / programm / 2207 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.4 KB  |  45 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!rsoft!mindlink!a3133
  2. From: Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins)
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Why can't I hook INT 21h???
  5. Message-ID: <14340@mindlink.bc.ca>
  6. Date: 17 Aug 92 17:43:42 GMT
  7. Organization: MIND LINK! - British Columbia, Canada
  8. Distribution: world
  9. Lines: 34
  10.  
  11. Okay, maybe someone could help me here.  I am trying to write a TSR
  12. that hooks interrupt 21h but whenever I try and hook that vector I
  13. get an invalid command.com error and my system crashes.  I am using
  14. TC++ 3.0 and I have tryed both using their set vect routine as
  15. well as manually changing the interrupt vector table but in both
  16. cases the same thing happens...crash!  Even if I write an ISR for
  17. INT 21h that simply returns control to the original ISR the system
  18. crahes.  For example, even this crashes my system:
  19.  
  20. #include <dos.h>
  21. #include <stdio.h>
  22.  
  23. void interrupt new21handler(void);
  24. void interrupt (*old21handler)();
  25.  
  26. void main(void)
  27. {
  28.         disable();
  29.         old21handler=getvect(0x21);
  30.         setvect(0x21, new21handler);
  31.         enable();
  32.         keep(0, 4000);
  33. }
  34.  
  35. void interrupt new21handler(void)
  36. {
  37.         (old21handler)();
  38. }
  39.  
  40. Anyone know what's wrong here??? As far as I can see this program should
  41. basically do nothing but take up memory but instead, it crahes the system when
  42. run.  Any info would be greatly appreciated.
  43.  
  44. ...Charlie Hutchins
  45.