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