Path: utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!gateway.qm.apple.com!sean_parent.snarkmail_l_z From: sean_parent.snarkmail_l_z@gateway.qm.apple.com (Sean Parent) Newsgroups: comp.sys.mac.programmer Subject: Re: Need jGNEFilter help Message-ID: <11380@goofy.Apple.COM> Date: 29 Nov 90 18:42:23 GMT References: <917@gagme.chi.il.us> Sender: usenet@Apple.COM Distribution: na Organization: Apple Computer, Inc. Lines: 34 The problem with your patch is that it is a tail patch. (A tail patch is a patch that does work after calling the original routine instead of returning directly to the original caller.) This is breaking a come-from patch that MultiFinder has installed. (A come from patch is a patch that checks the return address to fix a routine in ROM.) There are a few possible options that you could use -> 1) Have your INIT install a driver to get time cleanly. 2) Patch SystemTask (I think it is a better place to patch then GetNextEvent and contrary to inside Mac it can move memory (because it can call drivers and desk accessories) using a head patch. 3) Patch GNE using a head patch. When I patch traps I usually use asm code of the form -> SUBQ.W #4,SP ; save space to chain LINK A6,#stackSpace ; set up A6 frame MOVEM.L savedRegs,-(SP) ; save away ALL used registers (include scratch) ; Do my work MOVE.L oldRoutineAddress,4(A6) ; put old address in chain space UNLK A6 ; restore A6 frame MOVEM.L (SP)+,savedRegs ; restore ALL registers RTS ; chain to old routine In this way, any come from patchs that depend on register values (yes, they do exist) are kept intact. Also, some ROM routines depend on some of the traps not messing with scratch registers. (For example, the Dialog Manager relies on the fact that SetPort only trashes A0 and non of the other scratch registers). Sean Parent "Quality unattainable in a reasonable amount of time."