-3

我的 &pTemp

所以我认为我不太了解这一点。如果我没记错的话,指针值应该存储在 pTemp 中,对吧?那么,如果基指针是 0x00001A,pTemp 不应该显示同样的东西吗?我真的是 C++ 新手,任何帮助将不胜感激!

DWORD pointer = baseAddress;
DWORD pTemp;
DWORD pointerAddress;

cout << "Base Address: " << (DWORD*) pointer << endl;

for (int i = 0; i < PointerLevel; i++)
{
    if (i == 0)
    {
        ReadProcessMemory(handle, (LPVOID)pointer, &pTemp, sizeof(4), NULL);
        cout << "pTemp: " << pTemp << endl;
4

1 回答 1

0

尝试这个:

void * src_addr = reinterpret_cast<void *>(baseAddress);
std::size_t n;

if (ReadProcessMemory(handle, src_addr, &pTemp, sizeof pTemp, &n))
{
    if (n == sizeof pTemp)
    {
        std::cout << "Success: pTemp = " << pTemp << "\n";
    }
    else
    {
        std::cout << "We only read " << n << " bytes, not the expected "
                  << sizeof pTemp << " bytes.\n";
    }
}
else
{
    std::cout << "Failed to read process memory.\n";
}
于 2015-12-29T13:54:00.090 回答