Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<Windows.h>
- using namespace std;
- int main()
- {
- int newValue = 2000;
- int readTest = 0;
- HWND hwnd = FindWindowA(NULL, "Window Name");
- if (hwnd == NULL)
- {
- cout << "Cannot find window." << endl;
- Sleep(3000);
- exit(-1);
- }
- else
- {
- DWORD procID;
- GetWindowThreadProcessId(hwnd, &procID);
- HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
- if (procID == NULL)
- {
- cout << "Cannot obtain process." << endl;
- Sleep(3000);
- exit(-1);
- }
- else
- {
- // Write Memory in infinite loop (On 'press space' Write Memory)
- for (;;)
- {
- if (GetAsyncKeyState(VK_SPACE))
- {
- WriteProcessMemory(handle, (LPVOID)0x00ABEA6C, &newValue, sizeof(newValue), 0);
- newValue++;
- }
- Sleep(1);
- }
- // Read Memory:
- ReadProcessMemory(handle, (PBYTE*)0x00ABEA6C, &readTest, sizeof(readTest), 0);
- cout << readTest << endl;
- Sleep(10000);
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment