有人可以将 ReadInt32 发送到 Write Process Memory 吗?

Can someone send the ReadInt32 to Write Process Memory?

我正在尝试写入进程内存,所以我从视频中复制了代码。 但是这个视频没有显示功能"ReadInt32",谁能发给我终于可以运行这个应用程序了?

ReadInt32(进程, (IntPtr)地址)

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;
    }

代码中突出显示的错误:

指针:(类型为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;
}