-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathHook.m
47 lines (34 loc) · 1.11 KB
/
Hook.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
#import <HookKit/Hook.h>
@implementation HookKitHook
@end
@implementation HookKitClassHook
@synthesize objcClass, selector, replacement, orig;
+ (instancetype)hook:(Class)objcClass selector:(SEL)selector replacement:(void *)replacement orig:(void **)orig {
HookKitClassHook* hook = [HookKitClassHook new];
[hook setObjcClass:objcClass];
[hook setSelector:selector];
[hook setReplacement:replacement];
[hook setOrig:orig];
return hook;
}
@end
@implementation HookKitFunctionHook
@synthesize function, replacement, orig;
+ (instancetype)hook:(void *)function replacement:(void *)replacement orig:(void **)orig {
HookKitFunctionHook* hook = [HookKitFunctionHook new];
[hook setFunction:function];
[hook setReplacement:replacement];
[hook setOrig:orig];
return hook;
}
@end
@implementation HookKitMemoryHook
@synthesize target, data, size;
+ (instancetype)hook:(void *)target data:(const void *)data size:(size_t)size {
HookKitMemoryHook* hook = [HookKitMemoryHook new];
[hook setTarget:target];
[hook setData:data];
[hook setSize:size];
return hook;
}
@end