home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / msdos / programm / 8711 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  1.9 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!agate!rsoft!mindlink!a3133
  2. From: Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Why can't I hook INT 21h???
  5. Message-ID: <14497@mindlink.bc.ca>
  6. Date: 22 Aug 92 06:12:45 GMT
  7. Organization: MIND LINK! - British Columbia, Canada
  8. Distribution: world
  9. Lines: 40
  10.  
  11. > Gregory Humphreys writes:
  12. > Msg-ID: <1992Aug21.175406.3881@alw.nih.gov>
  13. > Posted: 21 Aug 92 17:54:06 GMT
  14. > Org.  : National Inst. of Health, DCRT, CSL
  15. > In article <frank.714406708@fam168>, Frank Hoffmann <fh.pad@sni.de> writes:
  16. > |> rmathews@zeus.calpoly.edu (Bob Mathews) writes:
  17. > |>
  18. > |> >Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins) writes:
  19. > |> >>Okay, maybe someone could help me here.  I am trying to write a TSR
  20. > |> >>that hooks interrupt 21h but whenever I try and hook that vector I
  21. > |> >>get an invalid command.com error and my system crashes.  I am using
  22. > |> >>TC++ 3.0 ....
  23. > |> >[code deleted]
  24. > |>
  25. > |> >The turbo c interrupt function automatically saves all cpu registers.
  26. > |> >The return values from DOS are getting clobbered.  Code like this
  27. > |> >absolutely needs to be written in assembly.  You need to have complete
  28. > |> >control of what's happening to the machine.
  29. > |>
  30. > |> >swehtam bob
  31. > |>
  32. > |> Same does MSC 5/6. You must write in ASM as well or add additional
  33. > ASM-Code
  34. > |> to restore the regs and the stack-ptr.
  35. > IMUST disagree here.  I have written numerous similar programs in C and
  36. > hooking
  37. > interrupts is just as reliable in C.  There is NOTHING you can't do in C that
  38. > you CAN in assembley.
  39. > Okay, lets see you write a short program in C that will do nothing
  40. > but sit in memory and hook interrupt 21h, returning control to the
  41. > original INT 21h when it's called.  No matter what I try I CAN'T
  42. > hook INT 21h from C. (TC++ 3.0 anyways).  Well?  Can you do it? (In
  43. > TC++ 3.0?)
  44.