Closed abbuaus closed 1 year ago
Generally speaking, this is how function calls work in the project:
long parameters[2]; //2 is the amount of parameters
parameters[0] = (uintptr_t) remoteMmapAddr;
parameters[1] = RTLD_NOW | RTLD_GLOBAL;
Note that we are passing a address to a string as the first argument, this was done by allocating memory and then writing a string to it, in this case it is the dlopen path.
// process id, address, parameters, amount of parameters, regs
if (ptrace_call(pid, (uintptr_t) dlopen_addr, parameters, 2, ¤tRegs) == -1) {
LOGE("Call dlopen Failed");
return -1;
}
void *remoteModuleAddr = (void *)ptrace_getret(¤tRegs);
LOGI("ptrace_call dlopen success, Remote module Address: 0x%lx", (long)remoteModuleAddr);
And that is it. That is how you can call a function with this project. There is currently no way to pass parameters and get the return value through the UI, you need to implement that on your own :)
great project, how to pass parameters, get function return? i am a beginner