I am trying to write to process memory, so I copied the code from a video. But this video does not show the function "ReadInt32", can someone send me to finally be able to run this application?
ReadInt32(process, (IntPtr)address)
public static long GetRealAddress(IntPtr process, IntPtr baseAddress, int[] offsets)
{
var address = baseAddress.ToInt64();
foreach (var offset in offsets)
{
address = ReadInt32(process, (IntPtr)address) + offset;
}
return address;
}
Error Highlighted in Code:
Pointer: (The type is float)
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(IntPtr handle, IntPtr baseAddress,
byte[] buffer, int size, out IntPtr lpNumberOfBytesRead);
public static int ReadInt32(IntPtr processHandle, IntPtr address)
{
byte[] buffer = new byte[4];
ReadProcessMemory(processHandle, address,
buffer, buffer.Length, out IntPtr bytesRead);
// if this gives the wrong value:
// Array.Reverse(buffer);
var myInt = BitConverter.ToInt32(buffer, 0);
return myInt;
}