[comp.sys.mac.programmer] Sys7 trap patching problem

cfry@jove.cs.pdx.edu (Chall Fry) (06/09/91)

I'm trying to write an application to replace several of my inits, and am
having trouble making my trap patches stick when my application isn't in
the foreground. Apparently, Multifinder (not really MF anymore) does lots
of funky stuff to the trap tables on an application switch that I can't
follow with MacsBug. The Programmer's Guide to Multifinder seems to say
some stuff about making your patches active all the time, (actually, it
says "To ensure the MF will only run your patches when your app's in the
foreground, place your patch-receiving routines in your application heap
and not in the system heap." Placing my routine in the system heap doesn't
help, however. Nor does setting the current heap to SysZone when calling
SetTrapAddress to install the patch.

I really want to make these patches from an application; I already have the
functionality in INIT code. It seems there should be a way to do this;
writing directly to the trap tables (a definite no-no for the most part)
seems to work, at least on my machine. For now. 

It seems there should be a way to tell SetTrapAddress you wish to make your
patch permanent (&omnipresent); inits have so little problem with it.
Should I be making a direct call to the ROM version of SetTrapAddress
(instead of the sys7 patch)?

Any help on how to get patches of this type to be installed with
SetTrapAddress after init time, or info on why they can't, would be very
much appreciated.

Thanks,

--Chall Fry     cfry@jove.cs.pdx.edu