How to convert ULONG64 to pointer

365 views Asked by At

I have an ULONG64 variable from SYMBOL_INFO structure that contains virtual address represented as 18446744073709551572 value and I need to convert it to the void* so I can pass it to the ReadProcessMemory function.

If I just do

reinterpret_cast<void*>(pSymInfo->Address)

it gives me FFFFFFD4.

Why? What am I doing wrong? How can I fix it?

Thanks in advance.

1

There are 1 answers

1
mmphs On

Not sure why the reinterpret_cast is not working as it should but I usually use ULongToPtr to do these kind of things.

ReadProcessMemory(process, ULongToPtr(virtual_address), &content, sizeof content, nullptr);