crashpad::ProcessMemoryRange Class Reference

Provides range protected access to the memory of another process. More...

`#include "util/process/process_memory_range.h"`

## Public Member Functions

bool | Initialize (const ProcessMemory *memory, bool is_64_bit, VMAddress base, VMSize size)
| Initializes this object. More...
bool | Initialize (const ProcessMemory *memory, bool is_64_bit)
| Initializes this object with the maximum range for the address space. More...
bool | Initialize (const ProcessMemoryRange &other)
| Initializes this object from an existing memory range. More...
bool | Is64Bit () const
| Returns whether the range is part of a 64-bit address space.
VMAddress | Base () const
| Returns the base address of the range.
VMSize | Size () const
| Returns the size of the range.
bool | RestrictRange (VMAddress base, VMSize size)
| Shrinks the range to the new base and size. More...
bool | Read (VMAddress address, size_t size, void *buffer) const
| Copies memory from the target process into a caller-provided buffer in the current process. More...
bool | ReadCStringSizeLimited (VMAddress address, size_t size, std::string *string) const
| Reads a `NUL`-terminated C string from the target process into a string in the current process. More...

## Detailed Description

Provides range protected access to the memory of another process.

## Member Function Documentation

## Initialize() [1/3]

bool crashpad::ProcessMemoryRange::Initialize | ( | const ProcessMemory * | memory,
|  | bool | is_64_bit,
|  | VMAddress | base,
|  | VMSize | size
| ) |  |

Initializes this object.

One of the Initialize methods must be successfully called on this object before calling any other.

Parameters

  [in] | memory | The memory reader to delegate to.
  [in] | is_64_bit | Whether the target process is 64-bit.
  [in] | base | The base address of the initial range.
  [in] | size | The size of the initial range.

Returns
  `true` on success. `false` on failure with a message logged.

## Initialize() [2/3]

bool crashpad::ProcessMemoryRange::Initialize | ( | const ProcessMemory * | memory,
|  | bool | is_64_bit
| ) |  |

Initializes this object with the maximum range for the address space.

One of the Initialize methods must be successfully called on this object before calling any other.

Parameters

  [in] | memory | The memory reader to delegate to.
  [in] | is_64_bit | Whether the target process is 64-bit.

## Initialize() [3/3]

bool crashpad::ProcessMemoryRange::Initialize | ( | const ProcessMemoryRange & | other | ) |

Initializes this object from an existing memory range.

One of the Initialize methods must be successfully called on this object before calling any other.

Parameters

  [in] | other | The memory range object to initialize from.

Returns
  `true` on success. `false` on failure with a message logged.

## Read()

bool crashpad::ProcessMemoryRange::Read | ( | VMAddress | address,
|  | size_t | size,
|  | void * | buffer
| ) |  | const

Copies memory from the target process into a caller-provided buffer in the current process.

Parameters

  [in] | address | The address, in the target process' address space, of the memory region to copy.
  [in] | size | The size, in bytes, of the memory region to copy. buffer must be at least this size.
  [out] | buffer | The buffer into which the contents of the other process' memory will be copied.

Returns
  `true` on success, with buffer filled appropriately. `false` on failure, with a message logged.

## ReadCStringSizeLimited()

bool crashpad::ProcessMemoryRange::ReadCStringSizeLimited | ( | VMAddress | address,
|  | size_t | size,
|  | std::string * | string
| ) |  | const

Reads a `NUL`-terminated C string from the target process into a string in the current process.

Parameters

  [in] | address | The address, in the target process’s address space, of the string to copy.
  [in] | size | The maximum number of bytes to read. The string is required to be `NUL`-terminated within this many bytes.
  [out] | string | The string read from the other process.

Returns
  `true` on success, with string set appropriately. `false` on failure, with a message logged. Failures can occur, for example, when a `NUL` terminator is not found within size bytes, or when encountering unmapped or unreadable pages.

## RestrictRange()

bool crashpad::ProcessMemoryRange::RestrictRange | ( | VMAddress | base,
|  | VMSize | size
| ) |  |

Shrinks the range to the new base and size.

The new range must be contained within the existing range for this object.

Parameters

  [in] | base | The new base of the range.
  [in] | size | The new size of the range.

Returns
  `true` on success. `false` on failure with a message logged.

The documentation for this class was generated from the following files:

- util/process/process_memory_range.h
- util/process/process_memory_range.cc