-
Notifications
You must be signed in to change notification settings - Fork 1
/
Memory.cpp
99 lines (94 loc) · 2.14 KB
/
Memory.cpp
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
87
88
89
90
91
92
93
94
95
96
97
98
99
#include "pch.h"
#include "Memory.h"
/************************************
* description: 黍2趼誹囀湔
* param:hProcess 輛最曆梟
* param:dwReadAddr 華硊
* param:bStatus 袨怓
* time: 2020.03.06.00.15
************************************/
DWORD Memory::ReadMemory_DWORD(HANDLE hProcess, DWORD dwReadAddr, BOOL* bStatus)
{
DWORD dwMemory = 0;
BOOL fok;
fok = ReadProcessMemory(hProcess,
(LPCVOID)dwReadAddr,
&dwMemory,
4,
NULL);
if (bStatus != 0)
*bStatus = fok;
return dwMemory;
}
/************************************
* description: 黍1趼誹囀湔
* param:hProcess 輛最曆梟
* param:dwReadAddr 華硊
* param:bStatus 袨怓
* time: 2020.03.06.00.17
************************************/
BYTE Memory::ReadMemory_BYTE(HANDLE hProcess, DWORD dwReadAddr, BOOL* bStatus)
{
BYTE dwMemory = 0;
BOOL fok;
fok = ReadProcessMemory(hProcess,
(LPCVOID)dwReadAddr,
&dwMemory,
1,
NULL);
if (bStatus != 0)
*bStatus = fok;
return dwMemory;
}
/************************************
* description: 黍4趼誹囀湔(等腹萸)
* param:hProcess 輛最曆梟
* param:dwReadAddr 華硊
* param:bStatus 袨怓
* time: 2020.03.06.00.17
************************************/
float Memory::ReadMemory_float(HANDLE hProcess, DWORD dwReadAddr, BOOL* bStatus)
{
float fMemory = 0;
BOOL fok;
fok = ReadProcessMemory(hProcess,
(LPCVOID)dwReadAddr,
&fMemory,
4,
NULL);
if (bStatus != 0)
*bStatus = fok;
return fMemory;
}
/************************************
* description: 迡2趼誹杅擂
* param:hProcess 輛最曆梟
* param:dwReadAddr 華硊
* param:bStatus 袨怓
* time: 2020.03.06.00.17
************************************/
BOOL Memory::WriteMemory_DWORD(HANDLE hProcess, DWORD dwReadAddr, DWORD dwNum)
{
return WriteProcessMemory(hProcess,
(LPVOID)dwReadAddr,
&dwNum,
4,
NULL
);
}
/************************************
* description: 迡4趼誹杅擂(float)
* param:hProcess 輛最曆梟
* param:dwReadAddr 華硊
* param:bStatus 袨怓
* time: 2020.03.06.00.17
************************************/
BOOL Memory::WriteMemory_float(HANDLE hProcess, DWORD dwReadAddr, float fNum)
{
return WriteProcessMemory(hProcess,
(LPVOID)dwReadAddr,
&fNum,
4,
NULL
);
}