mirror of
https://github.com/Obfuscator-Collections/VMProtect.git
synced 2024-12-27 08:49:27 +03:00
5ec92ee05e
Version 3.x.x
40 lines
842 B
C++
40 lines
842 B
C++
#ifndef HOOK_MANAGER_H
|
|
#define HOOK_MANAGER_H
|
|
|
|
class HookedAPI
|
|
{
|
|
public:
|
|
HookedAPI();
|
|
bool Hook(void *api, void *handler, void **result);
|
|
void Unhook();
|
|
void *old_handler() const { return old_handler_; }
|
|
private:
|
|
static size_t page_size_;
|
|
size_t size_;
|
|
void *api_;
|
|
void *old_handler_;
|
|
uint32_t crc_;
|
|
};
|
|
|
|
class HookManager
|
|
{
|
|
public:
|
|
HookManager();
|
|
void Begin();
|
|
void End();
|
|
void *HookAPI(HMODULE dll, const char *api_name, void *handler, bool show_error = true, void **result = NULL);
|
|
bool UnhookAPI(void * handler);
|
|
private:
|
|
HookManager(const HookManager &src);
|
|
HookManager & operator = (const HookManager &);// block the assignment operator
|
|
void GetThreads();
|
|
void SuspendThreads();
|
|
void ResumeThreads();
|
|
void FreeThreads();
|
|
|
|
vector<HookedAPI *> api_list_;
|
|
vector<HANDLE> thread_list_;
|
|
size_t update_count_;
|
|
};
|
|
|
|
#endif |