rdbo / libmem

Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)
GNU Affero General Public License v3.0
738 stars 90 forks source link

Consider reintroducing remote call API #240

Open rdbo opened 2 weeks ago

rdbo commented 2 weeks ago

Although complex, a remote call API could be possible if done like this:

enum {
    LM_REG_RAX = 0,
    ...
    LM_REG_MAX
};

enum {
    LM_FPREG_XMM0 = 0,
    ...
    LM_FPREG_MAX
}

struct lm_callstate_t {
    lm_byte_t stack[0xFF];
    lm_uintptr_t regs[32]; // arch-dependent, accessed by LM_REG_*
    double fpregs[16]; // arch-dependent, may not be available on some archs, accessed by LM_FPREG_*
}

lm_bool_t
LM_RemoteCall(lm_process_t *process, lm_callstate_t *setup, lm_callstate_t *post_call);

It will setup the call using the call state, and then write the post-call state into an optional variable On Linux/FreeBSD, this is """easily""" achievable with ptrace; on Windows, not sure.