-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMemory.cpp
executable file
·29 lines (24 loc) · 946 Bytes
/
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
#include "EG_client.h"
///
////////////////////////////////////////////////////////////////////////////////////////
///
void WriteProcMem(void* pAddress, void* pMem, int iSize)
{
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
DWORD dwOld;
VirtualProtectEx(hProc, pAddress, iSize, PAGE_EXECUTE_READWRITE, &dwOld);
WriteProcessMemory(hProc, pAddress, pMem, iSize, 0);
CloseHandle(hProc);
}
////////////////////////////////////////////////////////////////////////////////////////
void ReadProcMem(void* pAddress, void* pMem, int iSize)
{
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
DWORD dwOld;
VirtualProtectEx(hProc, pAddress, iSize, PAGE_EXECUTE_READWRITE, &dwOld);
ReadProcessMemory(hProc, pAddress, pMem, iSize, 0);
CloseHandle(hProc);
}
///
////////////////////////////////////////////////////////////////////////////////////////
///