forked from guywithahat-org/NullCoreCrackWrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhooks.h
33 lines (26 loc) · 813 Bytes
/
hooks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include <stdint.h>
class CJumpHook
{
public:
~CJumpHook() { UnHook(); }
template<class T = void*>
inline T Location() { return (T)m_loc; }
template<class T = void*>
inline T Original() { return (T)m_original; }
inline bool IsHooked() { return m_hooked; }
template <class T = void*>
void Hook(T From, void* To, size_t Length = 0) { Hook((void*)From, To, Length); }
void Hook(void* From, void* To, size_t Length = 0);
void Hook(const char* Module, const char* Function, void* To, size_t Length = 0);
void UnHook();
private:
bool m_hooked = false;
void* m_loc = nullptr;
uint16_t* m_original = nullptr;
size_t m_hooklen = 0;
// - Length: 5
void RelJmp(uintptr_t From, uintptr_t To);
// - Length: 14
void AbsJmp(uintptr_t From, uintptr_t To);
};