-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmemmod.h
86 lines (81 loc) · 2.24 KB
/
memmod.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
AUTHOR : TheFlood
URL : http://unknowncheats.me/
DESCRIPTION : A Class containing functions that make the
manipulation of memory within a proccess easier.
CREATED : November 13th 2013
MODIFIED : November 13th 2013
*/
#include <windows.h>
class MemMod {
public:
//Set the value of an address to an ADDRESS
static void setValue(DWORD Address, DWORD value) {
DWORD* pointer = getPointer(Address);
*pointer = value;
}
//Set the value of an address to an INTEGER
static void setValue(DWORD Address, int value) {
DWORD* pointer = getPointer(Address);
*pointer = value;
}
//Set the value of an address to a FLOAT
static void setValueF(DWORD Address, float value) {
float* pointer = (float*)Address;
*pointer = value;
}
//Set the value of an address to a CHAR* (BETA)
static void setValue(DWORD Address, char* value) {
DWORD* pointer = getPointer(Address);
pointer = (DWORD*)value;
}
//Get the value of an address as a POINTER
static DWORD* getPointer(DWORD Address) {
DWORD* Assignment = (DWORD*)Address;
return Assignment;
}
//Get the value of an address as an INTEGER
static int getValueInt(DWORD Address) {
int* pointer = (int*)Address;
return *pointer;
}
//Get the value of an address as an FLOAT
static float getValueFloat(DWORD Address) {
float* pointer = (float*)Address;
return *pointer;
}
//Get the value of an address as a CHAR* (BETA)
static char* getValueChar(DWORD Address) {
char* pointer = (char*)Address;
return pointer;
}
////Get the value of an address as a string* (BETA)
//static string *getValueString(DWORD Address) {
// string* pointer = (string*)Address;
// return pointer;
//}
//Get the value of an address as an ADDRESS
static DWORD getValue(DWORD Address) {
if (Address != 0) {
DWORD* pointer = getPointer(Address);
if (checkPointer(pointer)) {
Address = *pointer;
if ((Address != 0) && (Address != 0x0)) {
return Address;
}
}
}
return 0;
}
//Check if a pointer exist
static BOOL checkPointer(DWORD* Address) {
if (!IsBadReadPtr(Address, sizeof(DWORD))) {
try {
DWORD value = *Address;
return TRUE;
}
catch (EXCEPTION_POINTERS) {}
}
return FALSE;
}
};