关于ReadProcessMemory
已知基址006764E4,偏移量18,要取得基址加偏移量代表的值,我这样做有什么错误?给点思路哦~谢谢~
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &pi, sizeof(pi) );
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
CreateProcess(NULL
, "D:/Program Files/hl25/HL_Client.exe tqdigital", NULL, NULL, FALSE, 0,
NULL, "D:/Program Files/hl25", &si, &pi);
CString m_strTitle;
int ans;
LPBYTE lpBuf = new BYTE[4];
ReadProcessMemory(pi.hProcess,(LPCVOID)0x006764E4,lpBuf,4,NULL);
ans = ((int)lpBuf[0] & 0xff)<<0;
ans +=((int)lpBuf[1] & 0xff)<<8;
ans +=((int)lpBuf[2] & 0xff)<<16;
ans +=((int)lpBuf[3] & 0xff)<<24;
m_strTitle.Format("%d",ans);
AfxMessageBox(m_strTitle);
ReadProcessMemory(pi.hProcess,(LPCVOID)(ans+18),lpBuf,4,NULL);
ans = ((int)lpBuf[0] & 0xff)<<0;
ans +=((int)lpBuf[1] & 0xff)<<8;
ans +=((int)lpBuf[2] & 0xff)<<16;
ans +=((int)lpBuf[3] & 0xff)<<24;
m_strTitle.Format("%d",ans);
AfxMessageBox(m_strTitle);
ReadProcessMemory(pi.hProcess,(LPCVOID)(ans),lpBuf,4,NULL);
ans = ((int)lpBuf[0] & 0xff)<<0;
ans +=((int)lpBuf[1] & 0xff)<<8;
ans +=((int)lpBuf[2] & 0xff)<<16;
ans +=((int)lpBuf[3] & 0xff)<<24;
m_strTitle.Format("%d",ans);
AfxMessageBox(m_strTitle);