1*d8b80295SApple OSS Distributions<h2>vm_read</h2> 2*d8b80295SApple OSS Distributions<hr> 3*d8b80295SApple OSS Distributions<p> 4*d8b80295SApple OSS Distributions<strong>Function</strong> - Read the specified range of target task's address space. 5*d8b80295SApple OSS Distributions<h3>SYNOPSIS</h3> 6*d8b80295SApple OSS Distributions<pre> 7*d8b80295SApple OSS Distributions<strong>kern_return_t vm_read</strong> 8*d8b80295SApple OSS Distributions <strong>(vm_task_t</strong> <var>target_task</var>, 9*d8b80295SApple OSS Distributions <strong>vm_address_t</strong> <var>address</var>, 10*d8b80295SApple OSS Distributions <strong>vm_size_t</strong> <var>size</var>, 11*d8b80295SApple OSS Distributions <strong>size</strong> <var>data_out</var>, 12*d8b80295SApple OSS Distributions <strong>target_task</strong> <var>data_count</var><strong>);</strong> 13*d8b80295SApple OSS Distributions</pre> 14*d8b80295SApple OSS Distributions 15*d8b80295SApple OSS Distributions<h4>Overwrite form:</h4> 16*d8b80295SApple OSS Distributions<pre> 17*d8b80295SApple OSS Distributions<strong>kern_return_t vm_read_overwrite</strong> 18*d8b80295SApple OSS Distributions <strong>(vm_task_t</strong> <var>target_task</var>, 19*d8b80295SApple OSS Distributions <strong>vm_address_t</strong> <var>address</var>, 20*d8b80295SApple OSS Distributions <strong>vm_size_t</strong> <var>size</var>, 21*d8b80295SApple OSS Distributions <strong>pointer_t</strong> <var>data_in</var>, 22*d8b80295SApple OSS Distributions <strong>target_task</strong> <var>data_count</var><strong>);</strong> 23*d8b80295SApple OSS Distributions</pre> 24*d8b80295SApple OSS Distributions<h3>PARAMETERS</h3> 25*d8b80295SApple OSS Distributions<dl> 26*d8b80295SApple OSS Distributions<p> 27*d8b80295SApple OSS Distributions<dt> <var>target_task</var> 28*d8b80295SApple OSS Distributions<dd> 29*d8b80295SApple OSS Distributions[in task send right] 30*d8b80295SApple OSS DistributionsThe port for the task whose memory is to be read. 31*d8b80295SApple OSS Distributions<p> 32*d8b80295SApple OSS Distributions<dt> <var>address</var> 33*d8b80295SApple OSS Distributions<dd> 34*d8b80295SApple OSS Distributions[in scalar] 35*d8b80295SApple OSS DistributionsThe address at which to start the read. 36*d8b80295SApple OSS Distributions<p> 37*d8b80295SApple OSS Distributions<dt> <var>size</var> 38*d8b80295SApple OSS Distributions<dd> 39*d8b80295SApple OSS Distributions[in scalar] 40*d8b80295SApple OSS DistributionsThe number of bytes to read. 41*d8b80295SApple OSS Distributions<p> 42*d8b80295SApple OSS Distributions<dt> <var>data_out</var> 43*d8b80295SApple OSS Distributions<dd> 44*d8b80295SApple OSS DistributionsOut-pointer to dynamic array of bytes returned by the read. 45*d8b80295SApple OSS Distributions<p> 46*d8b80295SApple OSS Distributions<dt> <var>data_in</var> 47*d8b80295SApple OSS Distributions<dd> 48*d8b80295SApple OSS DistributionsIn-pointer to array of bytes that will be overwritten with the data returned by the read. 49*d8b80295SApple OSS Distributions<p> 50*d8b80295SApple OSS Distributions<dt> <var>data_count</var> 51*d8b80295SApple OSS Distributions<dd> 52*d8b80295SApple OSS Distributions[in/out scalar] 53*d8b80295SApple OSS DistributionsOn input, the maximum size of the buffer; on output, the 54*d8b80295SApple OSS Distributionssize returned (in natural-sized units). 55*d8b80295SApple OSS Distributions</dl> 56*d8b80295SApple OSS Distributions<h3>DESCRIPTION</h3> 57*d8b80295SApple OSS Distributions<p> 58*d8b80295SApple OSS DistributionsThe <strong>vm_read</strong> and <strong>vm_read_overwrite</strong> 59*d8b80295SApple OSS Distributionsfunctions read a portion of a task's virtual 60*d8b80295SApple OSS Distributionsmemory (they enable tasks to read other tasks' memory). 61*d8b80295SApple OSS DistributionsThe <strong>vm_read</strong> function returns the data in a dynamically 62*d8b80295SApple OSS Distributionsallocated array of bytes; the <strong>vm_read_overwrite</strong> function 63*d8b80295SApple OSS Distributionsplaces the data into a caller-specified buffer (the <var>data_in</var> 64*d8b80295SApple OSS Distributionsparameter). 65*d8b80295SApple OSS Distributions<h3>NOTES</h3> 66*d8b80295SApple OSS Distributions<p> 67*d8b80295SApple OSS DistributionsThis interface is machine word length specific because of the virtual address 68*d8b80295SApple OSS Distributionsparameter. 69*d8b80295SApple OSS Distributions<h3>RETURN VALUES</h3> 70*d8b80295SApple OSS Distributions<dl> 71*d8b80295SApple OSS Distributions<p> 72*d8b80295SApple OSS Distributions<dt> <strong>KERN_PROTECTION_FAILURE</strong> 73*d8b80295SApple OSS Distributions<dd> 74*d8b80295SApple OSS DistributionsSpecified memory is valid, but does not permit reading. 75*d8b80295SApple OSS Distributions<p> 76*d8b80295SApple OSS Distributions<dt> <strong>KERN_INVALID_ADDRESS</strong> 77*d8b80295SApple OSS Distributions<dd> 78*d8b80295SApple OSS DistributionsThe address is illegal or specifies a non-allocated region, or there are 79*d8b80295SApple OSS Distributionsless than <var>size</var> bytes of data following the address, or the region 80*d8b80295SApple OSS Distributionsspecified by the <var>data_in</var> parameter cannot be written to. 81*d8b80295SApple OSS Distributions</dl> 82*d8b80295SApple OSS Distributions<h3>RELATED INFORMATION</h3> 83*d8b80295SApple OSS Distributions<p> 84*d8b80295SApple OSS DistributionsFunctions: 85*d8b80295SApple OSS Distributions<a href="vm_copy.html"><strong>vm_copy</strong></a>, 86*d8b80295SApple OSS Distributions<a href="vm_deallocate.html"><strong>vm_deallocate</strong></a>, 87*d8b80295SApple OSS Distributions<a href="vm_write.html"><strong>vm_write</strong></a>. 88