osfmk/man/vm_write.html
Function - Write data to the specified address in the target task's address space.
**kern\_return\_t vm\_write**** (vm\_task\_t **target\_task,** vm\_address\_t **address,** pointer\_t **data,** mach\_msg\_type\_number\_t **data\_count** );**
target_task[in task send right] The port for the task whose memory is to be written.
address[in scalar] The address at which to start the write.
data[pointer to page aligned in array of bytes] An array of data to be written.
data_count[in scalar] The number of bytes in the array.
The vm_write function writes an array of data to a task's virtual memory. It allows one task to write to another task's memory.
The result of vm_write is as if target_task had directly written into the set of pages. Hence, target_task must have write permission to the pages.
This interface is machine word length specific because of the virtual address parameter.
KERN_PROTECTION_FAILURE Specified memory is valid, but does not permit writing.
KERN_INVALID_ADDRESS The address is illegal or specifies a non-allocated region.
Functions: vm_copy, vm_protect, vm_read, host_page_size.