FWIW, patching individual table entries could be problematic - example, the
library may be in ROM.  You can replace the entire table with your own, but
you have to muck with unsupported system variables.

I'd say that Mr. Spurrell's solution is cleaner.  Undocumented NetLibrary
calls aren't really a problem.  All arguments are stack based, so just pop
your libref, push the original, and fire off the same trap for any call you
don't care about (or know about).  Expanding your entry table to cover all
possible lib calls wouldn't make it that big.

-jjf

-----Original Message-----
From: Edward LeBlanc [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 04, 2000 9:37 AM
To: Palm Developer Forum
Subject: Re: trapping TrapIDs over A800


> Another approach you could take is patch the SysLibFoo calls so that when
the
> library you want to patch is loaded, you then replace it's library table
entry
> with one of your own that wraps it.  That way, all calls for that library
come
> to you. You can then do whatever you want, call the original function, and
then
> do any post-processing you want. This approach is requires getting the
pointer
> to the library table from system globals (which is unsupported) and
finding and
> replacing the library table entry (which is system-dependent, since the
entry
> format has changed over time).

As I understand it, part of the problem is how to patch SysLibFoo.

Now, please straighten me out if I get this wrong, but for Net lib, getting
the
pointer to the entry in the library table can be done with SysLibTblEntry
using a
refNum gotten with SysLibFind, right?

Then do you keep the address of the original Net lib table, and then replace
the
contents of the original entryP->dispatchTblP with your own table's address
(in
which case you had better have every Net lib function in your table)? Then
all Net
lib calls go to the new lib, and (presumably) you pass most of them on to
Net lib,
and actually only do work in the relatively few functions you really want.

Are there any traps in Net lib that are present after netLibTrapLast, that
are
undocumented? I guess we could check the contents of the original net lib
table.

When passing a call on to the original function (with or without additional
processing), do you just use the address from the original table, or is
there more
to it because of limited jump offsets? Is it reasonable to modify your table
at
run
time and just copy the addresses from the original Net lib table into your
own
table (for the functions you don't care about)? If I understand things
correctly,
you can no longer use traps to get to Net lib after you replace the original
entryP.

Are these the sort of questions that make doing this a 'scary-hairy
proposition',
or are there even more issues to deal with?





-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to