X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/9d79cefcbed6e10f562709ad1b6ec9ac085cd3eb..a93f15c0bc99a80cc7dbe2f43f53ca3f2d7f64a3:/Mach/Inject.cpp?ds=sidebyside diff --git a/Mach/Inject.cpp b/Mach/Inject.cpp index c629939..46f61be 100644 --- a/Mach/Inject.cpp +++ b/Mach/Inject.cpp @@ -22,7 +22,20 @@ #include #include + +#ifdef __APPLE__ +#include "TargetConditionals.h" +#endif + +#ifdef TARGET_OS_IPHONE +#include +#define mach_vm_allocate vm_allocate +#define mach_vm_protect vm_protect +#define mach_vm_write vm_write +#define mach_vm_address_t vm_address_t +#else #include +#endif #include @@ -35,8 +48,12 @@ #include "Pooling.hpp" #include "Trampoline.t.hpp" +extern "C" void CYHandleServer(pid_t); + void InjectLibrary(pid_t pid) { - const char *library(CY_LIBRARY); + Dl_info addr; + _assert(dladdr(reinterpret_cast(&CYHandleServer), &addr) != 0); + const char *library(addr.dli_fname); mach_port_t self(mach_task_self()), task; _krncall(task_for_pid(self, pid, &task));