home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / msdos / programm / 8594 < prev    next >
Encoding:
Text File  |  1992-08-18  |  2.5 KB  |  75 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!utcsri!torn!cunews!hobbit.gandalf.ca!tobrien
  3. From: tobrien@gandalf.ca (Tony Obrien)
  4. Subject: Re: Why can't I hook INT 21h???
  5. Message-ID: <1992Aug18.123800.16274@gandalf.ca>
  6. Organization: Gandalf Data Ltd.
  7. References: <14339@mindlink.bc.ca> <eoq.25.0@vthnw.cvm.msu.edu>
  8. Date: Tue, 18 Aug 1992 12:38:00 GMT
  9. Lines: 64
  10.  
  11. In <eoq.25.0@vthnw.cvm.msu.edu> eoq@vthnw.cvm.msu.edu (Edward Quillen) writes:
  12.  
  13. >In article <14339@mindlink.bc.ca> Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins) writes:
  14. >>From: Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins)
  15. >>Subject: Why can't I hook INT 21h???
  16. >>Date: 17 Aug 92 17:41:03 GMT
  17. >>Okay, maybe someone could help me here.  I am trying to write a TSR
  18. >>that hooks interrupt 21h but whenever I try and hook that vector I
  19. >>get an invalid command.com error and my system crashes.  I am using
  20. >>TC++ 3.0 and I have tryed both using their set vect routine as
  21. >>well as manually changing the interrupt vector table but in both
  22. >>cases the same thing happens...crash!  Even if I write an ISR for
  23. >>INT 21h that simply returns control to the original ISR the system
  24. >>crahes.  For example, even this crashes my system:
  25. >>
  26. >>#include <dos.h>
  27. >>#include <stdio.h>
  28. >>
  29. >>void interrupt new21handler(void);
  30. >>void interrupt (*old21handler)();
  31. >>
  32. >>void main(void)
  33. >>{
  34. >>        disable();
  35. >>        old21handler=getvect(0x21);
  36. >>        setvect(0x21, new21handler);
  37. >>        enable();
  38. >>        keep(0, 4000);
  39. >>}
  40. >>
  41. >>void interrupt new21handler(void)
  42. >>{
  43. >>        (old21handler)();
  44. >>}
  45. >>
  46. >>Anyone know what's wrong here??? As far as I can see this program should
  47. >>basically do nothing but take up memory but instead, it crahes the system when
  48. >>run.  Any info would be greatly appreciated.
  49. >>
  50. >>...Charlie Hutchins
  51.  
  52. >Please post replies to this ? because I've always wanted to hook INT 21h
  53. >but have never been able to. Thanks!!!
  54.  
  55. >+++++++++++++++++++++++++++++++++++++++++++++++++
  56. >+++ ED (Edward Quillen)   (517) 336-1293      +++
  57. >+++ Vet Teaching Hosp.    System Admin.       +++
  58. >+++ Email: quillen@cps.msu.edu                +++
  59.  
  60.  
  61.  
  62. Two things to consider:
  63. 1.  Beware of the "version" of your compiler...for example Microsoft 6.0 
  64. exhibits an improper coding of the "GETVECT" routine and returns the correct
  65. offset but the RONG segment!!!! (By the bye...MS6.AX revision seems to do 
  66. this OK.
  67.  
  68. 2. You might also try using "_far" in front of the routine prototypea and 
  69. instances.
  70.  
  71. Luck,
  72. tob
  73.  
  74. >+++++++++++++++++++++++++++++++++++++++++++++++++
  75.