summaryrefslogtreecommitdiff
path: root/data/uikittools/platformize.diff
diff options
context:
space:
mode:
Diffstat (limited to 'data/uikittools/platformize.diff')
-rw-r--r--data/uikittools/platformize.diff77
1 files changed, 77 insertions, 0 deletions
diff --git a/data/uikittools/platformize.diff b/data/uikittools/platformize.diff
new file mode 100644
index 000000000..3365511ea
--- /dev/null
+++ b/data/uikittools/platformize.diff
@@ -0,0 +1,77 @@
+diff -ur uikittools/ldrestart.cpp uikittools+iPhone/ldrestart.cpp
+--- uikittools/ldrestart.cpp 2018-07-31 14:40:26.000000000 -1000
++++ uikittools+iPhone/ldrestart.cpp 2018-08-03 12:16:31.000000000 -1000
+@@ -30,6 +30,26 @@
+ #include <launch.h>
+
+ #include <sys/stat.h>
++/* Set platform binary flag */
++#define FLAG_PLATFORMIZE (1 << 1)
++#include <dlfcn.h>
++
++void platformizeme() {
++ 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 process(launch_data_t value, const char *name, void *baton) {
+ if (launch_data_get_type(value) != LAUNCH_DATA_DICTIONARY)
+@@ -65,6 +85,7 @@
+ }
+
+ int main(int argc, char *argv[]) {
++ platformizeme();
+ auto request(launch_data_new_string(LAUNCH_KEY_GETJOBS));
+ auto response(launch_msg(request));
+ launch_data_free(request);
+diff -ur uikittools/sbreload.c uikittools+iPhone/sbreload.c
+--- uikittools/sbreload.c 2018-07-31 14:40:26.000000000 -1000
++++ uikittools+iPhone/sbreload.c 2018-08-03 12:16:13.000000000 -1000
+@@ -45,6 +45,27 @@
+
+ #include <CoreFoundation/CoreFoundation.h>
+
++/* Set platform binary flag */
++#define FLAG_PLATFORMIZE (1 << 1)
++#include <dlfcn.h>
++
++void platformizeme() {
++ 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);
++}
++
+ launch_data_t
+ CF2launch_data(CFTypeRef cfr);
+
+@@ -163,6 +184,7 @@
+ #define SpringBoard_plist "/System/Library/LaunchDaemons/com.apple.SpringBoard.plist"
+
+ int main(int argc, const char *argv[]) {
++ platformizeme();
+ _assert(argc == 1, "usage: sbreload");
+
+ CFDictionaryRef plist = CreateMyPropertyListFromFile(SpringBoard_plist);