2019-07-25 23:21:03 +02:00
|
|
|
#ifndef __INCLUDED_BASE_HOOK_H__
|
|
|
|
#define __INCLUDED_BASE_HOOK_H__
|
|
|
|
|
2019-08-14 14:55:31 +02:00
|
|
|
#include "../dll/base.h"
|
|
|
|
|
2019-08-14 15:09:57 +02:00
|
|
|
#ifndef NO_OVERLAY
|
2019-08-14 14:55:31 +02:00
|
|
|
|
2019-07-25 23:21:03 +02:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#define VC_EXTRALEAN
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
class Base_Hook
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
std::vector<std::pair<void**, void*>> _hooked_funcs;
|
|
|
|
|
|
|
|
HMODULE _dll;
|
|
|
|
bool _hooked;
|
|
|
|
|
|
|
|
Base_Hook(const Base_Hook&) = delete;
|
|
|
|
Base_Hook(Base_Hook&&) = delete;
|
|
|
|
Base_Hook& operator =(const Base_Hook&) = delete;
|
|
|
|
Base_Hook& operator =(Base_Hook&&) = delete;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Base_Hook() {}
|
|
|
|
virtual ~Base_Hook();
|
|
|
|
|
|
|
|
void BeginHook();
|
|
|
|
void EndHook();
|
|
|
|
void UnhookAll();
|
|
|
|
|
2019-08-01 17:04:49 +02:00
|
|
|
void HookFunc(std::pair<void**, void*> hook);
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void HookFuncs(std::pair<T*, T> funcs)
|
|
|
|
{
|
|
|
|
HookFunc(funcs);
|
|
|
|
}
|
2019-07-25 23:21:03 +02:00
|
|
|
|
|
|
|
template<typename T, typename ...Args>
|
|
|
|
void HookFuncs(std::pair<T*, T> funcs, Args... args)
|
|
|
|
{
|
2019-08-01 17:04:49 +02:00
|
|
|
HookFunc(funcs);
|
2019-07-25 23:21:03 +02:00
|
|
|
HookFuncs(args...);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-08-14 15:09:57 +02:00
|
|
|
#endif//NO_OVERLAY
|
2019-08-14 14:55:31 +02:00
|
|
|
|
2019-07-25 23:21:03 +02:00
|
|
|
#endif//__INCLUDED_BASE_HOOK_H__
|