读取或修改进程某一地址的数据

HWND hWnd = ::FindWindow(NULL, TEXT("QQ游戏 - 连连看角色版"));
if(hWnd != NULL) {
DWORD pid;
GetWindowThreadProcessId(hWnd,
&pid);
HANDLE hProcess
= OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if(hProcess != NULL) {
int num;
SIZE_T cnt;
if(ReadProcessMemory(hProcess, (LPCVOID)0x112f78, (LPVOID)&num, 4, &cnt)) {
if(4 == cnt) {
//读取数据成功
}
}
}
}
HWND hWnd = ::FindWindow(NULL, TEXT("QQ游戏 - 连连看角色版"));
if(hWnd != NULL) {
DWORD pid;
GetWindowThreadProcessId(hWnd,
&pid);
HANDLE hProcess
= OpenProcess(PROCESS_ALL_ACCESS, false, pid);
if(hProcess != NULL) {
int num = 0;
SIZE_T cnt;
if(WriteProcessMemory(hProcess, (LPVOID)0x1163b0, &num, 4, &cnt)) {
if(4 == cnt) {
MessageBox(TEXT(
"GOOD!"));
}
}
}
}
posted @ 2011-02-03 12:54  penink  阅读(478)  评论(2编辑  收藏  举报