osfmk/man/vm_read.html
Function - Read the specified range of target task's address space.
**kern\_return\_t vm\_read**** (vm\_task\_t **target\_task,** vm\_address\_t **address,** vm\_size\_t **size,** size **data\_out,** target\_task **data\_count** );**
**kern\_return\_t vm\_read\_overwrite**** (vm\_task\_t **target\_task,** vm\_address\_t **address,** vm\_size\_t **size,** pointer\_t **data\_in,** target\_task **data\_count** );**
target_task[in task send right] The port for the task whose memory is to be read.
address[in scalar] The address at which to start the read.
size[in scalar] The number of bytes to read.
data_outOut-pointer to dynamic array of bytes returned by the read.
data_inIn-pointer to array of bytes that will be overwritten with the data returned by the read.
data_count[in/out scalar] On input, the maximum size of the buffer; on output, the size returned (in natural-sized units).
The vm_read and vm_read_overwrite functions read a portion of a task's virtual memory (they enable tasks to read other tasks' memory). The vm_read function returns the data in a dynamically allocated array of bytes; the vm_read_overwrite function places the data into a caller-specified buffer (the data_in parameter).
This interface is machine word length specific because of the virtual address parameter.
KERN_PROTECTION_FAILURE Specified memory is valid, but does not permit reading.
KERN_INVALID_ADDRESS The address is illegal or specifies a non-allocated region, or there are less than size bytes of data following the address, or the region specified by the data_in parameter cannot be written to.
Functions: vm_copy, vm_deallocate, vm_write.