-
Notifications
You must be signed in to change notification settings - Fork 240
Expand file tree
/
Copy pathmain.h
More file actions
46 lines (39 loc) · 809 Bytes
/
main.h
File metadata and controls
46 lines (39 loc) · 809 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <Windows.h>
#include <vector>
/*
THIS IS JUST SOME BOILER-PLATE TO ALLOW THE EXAMPLE CODE TO WORK,
NOTHING INTERESTING HERE
*/
template<typename T>
T readMemory(DWORD address)
{
return *((T*)address);
}
template<typename T>
T* pointMemory(DWORD address)
{
return ((T*)address);
}
template<typename T>
void writeMemory(DWORD address, T value)
{
*((T*)address) = value;
}
template<typename T>
DWORD protectMemory(DWORD address, DWORD prot)
{
DWORD oldProt;
VirtualProtect((LPVOID)address, sizeof(T), prot, &oldProt);
return oldProt;
}
struct _creature
{
_creature(int hb, bool e, bool c) : healthBar(hb), isEnemy(e), isCloaked(c) {}
int healthBar;
bool isEnemy, isCloaked;
};
void NOPExample();
void callHookExample();
void VFHookExample();
void IATHookExample();