## vm_write

Function - Write data to the specified address in the target task's address space.

### SYNOPSIS

    kern_return_t   vm_write
                    (vm_task_t                          target_task,
                     vm_address_t                           address,
                     pointer_t                                 data,
                     mach_msg_type_number_t              data_count);

### PARAMETERS

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.

### DESCRIPTION

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.

### 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 writing.

KERN_INVALID_ADDRESS
  The address is illegal or specifies a non-allocated region.

### RELATED INFORMATION

Functions: vm_copy, vm_protect, vm_read, host_page_size.