コード例 #1
0
        public static unsafe byte[] ReadByte(ulong address, int size)
        {
            IntPtr buffer = Marshal.AllocHGlobal(size);

            Imports.ReadMemory(socket, (uint)PID, address, (UIntPtr)buffer.ToPointer(), size);

            byte[] output = new byte[size];
            Marshal.Copy(buffer, output, 0, size);

            Marshal.FreeHGlobal(buffer);

            return(output);
        }
コード例 #2
0
        public static unsafe T Read <T>(ulong address)
        {
            int size = Marshal.SizeOf(typeof(T));

            IntPtr buffer = Marshal.AllocHGlobal(size);

            Imports.ReadMemory(socket, (uint)PID, address, (UIntPtr)buffer.ToPointer(), size);

            T structure = (T)Marshal.PtrToStructure(buffer, typeof(T));

            Marshal.FreeHGlobal(buffer);

            return(structure);
        }