summaryrefslogtreecommitdiffhomepage
path: root/src/hook.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-05-16 21:07:41 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-05-16 22:15:46 +0100
commit278b61bc3f2018515e26fd6b45410aded8b6417e (patch)
tree39a860b66c3d88e91359f48dbf937c0c71d61833 /src/hook.c
parente8843dba3eb1c7a67f6ff7b920046ae36a12acd0 (diff)
Clean up some random bits and bobs
Diffstat (limited to 'src/hook.c')
-rw-r--r--src/hook.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hook.c b/src/hook.c
index 56eaf7d..9320636 100644
--- a/src/hook.c
+++ b/src/hook.c
@@ -85,7 +85,9 @@ nosp: con_warn("hook_inline: out of trampoline space\n");
// pad with original bytes so we can do an 8-byte atomic write
memcpy(jmp + 5, func + 5, 3);
*(volatile uvlong *)func = *(uvlong *)jmp; // (assuming function is aligned)
- FlushInstructionCache(GetCurrentProcess(), func, len);
+ // -1 is the current process, and it's a constant in the WDK, so it's
+ // assumed we can safely avoid the useless GetCurrentProcess call
+ FlushInstructionCache((void *)-1, func, len);
return trampoline;
}
@@ -95,7 +97,7 @@ void unhook_inline(void *orig) {
int off = mem_load32(p + len + 1);
uchar *q = p + off + 5;
memcpy(q, p, 5); // XXX: not atomic atm! (does any of it even need to be?)
- FlushInstructionCache(GetCurrentProcess(), q, 5);
+ FlushInstructionCache((void *)-1, q, 5);
}
#else