我目前正在尝试读取阻止调用OpenProcess
和的游戏的全部内存ReadProcessMemory
(我相信这是通过 Windows 驱动程序/服务完成的,尽管我不确定如何)。
我使用以下代码尝试打开进程并将其内存读取到文件中:
HANDLE process = OpenProcess(PROCESS_VM_READ, 0, pid);
if (!process) {
cout << "Failed to open process.";
return 1;
}
cout << "Successfully opened processs." << endl << "Dumping memory to mem.dmp..." << endl;
ofstream fout;
fout.open("mem.dmp");
char *base = (char *)0;
char *readCount = (char *)0;
do {
char buffer[PAGE_SIZE];
if (ReadProcessMemory(process, base, buffer, PAGE_SIZE, NULL) != 0)
{
fout << buffer;
}
base += PAGE_SIZE;
readCount++;
} while (base != 0);
if (readCount == 0) {
cout << "Warning: No memory was read from the process." << endl;
}
fout.flush();
fout.close();
但是,在运行时,这甚至无法打开该进程。
绕过阻止进程打开以进行内存读取的驱动程序的唯一方法是将整个物理内存转储到文件中。我不知道该怎么做,除了必须设置窗口以在蓝屏上转储所有物理内存,然后强制我的计算机以蓝屏关闭。这显然很不方便,因为我想经常分析应用程序的内存。
有没有办法在 Windows 上不使用这种方法来转储所有物理内存?我对驱动程序或它的工作原理几乎一无所知,因此几乎不可能找到另一种绕过它的方法。