#ifndef _NTMMAPI_H
//
// Virtual memory
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* The NtWriteVirtualMemory routine 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.
* \remarks The copy helper requires PROCESS_VM_WRITE for a nonzero transfer; an inaccessible
* target can still prevent or shorten the copy. A zero-byte request skips process-handle lookup and reports zero
* bytes written. Do not treat zero-byte success as proof of write access.
*/
_Kernel_entry_
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
_Kernel_entry_
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 GitHubNo description available.
NtWriteVirtualMemory is similar to WINAPI WriteProcessMemory. See Ms SDK for detailed description of parameters.