Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- // FindWindow();
- // GetWindowThreadProcessId();
- // OpenProcess();
- // WriteProcessMemory();
- // CloseHandle();
- using namespace std;
- int main()
- {
- int newValue = 0;
- HWND hWnd = FindWindow(0, "ENG");
- if (hWnd == 0)
- {
- cerr << "Cannot find window." << endl;
- }
- else
- {
- DWORD pId;
- GetWindowThreadProcessId(hWnd, &pId);
- HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
- if (!hProc)
- {
- cerr << "Cannot open process." << endl;
- }
- else
- {
- int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x151F485C, &newValue, (DWORD)sizeof(newValue), NULL);
- if (isSuccessful > 0)
- {
- clog << "Process memory written." << endl;
- }
- else
- {
- cerr << "Cannot write process memory." << endl;
- }
- CloseHandle(hProc);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement