vm_read


Function - Read the specified range of target task's address space.

SYNOPSIS

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);

Overwrite form:

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);

PARAMETERS

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_out
Out-pointer to dynamic array of bytes returned by the read.

data_in
In-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).

DESCRIPTION

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).

NOTES

This interface is machine word length specific because of the virtual address parameter.

RETURN VALUES

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.

RELATED INFORMATION

Functions: vm_copy, vm_deallocate, vm_write.