Is there really no way to patch library functions?

I've read some previous messages on this topic,
but it seems there is no reliable way to do it.
That was three years ago. Any ideas now?

I think there is, and has been, a way to patch library traps - I'm assuming you're talking about pre-5.0, right? The issue is that it requires some low-level 68K code.


One approach is to patch out sysLibTrapOpen, sysLibTrapClose, and the appropriate sysLibTrapXXX routines. In sysLibTrapOpen, if the refnum passed to you is the refnum of the library you want to patch, then record that in your globals, and activate the other patches. Undo this in the close patch (remembering to count the number of open/close pairs). In the routine patches, check the refnum to make sure you're being called for the library that you're patching out.

Another approach is to install in RAM a library with the same type/creator/name as the library you're patching out in ROM, but with a higher version # in the DB header. When you get opened, explicitly open the real library in the ROM. Do the inverse in the close routine. Library calls that you don't patch just get passed through by stubs.

-- Ken
--
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200

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

Reply via email to