]> git.saurik.com Git - cycript.git/commitdiff
Rearrange who pulls WebKit from where.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 2 May 2010 10:18:39 +0000 (10:18 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 2 May 2010 10:18:39 +0000 (10:18 +0000)
Baton.hpp
Darwin.mk
Mach/Inject.cpp
Trampoline.t.cpp

index 8d8adf53939e5295153d0df00137c7ddfa1c88d8..892d820888728f99209be526b6bba57160a6e86f 100644 (file)
--- a/Baton.hpp
+++ b/Baton.hpp
@@ -48,6 +48,7 @@ struct Baton {
     int (*pthread_join)(pthread_t, void **);
 
     void *(*dlopen)(const char *, int);
+    char *(*dlerror)();
     void *(*dlsym)(void *, const char *);
 
     mach_port_t (*mach_thread_self)();
index 02e2d2ab46a7b3fd5206b9ed2d520ad640426670..1289855210fd36fed9806c175b188056ea4478f4 100644 (file)
--- a/Darwin.mk
+++ b/Darwin.mk
@@ -3,9 +3,10 @@ link += -lobjc -framework CoreFoundation
 console += -framework Foundation
 library += -install_name /usr/lib/libcycript.$(dll)
 library += -framework Foundation
-library += -framework JavaScriptCore
+console += -framework JavaScriptCore
 # XXX: do I just need WebCore?
-library += -framework WebKit
+console += -framework WebKit
+library += -undefined dynamic_lookup
 library += -liconv
 flags += -I/usr/include/ffi
 apr_config := /usr/bin/apr-1-config
index 765a4ab6f37e41d23355206851d22b5694ef9316..f5673c24cfc7a72d51d549d615f0b9cfce8d4efd 100644 (file)
@@ -71,6 +71,7 @@ void InjectLibrary(pid_t pid) {
     baton->pthread_join = &pthread_join;
 
     baton->dlopen = &dlopen;
+    baton->dlerror = &dlerror;
     baton->dlsym = &dlsym;
 
     baton->mach_thread_self = &mach_thread_self;
index ad1f5156643b77a75f5eacefb634c690b3793843..d7853ca1aba5cab138d576ca9f83a48e374079e3 100644 (file)
@@ -46,6 +46,8 @@
 template <typename Type_>
 static _finline void dlset(Baton *baton, Type_ &function, const char *name, void *handle = RTLD_DEFAULT) {
     function = reinterpret_cast<Type_>(baton->dlsym(handle, name));
+    if (function == NULL)
+        baton->dlerror();
 }
 
 void *Routine(void *arg) {
@@ -55,13 +57,17 @@ void *Routine(void *arg) {
     dlset(baton, dlopen, "dlopen");
 
     void *handle(dlopen(baton->library, RTLD_LAZY | RTLD_LOCAL));
+    if (handle == NULL) {
+        baton->dlerror();
+        return NULL;
+    }
 
     void (*CYHandleServer)(pid_t);
     dlset(baton, CYHandleServer, "CYHandleServer", handle);
 
     CYHandleServer(baton->pid);
 
-    return arg;
+    return NULL;
 }
 
 static void $bzero(void *data, size_t size) {