plugify  1.0.0.0
Static Public Member Functions | List of all members
plugify::MemAccessor Class Reference

A class providing various memory access routines. More...

#include <mem_accessor.hpp>

Static Public Member Functions

static bool MemCopy (MemAddr dest, MemAddr src, size_t size)
 Defines a memory read/write routine that may fail ungracefully. It's expected this library will only ever use this routine in cases that are expected to succeed. More...
 
static bool SafeMemCopy (MemAddr dest, MemAddr src, size_t size, size_t &written) noexcept
 Defines a memory write routine that will not throw exceptions, and can handle potential writes to NO_ACCESS or otherwise inaccessible memory pages. Defaults to WriteProcessMemory. Must fail gracefully. More...
 
static bool SafeMemRead (MemAddr src, MemAddr dest, size_t size, size_t &read) noexcept
 Defines a memory read routine that will not throw exceptions, and can handle potential reads from NO_ACCESS or otherwise inaccessible memory pages. Defaults to ReadProcessMemory. Must fail gracefully. More...
 
static ProtFlag MemProtect (MemAddr dest, size_t size, ProtFlag newProtection, bool &status)
 Defines a memory protection set/unset routine that may fail ungracefully. More...
 

Detailed Description

A class providing various memory access routines.

Definition at line 12 of file mem_accessor.hpp.

Member Function Documentation

◆ MemCopy()

static bool plugify::MemAccessor::MemCopy ( MemAddr  dest,
MemAddr  src,
size_t  size 
)
static

Defines a memory read/write routine that may fail ungracefully. It's expected this library will only ever use this routine in cases that are expected to succeed.

Parameters
destThe destination memory address.
srcThe source memory address.
sizeThe number of bytes to copy.
Returns
True if the memory copy succeeds, false otherwise.

◆ MemProtect()

static ProtFlag plugify::MemAccessor::MemProtect ( MemAddr  dest,
size_t  size,
ProtFlag  newProtection,
bool &  status 
)
static

Defines a memory protection set/unset routine that may fail ungracefully.

Parameters
destThe memory address to change protection for.
sizeThe number of bytes to change protection for.
newProtectionThe new protection flags to set.
statusA reference to a variable that will hold the success status of the operation.
Returns
The previous protection flags if the operation succeeds, otherwise an appropriate error code.

◆ SafeMemCopy()

static bool plugify::MemAccessor::SafeMemCopy ( MemAddr  dest,
MemAddr  src,
size_t  size,
size_t &  written 
)
staticnoexcept

Defines a memory write routine that will not throw exceptions, and can handle potential writes to NO_ACCESS or otherwise inaccessible memory pages. Defaults to WriteProcessMemory. Must fail gracefully.

Parameters
destThe destination memory address.
srcThe source memory address.
sizeThe number of bytes to copy.
writtenA reference to the variable that will hold the number of bytes successfully written.
Returns
True if the memory copy succeeds, false otherwise.

◆ SafeMemRead()

static bool plugify::MemAccessor::SafeMemRead ( MemAddr  src,
MemAddr  dest,
size_t  size,
size_t &  read 
)
staticnoexcept

Defines a memory read routine that will not throw exceptions, and can handle potential reads from NO_ACCESS or otherwise inaccessible memory pages. Defaults to ReadProcessMemory. Must fail gracefully.

Parameters
srcThe source memory address.
destThe destination memory address.
sizeThe number of bytes to read.
readA reference to the variable that will hold the number of bytes successfully read.
Returns
True if the memory read succeeds, false otherwise.

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