Skip to content

Read/WriteProcessMemory examples, GetLastError() #215

Answered by krll-kov
krll-kov asked this question in Q&A
Discussion options

You must be logged in to vote

If anyone is looking for the answer:

static int readProcessMemory(int lpBaseAddress, num nSize) {
    Pointer<Int32> lpBuffer = calloc<Int32>();

    ReadProcessMemory(activeHandle,
        Pointer<Int32>.fromAddress(lpBaseAddress), lpBuffer, nSize.toInt(), nullptr);

    return lpBuffer.value;
  }

nSize should be the same size as lpBuffer, not more, not less. (after working with java jni i thought that it's okay to make nSize even more than buffer itselft)

However, writeProcessMemory still fails and i have no idea how to use it properly

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@dcharkes
Comment options

@krll-kov
Comment options

Comment options

You must be logged in to vote
1 reply
@krll-kov
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by krll-kov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants