GetToolTrapAddress
GetToolTrapAddress Obtain address of toolbox function
#include <OSUtils.h> Operating System Utilities
long GetToolTrapAddress (trapNum );
short trapNum ; trap number. See TrapWords.
returns address of the trap handling code
GetToolTrapAddress returns the address of a system routine - an element
of the toolbox trap dispatch table. Starting with the 128K ROMs, the Toolbox
routines have a trap dispatch table separate from the Operating System
routines. You must use this function (and not GetTrapAddress) if you are
running with 128K ROMs or later (see About Compatibility).
trapNum identifies the ROM routine whose address you want. See TrapWords
for a list.
Returns: a 32-bit value; the address of the system routine that corresponds
to trapNum.

Notes: GetToolTrapAddress is part of a new interface to the routine
NGetTrapAddress. GetToolTrapAddress does not require the
specification of the trap type as a parameter as NGetTrapAddress does.
Instead, either GetToolTrapAddress or GetOSTrapAddress should be
called, depending on which trap dispatch table you wish to modify. It is
recommended that you use one of these routines in place of
NGetTrapAddress. See About Compatibility for more information on
tool traps and OS traps.
It is possible to intercept OS or Toolbox calls and perform pre- or
post- processing, or even replace the function altogether. This sort of
custom patching is normally written in assembly language.
There is a great deal of overhead involved in the Macintosh trap dispatch
mechanism. In time-critical situations, you may save a significant amount
of time by calling the system routine directly, rather than using the normal
invocation of a trap.
The trap dispatcher changed between the 64K and 128K ROMs.See
About Compatibility for more information.