重複の可能性:
C# で byte[] から IntPtr を取得する方法
私はメモリから文字列を読んでいます
byte[] array =
reader.ReadProcessMemory((IntPtr)address, (uint)255, out bytesReadSize);
そして、この配列を文字列に変換しています。
プログラムのメモリ内のアドレス 003A53D4 の下に、文字列を指すポインターがあるため、問題が発生しました。文字列のアドレスを取得するにはどうすればよいですか? ありがとう :)
それは私が試したことです:
IntPtr pointers_address = new IntPtr(module_base_address + 3822548);
byte[] pointer_arrays =
reader.ReadProcessMemory(pointers_address, (uint)16, out bytesReadSize2);
IntPtr pointer_for_string = new IntPtr();
Marshal.Copy(pointers_array, 0, pointer_for_string, 16);
それは言います(約4行目):
値を null にすることはできません。パラメータ名: 宛先
new IntPtr() を new IntPtr(1)に変更 すると、
保護されたメモリを読み書きしようとしました。これは多くの場合、他のメモリが破損していることを示しています。