#ifndef _NTMMAPI_H
//
// Virtual memory
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* Writes virtual memory to a process.
*
* @param ProcessHandle A handle to the process whose memory is to be written.
* @param BaseAddress A pointer to the base address in the specified process to which to write.
* @param Buffer A pointer to the buffer that contains the data to be written to the address space of the specified process.
* @param NumberOfBytesToWrite The number of bytes to be written to the specified process.
* @param NumberOfBytesWritten A pointer to a variable that receives the number of bytes transferred into the specified buffer.
* @return NTSTATUS Successful or errant status.
*/
NTSYSCALLAPI
NTSTATUS
NTAPI
NtWriteVirtualMemory(
_In_ HANDLE ProcessHandle,
_In_opt_ PVOID BaseAddress,
_In_reads_bytes_(NumberOfBytesToWrite) PVOID Buffer,
_In_ SIZE_T NumberOfBytesToWrite,
_Out_opt_ PSIZE_T NumberOfBytesWritten
);
View code on GitHub
#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwWriteVirtualMemory(
_In_ HANDLE ProcessHandle,
_In_opt_ PVOID BaseAddress,
_In_reads_bytes_(NumberOfBytesToWrite) PVOID Buffer,
_In_ SIZE_T NumberOfBytesToWrite,
_Out_opt_ PSIZE_T NumberOfBytesWritten
);
View code on GitHub
NtWriteVirtualMemory
is similar to WINAPI WriteProcessMemory
. See Ms SDK for detailed description of parameters.