【发布时间】:2018-05-06 10:00:51
【问题描述】:
我还没有找到解决问题的方法。我想知道的是如何在 C++ 中做到这一点。
我有一个指向mov rcx, qword ptr [0xAddress] 的地址。
然后我需要找到一种方法,仅使用 C++ 从该内存位置获取 [0xAddress] 指针,而不使用内联 asm。
//I want something like this, but I don't get it working.
DWORD64 PatchAddress = FindAddressLocation(); //This finds the mov rcx, qword ptr [0xAddress]. location.
uint64_t rcx = *(volatile uint64_t*)PatchAddress;//This is supposed to give me the [0xAddress] address
*(BYTE*)(rcx) = 0;//Then write 0 to the pointer 0xAddress
【问题讨论】:
-
它返回一个不同于 [] 内的地址:/
-
即使在 64 位代码中,偏移量也是 32 位。您需要使用
uint32_t。 -
如果
PatchAddress指向指令,则mov rcx,部分首先出现,[memory_address]在一个或两个字节之后出现(查看x86指令格式了解详情)。 -
@BoPersson 我如何在 C++ 中做到这一点?
-
@gofmode - 如果
PatchAddress是内存中的特定地址,请考虑PatchAddress + 1可能是什么。
标签: c++ pointers assembly x86-64 machine-code