]> git.saurik.com Git - cycript.git/commitdiff
Find location of libcycript at runtime with dladdr.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 23 Jun 2013 01:57:56 +0000 (18:57 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 23 Jun 2013 01:59:02 +0000 (18:59 -0700)
Mach/Inject.cpp
Makefile.am
Makefile.in

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));
index f0ed2c2b0709bd25e057efd6bdd25a8098e55b3e..29221b10293f3a7272165fd39b8271bd1a51762d 100644 (file)
@@ -73,7 +73,7 @@ if CY_MACH
 libcycript_la_SOURCES += Handler.mm
 cycript_SOURCES += Mach/Inject.cpp
 
-AM_CPPFLAGS += -DCY_ATTACH -DCY_LIBRARY='"$(libdir)/libcycript.$(SO)"'
+AM_CPPFLAGS += -DCY_ATTACH
 
 Mach/Inject.$(OBJEXT): Trampoline.t.hpp
 
index 610d417b1607e385f829f9886c2595e2f8af4613..8575d201e7708d503131f7450da5bb9f6a0fe8d5 100644 (file)
@@ -81,7 +81,7 @@ bin_PROGRAMS = cycript$(EXEEXT)
 @CY_OBJECTIVEC_TRUE@am__append_6 = ObjectiveC/Output.mm ObjectiveC/Replace.cpp ObjectiveC/Library.mm
 @CY_MACH_TRUE@am__append_7 = Handler.mm
 @CY_MACH_TRUE@am__append_8 = Mach/Inject.cpp
-@CY_MACH_TRUE@am__append_9 = -DCY_ATTACH -DCY_LIBRARY='"$(libdir)/libcycript.$(SO)"'
+@CY_MACH_TRUE@am__append_9 = -DCY_ATTACH
 @CY_MACH_TRUE@am__append_10 = Trampoline.t.lo libTrampoline.t.la \
 @CY_MACH_TRUE@ Trampoline.t.hpp
 subdir = .