Path: utzoo!utgpu!attcan!uunet!husc6!mailrus!ames!amdahl!pacbell!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Multifinder: how do I patch GetNextEvent? Message-ID: <5654@hoptoad.uucp> Date: 16 Oct 88 22:09:12 GMT References: <747@ttrdf.UUCP> <10050025@eecs.nwu.edu> <2456@spray.CalComp.COM> <7374@well.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 29 Is there a technical note which refers to this "tail patching" issue? I must admit that as a seasoned mac programmer I find the rationales given for the illegality of tail patching quite incomprehensible. Whether or not there is a tail patch would appear to have no effect on the return-address Apple hacks. Let's look at a case. Say that GetNamedResource checks the return address to see if it's being called from a ROM Font Manager routine, and that routine has a tail patch for some reason. When the "old" software for the Font Manager calls the Resource Manager, the return address is exactly what the Resource Manager "where-from" check expects. The tail patch has no relevance, since the "where-from" check is meant only to apply to the way the Resource Manager is called from that place in the ROM, and that place gets executed normally. A tail patch by definition first calls the old trap software. The problem with non-standard register saving is more serious, since some software does depend on undocumented register return values. However, such code is broken. If it is a serious problem, your tail patch can as easily return the same register values once the bug is discovered, but the real burden of compatibility is on the broken code, not your patch. Sorry if I'm missing something, but I just can't see how tail patching could disturb a "where-from" check, and I think third-party developers have to draw the compatibility line somewhere. Compatibility with broken software is nice but not mandatory. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "As I was walking among the fires of Hell, delighted with the enjoyments of Genius; which to Angels look like torment and insanity. I collected some of their Proverbs..." - Blake, "The Marriage of Heaven and Hell"