This repository has been archived by the owner on Sep 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFutureMethods.m
58 lines (52 loc) · 2.08 KB
/
FutureMethods.m
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
#import "FutureMethods.h"
static NSString *const kMultitouchSupportFramework = @"/System/Library/PrivateFrameworks/MultitouchSupport.framework";
static void *GetFunctionByName(NSString *library, char *func) {
CFBundleRef bundle;
CFURLRef bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef) library, kCFURLPOSIXPathStyle, true);
CFStringRef functionName = CFStringCreateWithCString(kCFAllocatorDefault, func, kCFStringEncodingASCII);
bundle = CFBundleCreate(kCFAllocatorDefault, bundleURL);
void *f = NULL;
if (bundle) {
f = CFBundleGetFunctionPointerForName(bundle, functionName);
CFRelease(bundle);
}
CFRelease(functionName);
CFRelease(bundleURL);
return f;
}
MTActuatorCreateFromDeviceIDFunction *GetMTActuatorCreateFromDeviceIDFunction(void) {
static dispatch_once_t onceToken;
static MTActuatorCreateFromDeviceIDFunction *function;
dispatch_once(&onceToken, ^{
function = GetFunctionByName(kMultitouchSupportFramework,
"MTActuatorCreateFromDeviceID");
});
return function;
}
MTActuatorOpenFunction *GetMTActuatorOpenFunction(void) {
static dispatch_once_t onceToken;
static MTActuatorOpenFunction *function;
dispatch_once(&onceToken, ^{
function = GetFunctionByName(kMultitouchSupportFramework,
"MTActuatorOpen");
});
return function;
}
MTActuatorCloseFunction *GetMTActuatorCloseFunction(void) {
static dispatch_once_t onceToken;
static MTActuatorCloseFunction *function;
dispatch_once(&onceToken, ^{
function = GetFunctionByName(kMultitouchSupportFramework,
"MTActuatorClose");
});
return function;
}
MTActuatorActuateFunction *GetMTActuatorActuateFunction(void) {
static dispatch_once_t onceToken;
static MTActuatorActuateFunction *function;
dispatch_once(&onceToken, ^{
function = GetFunctionByName(kMultitouchSupportFramework,
"MTActuatorActuate");
});
return function;
}