At 7 Nov 1999 18:38:23 -0800, Ronald Gouldner Jr wrote:
>Thanks Matt,
>
>I have read this info, actually it is the reason I started looking
>for more info. I can tell from the API how to set traps addresses
>however TrapWeaver makes it sound very error prone.
Sorry, I guess the TrapWeaver docs could have been better written,
because that's not how I intended them to sound. I wanted the reader to
understand that while uninstalling a patch will erase any overlapping
patches installed after it, TrapWeaver solves this problem, and other
than that, patching is fairly straightforward. Do you have any
suggestions on how the docs might be improved?
>My main questions that I was hoping Palm might have
>documented are these
>1) When I install a trap should I force a reset (I think Yes)
Resetting when you install is unnecessary, since patch installation
conflicts are only caused through uninstalling. You could force a reset
on uninstall if you wanted to be safe, but if the device is running
TrapWeaver, this is unnecessary as well.
>2) How do I require my trap be uninstalled before it is
>deleted (Like Palm OS Patches)
When you install your patches, you can lock your app's database so
it can't be deleted, but this may cause problems if the user tries to
hotsync a newer version on top of it.
The method I prefer is to copy the patch functions to orphan chunks
in storage mem, then point SysSetTrapAddress() at those. (Ophan chunks
are just DmNewHandle()s that don't get attached to a database - they
will automatically be freed on reset). This way, the app can be deleted
or written over without disturbing the patches - a good thing or a bad
thing, depending on how you look at it.
>3) How do I lock the memory address of the function that
>I will be setting the trap to. It will be a very small part of
>my overall application.
If you use the orphan-chunk method, you just need to lock the
handle. (Which should be done anyways, before you can copy to it).
Otherwise, you need to get the code resource containing your function,
lock it, and release it without unlocking it. You can find code to do
this in the LaunchPad sources:
http://www.nwlink.com/~emilyk/LaunchPad/index.html
Josh Freeman
Twilight Edge Software
http://www.twilightedge.com