I would like to ask for a help on my script. I am trying to sniff on the PC's Memory. I am using JNA in loading user32 and kernel32.
I've made interface classes for those APIs. one interface for user32 that has these methods :
FindWindowA() - for retrieving handler window ID of an application
GetWindowThreadProcessId() - for retrieving Process ID of an application
one interface for kernel32 with these methods:
OpenProcess() - for retrieving Handler Process ID of an application
here is my problem: FindWindowA(),GetWindowThreadProcessId() and OpenProcess() works fine but i have problems with ReadProcessMemory() it can't retrieve data from the PC's memory. the GetLastError says : "Only part of a ReadProcessMemory or WriteProcessMemory request was completed"
I've implemented ReadProcessMemory() using this :
int ReadProcessMemory(int hProcess, int lpBaseAddress, String lpBuffer, int nSize, int lpNumberOfBytesWritten);
in visual basic 6 it is implemented like this :
Public Declare Function ReadProcessMemory Lib "kernel32" _
(ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As String, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
I am not sure how to implement this method, maybe i'm using it in a wrong way.
How do i implement this one?Do you have reference for this method?or examples that i could use as a guide?