Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!rutgers!uwvax!umn-d-ub!cs.umn.edu!nis!quest!digibd!merlyn From: merlyn@digibd (Brian Westley (Merlyn LeRoy)) Newsgroups: comp.sys.mac.programmer Subject: Think C non-tail patching (& PACK3) Message-ID: <1990Feb8.150728.9760@digibd> Date: 8 Feb 90 15:07:28 GMT Organization: DigiBoard Incorporated, St. Louis Park, MN Lines: 26 How do I clean up the stack & jmp to a patched routine, instead of tail-patching it, in Think C 4.0? Something like.. { jmpto = NGetTrapAddress(trapnum, ToolTrap); NSetTrapAddress(trapnum, myroutine, ToolTrap); } .... myroutine(arg1, arg2) { CallPascal(arg1, arg2, jmpto); /* A nasty tail patch */ } The CallPascal() call should be replaced by asm {} stuff that cleans up the stack and does a jmp to "jmpto". However, I haven't been able to figure it out and I'm tired of crashing my machine. Someone must have invented this wheel already. On a related note, how do I patch PACK3, which has different arguments depending on how it's called? Similar to the above problem. Thanks for any help. May as well post it, it's of general interest. ----- Merlyn LeRoy