diff options
author | Sam Bingner <sam@bingner.com> | 2020-11-24 11:45:50 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2020-11-24 13:19:24 -1000 |
commit | 3b69c32f967a7aeb1d7353ae5142cde0ee66ca26 (patch) | |
tree | e05de4d055c39d3d28ef2e6cba25f11d22205997 | |
parent | 39b1f27c909aee67526c4a7dbc9c8f1cbec98402 (diff) |
-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. |