writeprocessmemory (kernel32)
Last changed: 109.202.69.200

.

C#

[DllImport("kernel32.dll")]
static extern bool WriteProcessMemory(
     IntPtr hProcess,
     IntPtr lpBaseAddress,
     byte[] lpBuffer,
     Int32 nSize,
     out IntPtr *lpNumberOfBytesWritten
);

Note the "out" datatype; in your call, use out keyword in your parameter to pass the variable by reference instead of value, ex.,

IntPtr outSz;
WriteProcessMemory(hProcess,lpBaseAddress, lpBuffer, nSize, out outSz);

VB.NET Signature: