This class provides an interface for reading and writing memory in a remote process.
More...
#include <MemoryIO.hpp>
|
| | MemoryIO (const ProcessHandle &process) |
| | Construct a new MemoryIO object.
|
| |
| | MemoryIO (const MemoryIO &)=delete |
| |
| MemoryIO & | operator= (const MemoryIO &)=delete |
| |
| | MemoryIO (MemoryIO &&) noexcept=default |
| |
| MemoryIO & | operator= (MemoryIO &&) noexcept=default |
| |
| std::uint8_t | pointerSize () const |
| | Getter for the pointer size.
|
| |
| bool | isAttached () const |
| | This function determines if the process is attached.
|
| |
| template<typename T > |
| T | Read (RemotePtr< T > address) |
| | Wrapper for ReadProcessMemory.
|
| |
| template<typename T > |
| std::size_t | Read (void *dst, RemotePtr< T > src, std::size_t size) |
| | Wrapper for ReadProcessMemory. Similar to memcpy.
|
| |
| template<typename T > |
| void | Write (RemotePtr< T > address, const T &value) |
| | Wrapper for WriteProcessMemory.
|
| |
| template<typename T > |
| std::size_t | Write (RemotePtr< T > dst, const void *src, std::size_t size) |
| | Wrapper for WriteProcessMemory. Writes a buffer to the target process.
|
| |
| template<typename T > |
| RemotePtr< T > | ResolvePointerChain (RemotePtr< void > base, std::span< const std::ptrdiff_t > offsets) |
| | Resolves a pointer chain in the target process.
|
| |
| void | Fill (RemotePtr< void > dst, std::uint8_t value, std::size_t size) |
| | Fills a buffer in the target process with a specified byte (opcode).
|
| |
| template<typename T > |
| RemotePtr< T > | ResolvePointerChain (RemotePtr< void > base, std::initializer_list< std::ptrdiff_t > offsets) |
| | Overload of ResolvePointerChain for std::initializer_list.
|
| |
This class provides an interface for reading and writing memory in a remote process.
- Note
- Copy constructor and assignment operator are deleted to prevent copying.
-
Move constructor and assignment operator are defaulted to allow moving.
◆ MemoryIO() [1/3]
Construct a new MemoryIO object.
- Parameters
-
| process | The process handle to the target process. |
◆ MemoryIO() [2/3]
◆ MemoryIO() [3/3]
◆ Fill()
| void MemoryIO::Fill |
( |
RemotePtr< void > | dst, |
|
|
std::uint8_t | value, |
|
|
std::size_t | size ) |
Fills a buffer in the target process with a specified byte (opcode).
- Parameters
-
| dst | The address to fill. |
| value | The byte value to fill the buffer with. |
| size | The size of the buffer to fill. |
◆ isAttached()
| bool MemoryIO::isAttached |
( |
| ) |
const |
|
inlinenodiscard |
This function determines if the process is attached.
- Returns
- true if the process is attached
-
false if the process is not attached
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ pointerSize()
| std::uint8_t MemoryIO::pointerSize |
( |
| ) |
const |
|
inlinenodiscard |
Getter for the pointer size.
- Note
- The pointer size is determined by the architecture of the target process.
- Returns
- std::uint8_t The size of the pointer in bytes.
◆ Read() [1/2]
Wrapper for ReadProcessMemory.
- Parameters
-
| address | The address to read from. |
- Template Parameters
-
| T | The type of the value to read. |
- Returns
- T The value read from the address.
◆ Read() [2/2]
template<typename T >
| std::size_t MemoryIO::Read |
( |
void * | dst, |
|
|
RemotePtr< T > | src, |
|
|
std::size_t | size ) |
|
inline |
Wrapper for ReadProcessMemory. Similar to memcpy.
- Parameters
-
| dst | Pointer to the destination buffer. |
| src | The address to read from. |
| size | The size of the buffer to read. |
- Returns
- std::size_t The number of bytes read.
- Note
- This function is not type-safe. It is the caller's responsibility to ensure that the size of the buffer is correct.
◆ ResolvePointerChain() [1/2]
template<typename T >
| RemotePtr< T > MemoryIO::ResolvePointerChain |
( |
RemotePtr< void > | base, |
|
|
std::initializer_list< std::ptrdiff_t > | offsets ) |
|
inlinenodiscard |
Overload of ResolvePointerChain for std::initializer_list.
- Parameters
-
| base | The base address of the pointer chain. |
| offsets | A list of offsets to resolve the pointer chain. |
- Returns
- RemotePtr<T> The resolved pointer.
◆ ResolvePointerChain() [2/2]
template<typename T >
| RemotePtr< T > MemoryIO::ResolvePointerChain |
( |
RemotePtr< void > | base, |
|
|
std::span< const std::ptrdiff_t > | offsets ) |
|
inlinenodiscard |
Resolves a pointer chain in the target process.
- Parameters
-
| base | The base address of the pointer chain. |
| offsets | A span of offsets to resolve the pointer chain. |
- Returns
- RemotePtr<T> The resolved pointer.
- Note
- This function is not type-safe. It is the caller's responsibility to ensure that the offsets are correct.
-
This function assumes that the base address is a valid pointer in the target process.
◆ Write() [1/2]
template<typename T >
| void MemoryIO::Write |
( |
RemotePtr< T > | address, |
|
|
const T & | value ) |
|
inline |
Wrapper for WriteProcessMemory.
- Parameters
-
| address | The address to write to. |
| value | The value to write. |
- Template Parameters
-
| T | The type of the value to write. |
- Note
- This function is not type-safe. It is the caller's responsibility to ensure that the size of the value is correct.
◆ Write() [2/2]
template<typename T >
| std::size_t MemoryIO::Write |
( |
RemotePtr< T > | dst, |
|
|
const void * | src, |
|
|
std::size_t | size ) |
|
inline |
Wrapper for WriteProcessMemory. Writes a buffer to the target process.
- Parameters
-
| dst | The address to write to. |
| src | Pointer to the source buffer. |
| size | The size of the buffer to write. |
- Returns
- std::size_t The number of bytes written.
- Note
- This function is not type-safe. It is the caller's responsibility to ensure that the size of the buffer is correct.
The documentation for this class was generated from the following files: