summaryrefslogtreecommitdiff
path: root/data/uikittools/platformize.diff
blob: 3365511ea802d0d2054fd589f0d426ac7dc0fbe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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);