如图
源码
#include
#include
int main(int argc, PCHAR argv[]){
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 23548);
if (handle == NULL){
printf("打开进程失败\n");
}
printf("打开进程成功,句柄为:%p\n", handle);
LPSTR buffer;
DWORD i = 0;
DWORD newprot, oldprot;
VirtualProtectEx(handle, (LPVOID)0x0040008, 4, PAGE_EXECUTE_READWRITE, &oldprot);
if (!ReadProcessMemory(handle, (LPVOID)0x0040008, &buffer, 4, &i)){
printf("读取进程内存失败 %d %d\n", GetLastError(), i);
}
VirtualProtectEx(handle, (LPVOID)0x0040008, 4, oldprot, &newprot);
printf("读取到的进程内存信息为: %p 读取数量 %d\n", buffer, i);
CloseHandle(handle);
getchar();
return 0;
}