-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathrocketbootstrap_internal.h
52 lines (42 loc) · 1.31 KB
/
rocketbootstrap_internal.h
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
#import <CoreFoundation/CoreFoundation.h>
#import <dlfcn.h>
#import "rocketbootstrap.h"
#define kRocketBootstrapUnlockService "com.rpetrich.rocketbootstrapd"
#define ROCKETBOOTSTRAP_LOOKUP_ID -1
typedef struct {
mach_msg_header_t head;
mach_msg_body_t body;
uint32_t name_length;
char name[];
} _rocketbootstrap_lookup_query_t;
typedef struct {
mach_msg_header_t head;
mach_msg_body_t body;
mach_msg_port_descriptor_t response_port;
} _rocketbootstrap_lookup_response_t;
#import "LightMessaging/LightMessaging.h"
__attribute__((unused))
static LMConnection connection = {
MACH_PORT_NULL,
kRocketBootstrapUnlockService
};
__attribute__((unused))
static inline bool rocketbootstrap_is_passthrough(void)
{
return kCFCoreFoundationVersionNumber < 800.0;
}
__attribute__((unused))
static inline bool rocketbootstrap_uses_name_redirection(void)
{
if (kCFCoreFoundationVersionNumber >= 1556.00) {
static int state;
int currentState = state;
if (currentState == 0) {
int check = sandbox_check(getpid(), "mach-lookup", SANDBOX_FILTER_LOCAL_NAME | SANDBOX_CHECK_NO_REPORT, "cy:rbs");
currentState = check == 0 ? 1 : 2;
}
return currentState - 1;
}
return false;
}
kern_return_t _rocketbootstrap_is_unlocked(const name_t service_name); // Errors if not in a privileged process such as SpringBoard or backboardd