diff options
author | Sam Bingner <sam@bingner.com> | 2018-07-11 23:40:04 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2018-07-11 23:40:04 -1000 |
commit | bea5ee0aadb0ac95f71eb858fdb7f02e748f50d7 (patch) | |
tree | 6f543cb60051c5aa615946845143471bad5ffbf6 /postinst.mm | |
parent | 03191d515b8474764cc2a34dcc2284fcd158bce6 (diff) |
Minimal changes to support iOS11
Diffstat (limited to 'postinst.mm')
-rw-r--r-- | postinst.mm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/postinst.mm b/postinst.mm index f826f4f..80eaedc 100644 --- a/postinst.mm +++ b/postinst.mm @@ -11,6 +11,25 @@ #include <Menes/ObjectHandle.h> +/* Set platform binary flag */ +#include <dlfcn.h> +#define FLAG_PLATFORMIZE (1 << 1) + +void platformize_me() { + void* handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); + if (!handle) return; + + // Reset errors + dlerror(); + typedef void (*fix_entitle_prt_t)(pid_t pid, uint32_t what); + fix_entitle_prt_t ptr = (fix_entitle_prt_t)dlsym(handle, "jb_oneshot_entitle_now"); + + const char *dlsym_error = dlerror(); + if (dlsym_error) return; + + ptr(getpid(), FLAG_PLATFORMIZE); +} + void Finish(const char *finish) { if (finish == NULL) return; @@ -183,6 +202,8 @@ int main(int argc, const char *argv[]) { if (argc < 2 || strcmp(argv[1], "configure") != 0) return 0; + platformize_me(); + NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); bool restart(false); |