私の目標は、プロセス ハンドルを受け取り、そのプロセスのメモリを表すバイト配列を返すメソッドを作成することです。ここに私が持っているものがあります:
[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;
}
ラッパー メソッドに引数として何を渡せばよいかわかりません。ahandle
と thebytes
は出力変数ですが、address
andはsize
どうでしょうか。このデータはどこから入手できますか?