hooksystem: add callbackinfo struct and cancellable events

This commit is contained in:
Vaxry
2023-10-21 14:52:43 +01:00
parent c6233a790f
commit a61eb7694d
13 changed files with 39 additions and 24 deletions

View File

@@ -26,7 +26,7 @@ void CHookSystemManager::unhook(HOOK_CALLBACK_FN* fn) {
}
}
void CHookSystemManager::emit(const std::vector<SCallbackFNPtr>* callbacks, std::any data) {
void CHookSystemManager::emit(const std::vector<SCallbackFNPtr>* callbacks, SCallbackInfo& info, std::any data) {
if (callbacks->empty())
return;
@@ -38,7 +38,7 @@ void CHookSystemManager::emit(const std::vector<SCallbackFNPtr>* callbacks, std:
if (!cb.handle) {
// we don't guard hl hooks
(*cb.fn)(cb.fn, data);
(*cb.fn)(cb.fn, info, data);
continue;
}
@@ -49,7 +49,7 @@ void CHookSystemManager::emit(const std::vector<SCallbackFNPtr>* callbacks, std:
try {
if (!setjmp(m_jbHookFaultJumpBuf))
(*cb.fn)(cb.fn, data);
(*cb.fn)(cb.fn, info, data);
else {
// this module crashed.
throw std::exception();