Yes, that is one of two ways I was trying to imply. I tried to be
clearer in my follow-up post. But it is hard to explain. There are
actually a lot of tables when you sit down and think about it... <grin>
-jjf
-----Original Message-----
From: Danny Epstein [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 10, 2000 1:49 PM
To: Palm Developer Forum
Subject: Re: how to trap system library functions?
"Adam Wozniak" <[EMAIL PROTECTED]> wrote in message
news:7736@palm-dev-forum...
> Correct me if I'm wrong, but I don't believe you've ever tried this.
>
> The dispatch table ends at sysTrapLastTrapNumber. There are no
entries
> for libraries, which is why SysGetTrapAddress() and
SysSetTrapAddress()
> don't work for library functions.
Each library has its own dispatch table. I think Joe was suggesting that
you
modify the dispatch table for the library.
For example, if you wanted to intercept the "open" function for the IR
Library, you could find the entry for the IR Library in the system's
array
of open libraries using the reference number as an index. This entry
contains a pointer to the dispatch table as well as a pointer to the
library's globals. The first entry for all libraries is a pointer to the
library name. The second is "open", so you'd modify the second function
pointer in the dispatch table to point to your own hacked version of the
"open" function.
For the IR Library, you'd only have to do this once because the library
is
loaded at reset and never unloaded. For libraries that are loaded and
unloaded dynamically, you'd have to intercept the trap for loading the
library so you could patch the library's dispatch table after the
library
sets it up.
--
Danny Epstein
OS Engineer, Palm Inc.
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html