c++ 修改内存
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c++ 修改内存相关的知识,希望对你有一定的参考价值。
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); }
以上是关于c++ 修改内存的主要内容,如果未能解决你的问题,请参考以下文章