aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/NSMem.h
diff options
context:
space:
mode:
authorKittenPopo <Pokeberry123@gmail.com>2022-07-04 17:19:57 -0700
committerGitHub <noreply@github.com>2022-07-05 02:19:57 +0200
commit5995a7462da970ee2102a0dd0047ebbcef519dd0 (patch)
treece8a18c48a74ccedb8806ad04f230283203d9f37 /NorthstarDedicatedTest/NSMem.h
parent22a1ce87fa1205aa15eff81d78dc7c0e87c251c9 (diff)
downloadNorthstarLauncher-5995a7462da970ee2102a0dd0047ebbcef519dd0.tar.gz
NorthstarLauncher-5995a7462da970ee2102a0dd0047ebbcef519dd0.zip
Fix KHook hooking order to prevent missed hooks (#213)
Diffstat (limited to 'NorthstarDedicatedTest/NSMem.h')
-rw-r--r--NorthstarDedicatedTest/NSMem.h20
1 files changed, 1 insertions, 19 deletions
diff --git a/NorthstarDedicatedTest/NSMem.h b/NorthstarDedicatedTest/NSMem.h
index 74df3a84..84bb93db 100644
--- a/NorthstarDedicatedTest/NSMem.h
+++ b/NorthstarDedicatedTest/NSMem.h
@@ -182,25 +182,7 @@ struct KHook
if (!targetFuncAddr)
return false;
- return MH_CreateHook(targetFuncAddr, hookFunc, original) == MH_OK;
- }
-
- // Returns true if succeeded
- static bool InitAllHooks()
- {
- for (KHook* hook : _allHooks)
- {
- if (hook->Setup())
- {
- spdlog::info("KHook hooked at {}", hook->targetFuncAddr);
- }
- else
- {
- return false;
- }
- }
-
- return MH_EnableHook(MH_ALL_HOOKS) == MH_OK;
+ return (MH_CreateHook(targetFuncAddr, hookFunc, original) == MH_OK) && (MH_EnableHook(targetFuncAddr) == MH_OK);
}
};
#define KHOOK(name, funcPatternInfo, returnType, convention, args) \