Mac OS 9
Patches.h File Reference

Patch Manager Interfaces. More...

#include <MacTypes.h>

Go to the source code of this file.

Typedefs

typedef SignedByte TrapType
 

Enumerations

enum  { kOSTrapType = 0 , kToolboxTrapType = 1 }
 
enum  { OSTrap = kOSTrapType , ToolTrap = kToolboxTrapType }
 

Functions

UniversalProcPtr NGetTrapAddress (UInt16 trapNum, TrapType tTyp)
 
void NSetTrapAddress (UniversalProcPtr trapAddr, UInt16 trapNum, TrapType tTyp)
 
UniversalProcPtr GetOSTrapAddress (UInt16 trapNum)
 
void SetOSTrapAddress (UniversalProcPtr trapAddr, UInt16 trapNum)
 
UniversalProcPtr GetToolTrapAddress (UInt16 trapNum)
 
void SetToolTrapAddress (UniversalProcPtr trapAddr, UInt16 trapNum)
 
UniversalProcPtr GetToolboxTrapAddress (UInt16 trapNum)
 
void SetToolboxTrapAddress (UniversalProcPtr trapAddr, UInt16 trapNum)
 

Detailed Description

Patch Manager Interfaces.

Introduced In: System 8
Avaliable From: Universal Interfaces 3.4.1
Copyright: © 1994-2001 by Apple Computer, Inc., all rights reserved

For bug reports, consult the following page on the World Wide Web:

http://developer.apple.com/bugreporter/

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ToolTrap 

old name

Function Documentation

◆ GetOSTrapAddress()

UniversalProcPtr GetOSTrapAddress ( UInt16  trapNum)

CALL_NOT_IN_CARBON

\brief GetOSTrapAddress Obtain address of operating system function

<pre>GetOSTrapAddress returns the address of a system routine - an element of

the operating system 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 .
Note
GetOSTrapAddress is part of a new interface to the routine
NGetTrapAddress . GetOSTrapAddress 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.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ GetToolboxTrapAddress()

UniversalProcPtr GetToolboxTrapAddress ( UInt16  trapNum)

GetToolboxTrapAddress()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ GetToolTrapAddress()

UniversalProcPtr GetToolTrapAddress ( UInt16  trapNum)
\brief GetToolTrapAddress Obtain address of toolbox function

<pre>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 .
Note
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.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ NGetTrapAddress()

UniversalProcPtr NGetTrapAddress ( UInt16  trapNum,
TrapType  tTyp 
)

CALL_NOT_IN_CARBON GetTrapAddress and SetTrapAddress are obsolete and should not be used. Always use NGetTrapAddress and NSetTrapAddress instead. The old routines will not be supported for PowerPC apps. TARGET_CPU_68K && !TARGET_RT_MAC_CFM

\brief Obtain address of system functions

<pre>NGetTrapAddress returns the address of a system routine - an element of

the 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. trapType differentiates between traps by type, since the 128K ROMs uses two separate trap dispatch tables. This must be one of: OSTrap (0)Operating System trap ToolTrap (1)Toolbox trap

Returns
a 32-bit value; the address of the system routine that corresponds
to trapNum .
Note
There is a new interface to this routine, consisting of the calls
GetToolTrapAddress and GetOSTrapAddress . These calls do not
require the specification of the trap type as a parameter.
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.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ NSetTrapAddress()

void NSetTrapAddress ( UniversalProcPtr  trapAddr,
UInt16  trapNum,
TrapType  tTyp 
)
\brief Install custom code to replace a system routine

<pre>NSetTrapAddress changes an element of the trap dispatch table so that

subsequent invocations of that trap will cause execution to go to a specified address. Use this function (and not SetTrapAddress ) if your application will run in a Mac equipped with a ROM version later than the 64K ROMs (see About Compatibility ). trapAddr is the address of some code to handle execution of an Operating System or Toolbox function. trapNum identifies the ROM routine you wish to replace. See TrapWords for a list. trapType differentiates between traps by type, since the 128K ROMs use two separate trap dispatch tables. This must be one of: OSTrap (0)Operating System trap ToolTrap (1)Toolbox trap

Returns
none
Note
There is a new interface to this routine, consisting of the calls
SetToolTrapAddress and SetOSTrapAddress . These calls do not
require the specification of the trap type as a parameter.
NSetTrapAddress is used mostly by assembly-language programers . It
is most often used in device drivers of INIT code, rather an by an
application.
Note: Be sure to change all traps back to their original addresses before
your application exits!
The trap dispatcher changed between the 64K and 128K ROMs. For more
information see About Compatibility .
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ SetOSTrapAddress()

void SetOSTrapAddress ( UniversalProcPtr  trapAddr,
UInt16  trapNum 
)
\brief SetOSTrapAddress Install custom code to replace an operating system routine

<pre>SetOSTrapAddress changes an element of the operating system trap

dispatch table so that subsequent invocations of that trap will cause execution to go to a specified address. Use this function (and not SetTrapAddress ) if your application will run in a Mac equipped with a ROM version later than the 64K ROMs (see About Compatibility ). trapAddr is the address of some code to handle execution of a operating system function. trapNum identifies the ROM routine you wish to replace. See TrapWords for a list.

Returns
none
Note
SetOSTrapAddress is part of a new interface to the routine
NSetTrapAddress . SetOSTrapAddress does not require the
specification of the trap type as a parameter as NSetTrapAddress does.
Instead, either SetToolTrapAddress or SetOSTrapAddress 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
NSetTrapAddress . See About Compatibility for more information on
tool traps and OS traps.
SetOSTrapAddress is used mostly by assembly-language programers .
It is most often used in device drivers of INIT code, rather an by an
application.
Note: Be sure to change all traps back to their original addresses before
your application exits!
The trap dispatcher changed between the 64K and 128K ROMs. For more
information see About Compatibility .
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ SetToolboxTrapAddress()

void SetToolboxTrapAddress ( UniversalProcPtr  trapAddr,
UInt16  trapNum 
)

SetToolboxTrapAddress()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ SetToolTrapAddress()

void SetToolTrapAddress ( UniversalProcPtr  trapAddr,
UInt16  trapNum 
)
\brief SetToolTrapAddress Install custom code to replace an operating system routine

<pre>SetToolTrapAddress changes an element of the toolbox trap dispatch table

so that subsequent invocations of that trap will cause execution to go to a specified address. Use this function (and not SetTrapAddress ) if your application will run in a Mac equipped with a ROM version later than the 64K ROMs (see About Compatibility ). trapAddr is the address of some code to handle execution of a Toolbox function. trapNum identifies the ROM routine you wish to replace. See TrapWords for a list.

Returns
none
Note
SetToolTrapAddress is part of a new interface to the routine
NSetTrapAddress . SetToolTrapAddress does not require the
specification of the trap type as a parameter as NSetTrapAddress does.
Instead, either SetToolTrapAddress or SetOSTrapAddress 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
NSetTrapAddress . See About Compatibility for more information on
tool traps and OS traps.
SetToolTrapAddress is used mostly by assembly-language programers .
It is most often used in device drivers of INIT code, rather an by an
application.
Note: Be sure to change all traps back to their original addresses before
your application exits!
The trap dispatcher changed between the 64K and 128K ROMs. For more
information see About Compatibility .
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available