diff options
-rw-r--r-- | Tweak.xm | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -440,7 +440,7 @@ const char *dylibs_[] = { NULL, }; -MSHook(void *, dlopen, const char *path, int mode) { +MSHook(void *, dlopen, const char *path, int mode, void *lr) { // we probably don't need this whitelist, but it has the nifty benefit of letting Cycript inject // that said, older versions of iOS (before 3.1) will need a special case due to now shared cache @@ -462,14 +462,17 @@ MSHook(void *, dlopen, const char *path, int mode) { mode |= RTLD_NOLOAD; load: - return _dlopen(path, mode); + return _dlopen(path, mode, lr); } - %ctor { NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); - MSHookFunction(&dlopen, MSHake(dlopen)); + decltype(_dlopen) dlopen$(nullptr); + if (MSImageRef libdyld = MSGetImageByName("/usr/lib/system/libdyld.dylib")) { + MSHookSymbol(dlopen$, "__ZL15dlopen_internalPKciPv", libdyld); + } + MSHookFunction(dlopen$ ?: reinterpret_cast<decltype(dlopen$)>(&dlopen), MSHake(dlopen)); // on iOS 6, backboardd is in charge of brightness, and freaks out when SpringBoard restarts :( // the result is that the device is super dark until we attempt to update the brightness here. |