libmem icon indicating copy to clipboard operation
libmem copied to clipboard

Consider reintroducing remote call API

Open rdbo opened this issue 1 year ago • 0 comments

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.

rdbo avatar Jun 19 '24 09:06 rdbo