]> git.saurik.com Git - cycript.git/blobdiff - Mach/Inject.cpp
Use the LC_ID_DYLIB when possible to ID dylibs.
[cycript.git] / Mach / Inject.cpp
index c629939610469954275a80094e52b64bbc226fe6..840dc63f89f392957e1930c2aaf57f9a5389b177 100644 (file)
 #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<void *>(&CYHandleServer), &addr) != 0);
+    const char *library(addr.dli_fname);
 
     mach_port_t self(mach_task_self()), task;
     _krncall(task_for_pid(self, pid, &task));