In my experience, yes.  That is why I mentioned replacing the whole
dispatch table.  I'm sorry, I'm not trying to be annoying, but I'm
having a terrible time explaining this clearly.

Best Regards,
-jjf

-----Original Message-----
From: Adam Wozniak [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 10, 2000 2:20 PM
To: Palm Developer Forum
Subject: Re: how to trap system library functions?


Danny Epstein wrote:

> "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.

I see.  This still seems problematic.  The original question was about
the serial
and IR libraries.  Aren't these in ROM?  Aren't their dispatch tables in
ROM
also?  Or does the act of "loading" them copy them into RAM?  Where
would
you find the address of the library's dispatch table?

--
Adam Wozniak
Senior Software Design Engineer
Surveyor Corporation
4501 Orcutt Rd.
San Luis Obispo, CA 93401



-- 
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

Reply via email to