Fixed dual hook on last function call

merge-requests/28/head
Nemirtingas 2019-08-01 17:04:49 +02:00
parent 890f19c20a
commit dda1e3210c
2 changed files with 9 additions and 4 deletions

View File

@ -34,7 +34,7 @@ void Base_Hook::UnhookAll()
}
}
void Base_Hook::HookFuncs(std::pair<void**, void*> hook)
void Base_Hook::HookFunc(std::pair<void**, void*> hook)
{
if( DetourAttach(hook.first, hook.second) == 0 )
_hooked_funcs.emplace_back(hook);

View File

@ -29,13 +29,18 @@ public:
void EndHook();
void UnhookAll();
void HookFuncs(std::pair<void**, void*> hook);
void HookFunc(std::pair<void**, void*> hook);
template<typename T>
void HookFuncs(std::pair<T*, T> funcs)
{
HookFunc(funcs);
}
template<typename T, typename ...Args>
void HookFuncs(std::pair<T*, T> funcs, Args... args)
{
_hooked_funcs.emplace_back(std::move(funcs));
HookFuncs(funcs);
HookFunc(funcs);
HookFuncs(args...);
}
};