我是这个专家领域的新手,所以我不完全确定...我知道你有两个函数: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);
}
答案 0 :(得分:0)
这是实现目标的一种方式:
void ReadFromMemory(DWORD addressToRead, float value)
{
value = *(float*)addressToRead;
}
还有其他建议吗?