我的目标是创建一个方法,该方法将采用进程句柄并返回表示该进程内存的字节数组。这是我所拥有的:
[DllImport("Kernel32.dll")]
public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UInt32 nSize, ref UInt32 lpNumberOfBytesRead);
public static byte[] MemRead(IntPtr handle, IntPtr address, UInt32 size, ref UInt32 bytes)
{
byte[] buffer = new byte[size];
ReadProcessMemory(handle, address, buffer, size, ref bytes);
return buffer;
}
我不知道将什么作为参数传递给包装器方法。我可以找到 a handle
and thebytes
是一个输出变量,但是address
andsize
呢?我可以从哪里获得这些数据?