- int ReadMem(char *window, int dAddr)
- {
- int buffer;
- //DWORD prevProtection;
- HWND hWnd = FindWindow(0, window);
- if (!hWnd) MessageBox(0, "Error finding window", 0, MB_OK);
- DWORD proc_id;
- GetWindowThreadProcessId(hWnd, &proc_id);
- HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
- //VirtualProtectEx(hProcess, (LPVOID)dAddr, 4, PAGE_EXECUTE_READWRITE, &prevProtection);
- //VirtualUnlock((LPVOID)dAddr, 2);
- if (!ReadProcessMemory(hProcess, (LPCVOID)dAddr, &buffer, 2, NULL))
- MessageBox(0, "Error doing memory reading", 0, MB_OK);
- //VirtualProtectEx(hProcess, (LPVOID)dAddr, 4, prevProtection, &prevProtection);
- return buffer;
- }
Undefined
By: Guest | Date: Jan 9 2009 21:31 | Format: None | Expires: never | Size: 736 B | Hits: 863
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago