Path: utzoo!utgpu!attcan!uunet!husc6!rutgers!att!poseidon!ech From: ech@poseidon.ATT.COM (Edward C Horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: How to Patch Message-ID: <563@poseidon.ATT.COM> Date: 7 Nov 88 02:55:06 GMT References: <10050042@eecs.nwu.edu> Organization: AT&T Bell Laboratories, Lincroft, NJ Lines: 18 From article <10050042@eecs.nwu.edu>, by bob@eecs.nwu.edu (Bob Hablutzel): > You don't want to mess with a PTCH resource... No, he wants to know how to OVERRIDE or REPLACE a system trap, right? The straight answer is: - Use GetTrapAddress to get the address of the trap handler. - Use SetTrapAddress to replace that one with your own. Note that your own trap handler has to be in a locked-down chunk of code in order for that to be viable. There are a couple of choices for INIT code: - allocate a block (NewPtr) in the System heap. Install your code there. - reduce the value in BufPtr (the effective top of memory) by the size of the permanent block you want, and put your stuff there. There's no simple way to release that memory later, so you own it 'til reboot. =Ned Horvath=