From: "Vesselin Bontchev" <[EMAIL PROTECTED]>
> > In fact, since the client decided that they didn't
> > want Palm OS 4 support I'd be quite happy to sell you the
> > implementation pre-written :-). 
> 
> Thanks for the offer but I am writing it myself and I'd like to support 
> as lower an OS version as possible. 
>
I think below 5.0 the same implementation should work down to 
3.5, possibly 3.0.  The trap mechanism is a fairly fundamental part 
of pre-OS5 Palm OS, as far as I'm aware so it's more of a testing
issue than anything else.

> I also want to intercept the fact that an application has just been 
> beamed to the device, that a HotSync operation has completed, 
> ... 
For all of these it's a matter of identifying an OS function that will
interact at the appropriate point in the process and then hook 
your code into that sequence.

> > From memory you create a code segment, attach it to your app
> > as a resource (Ben's answer to my question on how to do this
> > should be in the archive), load and lock it and then redirect the
> > trap through that code segment.
> 
> Ugh. Why is that necessary? Can't you just use SysSetTrapAddress 
> to intercept trap 0xA0A7 (sysTrapsysUIAppSwitch) with a function 
> in your normal code segment?
> 
Because (working from what I remember) your normal code segment 
will be unloaded when your app exits.  You need a chunk of code to 
sit around disconnected from the normal Palm OS app startup and
shutdown.  It's not as big a deal as it sounds, certainly not much more
complicated than the step from single-segment to multi-segment apps.
The only reason it took me a couple of days of frustration is that I'd
assumed I knew how the linking process worked and couldn't build
the app the way I expected.  Once I switched my brain off and 
followed Ben's instructions step by step it just worked.  :-)

> > The real problem is that HackMaster was created because
> > the trap redirection can cause the device to become unstable
> > if multiple apps try to hook into the same trap - I can't
> > remember if the instability occurs immediately or if the problem
> > is related to removing your hack.
> 
> Oh, I don't mind if my application is HackMaster-compatible. What 
> I want to avoid, though, is making it HackMaster-dependent. 
>
It's possible, but a bit more work.  You have to implement the 
connection points and resource id rules that the hack management
(sorry, System Extension management) apps follow, but you also
have to implement the low-level stuff yourself the hard way.  You
then have to warn the user that using your hack in conjunction with
any other hack without a hack manager will cause unpredictable
crashes.

It's certainly an approach that I think is reasonable - I've had clients
ask for the same non-dependency and I'd like to see it better 
documented.  If you were willing to release a code sample that
implements the hackmaster-independent mechanism as open source
I'd be happy to contribute some of my existing code to it.  I just
don't have the time to turn that code into a sample and document it.

Chris Tutty

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

Reply via email to