【发布时间】:2016-03-08 16:43:07
【问题描述】:
我是这个专业领域的新手,所以我不完全确定......我知道外部你有两个函数:WriteProcessMemory 和 ReadProcessMemory,但内部情况不同......我也不熟悉有足够的指针我自己做 - 但如果你可以为我评论它,我想我会没事的:)。
那么,读取内存的最佳方法是什么?
顺便说一下,这是我的写记忆功能:
void WriteToMemory(DWORD addressToWrite, char* valueToWrite, int byteNum)
{
//used to change our file access type, stores the old
//access type and restores it after memory is written
unsigned long OldProtection;
//give that address read and write permissions and store the old permissions at oldProtection
VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
//write the memory into the program and overwrite previous value
memcpy((LPVOID)addressToWrite, valueToWrite, byteNum);
//reset the permissions of the address back to oldProtection after writting memory
VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, NULL);
}
【问题讨论】:
-
不确定你在问什么。 “内部”=从正在运行的进程中读取内存?不需要任何API,只需访问内存即可。也许您在问枚举加载的 DLL 并访问映射到特定的内存区域?
-
就像我说的,新的,所以我的术语不好,抱歉 :P 我开始的是一个外部控制台程序,它用 WriteProcessMemory 将内存写入另一个程序。现在我有一个注入到程序中的 DLL。我认为它被称为内部改变内存或类似......
-
"对指针还不够熟悉" - 虽然这在 C++ 中不一定是坏事,但对于您在这里尝试的类型来说是坏事。在尝试这些事情之前,您应该对普通指针感到非常满意。
-
这不是我不了解它们,我只是对它们很陌生,新事物需要一段时间才能熟悉 :D 无论如何,我正在发布我使用的一种方法,我'我只是不太确定这是否是“最好的方法”。如果可能的话,我会尽量不被作弊探测器发现。
标签: c++ memory offset memory-address cheat-engine