summaryrefslogtreecommitdiff
path: root/src/plugins/HPMHooking.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/HPMHooking.h')
-rw-r--r--src/plugins/HPMHooking.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/HPMHooking.h b/src/plugins/HPMHooking.h
index b2d95dd8d..44970863c 100644
--- a/src/plugins/HPMHooking.h
+++ b/src/plugins/HPMHooking.h
@@ -43,8 +43,18 @@ struct HPMHooking_core_interface {
#else // ! HERCULES_CORE
HPExport struct HPMHooking_interface HPMHooking_s;
-#define addHookPre(tname,hook) (HPMi->hooking->AddHook(HOOK_TYPE_PRE,(tname),(hook),HPMi->pid))
-#define addHookPost(tname,hook) (HPMi->hooking->AddHook(HOOK_TYPE_POST,(tname),(hook),HPMi->pid))
+#include "HPMHooking/HPMHooking.Defs.inc"
+
+#define addHookPre(ifname, funcname, hook) ( \
+ (void)((HPMHOOK_pre_ ## ifname ## _ ## funcname)0 == (hook)), \
+ HPMi->hooking->AddHook(HOOK_TYPE_PRE, #ifname "->" #funcname, (hook), HPMi->pid) \
+ )
+
+#define addHookPost(ifname, funcname, hook) ( \
+ (void)((HPMHOOK_post_ ## ifname ## _ ## funcname)0 == (hook)), \
+ HPMi->hooking->AddHook(HOOK_TYPE_POST, #ifname "->" #funcname, (hook), HPMi->pid) \
+ )
+
/* need better names ;/ */
/* will not run the original function after pre-hook processing is complete (other hooks will run) */
#define hookStop() (HPMi->hooking->HookStop(__func__,HPMi->pid))