6#include "ut/expr/string_expr.h"
16 (hedgedev::csl::mem::to_aslr(reinterpret_cast<void*>(ADDRESS)))
26#define IS_NOP(ADDRESS)
27 (hedgedev::csl::mem::is_nop(reinterpret_cast<void*>(ADDRESS)))
37#define READ(ADDRESS, TYPE)
38 (hedgedev::csl::mem::read<TYPE>(reinterpret_cast<void*>(ADDRESS)))
49#define READ_ARRAY(ADDRESS, TYPE, COUNT)
50 (hedgedev::csl::mem::read<TYPE, COUNT>(reinterpret_cast<void*>(ADDRESS)))
62#define READ_INSTR_ADDRESS(ADDRESS, TYPE, OFFSET, STRIDE)
63 (hedgedev::csl::mem::read_instr_address<TYPE>(reinterpret_cast<void*>(ADDRESS), OFFSET, STRIDE))
72#define READ_CALL(ADDRESS)
73 (hedgedev::csl::mem::read_call(reinterpret_cast<void*>(ADDRESS)))
82#define READ_JUMP(ADDRESS)
83 (hedgedev::csl::mem::read_jump(reinterpret_cast<void*>(ADDRESS)))
94#define WRITE(ADDRESS, TYPE, ...)
95 (hedgedev::csl::mem::write<TYPE>(reinterpret_cast<void*>(ADDRESS), { __VA_ARGS__ }))
106#define WRITE_ARRAY(ADDRESS, TYPE, DATA)
107 (hedgedev::csl::mem::write<TYPE>(reinterpret_cast<void*>(ADDRESS), DATA))
117#define WRITE_CALL(ADDRESS, DESTINATION)
118 (hedgedev::csl::mem::write_call(reinterpret_cast<void*>(ADDRESS), reinterpret_cast<void*>(DESTINATION)))
128#define WRITE_JUMP(ADDRESS, DESTINATION)
129 (hedgedev::csl::mem::write_jump(reinterpret_cast<void*>(ADDRESS), reinterpret_cast<void*>(DESTINATION)))
140#define WRITE_NOP(ADDRESS, COUNT)
141 (hedgedev::csl::mem::write_nop(reinterpret_cast<void*>(ADDRESS), COUNT))
151#define WRITE_STRING(ADDRESS, STR)
152 (hedgedev::csl::mem::write_string(reinterpret_cast<void*>(ADDRESS), STR))
165#define WRITE_STRING_FIXED(ADDRESS, STR, ...)
166 (hedgedev::csl::mem::write_string_fixed_length(reinterpret_cast<void*>(ADDRESS), STR, __VA_ARGS__))
168namespace hedgedev::csl::
mem
218 inline bool protect(
void* in_address, size_t in_length, uint32_t in_new_protect_flags, uint32_t* out_old_protect_flags =
nullptr);
229 inline void*
to_aslr(
void* in_address,
void* in_base_address =
nullptr);
240 inline void*
from_aslr(
void* in_address,
void* in_base_address =
nullptr);
250 inline bool is_nop(
void* in_address);
273 inline void*
align(
void* in_address, uintptr_t in_alignment);
284 template <
typename T>
285 inline T
read(
void* in_address);
297 template <
typename T, size_t count>
298 inline std::array<T, count>
read(
void* in_address);
320 template <
typename T>
321 inline void*
read_instr_address(
void* in_address, ptrdiff_t in_offset, size_t in_stride);
330 inline void*
read_call(
void* in_address);
339 inline void*
read_jump(
void* in_address);
348 template <
typename T>
349 inline constexpr T
byteswap(T in_value);
356 template <
typename T>
370 template <
typename T>
371 inline bool write(
void* in_address,
const T& in_data, size_t in_count = 1);
383 template <
typename T>
384 inline bool write(
void* in_address,
const std::vector<T>& in_data);
394 inline bool write_call(
void* in_address,
void* in_destination);
406 inline bool write_jump(
void* in_address,
void* in_destination,
bool in_call =
false);
417 inline bool write_nop(
void* in_address, size_t in_count = 1);
427 template <ut::expr::any_string T>
428 inline bool write_string(
void* in_address,
const T& in_str);
441 template <ut::expr::any_string T>
447#if defined(CMNLIB_X64) || defined(CMNLIB_X86)
448#include "arch/mem_x86.inl"
452#include "os/mem_win32.inl"
Definition string_expr.h:92
Definition string_expr.h:116
Definition string_expr.h:122
Definition string_expr.h:110
Definition string_expr.h:104
Definition string_expr.h:98
Definition container_expr.h:21
Definition string_expr.h:86
Definition string_expr.h:74
Definition string_expr.h:38
Definition string_expr.h:56
Definition string_expr.h:62
Definition string_expr.h:50
Definition string_expr.h:44
Definition container_expr.h:15
Definition this_process_win32.inl:13
std::filesystem::path get_executable_root()
Definition this_process.inl:7
bool is_neighbour(const std::filesystem::path &in_path)
Definition this_process.inl:12
void * to_aslr(void *in_address, void *in_base_address=nullptr)
Definition mem_win32.inl:63
bool write_string_fixed_length(void *in_address, const T &in_str, size_t in_length=0)
Definition mem.inl:156
void * read_jump(void *in_address)
Definition mem_x86.inl:141
void * read_call(void *in_address)
Definition mem_x86.inl:136
bool write(void *in_address, const std::vector< T > &in_data)
Definition mem.inl:130
bool write_string(void *in_address, const T &in_str)
Definition mem.inl:147
bool write(void *in_address, const T &in_data, size_t in_count=1)
Definition mem.inl:110
void * read_instr_address(void *in_address, ptrdiff_t in_offset, size_t in_stride)
Definition mem_x86.inl:128
branch_info get_branch_info(void *in_address)
Definition mem_x86.inl:44
uint32_t get_protect_flags(page_protection in_protection)
Definition mem_win32.inl:21
bool write_jump(void *in_address, void *in_destination, bool in_call=false)
Definition mem_x86.inl:151
constexpr T byteswap(T in_value)
Definition mem.inl:46
constexpr T align(T in_address, T in_alignment)
Definition mem.inl:18
std::array< T, count > read(void *in_address)
Definition mem.inl:35
branch_distance
Definition mem_x86.inl:13
bool write_nop(void *in_address, size_t in_count=1)
Definition mem_x86.inl:188
void * from_aslr(void *in_address, void *in_base_address=nullptr)
Definition mem_win32.inl:71
void * align(void *in_address, uintptr_t in_alignment)
Definition mem.inl:23
bool is_nop(void *in_address)
Definition mem_x86.inl:39
bool write_call(void *in_address, void *in_destination)
Definition mem_x86.inl:146
T read(void *in_address)
Definition mem.inl:29
bool protect(void *in_address, size_t in_length, uint32_t in_new_protect_flags, uint32_t *out_old_protect_flags=nullptr)
Definition mem_win32.inl:51
void * get_original_module_base()
Definition mem_win32.inl:9
page_protection
Definition mem.h:171
@ read_write
Definition mem.h:178
@ no_access
Definition mem.h:172
@ read_write_execute
Definition mem.h:180
@ read_execute
Definition mem.h:179
@ rwx
Definition mem.h:188
@ execute
Definition mem.h:176
@ read
Definition mem.h:174
@ write
Definition mem.h:175
branch_condition
Definition mem_x86.inl:20
constexpr void byteswap_inplace(T &io_value)
Definition mem.inl:104
branch_type
Definition mem_x86.inl:6
constexpr size_t get_bom_length()
Definition encoding.inl:73
constexpr size_t get_bom_length(encoding_type in_encoding)
Definition encoding.inl:53
std::array< T_result, sizeof...(T_args)> precedent_convert(const T_args &... in_args)
Definition encoding.inl:79
bool try_convert(const T_str &in_str, T_result &out_result, encoding_type in_dst_encoding=expr::get_char_encoding_type< T_result >(), encoding_type in_src_encoding=expr::get_char_encoding_type< T_str >())
Definition encoding.inl:126
std::vector< uint8_t > get_bom(encoding_type in_encoding)
Definition encoding.inl:30
T_result convert(const T_str &in_str, encoding_type in_dst_encoding=expr::get_char_encoding_type< T_result >(), encoding_type in_src_encoding=expr::get_char_encoding_type< T_str >())
Definition encoding.inl:15
encoding_type
Definition encoding_type.h:6
@ utf32_be
Definition encoding_type.h:12
@ utf16_be
Definition encoding_type.h:10
@ unknown
Definition encoding_type.h:7
@ utf32_le
Definition encoding_type.h:11
@ latin1
Definition encoding_type.h:13
@ utf8
Definition encoding_type.h:8
@ utf16_le
Definition encoding_type.h:9
typename get_encoding_char_type< encoding >::type get_encoding_char_type_t
Definition encoding_expr.h:35
constexpr bool is_char_encoding_type_v
Definition encoding_expr.h:74
constexpr bool is_all_same_v
Definition expr.h:38
constexpr bool is_same_underlying_char_type_v
Definition string_expr.h:128
constexpr encoding::encoding_type get_char_encoding_type()
Definition encoding_expr.inl:9
constexpr size_t get_string_type_precedence()
Definition string_expr.inl:23
constexpr encoding::encoding_type get_native_encoding_type(encoding::encoding_type in_encoding)
Definition encoding_expr.inl:43
constexpr T_result create_inferred_string(const T_str &in_str)
Definition string_expr.inl:6
constexpr size_t get_encoding_char_size(encoding::encoding_type in_encoding)
Definition encoding_expr.inl:71
constexpr bool is_char_encoding_type(encoding::encoding_type in_encoding)
Definition encoding_expr.inl:92
constexpr bool is_supported_template_v
Definition expr.h:46
Definition filesystem.h:6
std::error_code truncate_files_by_age(const std::filesystem::path &in_path, std::string_view in_extension, size_t in_max=10)
Definition filesystem.inl:46
bool is_neighbour(const std::filesystem::path &in_left, const std::filesystem::path &in_right)
Definition filesystem.inl:7
std::error_code truncate_files(const std::filesystem::path &in_path, std::string_view in_extension, size_t in_max, T &&in_compare_func)
Definition filesystem.inl:13
expr::inferred_string_t< T_str > trim_start(const T_str &in_str, std::optional< std::vector< T_trim_chars > > in_trim_chars={})
Definition string.inl:326
expr::inferred_string_t< T > format(const T in_str,...)
Definition string.inl:82
expr::inferred_string_t< T > lower(const T &in_str)
Definition string.inl:288
expr::inferred_string_t< T_str > trim(const T_str &in_str, std::optional< std::vector< T_trim_chars > > in_trim_chars={})
Definition string.inl:365
bool is_null_or_empty(const T &in_str)
Definition string.inl:160
T_result hyperlink(const T_str &in_str, const T_url &in_url)
Definition string.inl:140
expr::inferred_string_t< T_str > remove_xml_tags(const T_str &in_str)
Definition string.inl:247
bool is_null_or_whitespace(const T &in_str)
Definition string.inl:172
expr::inferred_string_t< T_str > trim_end(const T_str &in_str, std::optional< std::vector< T_trim_chars > > in_trim_chars={})
Definition string.inl:345
expr::inferred_string_t< T_str > wrap(const T_str &in_str, size_t in_max_width)
Definition string.inl:505
bool compare(const T_left &in_left, const T_right &in_right, bool in_case_sensitive=true)
Definition string.inl:18
T_result join(const T_delimiter &in_delimiter, const T_args &... in_args)
Definition string.inl:214
std::vector< T_result > split(const T_str &in_str, const T_delimiter &in_delimiter)
Definition string.inl:257
expr::inferred_string_t< T > upper(const T &in_str)
Definition string.inl:307
bool try_parse(const T_str &in_str, T_result &out_result)
Definition string.inl:447
expr::inferred_string_t< T_str > escape(const T_str &in_str, T_str_char in_search_char, T_str_char in_escape_char=T_str_char('\\'))
Definition string.inl:66
bool contains(const T_str &in_str, const T_substr &in_substr, bool in_case_sensitive=true)
Definition string.inl:35
T_result pad(const T_str &in_str, const T_pad_str &in_pad_str)
Definition string.inl:222
T_result hex(T_value in_value, size_t in_max_length=sizeof(size_t) *2, bool in_prefix=true)
Definition string.inl:420
T_result parse(const T_str &in_str)
Definition string.inl:237
size_t get_width(const T &in_str)
Definition string.inl:126
expr::inferred_string_t< T > truncate(const T &in_str, size_t in_max_length, bool in_truncate_end=true, bool in_ellipsis=true)
Definition string.inl:371
expr::inferred_string_t< T_strings > join(const T_delimiter &in_delimiter, const std::vector< T_strings > &in_strings)
Definition string.inl:186
void * destination
Definition mem.h:202
branch_condition condition
Definition mem.h:199
uint8_t instr_length
Definition mem.h:201
branch_type type
Definition mem.h:197
uint8_t opcode_length
Definition mem.h:200
branch_distance distance
Definition mem.h:198
Definition string_expr.h:19
Definition encoding_expr.h:20
char16_t type
Definition encoding_expr.h:20
Definition encoding_expr.h:17
char16_t type
Definition encoding_expr.h:17
Definition encoding_expr.h:26
char32_t type
Definition encoding_expr.h:26
Definition encoding_expr.h:23
char32_t type
Definition encoding_expr.h:23
Definition encoding_expr.h:14
Definition encoding_expr.h:11
char type
Definition encoding_expr.h:11
Definition string_expr.h:68
Definition string_expr.h:77
Definition string_expr.h:65