OK, folks, I keep digging. :-) I was pointed to the following Japanese article:

http://salon.simple-palm.com/os5/os5_04/

For those of us who can't read Japanese, here's a rough English translation of 
it:

http://tinyurl.com/3jrx6

Apparently, the author of the Avast application I mentioned before used this 
method.

Now, looking at what the source of the program in the article does, it ought 
not to work. I mean, it just patches the trap and protects the application that 
has patched it. Suppose that we have

Launcher->App2->App1->PalmOS

where both App1 and App2 have used this method to patch the same system trap. 
Now, if one deletes App1, then App2 should crash.

Ah! But you can't delete App1 as long as it has patched the system trap, 
because it is protected. Fine. So, we tell it to release the trap first (hack 
off). This avoids the crash - but it has another unwanted side effect - it 
disconnects App2, although App2 thinks that it has still patched the trap.

I decided to verify this conjecture with two real applications - Avast and 
mine. They both patch system trap 0xA0A7 using the method described in the 
Japanese article. First, I had the chain like this:

Launcher->Avast->MyApp->PalmOS

Then I told MyApp to release the trap, so that it could be deleted. This worked 
fine (no crashes) - but, as expected, Avast got disconnected; i.e., it stopped 
detecting viruses on launch, despite the fact that it still thought that its 
"resident protection" was on.

Then I tried it the other way around:

Launcher->MyApp->Avast->PalmOS

I disabled the "resident protection" (i.e., the hack) of Avast, in order to be 
able to delete it. Surprisingly, as a result, my application was *not* 
disconnected (currently it just beeps when an application is launched). 
Clearly, Avast is doing something more than what is described in the Japanese 
article. What might that be?

Well, visibly, it *does* something more. Namely, as soon as you tell it to 
release the trap it has patched, it resets the device. Could that be the key to 
success? So, I returned to my original experiment, in order to test this 
conjecture:

Launcher->Avast->MyApp->PalmOS

First, I told MyApp to unpatch the system trap. Then I *manually* soft-reset 
the device (the emulator, actually). Lo and behold, after the reset, Avast was 
still active and was detecting viruses just fine.

So, with this little improvement, the Japanese method seems to work.

Now, could somebody explain me why? :-) My application certainly isn't doing 
anything special on reset.

BTW, the emulator issues a warning when an application tries to use 
SysSetTrapAddress. My application uses that only when told (through the user 
interface) to patch a trap - not on startup or on reset or anything like that. 
Yet I noticed that, after I've told it to patch a trap, when I soft-reset the 
emulator, I get the above warning about my program. It's as if the reset 
somehow forces all applications that have patched a trap to re-patch it - 
despite that the applications themselves are not trying to do anything of the 
sort on soft reset...

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

Reply via email to