我正在嘗試使用ReadProcessMemory()API函數讀取控制檯程序的進程內存。正在讀取進程內存
更新的代碼:
HWND hWnd = FindWindow(NULL, "Read Memory Window");
DWORD ProcessId;
ProcessId = GetProcessId(hWnd);
GetWindowThreadProcessId(hWnd, &ProcessId);
HANDLE hProcess = OpenProcess(PROCESS_VM_READ,FALSE, ProcessId);
SIZE_T NumberOfBytesRead;
CHAR Buffer[128] = {0};
dwAddr = 0x0012FD6C; //address of array to get
BOOL sucess = ReadProcessMemory(hProcess, &dwAddr, &Buffer, 128, &NumberOfBytesRead);
我得到空和垃圾值作爲我的程序讀取陣列沿運行程序。
哪裏是打開的代碼hProcess?你確定它成功了嗎? 您確定該地址在目標進程中包含有效數據嗎? – 2010-02-20 03:20:08
是的,我從窗口句柄中得到一個有效的進程ID – cpx 2010-02-20 03:33:30
NumberOfBytesRead返回值爲128. – cpx 2010-02-20 03:39:55