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
|
void Read(DWORD Add, DWORD Value);
void Write(DWORD Add, DWORD Value);
void Read(DWORD Add, DWORD Value)
{
//Declare variables and set values
GetWindowThreadProcessId(window, &pID);
//Read process info
ReadProcessMemory(handle, (LPCVOID)(base+Add), &Value, 4, NULL);
}
void Write(DWORD Add, DWORD Value)
{
HWND window = FindWindow(0, _T("Process Window Name"));
DWORD pID = NULL;
DWORD base = dwGetModuleBaseAddress(pID, _T("App.exe"));
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID);
GetWindowThreadProcessId(window, &pID);
//Write to the memory address
WriteProcessMemory(handle, (BYTE*)(base+Add), &Value, sizeof(Value), NULL);
CloseHandle(handle);
}
|