aboutsummaryrefslogtreecommitdiff
path: root/lib/hook-functions.c
diff options
context:
space:
mode:
authorcomex2015-02-28 21:54:23 -0500
committercomex2015-02-28 21:54:23 -0500
commita976efe67c5f936eb553a0d61b78a311da7224d9 (patch)
tree759de2adb9ad10a80b0373b5dbefdacbc04c9c18 /lib/hook-functions.c
parentfix accidental usage of panic() from mach/mach.h instead of substitute_panic (diff)
downloadsubstitute-a976efe67c5f936eb553a0d61b78a311da7224d9.tar.gz
Add extra argument to substitute_hook_functions and interpose_imports for use with unhooking.
I think we'll need to explicitly record trampoline locations to avoid the possibility of stomping on someone else's stuff if the function was re-patched... Also, document substitute_hook_functions.
Diffstat (limited to '')
-rw-r--r--lib/hook-functions.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/hook-functions.c b/lib/hook-functions.c
index 6d53a0d..2a8d618 100644
--- a/lib/hook-functions.c
+++ b/lib/hook-functions.c
@@ -127,11 +127,16 @@ end:
EXPORT
int substitute_hook_functions(const struct substitute_function_hook *hooks,
- size_t nhooks, int options) {
+ size_t nhooks,
+ struct substitute_function_hook_record **recordp,
+ int options) {
bool thread_safe = !(options & SUBSTITUTE_NO_THREAD_SAFETY);
if (thread_safe && !pthread_main_np())
return SUBSTITUTE_ERR_NOT_ON_MAIN_THREAD;
+ if (recordp)
+ *recordp = NULL;
+
struct execmem_foreign_write *fws;
struct hook_internal *his = malloc(nhooks * sizeof(*his) +
nhooks + sizeof(*fws));