public static bool Write(long iMemoryAddress, short iShortToWrite) { var bBuffer = BitConverter.GetBytes(iShortToWrite); Array.Reverse(bBuffer); IntPtr lpNumberOfBytesWritten; Mapi.WriteProcessMemory(_hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 2U, out lpNumberOfBytesWritten); return(lpNumberOfBytesWritten.ToInt32() == 2); }
public static bool Write(long iMemoryAddress, byte bByteToWrite) { var bBuffer = new byte[1] { bByteToWrite }; Array.Reverse(bBuffer); IntPtr lpNumberOfBytesWritten; Mapi.WriteProcessMemory(_hReadProcess, (IntPtr)iMemoryAddress, bBuffer, 1U, out lpNumberOfBytesWritten); return(lpNumberOfBytesWritten.ToInt32() == 1); }