我是这个专业领域的新手,所以我不完全确定......我知道你有两个功能: 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);
}