49
49
#include <mach/error.h>
56
Returned if the function to be overrided begins with a 'mfctr' instruction.
56
Returned if the function to be overrided begins with a 'mfctr' instruction.
58
58
#define err_cannot_override (err_local|1)
60
/***************************************************************************//**
61
Dynamically overrides the function implementation referenced by
62
originalFunctionSymbolName with the implentation pointed to by
63
overrideFunctionAddress. Optionally returns a pointer to a "reentry island"
64
which, if jumped to, will resume the original implementation.
66
@param originalFunctionSymbolName -> Required symbol name of the
67
function to override (with
68
overrideFunctionAddress).
69
Remember, C function name
70
symbols are prepended with an
72
@param originalFunctionLibraryNameHint -> Optional name of the library
74
originalFunctionSymbolName. Can
75
be NULL, but this may result in
76
the wrong function being
77
overridden and/or a crash.
78
@param overrideFunctionAddress -> Required address to the
80
@param originalFunctionReentryIsland <- Optional pointer to pointer to
81
the reentry island. Can be NULL.
82
@result <- err_cannot_override if the
84
implementation begins with the
87
***************************************************************************/
91
char *originalFunctionSymbolName,
92
const char *originalFunctionLibraryNameHint,
93
const void *overrideFunctionAddress,
94
void **originalFunctionReentryIsland );
96
/************************************************************************************//**
97
Dynamically overrides the function implementation referenced by
98
originalFunctionAddress with the implentation pointed to by overrideFunctionAddress.
99
Optionally returns a pointer to a "reentry island" which, if jumped to, will resume
100
the original implementation.
102
@param originalFunctionAddress -> Required address of the function to
103
override (with overrideFunctionAddress).
104
@param overrideFunctionAddress -> Required address to the overriding
106
@param originalFunctionReentryIsland <- Optional pointer to pointer to the
107
reentry island. Can be NULL.
108
@result <- err_cannot_override if the original
109
function's implementation begins with
110
the 'mfctr' instruction.
112
************************************************************************************/
116
void *originalFunctionAddress,
117
const void *overrideFunctionAddress,
118
void **originalFunctionReentryIsland );
120
/************************************************************************************//**
123
************************************************************************************/
60
/***************************************************************************//**
61
Dynamically overrides the function implementation referenced by
62
originalFunctionSymbolName with the implentation pointed to by
63
overrideFunctionAddress. Optionally returns a pointer to a "reentry island"
64
which, if jumped to, will resume the original implementation.
66
@param originalFunctionSymbolName -> Required symbol name of the
67
function to override (with
68
overrideFunctionAddress).
69
Remember, C function name
70
symbols are prepended with an
72
@param originalFunctionLibraryNameHint -> Optional name of the library
74
originalFunctionSymbolName. Can
75
be NULL, but this may result in
76
the wrong function being
77
overridden and/or a crash.
78
@param overrideFunctionAddress -> Required address to the
80
@param originalFunctionReentryIsland <- Optional pointer to pointer to
81
the reentry island. Can be NULL.
82
@result <- err_cannot_override if the
84
implementation begins with the
87
***************************************************************************/
91
char *originalFunctionSymbolName,
92
const char *originalFunctionLibraryNameHint,
93
const void *overrideFunctionAddress,
94
void **originalFunctionReentryIsland);
96
/************************************************************************************//**
97
Dynamically overrides the function implementation referenced by
98
originalFunctionAddress with the implentation pointed to by overrideFunctionAddress.
99
Optionally returns a pointer to a "reentry island" which, if jumped to, will resume
100
the original implementation.
102
@param originalFunctionAddress -> Required address of the function to
103
override (with overrideFunctionAddress).
104
@param overrideFunctionAddress -> Required address to the overriding
106
@param originalFunctionReentryIsland <- Optional pointer to pointer to the
107
reentry island. Can be NULL.
108
@result <- err_cannot_override if the original
109
function's implementation begins with
110
the 'mfctr' instruction.
112
************************************************************************************/
116
void *originalFunctionAddress,
117
const void *overrideFunctionAddress,
118
void **originalFunctionReentryIsland);
120
/************************************************************************************//**
123
************************************************************************************/
125
125
#ifdef __cplusplus
127
127
#define MACH_OVERRIDE( ORIGINAL_FUNCTION_RETURN_TYPE, ORIGINAL_FUNCTION_NAME, ORIGINAL_FUNCTION_ARGS, ERR ) \