1# zx_process_write_memory
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7process_write_memory - Write into the given process's address space.
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_process_write_memory(zx_handle_t handle,
17                                    zx_vaddr_t vaddr,
18                                    const void* buffer,
19                                    size_t buffer_size,
20                                    size_t* actual);
21```
22
23## DESCRIPTION
24
25`zx_process_write_memory()` attempts to write memory of the specified process.
26
27This function will eventually be replaced with something vmo-centric.
28
29*vaddr* the address of the block of memory to write.
30
31*buffer* pointer to a user buffer containing the bytes to write.
32
33*buffer_size* number of bytes to attempt to write. *buffer* buffer must be
34large enough for at least this many bytes. *buffer_size* must be greater than
35zero and less than or equal to 64MB.
36
37*actual_size* the actual number of bytes written is stored here. Less bytes
38than requested may be returned if *vaddr*+*buffer_size* extends beyond the
39memory mapped in the process.
40
41## RIGHTS
42
43<!-- Updated by update-docs-from-abigen, do not edit. -->
44
45*handle* must be of type **ZX_OBJ_TYPE_PROCESS** and have **ZX_RIGHT_WRITE**.
46
47## RETURN VALUE
48
49`zx_process_write_memory()` returns **ZX_OK** on success.
50In the event of failure, a negative error value is returned, and the number of
51bytes written to *buffer* is undefined.
52
53## ERRORS
54
55**ZX_ERR_ACCESS_DENIED**  *handle* does not have the **ZX_RIGHT_WRITE** right.
56
57**ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle.
58
59**ZX_ERR_BAD_STATE**  the process's memory is not accessible (e.g.,
60the process is being terminated),
61or the requested memory is not cacheable.
62
63**ZX_ERR_INVALID_ARGS** *buffer* is an invalid pointer or NULL,
64or *buffer_size* is zero or greater than 64MB.
65
66**ZX_ERR_NO_MEMORY** the process does not have any memory at the
67requested address.
68
69**ZX_ERR_WRONG_TYPE**  *handle* is not a process handle.
70
71## SEE ALSO
72
73
74[process_read_memory](process_read_memory.md).
75