HWND hwnd = FindWindow(NULL, TEXT("Form1")); DWORD dwProcessId; (VOID)GetWindowThreadProcessId(hwnd, &dwProcessId); HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS | PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, dwProcessId); DWORD numBytesRead; PVOID pDestination = (PVOID)0x02233C70;//内存地址 BYTE MyData[4] = { 0 & 0x000000ff, (0 & 0x0000ff00) >> 8, (0 & 0x00ff0000) >> 16, (0 & 0xff000000) >> 24 }; BOOL fSuccess = WriteProcessMemory(hProcess, pDestination, (PVOID)MyData, 4, NULL); while (1) { ReadProcessMemory(hProcess, (LPCVOID)(0x02233C70), &MyData, sizeof(DWORD), &numBytesRead); for (int i = 0; i < 4; i++) printf(" %.2x", MyData[i]); printf("\n"); Sleep(100); }
时间: 2024-12-16 17:24:18