|
CommonLib
|
#include <array>#include <vector>#include "ut/expr/string_expr.h"#include "mem.inl"#include "arch/mem_x86.inl"Go to the source code of this file.
Classes | |
| struct | hedgedev::csl::mem::branch_info |
Namespaces | |
| namespace | hedgedev |
| namespace | hedgedev::csl |
| namespace | hedgedev::csl::mem |
Macros | |
| #define | ASLR(ADDRESS) |
| #define | IS_NOP(ADDRESS) |
| #define | READ(ADDRESS, TYPE) |
| #define | READ_ARRAY(ADDRESS, TYPE, COUNT) |
| #define | READ_INSTR_ADDRESS(ADDRESS, TYPE, OFFSET, STRIDE) |
| #define | READ_CALL(ADDRESS) |
| #define | READ_JUMP(ADDRESS) |
| #define | WRITE(ADDRESS, TYPE, ...) |
| #define | WRITE_ARRAY(ADDRESS, TYPE, DATA) |
| #define | WRITE_CALL(ADDRESS, DESTINATION) |
| #define | WRITE_JUMP(ADDRESS, DESTINATION) |
| #define | WRITE_NOP(ADDRESS, COUNT) |
| #define | WRITE_STRING(ADDRESS, STR) |
| #define | WRITE_STRING_FIXED(ADDRESS, STR, ...) |
Enumerations | |
| enum class | hedgedev::csl::mem::page_protection { hedgedev::csl::mem::no_access = 0 << 0 , hedgedev::csl::mem::read = 1 << 0 , hedgedev::csl::mem::write = 1 << 1 , hedgedev::csl::mem::execute = 1 << 2 , hedgedev::csl::mem::read_write = read | write , hedgedev::csl::mem::read_execute = read | execute , hedgedev::csl::mem::read_write_execute = read | write | execute , hedgedev::csl::mem::r = read , hedgedev::csl::mem::w = write , hedgedev::csl::mem::x = execute , hedgedev::csl::mem::rw = read_write , hedgedev::csl::mem::rx = read_execute , hedgedev::csl::mem::rwx = read_write_execute } |
Functions | |
| void * | hedgedev::csl::mem::get_original_module_base () |
| uint32_t | hedgedev::csl::mem::get_protect_flags (page_protection in_protection) |
| bool | hedgedev::csl::mem::protect (void *in_address, size_t in_length, uint32_t in_new_protect_flags, uint32_t *out_old_protect_flags=nullptr) |
| void * | hedgedev::csl::mem::to_aslr (void *in_address, void *in_base_address=nullptr) |
| void * | hedgedev::csl::mem::from_aslr (void *in_address, void *in_base_address=nullptr) |
| bool | hedgedev::csl::mem::is_nop (void *in_address) |
| template<typename T> requires (std::is_integral_v<T>) | |
| constexpr T | hedgedev::csl::mem::align (T in_address, T in_alignment) |
| void * | hedgedev::csl::mem::align (void *in_address, uintptr_t in_alignment) |
| template<typename T> | |
| T | hedgedev::csl::mem::read (void *in_address) |
| template<typename T, size_t count> | |
| std::array< T, count > | hedgedev::csl::mem::read (void *in_address) |
| branch_info | hedgedev::csl::mem::get_branch_info (void *in_address) |
| template<typename T> | |
| void * | hedgedev::csl::mem::read_instr_address (void *in_address, ptrdiff_t in_offset, size_t in_stride) |
| void * | hedgedev::csl::mem::read_call (void *in_address) |
| void * | hedgedev::csl::mem::read_jump (void *in_address) |
| template<typename T> | |
| constexpr T | hedgedev::csl::mem::byteswap (T in_value) |
| template<typename T> | |
| constexpr void | hedgedev::csl::mem::byteswap_inplace (T &io_value) |
| template<typename T> | |
| bool | hedgedev::csl::mem::write (void *in_address, const T &in_data, size_t in_count=1) |
| template<typename T> | |
| bool | hedgedev::csl::mem::write (void *in_address, const std::vector< T > &in_data) |
| bool | hedgedev::csl::mem::write_call (void *in_address, void *in_destination) |
| bool | hedgedev::csl::mem::write_jump (void *in_address, void *in_destination, bool in_call=false) |
| bool | hedgedev::csl::mem::write_nop (void *in_address, size_t in_count=1) |
| template<ut::expr::any_string T> | |
| bool | hedgedev::csl::mem::write_string (void *in_address, const T &in_str) |
| template<ut::expr::any_string T> | |
| bool | hedgedev::csl::mem::write_string_fixed_length (void *in_address, const T &in_str, size_t in_length=0) |
| #define ASLR | ( | ADDRESS | ) |
Transforms a virtual address to the current module's ASLR base.
| ADDRESS | The address to transform. |
| #define IS_NOP | ( | ADDRESS | ) |
Checks if the instruction at the given memory address is a no-operation (NOP) instruction.
| ADDRESS | The address to check. |
| #define READ | ( | ADDRESS, | |
| TYPE ) |
Reads a value in memory.
| ADDRESS | The address to read from. |
| TYPE | The type to read. |
| #define READ_ARRAY | ( | ADDRESS, | |
| TYPE, | |||
| COUNT ) |
Reads an array of values in memory.
| ADDRESS | The address to read from. |
| TYPE | The type to read. |
| COUNT | The total number of values to read. |
| #define READ_CALL | ( | ADDRESS | ) |
Reads the address of a call instruction in memory.
| ADDRESS | The address of the call instruction to read. |
| #define READ_INSTR_ADDRESS | ( | ADDRESS, | |
| TYPE, | |||
| OFFSET, | |||
| STRIDE ) |
Reads the address of an instruction in memory.
| ADDRESS | The address of the instruction to read. |
| TYPE | The type to read. |
| OFFSET | The offset of the address after ADDRESS. |
| STRIDE | The length of the instruction that was read. |
| #define READ_JUMP | ( | ADDRESS | ) |
Reads the address of a jump instruction in memory.
| ADDRESS | The address of the jump instruction to read. |
| #define WRITE | ( | ADDRESS, | |
| TYPE, | |||
| ... ) |
Writes any number of values in memory.
| ADDRESS | The address to write to. |
| TYPE | The type to write. |
| __VA_ARGS__ | The values to write. |
| #define WRITE_ARRAY | ( | ADDRESS, | |
| TYPE, | |||
| DATA ) |
Writes an array of values in memory.
| ADDRESS | The address to write to. |
| TYPE | The type to write. |
| DATA | The collection of values to write. |
| #define WRITE_CALL | ( | ADDRESS, | |
| DESTINATION ) |
Writes a call instruction in memory.
| ADDRESS | The address to write to. |
| DESTINATION | The address of the function to call. |
| #define WRITE_JUMP | ( | ADDRESS, | |
| DESTINATION ) |
Writes a jump instruction in memory.
| ADDRESS | The address to write to. |
| DESTINATION | The address of the address to jump to. |
| #define WRITE_NOP | ( | ADDRESS, | |
| COUNT ) |
Writes a no-operation (NOP) instruction in memory.
| ADDRESS | The address to write to. |
| COUNT | The total number of no-operation (NOP) instructions to write. |
| #define WRITE_STRING | ( | ADDRESS, | |
| STR ) |
Writes a string in memory.
| ADDRESS | The address to write to. |
| STR | The string to write. |
| #define WRITE_STRING_FIXED | ( | ADDRESS, | |
| STR, | |||
| ... ) |
Writes a string of fixed length in memory.
| ADDRESS | The address to write to. |
| STR | The string to write. |
| __VA_ARGS__ | The length of the string to write. If zero or unspecified, the length will be determined by the length of an existing string located at ADDRESS. |