home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / msdos / programm / 10388 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  2.1 KB

  1. Path: sparky!uunet!ogicse!hp-cv!hp-pcd!hpcvra!andyg
  2. From: andyg@hpcvra.cv.hp.com (Andrew Gryc)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: passing info between a TSR and a program
  5. Message-ID: <143140003@hpcvra.cv.hp.com>
  6. Date: 6 Nov 92 18:20:51 GMT
  7. Article-I.D.: hpcvra.143140003
  8. References: <1992Nov3.170342.16677@slate.mines.colorado.edu>
  9. Organization: Hewlett-Packard Co., Corvallis, OR, USA
  10. Lines: 36
  11.  
  12.  
  13. >Does anybody know how I can pass info between a TSR and a program?
  14. >What I am trying to do is to put 4-byte address of a handler in some
  15. >place, and get that address later to use in the other program.
  16.  
  17. Probably the safest method is to hook the multiplex interrupt (2Fh), and
  18. use it to pass info back and forth.  You need to provide an unique signature
  19. that your program can send and the TSR can recognize; the most common way
  20. of doing this is loading a handful of registers with unlikely values (i.e.
  21. not 0,1, but maybe something like 1357h or ASCII letter values that have 
  22. some significance to you).  The TSR looks for these, and if it finds them, 
  23. responds to a command word in another arbitrary register, returning an address.
  24.  
  25. The absolute safest thing to do is to write the TSR and program to be able to
  26. use different signatures in case a TSR already on the multiplex chain has the
  27. same signature, but in most cases this probably isn't necessary.  Microsoft
  28. tends to espouse this approach though, so be as safe as you feel necessary.
  29.  
  30. An example of this general method:
  31.   
  32.    TSR: Hooks into 2Fh chain--
  33.       If AX=4123H and BX=6987H and CX=1012H (DX is command word if needed);
  34.       otherwise, call old 2Fh vector.
  35.  
  36.    Program:  Calls int 2F with regs loaded as above (DX is command if you need
  37.       more than one action).  TSR recognizes signature and loads ES:BX with 
  38.       address.
  39.  
  40. This method is the method used most frequently for a TSR program to communicate
  41. to its resident portion (i.e. using command switches to change the state of
  42. an already installed TSR).
  43.  
  44. --------------------------------------------------------------------------
  45. Andrew J. Gryc      |  #include <stddisclaimer>
  46. Hewlett-Packard     |
  47. Corvallis, OR  USA  |
  48.