├── MyApp ├── MyApp │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── ViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── ViewController.m │ ├── Info.plist │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── AppDelegate.m └── MyApp.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj ├── HookMyApp ├── LatestBuild ├── Packages │ ├── com.halou.HookMyApp_0.1-1_iphoneos-arm.deb │ └── com.halou.HookMyApp_0.1-1_iphoneos-arm.zip ├── HookMyApp │ ├── Package │ │ ├── Library │ │ │ └── MobileSubstrate │ │ │ │ └── DynamicLibraries │ │ │ │ ├── HookMyApp.dylib │ │ │ │ └── HookMyApp.plist │ │ └── DEBIAN │ │ │ └── control │ ├── HookMyApp-Prefix.pch │ ├── CydiaSubstrate.framework │ │ ├── CydiaSubstrate.tbd │ │ ├── Info.plist │ │ └── Headers │ │ │ └── CydiaSubstrate.h │ ├── MyMain.m │ └── HookMyApp.mm └── HookMyApp.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj ├── README.md ├── LICENSE └── .gitignore /MyApp/MyApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /HookMyApp/LatestBuild: -------------------------------------------------------------------------------- 1 | /Users/gaoliutong/Library/Developer/Xcode/DerivedData/HookMyApp-ewryzobshxbvfgagyqojkjvbhzbc/Build/Products/Debug-iphoneos -------------------------------------------------------------------------------- /HookMyApp/Packages/com.halou.HookMyApp_0.1-1_iphoneos-arm.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glthello/sub_xxx/HEAD/HookMyApp/Packages/com.halou.HookMyApp_0.1-1_iphoneos-arm.deb -------------------------------------------------------------------------------- /HookMyApp/Packages/com.halou.HookMyApp_0.1-1_iphoneos-arm.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glthello/sub_xxx/HEAD/HookMyApp/Packages/com.halou.HookMyApp_0.1-1_iphoneos-arm.zip -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/Package/Library/MobileSubstrate/DynamicLibraries/HookMyApp.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glthello/sub_xxx/HEAD/HookMyApp/HookMyApp/Package/Library/MobileSubstrate/DynamicLibraries/HookMyApp.dylib -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/HookMyApp-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'HookMyApp' target in the 'HookMyApp' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /MyApp/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS Hook在IDA中显示为sub_xxx的函数 2 | 3 | 具体介绍: [https://blog.csdn.net/glt_code/article/details/83420589](https://blog.csdn.net/glt_code/article/details/83420589) 4 | 5 | ## Author 6 | - Email: 1282990794@qq.com 7 | - -Blog: https://blog.csdn.net/glt_code 8 | 9 | -------------------------------------------------------------------------------- /MyApp/MyApp/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // MyApp 4 | // 5 | // Created by gaoliutong on 2018/10/25. 6 | // Copyright © 2018 Test. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /MyApp/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MyApp/MyApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MyApp 4 | // 5 | // Created by gaoliutong on 2018/10/25. 6 | // Copyright © 2018 Test. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/Package/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: com.halou.HookMyApp 2 | Name: HookMyApp 3 | Version: 0.1-1 4 | Description: 5 | Section: Tweaks 6 | Depends: firmware (>= 5.0), mobilesubstrate 7 | Conflicts: 8 | Replaces: 9 | Priority: optional 10 | Architecture: iphoneos-arm 11 | Author: gaoliutong 12 | dev: 13 | Homepage: 14 | Depiction: 15 | Maintainer: 16 | Icon: 17 | 18 | -------------------------------------------------------------------------------- /MyApp/MyApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MyApp 4 | // 5 | // Created by gaoliutong on 2018/10/25. 6 | // Copyright © 2018 Test. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/Package/Library/MobileSubstrate/DynamicLibraries/HookMyApp.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Filter 6 | 7 | Bundles 8 | 9 | com.halou.MyApp 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/CydiaSubstrate.framework/CydiaSubstrate.tbd: -------------------------------------------------------------------------------- 1 | --- 2 | archs: [ armv7, armv7s, arm64, i386, x86_64 ] 3 | platform: ios 4 | install-name: /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate 5 | current-version: 0.0.0 6 | compatibility-version: 0.0.0 7 | exports: 8 | - archs: [ armv7, armv7s, arm64, i386, x86_64 ] 9 | symbols: [ _MSDebug, 10 | _MSFindSymbol, _MSGetImageByName, 11 | _MSHookFunction, _MSHookMessageEx ] 12 | ... 13 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/CydiaSubstrate.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | CydiaSubstrate 9 | CFBundleGetInfoString 10 | Cydia Substrate, SaurikIT LLC 11 | CFBundleIdentifier 12 | com.saurik.CydiaSubstate 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | Cydia Substrate 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.9 21 | CFBundleSignature 22 | ???? 23 | 24 | 25 | -------------------------------------------------------------------------------- /MyApp/MyApp/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // MyApp 4 | // 5 | // Created by gaoliutong on 2018/10/25. 6 | // Copyright © 2018 Test. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 21 | button.frame = CGRectMake(100, 100, 100, 100); 22 | button.backgroundColor = [UIColor redColor]; 23 | [self.view addSubview:button]; 24 | [button addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside]; 25 | 26 | } 27 | 28 | - (void)btnClick { 29 | testMethod(); 30 | } 31 | 32 | void testMethod(void) { 33 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"title" message:@"message" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"other", nil]; 34 | [alert show]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 GaoLiuTong 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MyApp/MyApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/MyMain.m: -------------------------------------------------------------------------------- 1 | // 2 | // HookMyApp 3 | // 4 | // Created by gaoliutong on 2018/10/25. 5 | // 6 | 7 | #import 8 | #include 9 | #include 10 | #import 11 | #import "CydiaSubstrate/CydiaSubstrate.h" 12 | 13 | intptr_t g_slide; 14 | 15 | //保存模块偏移基地址的值 16 | static void _register_func_for_add_image(const struct mach_header *header, intptr_t slide) { 17 | Dl_info image_info; 18 | int result = dladdr(header, &image_info); 19 | if (result == 0) { 20 | NSLog(@"load mach_header failed"); 21 | return; 22 | } 23 | //获取当前的可执行文件路径 24 | NSString *execName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"]; 25 | NSString *execPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingFormat:@"/%@", execName]; 26 | if (strcmp([execPath UTF8String], image_info.dli_fname) == 0) { 27 | g_slide = slide; 28 | } 29 | } 30 | 31 | void (*orig_testMethod)(void); 32 | void hook_testMethod(void); 33 | 34 | //hook后会来到这里 35 | void hook_testMethod(void) { 36 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"hook了我" message:@"message" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"other", nil]; 37 | [alert show]; 38 | } 39 | 40 | static void __attribute__((constructor)) __init__() { 41 | //注册添加镜像回调 42 | _dyld_register_func_for_add_image(_register_func_for_add_image); 43 | //通过 模块偏移前的基地址 + ASLR偏移量 找到函数真正的地址进行hook 44 | #warning 如果修改了MyApp工程的代码,此处的内存地址0x100006934需要改变,仅修改当前工程的代码,内存地址不需要改变 45 | MSHookFunction((void *)(0x100006934+g_slide), (void *)hook_testMethod, (void **)&orig_testMethod); 46 | } 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /MyApp/MyApp/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /MyApp/MyApp/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /MyApp/MyApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /MyApp/MyApp/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MyApp 4 | // 5 | // Created by gaoliutong on 2018/10/25. 6 | // Copyright © 2018 Test. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/HookMyApp.mm: -------------------------------------------------------------------------------- 1 | // 2 | // HookMyApp.mm 3 | // HookMyApp 4 | // 5 | // Created by gaoliutong on 2018/10/25. 6 | // Copyright (c) 2018 ___ORGANIZATIONNAME___. All rights reserved. 7 | // 8 | 9 | // CaptainHook by Ryan Petrich 10 | // see https://github.com/rpetrich/CaptainHook/ 11 | 12 | #if TARGET_OS_SIMULATOR 13 | #error Do not support the simulator, please use the real iPhone Device. 14 | #endif 15 | 16 | #import 17 | #import "CaptainHook/CaptainHook.h" 18 | #include // not required; for examples only 19 | 20 | // Objective-C runtime hooking using CaptainHook: 21 | // 1. declare class using CHDeclareClass() 22 | // 2. load class using CHLoadClass() or CHLoadLateClass() in CHConstructor 23 | // 3. hook method using CHOptimizedMethod() 24 | // 4. register hook using CHHook() in CHConstructor 25 | // 5. (optionally) call old method using CHSuper() 26 | 27 | 28 | @interface HookMyApp : NSObject 29 | 30 | @end 31 | 32 | @implementation HookMyApp 33 | 34 | -(id)init 35 | { 36 | if ((self = [super init])) 37 | { 38 | } 39 | 40 | return self; 41 | } 42 | 43 | @end 44 | 45 | 46 | @class ClassToHook; 47 | 48 | CHDeclareClass(ClassToHook); // declare class 49 | 50 | CHOptimizedMethod(0, self, void, ClassToHook, messageName) // hook method (with no arguments and no return value) 51 | { 52 | // write code here ... 53 | 54 | CHSuper(0, ClassToHook, messageName); // call old (original) method 55 | } 56 | 57 | CHOptimizedMethod(2, self, BOOL, ClassToHook, arg1, NSString*, value1, arg2, BOOL, value2) // hook method (with 2 arguments and a return value) 58 | { 59 | // write code here ... 60 | 61 | return CHSuper(2, ClassToHook, arg1, value1, arg2, value2); // call old (original) method and return its return value 62 | } 63 | 64 | static void WillEnterForeground(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) 65 | { 66 | // not required; for example only 67 | } 68 | 69 | static void ExternallyPostedNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) 70 | { 71 | // not required; for example only 72 | } 73 | 74 | CHConstructor // code block that runs immediately upon load 75 | { 76 | @autoreleasepool 77 | { 78 | // listen for local notification (not required; for example only) 79 | CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter(); 80 | CFNotificationCenterAddObserver(center, NULL, WillEnterForeground, CFSTR("UIApplicationWillEnterForegroundNotification"), NULL, CFNotificationSuspensionBehaviorCoalesce); 81 | 82 | // listen for system-side notification (not required; for example only) 83 | // this would be posted using: notify_post("com.halou.HookMyApp.eventname"); 84 | CFNotificationCenterRef darwin = CFNotificationCenterGetDarwinNotifyCenter(); 85 | CFNotificationCenterAddObserver(darwin, NULL, ExternallyPostedNotification, CFSTR("com.halou.HookMyApp.eventname"), NULL, CFNotificationSuspensionBehaviorCoalesce); 86 | 87 | // CHLoadClass(ClassToHook); // load class (that is "available now") 88 | // CHLoadLateClass(ClassToHook); // load class (that will be "available later") 89 | 90 | CHHook(0, ClassToHook, messageName); // register hook 91 | CHHook(2, ClassToHook, arg1, arg2); // register hook 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /MyApp/MyApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6AB4846621818A2D0056EB75 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AB4846521818A2D0056EB75 /* AppDelegate.m */; }; 11 | 6AB4846921818A2D0056EB75 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AB4846821818A2D0056EB75 /* ViewController.m */; }; 12 | 6AB4846C21818A2D0056EB75 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6AB4846A21818A2D0056EB75 /* Main.storyboard */; }; 13 | 6AB4846E21818A2E0056EB75 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6AB4846D21818A2E0056EB75 /* Assets.xcassets */; }; 14 | 6AB4847121818A2E0056EB75 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6AB4846F21818A2E0056EB75 /* LaunchScreen.storyboard */; }; 15 | 6AB4847421818A2E0056EB75 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AB4847321818A2E0056EB75 /* main.m */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 6AB4846121818A2D0056EB75 /* MyApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MyApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 6AB4846421818A2D0056EB75 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 21 | 6AB4846521818A2D0056EB75 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 22 | 6AB4846721818A2D0056EB75 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 23 | 6AB4846821818A2D0056EB75 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 24 | 6AB4846B21818A2D0056EB75 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | 6AB4846D21818A2E0056EB75 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 6AB4847021818A2E0056EB75 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 6AB4847221818A2E0056EB75 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 6AB4847321818A2E0056EB75 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 6AB4845E21818A2D0056EB75 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 6AB4845821818A2D0056EB75 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 6AB4846321818A2D0056EB75 /* MyApp */, 46 | 6AB4846221818A2D0056EB75 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 6AB4846221818A2D0056EB75 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 6AB4846121818A2D0056EB75 /* MyApp.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 6AB4846321818A2D0056EB75 /* MyApp */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 6AB4846421818A2D0056EB75 /* AppDelegate.h */, 62 | 6AB4846521818A2D0056EB75 /* AppDelegate.m */, 63 | 6AB4846721818A2D0056EB75 /* ViewController.h */, 64 | 6AB4846821818A2D0056EB75 /* ViewController.m */, 65 | 6AB4846A21818A2D0056EB75 /* Main.storyboard */, 66 | 6AB4846D21818A2E0056EB75 /* Assets.xcassets */, 67 | 6AB4846F21818A2E0056EB75 /* LaunchScreen.storyboard */, 68 | 6AB4847221818A2E0056EB75 /* Info.plist */, 69 | 6AB4847321818A2E0056EB75 /* main.m */, 70 | ); 71 | path = MyApp; 72 | sourceTree = ""; 73 | }; 74 | /* End PBXGroup section */ 75 | 76 | /* Begin PBXNativeTarget section */ 77 | 6AB4846021818A2D0056EB75 /* MyApp */ = { 78 | isa = PBXNativeTarget; 79 | buildConfigurationList = 6AB4847721818A2E0056EB75 /* Build configuration list for PBXNativeTarget "MyApp" */; 80 | buildPhases = ( 81 | 6AB4845D21818A2D0056EB75 /* Sources */, 82 | 6AB4845E21818A2D0056EB75 /* Frameworks */, 83 | 6AB4845F21818A2D0056EB75 /* Resources */, 84 | ); 85 | buildRules = ( 86 | ); 87 | dependencies = ( 88 | ); 89 | name = MyApp; 90 | productName = MyApp; 91 | productReference = 6AB4846121818A2D0056EB75 /* MyApp.app */; 92 | productType = "com.apple.product-type.application"; 93 | }; 94 | /* End PBXNativeTarget section */ 95 | 96 | /* Begin PBXProject section */ 97 | 6AB4845921818A2D0056EB75 /* Project object */ = { 98 | isa = PBXProject; 99 | attributes = { 100 | LastUpgradeCheck = 1000; 101 | ORGANIZATIONNAME = Test; 102 | TargetAttributes = { 103 | 6AB4846021818A2D0056EB75 = { 104 | CreatedOnToolsVersion = 10.0; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = 6AB4845C21818A2D0056EB75 /* Build configuration list for PBXProject "MyApp" */; 109 | compatibilityVersion = "Xcode 9.3"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = 6AB4845821818A2D0056EB75; 117 | productRefGroup = 6AB4846221818A2D0056EB75 /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | 6AB4846021818A2D0056EB75 /* MyApp */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | 6AB4845F21818A2D0056EB75 /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | 6AB4847121818A2E0056EB75 /* LaunchScreen.storyboard in Resources */, 132 | 6AB4846E21818A2E0056EB75 /* Assets.xcassets in Resources */, 133 | 6AB4846C21818A2D0056EB75 /* Main.storyboard in Resources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXResourcesBuildPhase section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | 6AB4845D21818A2D0056EB75 /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | 6AB4846921818A2D0056EB75 /* ViewController.m in Sources */, 145 | 6AB4847421818A2E0056EB75 /* main.m in Sources */, 146 | 6AB4846621818A2D0056EB75 /* AppDelegate.m in Sources */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | /* End PBXSourcesBuildPhase section */ 151 | 152 | /* Begin PBXVariantGroup section */ 153 | 6AB4846A21818A2D0056EB75 /* Main.storyboard */ = { 154 | isa = PBXVariantGroup; 155 | children = ( 156 | 6AB4846B21818A2D0056EB75 /* Base */, 157 | ); 158 | name = Main.storyboard; 159 | sourceTree = ""; 160 | }; 161 | 6AB4846F21818A2E0056EB75 /* LaunchScreen.storyboard */ = { 162 | isa = PBXVariantGroup; 163 | children = ( 164 | 6AB4847021818A2E0056EB75 /* Base */, 165 | ); 166 | name = LaunchScreen.storyboard; 167 | sourceTree = ""; 168 | }; 169 | /* End PBXVariantGroup section */ 170 | 171 | /* Begin XCBuildConfiguration section */ 172 | 6AB4847521818A2E0056EB75 /* Debug */ = { 173 | isa = XCBuildConfiguration; 174 | buildSettings = { 175 | ALWAYS_SEARCH_USER_PATHS = NO; 176 | CLANG_ANALYZER_NONNULL = YES; 177 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 178 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 179 | CLANG_CXX_LIBRARY = "libc++"; 180 | CLANG_ENABLE_MODULES = YES; 181 | CLANG_ENABLE_OBJC_ARC = YES; 182 | CLANG_ENABLE_OBJC_WEAK = YES; 183 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 184 | CLANG_WARN_BOOL_CONVERSION = YES; 185 | CLANG_WARN_COMMA = YES; 186 | CLANG_WARN_CONSTANT_CONVERSION = YES; 187 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 188 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 189 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 190 | CLANG_WARN_EMPTY_BODY = YES; 191 | CLANG_WARN_ENUM_CONVERSION = YES; 192 | CLANG_WARN_INFINITE_RECURSION = YES; 193 | CLANG_WARN_INT_CONVERSION = YES; 194 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 195 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 196 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 197 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 198 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 199 | CLANG_WARN_STRICT_PROTOTYPES = YES; 200 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 201 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 202 | CLANG_WARN_UNREACHABLE_CODE = YES; 203 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 204 | CODE_SIGN_IDENTITY = "iPhone Developer"; 205 | COPY_PHASE_STRIP = NO; 206 | DEBUG_INFORMATION_FORMAT = dwarf; 207 | ENABLE_STRICT_OBJC_MSGSEND = YES; 208 | ENABLE_TESTABILITY = YES; 209 | GCC_C_LANGUAGE_STANDARD = gnu11; 210 | GCC_DYNAMIC_NO_PIC = NO; 211 | GCC_NO_COMMON_BLOCKS = YES; 212 | GCC_OPTIMIZATION_LEVEL = 0; 213 | GCC_PREPROCESSOR_DEFINITIONS = ( 214 | "DEBUG=1", 215 | "$(inherited)", 216 | ); 217 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 218 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 219 | GCC_WARN_UNDECLARED_SELECTOR = YES; 220 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 221 | GCC_WARN_UNUSED_FUNCTION = YES; 222 | GCC_WARN_UNUSED_VARIABLE = YES; 223 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 224 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 225 | MTL_FAST_MATH = YES; 226 | ONLY_ACTIVE_ARCH = YES; 227 | SDKROOT = iphoneos; 228 | }; 229 | name = Debug; 230 | }; 231 | 6AB4847621818A2E0056EB75 /* Release */ = { 232 | isa = XCBuildConfiguration; 233 | buildSettings = { 234 | ALWAYS_SEARCH_USER_PATHS = NO; 235 | CLANG_ANALYZER_NONNULL = YES; 236 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 237 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 238 | CLANG_CXX_LIBRARY = "libc++"; 239 | CLANG_ENABLE_MODULES = YES; 240 | CLANG_ENABLE_OBJC_ARC = YES; 241 | CLANG_ENABLE_OBJC_WEAK = YES; 242 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 243 | CLANG_WARN_BOOL_CONVERSION = YES; 244 | CLANG_WARN_COMMA = YES; 245 | CLANG_WARN_CONSTANT_CONVERSION = YES; 246 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 247 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 248 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 261 | CLANG_WARN_UNREACHABLE_CODE = YES; 262 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 263 | CODE_SIGN_IDENTITY = "iPhone Developer"; 264 | COPY_PHASE_STRIP = NO; 265 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 266 | ENABLE_NS_ASSERTIONS = NO; 267 | ENABLE_STRICT_OBJC_MSGSEND = YES; 268 | GCC_C_LANGUAGE_STANDARD = gnu11; 269 | GCC_NO_COMMON_BLOCKS = YES; 270 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 271 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 272 | GCC_WARN_UNDECLARED_SELECTOR = YES; 273 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 274 | GCC_WARN_UNUSED_FUNCTION = YES; 275 | GCC_WARN_UNUSED_VARIABLE = YES; 276 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 277 | MTL_ENABLE_DEBUG_INFO = NO; 278 | MTL_FAST_MATH = YES; 279 | SDKROOT = iphoneos; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Release; 283 | }; 284 | 6AB4847821818A2E0056EB75 /* Debug */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 288 | CODE_SIGN_STYLE = Automatic; 289 | DEVELOPMENT_TEAM = 87Q7B3DYHT; 290 | INFOPLIST_FILE = MyApp/Info.plist; 291 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 292 | LD_RUNPATH_SEARCH_PATHS = ( 293 | "$(inherited)", 294 | "@executable_path/Frameworks", 295 | ); 296 | PRODUCT_BUNDLE_IDENTIFIER = com.halou.MyApp; 297 | PRODUCT_NAME = "$(TARGET_NAME)"; 298 | TARGETED_DEVICE_FAMILY = "1,2"; 299 | }; 300 | name = Debug; 301 | }; 302 | 6AB4847921818A2E0056EB75 /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 306 | CODE_SIGN_STYLE = Automatic; 307 | DEVELOPMENT_TEAM = 87Q7B3DYHT; 308 | INFOPLIST_FILE = MyApp/Info.plist; 309 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 310 | LD_RUNPATH_SEARCH_PATHS = ( 311 | "$(inherited)", 312 | "@executable_path/Frameworks", 313 | ); 314 | PRODUCT_BUNDLE_IDENTIFIER = com.halou.MyApp; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | TARGETED_DEVICE_FAMILY = "1,2"; 317 | }; 318 | name = Release; 319 | }; 320 | /* End XCBuildConfiguration section */ 321 | 322 | /* Begin XCConfigurationList section */ 323 | 6AB4845C21818A2D0056EB75 /* Build configuration list for PBXProject "MyApp" */ = { 324 | isa = XCConfigurationList; 325 | buildConfigurations = ( 326 | 6AB4847521818A2E0056EB75 /* Debug */, 327 | 6AB4847621818A2E0056EB75 /* Release */, 328 | ); 329 | defaultConfigurationIsVisible = 0; 330 | defaultConfigurationName = Release; 331 | }; 332 | 6AB4847721818A2E0056EB75 /* Build configuration list for PBXNativeTarget "MyApp" */ = { 333 | isa = XCConfigurationList; 334 | buildConfigurations = ( 335 | 6AB4847821818A2E0056EB75 /* Debug */, 336 | 6AB4847921818A2E0056EB75 /* Release */, 337 | ); 338 | defaultConfigurationIsVisible = 0; 339 | defaultConfigurationName = Release; 340 | }; 341 | /* End XCConfigurationList section */ 342 | }; 343 | rootObject = 6AB4845921818A2D0056EB75 /* Project object */; 344 | } 345 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6AB4848821818B220056EB75 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AB4848721818B220056EB75 /* Foundation.framework */; }; 11 | 6AB4849021818B220056EB75 /* HookMyApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6AB4848F21818B220056EB75 /* HookMyApp.mm */; }; 12 | 6AB4849D21818B940056EB75 /* MyMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AB4849B21818B940056EB75 /* MyMain.m */; }; 13 | 6AB4849F21818CD90056EB75 /* CydiaSubstrate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AB4849E21818CD90056EB75 /* CydiaSubstrate.framework */; }; 14 | 6AB484A121818D7D0056EB75 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AB484A021818D7D0056EB75 /* UIKit.framework */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 6AB4848421818B220056EB75 /* HookMyApp.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = HookMyApp.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 6AB4848721818B220056EB75 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 20 | 6AB4848C21818B220056EB75 /* control */ = {isa = PBXFileReference; lastKnownFileType = text; name = control; path = Package/DEBIAN/control; sourceTree = ""; }; 21 | 6AB4848E21818B220056EB75 /* HookMyApp-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HookMyApp-Prefix.pch"; sourceTree = ""; }; 22 | 6AB4848F21818B220056EB75 /* HookMyApp.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HookMyApp.mm; sourceTree = ""; }; 23 | 6AB4849421818B220056EB75 /* HookMyApp.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = HookMyApp.plist; path = Package/Library/MobileSubstrate/DynamicLibraries/HookMyApp.plist; sourceTree = ""; }; 24 | 6AB4849B21818B940056EB75 /* MyMain.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyMain.m; sourceTree = ""; }; 25 | 6AB4849E21818CD90056EB75 /* CydiaSubstrate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CydiaSubstrate.framework; sourceTree = ""; }; 26 | 6AB484A021818D7D0056EB75 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | 6AB4848021818B220056EB75 /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | 6AB484A121818D7D0056EB75 /* UIKit.framework in Frameworks */, 35 | 6AB4848821818B220056EB75 /* Foundation.framework in Frameworks */, 36 | 6AB4849F21818CD90056EB75 /* CydiaSubstrate.framework in Frameworks */, 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 6AB4847A21818B220056EB75 = { 44 | isa = PBXGroup; 45 | children = ( 46 | 6AB4848921818B220056EB75 /* HookMyApp */, 47 | 6AB4848621818B220056EB75 /* Frameworks */, 48 | 6AB4848521818B220056EB75 /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 6AB4848521818B220056EB75 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 6AB4848421818B220056EB75 /* HookMyApp.dylib */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 6AB4848621818B220056EB75 /* Frameworks */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 6AB484A021818D7D0056EB75 /* UIKit.framework */, 64 | 6AB4848721818B220056EB75 /* Foundation.framework */, 65 | ); 66 | name = Frameworks; 67 | sourceTree = ""; 68 | }; 69 | 6AB4848921818B220056EB75 /* HookMyApp */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 6AB4849E21818CD90056EB75 /* CydiaSubstrate.framework */, 73 | 6AB4849B21818B940056EB75 /* MyMain.m */, 74 | 6AB4848F21818B220056EB75 /* HookMyApp.mm */, 75 | 6AB4848A21818B220056EB75 /* Package */, 76 | 6AB4848D21818B220056EB75 /* Supporting Files */, 77 | ); 78 | path = HookMyApp; 79 | sourceTree = ""; 80 | }; 81 | 6AB4848A21818B220056EB75 /* Package */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 6AB4848B21818B220056EB75 /* DEBIAN */, 85 | 6AB4849121818B220056EB75 /* Library */, 86 | ); 87 | name = Package; 88 | sourceTree = ""; 89 | }; 90 | 6AB4848B21818B220056EB75 /* DEBIAN */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 6AB4848C21818B220056EB75 /* control */, 94 | ); 95 | name = DEBIAN; 96 | sourceTree = ""; 97 | }; 98 | 6AB4848D21818B220056EB75 /* Supporting Files */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 6AB4848E21818B220056EB75 /* HookMyApp-Prefix.pch */, 102 | ); 103 | name = "Supporting Files"; 104 | sourceTree = ""; 105 | }; 106 | 6AB4849121818B220056EB75 /* Library */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 6AB4849221818B220056EB75 /* MobileSubstrate */, 110 | ); 111 | name = Library; 112 | sourceTree = ""; 113 | }; 114 | 6AB4849221818B220056EB75 /* MobileSubstrate */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 6AB4849321818B220056EB75 /* DynamicLibraries */, 118 | ); 119 | name = MobileSubstrate; 120 | sourceTree = ""; 121 | }; 122 | 6AB4849321818B220056EB75 /* DynamicLibraries */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 6AB4849421818B220056EB75 /* HookMyApp.plist */, 126 | ); 127 | name = DynamicLibraries; 128 | sourceTree = ""; 129 | }; 130 | /* End PBXGroup section */ 131 | 132 | /* Begin PBXHeadersBuildPhase section */ 133 | 6AB4848121818B220056EB75 /* Headers */ = { 134 | isa = PBXHeadersBuildPhase; 135 | buildActionMask = 2147483647; 136 | files = ( 137 | ); 138 | runOnlyForDeploymentPostprocessing = 0; 139 | }; 140 | /* End PBXHeadersBuildPhase section */ 141 | 142 | /* Begin PBXNativeTarget section */ 143 | 6AB4848321818B220056EB75 /* HookMyApp */ = { 144 | isa = PBXNativeTarget; 145 | buildConfigurationList = 6AB4849721818B220056EB75 /* Build configuration list for PBXNativeTarget "HookMyApp" */; 146 | buildPhases = ( 147 | 6AB4847F21818B220056EB75 /* Sources */, 148 | 6AB4848021818B220056EB75 /* Frameworks */, 149 | 6AB4848121818B220056EB75 /* Headers */, 150 | 6AB4848221818B220056EB75 /* ShellScript */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = HookMyApp; 157 | productName = HookMyApp; 158 | productReference = 6AB4848421818B220056EB75 /* HookMyApp.dylib */; 159 | productType = "com.apple.product-type.library.dynamic"; 160 | }; 161 | /* End PBXNativeTarget section */ 162 | 163 | /* Begin PBXProject section */ 164 | 6AB4847B21818B220056EB75 /* Project object */ = { 165 | isa = PBXProject; 166 | attributes = { 167 | LastUpgradeCheck = 1000; 168 | TargetAttributes = { 169 | 6AB4848321818B220056EB75 = { 170 | CreatedOnToolsVersion = 10.0; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 6AB4847E21818B220056EB75 /* Build configuration list for PBXProject "HookMyApp" */; 175 | compatibilityVersion = "Xcode 9.3"; 176 | developmentRegion = en; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | ); 181 | mainGroup = 6AB4847A21818B220056EB75; 182 | productRefGroup = 6AB4848521818B220056EB75 /* Products */; 183 | projectDirPath = ""; 184 | projectRoot = ""; 185 | targets = ( 186 | 6AB4848321818B220056EB75 /* HookMyApp */, 187 | ); 188 | }; 189 | /* End PBXProject section */ 190 | 191 | /* Begin PBXShellScriptBuildPhase section */ 192 | 6AB4848221818B220056EB75 /* ShellScript */ = { 193 | isa = PBXShellScriptBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | inputFileListPaths = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | outputFileListPaths = ( 202 | ); 203 | outputPaths = ( 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | shellPath = /bin/sh; 207 | shellScript = "/opt/MonkeyDev/bin/md --xcbp"; 208 | }; 209 | /* End PBXShellScriptBuildPhase section */ 210 | 211 | /* Begin PBXSourcesBuildPhase section */ 212 | 6AB4847F21818B220056EB75 /* Sources */ = { 213 | isa = PBXSourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | 6AB4849021818B220056EB75 /* HookMyApp.mm in Sources */, 217 | 6AB4849D21818B940056EB75 /* MyMain.m in Sources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | /* End PBXSourcesBuildPhase section */ 222 | 223 | /* Begin XCBuildConfiguration section */ 224 | 6AB4849521818B220056EB75 /* Release */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | CODE_SIGN_IDENTITY = "iPhone Developer"; 228 | COPY_PHASE_STRIP = YES; 229 | EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "*.nib *.lproj *.gch (*) .DS_Store CVS .svn .git .hg *.xcodeproj *.xcode *.pbproj *.pbxproj"; 230 | FRAMEWORK_SEARCH_PATHS = ( 231 | "$(MonkeyDevPath)/frameworks/**", 232 | "$(MonkeyDevTheosPath)/vendor/lib", 233 | ); 234 | GCC_C_LANGUAGE_STANDARD = gnu99; 235 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 236 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 237 | GCC_WARN_UNUSED_VARIABLE = YES; 238 | HEADER_SEARCH_PATHS = "$(MonkeyDevTheosPath)/vendor/include/**"; 239 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 240 | LIBRARY_SEARCH_PATHS = "$(MonkeyDevTheosPath)/vendor/lib/**"; 241 | MonkeyDevPath = /opt/MonkeyDev; 242 | MonkeyDevTheosPath = /opt/theos; 243 | OTHER_CFLAGS = "-DTHEOS_INSTANCE_NAME=\"\\\"HookMyApp\\\"\""; 244 | SDKROOT = iphoneos; 245 | TARGETED_DEVICE_FAMILY = "1,2"; 246 | VALIDATE_PRODUCT = YES; 247 | }; 248 | name = Release; 249 | }; 250 | 6AB4849621818B220056EB75 /* Debug */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | CODE_SIGN_IDENTITY = "iPhone Developer"; 254 | COPY_PHASE_STRIP = NO; 255 | EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "*.nib *.lproj *.gch (*) .DS_Store CVS .svn .git .hg *.xcodeproj *.xcode *.pbproj *.pbxproj"; 256 | FRAMEWORK_SEARCH_PATHS = ( 257 | "$(MonkeyDevPath)/frameworks/**", 258 | "$(MonkeyDevTheosPath)/vendor/lib", 259 | ); 260 | GCC_C_LANGUAGE_STANDARD = gnu99; 261 | GCC_DYNAMIC_NO_PIC = NO; 262 | GCC_OPTIMIZATION_LEVEL = 0; 263 | GCC_PREPROCESSOR_DEFINITIONS = ( 264 | "DEBUG=1", 265 | "$(inherited)", 266 | ); 267 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 268 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 269 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 270 | GCC_WARN_UNUSED_VARIABLE = YES; 271 | HEADER_SEARCH_PATHS = "$(MonkeyDevTheosPath)/vendor/include/**"; 272 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 273 | LIBRARY_SEARCH_PATHS = "$(MonkeyDevTheosPath)/vendor/lib/**"; 274 | MonkeyDevPath = /opt/MonkeyDev; 275 | MonkeyDevTheosPath = /opt/theos; 276 | ONLY_ACTIVE_ARCH = YES; 277 | OTHER_CFLAGS = "-DTHEOS_INSTANCE_NAME=\"\\\"HookMyApp\\\"\""; 278 | SDKROOT = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = NO; 281 | }; 282 | name = Debug; 283 | }; 284 | 6AB4849821818B220056EB75 /* Release */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CODE_SIGN_IDENTITY = ""; 289 | CODE_SIGN_STYLE = Automatic; 290 | DEVELOPMENT_TEAM = 4PXFJL735S; 291 | DYLIB_COMPATIBILITY_VERSION = 1; 292 | DYLIB_CURRENT_VERSION = 1; 293 | FRAMEWORK_SEARCH_PATHS = ( 294 | "$(inherited)", 295 | "$(PROJECT_DIR)/HookMyApp", 296 | ); 297 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 298 | GCC_PREFIX_HEADER = "HookMyApp/HookMyApp-Prefix.pch"; 299 | HEADER_SEARCH_PATHS = ( 300 | "$(MonkeyDevPath)/include", 301 | "$(MonkeyDevTheosPath)/vendor/include/**", 302 | ); 303 | INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries; 304 | MonkeyDevBuildPackageOnAnyBuild = NO; 305 | MonkeyDevClearUiCacheOnInstall = NO; 306 | MonkeyDevCopyOnBuild = NO; 307 | MonkeyDevDeviceIP = 127.0.0.1; 308 | MonkeyDevDevicePassword = alpine; 309 | MonkeyDevDevicePort = 10086; 310 | MonkeyDevInstallOnAnyBuild = YES; 311 | MonkeyDevInstallOnProfiling = YES; 312 | MonkeyDevkillProcessOnInstall = SpringBoard; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | TARGETED_DEVICE_FAMILY = "1,2"; 315 | }; 316 | name = Release; 317 | }; 318 | 6AB4849921818B220056EB75 /* Debug */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CODE_SIGN_IDENTITY = ""; 323 | CODE_SIGN_STYLE = Automatic; 324 | DEVELOPMENT_TEAM = 4PXFJL735S; 325 | DYLIB_COMPATIBILITY_VERSION = 1; 326 | DYLIB_CURRENT_VERSION = 1; 327 | FRAMEWORK_SEARCH_PATHS = ( 328 | "$(inherited)", 329 | "$(PROJECT_DIR)/HookMyApp", 330 | ); 331 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 332 | GCC_PREFIX_HEADER = "HookMyApp/HookMyApp-Prefix.pch"; 333 | HEADER_SEARCH_PATHS = ( 334 | "$(MonkeyDevPath)/include", 335 | "$(MonkeyDevTheosPath)/vendor/include/**", 336 | ); 337 | INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries; 338 | MonkeyDevBuildPackageOnAnyBuild = NO; 339 | MonkeyDevClearUiCacheOnInstall = NO; 340 | MonkeyDevCopyOnBuild = NO; 341 | MonkeyDevDeviceIP = 127.0.0.1; 342 | MonkeyDevDevicePassword = alpine; 343 | MonkeyDevDevicePort = 10086; 344 | MonkeyDevInstallOnAnyBuild = YES; 345 | MonkeyDevInstallOnProfiling = YES; 346 | MonkeyDevkillProcessOnInstall = SpringBoard; 347 | PRODUCT_NAME = "$(TARGET_NAME)"; 348 | TARGETED_DEVICE_FAMILY = "1,2"; 349 | }; 350 | name = Debug; 351 | }; 352 | /* End XCBuildConfiguration section */ 353 | 354 | /* Begin XCConfigurationList section */ 355 | 6AB4847E21818B220056EB75 /* Build configuration list for PBXProject "HookMyApp" */ = { 356 | isa = XCConfigurationList; 357 | buildConfigurations = ( 358 | 6AB4849521818B220056EB75 /* Release */, 359 | 6AB4849621818B220056EB75 /* Debug */, 360 | ); 361 | defaultConfigurationIsVisible = 0; 362 | defaultConfigurationName = Release; 363 | }; 364 | 6AB4849721818B220056EB75 /* Build configuration list for PBXNativeTarget "HookMyApp" */ = { 365 | isa = XCConfigurationList; 366 | buildConfigurations = ( 367 | 6AB4849821818B220056EB75 /* Release */, 368 | 6AB4849921818B220056EB75 /* Debug */, 369 | ); 370 | defaultConfigurationIsVisible = 0; 371 | defaultConfigurationName = Release; 372 | }; 373 | /* End XCConfigurationList section */ 374 | }; 375 | rootObject = 6AB4847B21818B220056EB75 /* Project object */; 376 | } 377 | -------------------------------------------------------------------------------- /HookMyApp/HookMyApp/CydiaSubstrate.framework/Headers/CydiaSubstrate.h: -------------------------------------------------------------------------------- 1 | /* Cydia Substrate - Powerful Code Insertion Platform 2 | * Copyright (C) 2008-2012 Jay Freeman (saurik) 3 | */ 4 | 5 | /* GNU Lesser General Public License, Version 3 {{{ */ 6 | /* 7 | * Substrate is free software: you can redistribute it and/or modify it under 8 | * the terms of the GNU Lesser General Public License as published by the 9 | * Free Software Foundation, either version 3 of the License, or (at your 10 | * option) any later version. 11 | * 12 | * Substrate is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15 | * License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with Substrate. If not, see . 19 | **/ 20 | /* }}} */ 21 | 22 | #ifndef SUBSTRATE_H_ 23 | #define SUBSTRATE_H_ 24 | 25 | #ifdef __APPLE__ 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | #include 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #include 35 | #include 36 | #endif 37 | 38 | #include 39 | #include 40 | 41 | #define _finline \ 42 | inline __attribute__((__always_inline__)) 43 | #define _disused \ 44 | __attribute__((__unused__)) 45 | 46 | #define _extern \ 47 | extern "C" __attribute__((__visibility__("default"))) 48 | 49 | #ifdef __cplusplus 50 | #define _default(value) = value 51 | #else 52 | #define _default(value) 53 | #endif 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | bool MSHookProcess(pid_t pid, const char *library); 60 | 61 | typedef const void *MSImageRef; 62 | 63 | MSImageRef MSGetImageByName(const char *file); 64 | void *MSFindSymbol(MSImageRef image, const char *name); 65 | 66 | void MSHookFunction(void *symbol, void *replace, void **result); 67 | 68 | #ifdef __APPLE__ 69 | #ifdef __arm__ 70 | __attribute__((__deprecated__)) 71 | IMP MSHookMessage(Class _class, SEL sel, IMP imp, const char *prefix _default(NULL)); 72 | #endif 73 | void MSHookMessageEx(Class _class, SEL sel, IMP imp, IMP *result); 74 | #endif 75 | 76 | #ifdef SubstrateInternal 77 | typedef void *SubstrateAllocatorRef; 78 | typedef struct __SubstrateProcess *SubstrateProcessRef; 79 | typedef struct __SubstrateMemory *SubstrateMemoryRef; 80 | 81 | SubstrateProcessRef SubstrateProcessCreate(SubstrateAllocatorRef allocator, pid_t pid); 82 | void SubstrateProcessRelease(SubstrateProcessRef process); 83 | 84 | SubstrateMemoryRef SubstrateMemoryCreate(SubstrateAllocatorRef allocator, SubstrateProcessRef process, void *data, size_t size); 85 | void SubstrateMemoryRelease(SubstrateMemoryRef memory); 86 | #endif 87 | 88 | #ifdef __ANDROID__ 89 | #include 90 | _extern void MSJavaHookClassLoad(JNIEnv *jni, const char *name, void (*callback)(JNIEnv *, jclass, void *), void *data _default(NULL)); 91 | _extern void MSJavaHookMethod(JNIEnv *jni, jclass _class, jmethodID methodID, void *function, void **result); 92 | _extern void MSJavaBlessClassLoader(JNIEnv *jni, jobject loader); 93 | 94 | typedef struct MSJavaObjectKey_ *MSJavaObjectKey; 95 | _extern MSJavaObjectKey MSJavaNewObjectKey(); 96 | _extern void MSJavaDeleteObjectKey(MSJavaObjectKey key); 97 | _extern void *MSJavaGetObjectKey(JNIEnv *jni, jobject object, MSJavaObjectKey key); 98 | _extern void MSJavaSetObjectKey(JNIEnv *jni, jobject object, MSJavaObjectKey key, void *value, void (*clean)(void *, JNIEnv *, void *) _default(NULL), void *data _default(NULL)); 99 | #endif 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #ifdef __cplusplus 106 | 107 | #ifdef SubstrateInternal 108 | struct SubstrateHookMemory { 109 | SubstrateMemoryRef handle_; 110 | 111 | SubstrateHookMemory(SubstrateProcessRef process, void *data, size_t size) : 112 | handle_(SubstrateMemoryCreate(NULL, NULL, data, size)) 113 | { 114 | } 115 | 116 | ~SubstrateHookMemory() { 117 | if (handle_ != NULL) 118 | SubstrateMemoryRelease(handle_); 119 | } 120 | }; 121 | #endif 122 | 123 | #ifdef __APPLE__ 124 | 125 | namespace etl { 126 | 127 | template 128 | struct Case { 129 | static char value[Case_ + 1]; 130 | }; 131 | 132 | typedef Case Yes; 133 | typedef Case No; 134 | 135 | namespace be { 136 | template 137 | static Yes CheckClass_(void (Checked_::*)()); 138 | 139 | template 140 | static No CheckClass_(...); 141 | } 142 | 143 | template 144 | struct IsClass { 145 | void gcc32(); 146 | 147 | static const bool value = (sizeof(be::CheckClass_(0).value) == sizeof(Yes::value)); 148 | }; 149 | 150 | } 151 | 152 | #ifdef __arm__ 153 | template 154 | __attribute__((__deprecated__)) 155 | static inline Type_ *MSHookMessage(Class _class, SEL sel, Type_ *imp, const char *prefix = NULL) { 156 | return reinterpret_cast(MSHookMessage(_class, sel, reinterpret_cast(imp), prefix)); 157 | } 158 | #endif 159 | 160 | template 161 | static inline void MSHookMessage(Class _class, SEL sel, Type_ *imp, Type_ **result) { 162 | return MSHookMessageEx(_class, sel, reinterpret_cast(imp), reinterpret_cast(result)); 163 | } 164 | 165 | template 166 | static inline Type_ &MSHookIvar(id self, const char *name) { 167 | Ivar ivar(class_getInstanceVariable(object_getClass(self), name)); 168 | #if __has_feature(objc_arc) 169 | void *pointer(ivar == NULL ? NULL : reinterpret_cast((__bridge void *)self) + ivar_getOffset(ivar)); 170 | #else 171 | void *pointer(ivar == NULL ? NULL : reinterpret_cast(self) + ivar_getOffset(ivar)); 172 | #endif 173 | return *reinterpret_cast(pointer); 174 | } 175 | 176 | #define MSAddMessage0(_class, type, arg0) \ 177 | class_addMethod($ ## _class, @selector(arg0), (IMP) &$ ## _class ## $ ## arg0, type); 178 | #define MSAddMessage1(_class, type, arg0) \ 179 | class_addMethod($ ## _class, @selector(arg0:), (IMP) &$ ## _class ## $ ## arg0 ## $, type); 180 | #define MSAddMessage2(_class, type, arg0, arg1) \ 181 | class_addMethod($ ## _class, @selector(arg0:arg1:), (IMP) &$ ## _class ## $ ## arg0 ## $ ## arg1 ## $, type); 182 | #define MSAddMessage3(_class, type, arg0, arg1, arg2) \ 183 | class_addMethod($ ## _class, @selector(arg0:arg1:arg2:), (IMP) &$ ## _class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $, type); 184 | #define MSAddMessage4(_class, type, arg0, arg1, arg2, arg3) \ 185 | class_addMethod($ ## _class, @selector(arg0:arg1:arg2:arg3:), (IMP) &$ ## _class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $, type); 186 | #define MSAddMessage5(_class, type, arg0, arg1, arg2, arg3, arg4) \ 187 | class_addMethod($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:), (IMP) &$ ## _class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $, type); 188 | #define MSAddMessage6(_class, type, arg0, arg1, arg2, arg3, arg4, arg5) \ 189 | class_addMethod($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:arg5:), (IMP) &$ ## _class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $ ## arg5 ## $, type); 190 | #define MSAddMessage7(_class, type, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ 191 | class_addMethod($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:arg5:arg6:), (IMP) &$ ## _class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $ ## arg5 ## $ $$ arg6 ## $, type); 192 | #define MSAddMessage8(_class, type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ 193 | class_addMethod($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:arg5:arg6:arg7:), (IMP) &$ ## _class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $ ## arg5 ## $ $$ arg6 ## $ ## arg7 ## $, type); 194 | 195 | #define MSHookMessage0(_class, arg0) \ 196 | MSHookMessage($ ## _class, @selector(arg0), MSHake(_class ## $ ## arg0)) 197 | #define MSHookMessage1(_class, arg0) \ 198 | MSHookMessage($ ## _class, @selector(arg0:), MSHake(_class ## $ ## arg0 ## $)) 199 | #define MSHookMessage2(_class, arg0, arg1) \ 200 | MSHookMessage($ ## _class, @selector(arg0:arg1:), MSHake(_class ## $ ## arg0 ## $ ## arg1 ## $)) 201 | #define MSHookMessage3(_class, arg0, arg1, arg2) \ 202 | MSHookMessage($ ## _class, @selector(arg0:arg1:arg2:), MSHake(_class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $)) 203 | #define MSHookMessage4(_class, arg0, arg1, arg2, arg3) \ 204 | MSHookMessage($ ## _class, @selector(arg0:arg1:arg2:arg3:), MSHake(_class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $)) 205 | #define MSHookMessage5(_class, arg0, arg1, arg2, arg3, arg4) \ 206 | MSHookMessage($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:), MSHake(_class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $)) 207 | #define MSHookMessage6(_class, arg0, arg1, arg2, arg3, arg4, arg5) \ 208 | MSHookMessage($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:arg5:), MSHake(_class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $ ## arg5 ## $)) 209 | #define MSHookMessage7(_class, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ 210 | MSHookMessage($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:arg5:arg6:), MSHake(_class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $ ## arg5 ## $ ## arg6 ## $)) 211 | #define MSHookMessage8(_class, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ 212 | MSHookMessage($ ## _class, @selector(arg0:arg1:arg2:arg3:arg4:arg5:arg6:arg7:), MSHake(_class ## $ ## arg0 ## $ ## arg1 ## $ ## arg2 ## $ ## arg3 ## $ ## arg4 ## $ ## arg5 ## $ ## arg6 ## $ ## arg7 ## $)) 213 | 214 | #define MSRegister_(name, dollar, colon) \ 215 | namespace { static class C_$ ## name ## $ ## dollar { public: _finline C_$ ## name ## $ ##dollar() { \ 216 | MSHookMessage($ ## name, @selector(colon), MSHake(name ## $ ## dollar)); \ 217 | } } V_$ ## name ## $ ## dollar; } \ 218 | 219 | #define MSIgnore_(name, dollar, colon) 220 | 221 | #define MSMessage_(extra, type, _class, name, dollar, colon, call, args...) \ 222 | static type _$ ## name ## $ ## dollar(Class _cls, type (*_old)(_class, SEL, ## args, ...), type (*_spr)(struct objc_super *, SEL, ## args, ...), _class self, SEL _cmd, ## args); \ 223 | MSHook(type, name ## $ ## dollar, _class self, SEL _cmd, ## args) { \ 224 | Class const _cls($ ## name); \ 225 | type (* const _old)(_class, SEL, ## args, ...) = reinterpret_cast(_ ## name ## $ ## dollar); \ 226 | typedef type (*msgSendSuper_t)(struct objc_super *, SEL, ## args, ...); \ 227 | msgSendSuper_t const _spr(::etl::IsClass::value ? reinterpret_cast(&objc_msgSendSuper_stret) : reinterpret_cast(&objc_msgSendSuper)); \ 228 | return _$ ## name ## $ ## dollar call; \ 229 | } \ 230 | extra(name, dollar, colon) \ 231 | static _finline type _$ ## name ## $ ## dollar(Class _cls, type (*_old)(_class, SEL, ## args, ...), type (*_spr)(struct objc_super *, SEL, ## args, ...), _class self, SEL _cmd, ## args) 232 | 233 | /* for((x=1;x!=7;++x)){ echo -n "#define MSMessage${x}_(extra, type, _class, name";for((y=0;y!=x;++y));do echo -n ", sel$y";done;for((y=0;y!=x;++y));do echo -n ", type$y, arg$y";done;echo ") \\";echo -n " MSMessage_(extra, type, _class, name,";for((y=0;y!=x;++y));do if [[ $y -ne 0 ]];then echo -n " ##";fi;echo -n " sel$y ## $";done;echo -n ", ";for((y=0;y!=x;++y));do echo -n "sel$y:";done;echo -n ", (_cls, _old, _spr, self, _cmd";for((y=0;y!=x;++y));do echo -n ", arg$y";done;echo -n ")";for((y=0;y!=x;++y));do echo -n ", type$y arg$y";done;echo ")";} */ 234 | 235 | #define MSMessage0_(extra, type, _class, name, sel0) \ 236 | MSMessage_(extra, type, _class, name, sel0, sel0, (_cls, _old, _spr, self, _cmd)) 237 | #define MSMessage1_(extra, type, _class, name, sel0, type0, arg0) \ 238 | MSMessage_(extra, type, _class, name, sel0 ## $, sel0:, (_cls, _old, _spr, self, _cmd, arg0), type0 arg0) 239 | #define MSMessage2_(extra, type, _class, name, sel0, sel1, type0, arg0, type1, arg1) \ 240 | MSMessage_(extra, type, _class, name, sel0 ## $ ## sel1 ## $, sel0:sel1:, (_cls, _old, _spr, self, _cmd, arg0, arg1), type0 arg0, type1 arg1) 241 | #define MSMessage3_(extra, type, _class, name, sel0, sel1, sel2, type0, arg0, type1, arg1, type2, arg2) \ 242 | MSMessage_(extra, type, _class, name, sel0 ## $ ## sel1 ## $ ## sel2 ## $, sel0:sel1:sel2:, (_cls, _old, _spr, self, _cmd, arg0, arg1, arg2), type0 arg0, type1 arg1, type2 arg2) 243 | #define MSMessage4_(extra, type, _class, name, sel0, sel1, sel2, sel3, type0, arg0, type1, arg1, type2, arg2, type3, arg3) \ 244 | MSMessage_(extra, type, _class, name, sel0 ## $ ## sel1 ## $ ## sel2 ## $ ## sel3 ## $, sel0:sel1:sel2:sel3:, (_cls, _old, _spr, self, _cmd, arg0, arg1, arg2, arg3), type0 arg0, type1 arg1, type2 arg2, type3 arg3) 245 | #define MSMessage5_(extra, type, _class, name, sel0, sel1, sel2, sel3, sel4, type0, arg0, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \ 246 | MSMessage_(extra, type, _class, name, sel0 ## $ ## sel1 ## $ ## sel2 ## $ ## sel3 ## $ ## sel4 ## $, sel0:sel1:sel2:sel3:sel4:, (_cls, _old, _spr, self, _cmd, arg0, arg1, arg2, arg3, arg4), type0 arg0, type1 arg1, type2 arg2, type3 arg3, type4 arg4) 247 | #define MSMessage6_(extra, type, _class, name, sel0, sel1, sel2, sel3, sel4, sel5, type0, arg0, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \ 248 | MSMessage_(extra, type, _class, name, sel0 ## $ ## sel1 ## $ ## sel2 ## $ ## sel3 ## $ ## sel4 ## $ ## sel5 ## $, sel0:sel1:sel2:sel3:sel4:sel5:, (_cls, _old, _spr, self, _cmd, arg0, arg1, arg2, arg3, arg4, arg5), type0 arg0, type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) 249 | #define MSMessage7_(extra, type, _class, name, sel0, sel1, sel2, sel3, sel4, sel5, sel6, type0, arg0, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5, type6, arg6) \ 250 | MSMessage_(extra, type, _class, name, sel0 ## $ ## sel1 ## $ ## sel2 ## $ ## sel3 ## $ ## sel4 ## $ ## sel5 ## $ ## sel6 ## $, sel0:sel1:sel2:sel3:sel4:sel5:sel6:, (_cls, _old, _spr, self, _cmd, arg0, arg1, arg2, arg3, arg4, arg5, arg6), type0 arg0, type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) 251 | #define MSMessage8_(extra, type, _class, name, sel0, sel1, sel2, sel3, sel4, sel5, sel6, sel7, type0, arg0, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7) \ 252 | MSMessage_(extra, type, _class, name, sel0 ## $ ## sel1 ## $ ## sel2 ## $ ## sel3 ## $ ## sel4 ## $ ## sel5 ## $ ## sel6 ## $ ## sel7 ## $, sel0:sel1:sel2:sel3:sel4:sel5:sel6:sel7:, (_cls, _old, _spr, self, _cmd, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7), type0 arg0, type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6, type7 arg7) 253 | 254 | #define MSInstanceMessage0(type, _class, args...) MSMessage0_(MSIgnore_, type, _class *, _class, ## args) 255 | #define MSInstanceMessage1(type, _class, args...) MSMessage1_(MSIgnore_, type, _class *, _class, ## args) 256 | #define MSInstanceMessage2(type, _class, args...) MSMessage2_(MSIgnore_, type, _class *, _class, ## args) 257 | #define MSInstanceMessage3(type, _class, args...) MSMessage3_(MSIgnore_, type, _class *, _class, ## args) 258 | #define MSInstanceMessage4(type, _class, args...) MSMessage4_(MSIgnore_, type, _class *, _class, ## args) 259 | #define MSInstanceMessage5(type, _class, args...) MSMessage5_(MSIgnore_, type, _class *, _class, ## args) 260 | #define MSInstanceMessage6(type, _class, args...) MSMessage6_(MSIgnore_, type, _class *, _class, ## args) 261 | #define MSInstanceMessage7(type, _class, args...) MSMessage7_(MSIgnore_, type, _class *, _class, ## args) 262 | #define MSInstanceMessage8(type, _class, args...) MSMessage8_(MSIgnore_, type, _class *, _class, ## args) 263 | 264 | #define MSClassMessage0(type, _class, args...) MSMessage0_(MSIgnore_, type, Class, $ ## _class, ## args) 265 | #define MSClassMessage1(type, _class, args...) MSMessage1_(MSIgnore_, type, Class, $ ## _class, ## args) 266 | #define MSClassMessage2(type, _class, args...) MSMessage2_(MSIgnore_, type, Class, $ ## _class, ## args) 267 | #define MSClassMessage3(type, _class, args...) MSMessage3_(MSIgnore_, type, Class, $ ## _class, ## args) 268 | #define MSClassMessage4(type, _class, args...) MSMessage4_(MSIgnore_, type, Class, $ ## _class, ## args) 269 | #define MSClassMessage5(type, _class, args...) MSMessage5_(MSIgnore_, type, Class, $ ## _class, ## args) 270 | #define MSClassMessage6(type, _class, args...) MSMessage6_(MSIgnore_, type, Class, $ ## _class, ## args) 271 | #define MSClassMessage7(type, _class, args...) MSMessage7_(MSIgnore_, type, Class, $ ## _class, ## args) 272 | #define MSClassMessage8(type, _class, args...) MSMessage8_(MSIgnore_, type, Class, $ ## _class, ## args) 273 | 274 | #define MSInstanceMessageHook0(type, _class, args...) MSMessage0_(MSRegister_, type, _class *, _class, ## args) 275 | #define MSInstanceMessageHook1(type, _class, args...) MSMessage1_(MSRegister_, type, _class *, _class, ## args) 276 | #define MSInstanceMessageHook2(type, _class, args...) MSMessage2_(MSRegister_, type, _class *, _class, ## args) 277 | #define MSInstanceMessageHook3(type, _class, args...) MSMessage3_(MSRegister_, type, _class *, _class, ## args) 278 | #define MSInstanceMessageHook4(type, _class, args...) MSMessage4_(MSRegister_, type, _class *, _class, ## args) 279 | #define MSInstanceMessageHook5(type, _class, args...) MSMessage5_(MSRegister_, type, _class *, _class, ## args) 280 | #define MSInstanceMessageHook6(type, _class, args...) MSMessage6_(MSRegister_, type, _class *, _class, ## args) 281 | #define MSInstanceMessageHook7(type, _class, args...) MSMessage7_(MSRegister_, type, _class *, _class, ## args) 282 | #define MSInstanceMessageHook8(type, _class, args...) MSMessage8_(MSRegister_, type, _class *, _class, ## args) 283 | 284 | #define MSClassMessageHook0(type, _class, args...) MSMessage0_(MSRegister_, type, Class, $ ## _class, ## args) 285 | #define MSClassMessageHook1(type, _class, args...) MSMessage1_(MSRegister_, type, Class, $ ## _class, ## args) 286 | #define MSClassMessageHook2(type, _class, args...) MSMessage2_(MSRegister_, type, Class, $ ## _class, ## args) 287 | #define MSClassMessageHook3(type, _class, args...) MSMessage3_(MSRegister_, type, Class, $ ## _class, ## args) 288 | #define MSClassMessageHook4(type, _class, args...) MSMessage4_(MSRegister_, type, Class, $ ## _class, ## args) 289 | #define MSClassMessageHook5(type, _class, args...) MSMessage5_(MSRegister_, type, Class, $ ## _class, ## args) 290 | #define MSClassMessageHook6(type, _class, args...) MSMessage6_(MSRegister_, type, Class, $ ## _class, ## args) 291 | #define MSClassMessageHook7(type, _class, args...) MSMessage7_(MSRegister_, type, Class, $ ## _class, ## args) 292 | #define MSClassMessageHook8(type, _class, args...) MSMessage8_(MSRegister_, type, Class, $ ## _class, ## args) 293 | 294 | #define MSOldCall(args...) \ 295 | _old(self, _cmd, ## args) 296 | #define MSSuperCall(args...) \ 297 | _spr(& (struct objc_super) {self, class_getSuperclass(_cls)}, _cmd, ## args) 298 | 299 | #define MSIvarHook(type, name) \ 300 | type &name(MSHookIvar(self, #name)) 301 | 302 | #define MSClassHook(name) \ 303 | @class name; \ 304 | static Class $ ## name = objc_getClass(#name); 305 | #define MSMetaClassHook(name) \ 306 | @class name; \ 307 | static Class $$ ## name = object_getClass($ ## name); 308 | 309 | #endif/*__APPLE__*/ 310 | 311 | template 312 | static inline void MSHookFunction(Type_ *symbol, Type_ *replace, Type_ **result) { 313 | return MSHookFunction( 314 | reinterpret_cast(symbol), 315 | reinterpret_cast(replace), 316 | reinterpret_cast(result) 317 | ); 318 | } 319 | 320 | template 321 | static inline void MSHookFunction(Type_ *symbol, Type_ *replace) { 322 | return MSHookFunction(symbol, replace, reinterpret_cast(NULL)); 323 | } 324 | 325 | template 326 | static inline void MSHookSymbol(Type_ *&value, const char *name, MSImageRef image = NULL) { 327 | value = reinterpret_cast(MSFindSymbol(image, name)); 328 | } 329 | 330 | template 331 | static inline void MSHookFunction(const char *name, Type_ *replace, Type_ **result = NULL) { 332 | Type_ *symbol; 333 | MSHookSymbol(symbol, name); 334 | return MSHookFunction(symbol, replace, result); 335 | } 336 | 337 | template 338 | static inline void MSHookFunction(MSImageRef image, const char *name, Type_ *replace, Type_ **result = NULL) { 339 | Type_ *symbol; 340 | MSHookSymbol(symbol, name, image); 341 | return MSHookFunction(symbol, replace, result); 342 | } 343 | 344 | #endif 345 | 346 | #ifdef __ANDROID__ 347 | 348 | #ifdef __cplusplus 349 | 350 | template 351 | static inline void MSJavaHookMethod(JNIEnv *jni, jclass _class, jmethodID method, Type_ (*replace)(JNIEnv *, Kind_, Args_...), Type_ (**result)(JNIEnv *, Kind_, ...)) { 352 | return MSJavaHookMethod( 353 | jni, _class, method, 354 | reinterpret_cast(replace), 355 | reinterpret_cast(result) 356 | ); 357 | } 358 | 359 | #endif 360 | 361 | static inline void MSAndroidGetPackage(JNIEnv *jni, jobject global, const char *name, jobject &local, jobject &loader) { 362 | jclass Context(jni->FindClass("android/content/Context")); 363 | jmethodID Context$createPackageContext(jni->GetMethodID(Context, "createPackageContext", "(Ljava/lang/String;I)Landroid/content/Context;")); 364 | jmethodID Context$getClassLoader(jni->GetMethodID(Context, "getClassLoader", "()Ljava/lang/ClassLoader;")); 365 | 366 | jstring string(jni->NewStringUTF(name)); 367 | local = jni->CallObjectMethod(global, Context$createPackageContext, string, 3); 368 | loader = jni->CallObjectMethod(local, Context$getClassLoader); 369 | } 370 | 371 | static inline jclass MSJavaFindClass(JNIEnv *jni, jobject loader, const char *name) { 372 | jclass Class(jni->FindClass("java/lang/Class")); 373 | jmethodID Class$forName(jni->GetStaticMethodID(Class, "forName", "(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;")); 374 | 375 | jstring string(jni->NewStringUTF(name)); 376 | jobject _class(jni->CallStaticObjectMethod(Class, Class$forName, string, JNI_TRUE, loader)); 377 | if (jni->ExceptionCheck()) 378 | return NULL; 379 | 380 | return reinterpret_cast(_class); 381 | } 382 | 383 | _disused static void MSJavaCleanWeak(void *data, JNIEnv *jni, void *value) { 384 | jni->DeleteWeakGlobalRef(reinterpret_cast(value)); 385 | } 386 | 387 | #endif 388 | 389 | #define MSHook(type, name, args...) \ 390 | _disused static type (*_ ## name)(args); \ 391 | static type $ ## name(args) 392 | 393 | #define MSJavaHook(type, name, arg0, args...) \ 394 | _disused static type (*_ ## name)(JNIEnv *jni, arg0, ...); \ 395 | static type $ ## name(JNIEnv *jni, arg0, ## args) 396 | 397 | #ifdef __cplusplus 398 | #define MSHake(name) \ 399 | &$ ## name, &_ ## name 400 | #else 401 | #define MSHake(name) \ 402 | &$ ## name, (void **) &_ ## name 403 | #endif 404 | 405 | #define SubstrateConcat_(lhs, rhs) \ 406 | lhs ## rhs 407 | #define SubstrateConcat(lhs, rhs) \ 408 | SubstrateConcat_(lhs, rhs) 409 | 410 | #ifdef __APPLE__ 411 | #define SubstrateSection \ 412 | __attribute__((__section__("__TEXT, __substrate"))) 413 | #else 414 | #define SubstrateSection \ 415 | __attribute__((__section__(".substrate"))) 416 | #endif 417 | 418 | #ifdef __APPLE__ 419 | #define MSFilterCFBundleID "Filter:CFBundleID" 420 | #define MSFilterObjC_Class "Filter:ObjC.Class" 421 | #endif 422 | 423 | #define MSFilterLibrary "Filter:Library" 424 | #define MSFilterExecutable "Filter:Executable" 425 | 426 | #define MSConfig(name, value) \ 427 | extern const char SubstrateConcat(_substrate_, __LINE__)[] SubstrateSection = name "=" value; 428 | 429 | #ifdef __cplusplus 430 | #define MSInitialize \ 431 | static void _MSInitialize(void); \ 432 | namespace { static class $MSInitialize { public: _finline $MSInitialize() { \ 433 | _MSInitialize(); \ 434 | } } $MSInitialize; } \ 435 | static void _MSInitialize() 436 | #else 437 | #define MSInitialize \ 438 | __attribute__((__constructor__)) static void _MSInitialize(void) 439 | #endif 440 | 441 | #define Foundation_f "/System/Library/Frameworks/Foundation.framework/Foundation" 442 | #define UIKit_f "/System/Library/Frameworks/UIKit.framework/UIKit" 443 | #define JavaScriptCore_f "/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore" 444 | #define IOKit_f "/System/Library/Frameworks/IOKit.framework/IOKit" 445 | 446 | #endif//SUBSTRATE_H_ 447 | --------------------------------------------------------------------------------