ReadProcessMemory + address from ollydbg
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 30 14:36:25 PDT 2017
On Friday, 30 June 2017 at 20:14:15 UTC, bauss wrote:
> This is my definition:
> BOOL ReadProcessMemory(HANDLE hProcess, LPCVOID lpBaseAddress,
> LPVOID lpBuffer, SIZE_T nSize, SIZE_T *lpNumberOfBytesRead);
>
> And I'm reading it like this:
> if (!ReadProcessMemory(process,
> cast(PCVOID)address, cast(PVOID)&data,
> cast(DWORD)stringSize, cast(PDWORD)&bytesRead)) {
> return defaultValue;
> }
I guess the first cast is necessary when `address` isn't typed as
a pointer yet. But the other casts shouldn't be needed. If you
get errors without them, those errors might give a hint on what's
wrong.
> process is a HANDLE that I got from OpenProcess()
> address is a DWORD
> data is char[1024]
> stringSize is size_t
> bytesRead is PDWORD
bytesRead is a SIZE_T, no? Or maybe a DWORD.
More information about the Digitalmars-d-learn
mailing list