diff options
author | midipix <writeonce@midipix.org> | 2025-06-10 09:26:19 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2025-06-10 09:26:19 +0000 |
commit | fcf54a66614eaa4212780fb48eb0f7de81a2aec8 (patch) | |
tree | 5061254ac38302b2637a8dd2cde4d7d4be7afdae /src | |
parent | 28dd46450ef30fff57b18168e1ecbaf654cc3066 (diff) | |
download | perk-fcf54a66614eaa4212780fb48eb0f7de81a2aec8.tar.bz2 perk-fcf54a66614eaa4212780fb48eb0f7de81a2aec8.tar.xz |
code base: added mdso's mdso_specs.h and mdso_structs.h as internal headers.
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/mdso/mdso_specs.h | 98 | ||||
-rw-r--r-- | src/internal/mdso/mdso_structs.h | 80 |
2 files changed, 178 insertions, 0 deletions
diff --git a/src/internal/mdso/mdso_specs.h b/src/internal/mdso/mdso_specs.h new file mode 100644 index 0000000..cdbbd7c --- /dev/null +++ b/src/internal/mdso/mdso_specs.h @@ -0,0 +1,98 @@ +#ifndef MDSO_SPECS_H +#define MDSO_SPECS_H + +#include <stdint.h> + +#define MDSO_META_SECTION ".dsometa" +#define MDSO_SYMS_SECTION ".dsosyms" +#define MDSO_STRS_SECTION ".dsostrs" +#define MDSO_HASH_SECTION ".dsohash" +#define MDSO_DATA_SECTION ".dsodata" +#define MDSO_REFS_SECTION ".gotrefs" + +#define MDSO_FLAG_LOADER_PATH 0x0001 +#define MDSO_FLAG_LDSO_LIB 0x0002 +#define MDSO_FLAG_PEB_PATH 0x0004 +#define MDSO_FLAG_SYSTEM32 0x0008 + +struct mdso_arg; +struct mdso_meta_record; +struct mdso_hash_table; +struct mdso_sym_table; + +typedef int32_t mdso_arg_conv_fn(char *, uint16_t **); +typedef int32_t mdso_arg_arr_conv_fn(struct mdso_arg *); + +struct mdso_arg { + char * utf8; + uint16_t * utf16; +}; + +struct mdso_def_entry { + void * addr; + char * string; +}; + +struct mdso_got_entry { + void * addr; + uintptr_t rsymstr; +}; + +struct mdso_sym_entry { + uintptr_t rsymstr; + uintptr_t rmeta; +}; + +struct mdso_ref_entry { + uint32_t rsecrva; + uint32_t rbackref; + uint32_t rsymref; +}; + +struct mdso_meta_record { + void * base; + const char * name; + uint32_t flags; + uint32_t priority; + uint32_t nsyms; + uint32_t padding; + struct mdso_hash_table * hashtbl; + struct mdso_sym_table * symtbl; + mdso_arg_conv_fn * fncarg; + mdso_arg_arr_conv_fn * fncargarr; + void * fnr1; + void * fnr2; +}; + + +struct mdso_meta_record_m32 { + uint32_t base; + uint32_t name; + uint32_t flags; + uint32_t priority; + uint32_t nsyms; + uint32_t padding; + uint32_t hashtbl; + uint32_t symtbl; + uint32_t fncarg; + uint32_t fncargarr; + uint32_t fnr1; + uint32_t fnr2; +}; + +struct mdso_meta_record_m64 { + uint64_t base; + uint64_t name; + uint32_t flags; + uint32_t priority; + uint32_t nsyms; + uint32_t padding; + uint64_t hashtbl; + uint64_t symtbl; + uint64_t fncarg; + uint64_t fncargarr; + uint64_t fnr1; + uint64_t fnr2; +}; + +#endif diff --git a/src/internal/mdso/mdso_structs.h b/src/internal/mdso/mdso_structs.h new file mode 100644 index 0000000..133825e --- /dev/null +++ b/src/internal/mdso/mdso_structs.h @@ -0,0 +1,80 @@ +#ifndef MDSO_STRUCTS_H +#define MDSO_STRUCTS_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct mdso_raw_arg_m32 { + unsigned char marg_utf8 [0x04]; /* 0x00 */ + unsigned char marg_utf16 [0x04]; /* 0x04 */ +}; + +struct mdso_raw_arg_m64 { + unsigned char marg_utf8 [0x08]; /* 0x00 */ + unsigned char marg_utf16 [0x08]; /* 0x08 */ +}; + +union mdso_raw_arg { + struct mdso_raw_arg_m32 marg_m32; + struct mdso_raw_arg_m64 marg_m64; +}; + + +struct mdso_raw_sym_entry_m32 { + unsigned char msym_string [0x04]; /* 0x00 */ + unsigned char msym_meta [0x04]; /* 0x04 */ +}; + +struct mdso_raw_sym_entry_m64 { + unsigned char msym_string [0x08]; /* 0x00 */ + unsigned char msym_meta [0x08]; /* 0x08 */ +}; + +union mdso_raw_sym_entry { + struct mdso_raw_sym_entry_m32 msym_m32; + struct mdso_raw_sym_entry_m64 msym_m64; +}; + + +struct mdso_raw_meta_record_m32 { + unsigned char mrec_base [0x04]; /* 0x00 */ + unsigned char mrec_name [0x04]; /* 0x04 */ + unsigned char mrec_flags [0x04]; /* 0x08 */ + unsigned char mrec_priority [0x04]; /* 0x0c */ + unsigned char mrec_nsyms [0x04]; /* 0x10 */ + unsigned char mrec_padding [0x04]; /* 0x14 */ + unsigned char mrec_hashtbl [0x04]; /* 0x18 */ + unsigned char mrec_symtbl [0x04]; /* 0x1c */ + unsigned char mrec_fncarg [0x04]; /* 0x20 */ + unsigned char mrec_fncargarr [0x04]; /* 0x24 */ + unsigned char mrec_fnr1 [0x04]; /* 0x28 */ + unsigned char mrec_fnr2 [0x04]; /* 0x2c */ +}; + +struct mdso_raw_meta_record_m64 { + unsigned char mrec_base [0x08]; /* 0x00 */ + unsigned char mrec_name [0x08]; /* 0x08 */ + unsigned char mrec_flags [0x04]; /* 0x10 */ + unsigned char mrec_priority [0x04]; /* 0x14 */ + unsigned char mrec_nsyms [0x04]; /* 0x18 */ + unsigned char mrec_padding [0x04]; /* 0x1c */ + unsigned char mrec_hashtbl [0x08]; /* 0x20 */ + unsigned char mrec_symtbl [0x08]; /* 0x28 */ + unsigned char mrec_fncarg [0x08]; /* 0x30 */ + unsigned char mrec_fncargarr [0x08]; /* 0x38 */ + unsigned char mrec_fnr1 [0x08]; /* 0x40 */ + unsigned char mrec_fnr2 [0x08]; /* 0x48 */ +}; + +union mdso_raw_meta_record { + struct mdso_raw_meta_record_m32 mrec_m32; + struct mdso_raw_meta_record_m64 mrec_m64; +}; + + +#ifdef __cplusplus +} +#endif + +#endif |