Guest User

Untitled

a guest
Jul 16th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. //
  2. // Overboard.mm
  3. // Overboard
  4. //
  5. // Created by Aaron Alexander on 10/24/09.
  6. // Copyright __MyCompanyName__ 2009. All rights reserved.
  7. //
  8. // MobileSubstrate, libsubstrate.dylib, and substrate.h are
  9. // created and copyrighted by Jay Freeman a.k.a saurik and
  10. // are protected by various means of open source licensing.
  11. //
  12. // Additional defines courtesy Lance Fetters a.k.a ashikase
  13. //
  14.  
  15.  
  16. #include <substrate.h>
  17.  
  18. #import <SpringBoard/SpringBoard.h>
  19.  
  20.  
  21.  
  22. #define HOOK(class, name, type, args...) \
  23. static type (*_ ## class ## $ ## name)(class *self, SEL sel, ## args); \
  24. static type $ ## class ## $ ## name(class *self, SEL sel, ## args)
  25.  
  26. #define CALL_ORIG(class, name, args...) \
  27. _ ## class ## $ ## name(self, sel, ## args)
  28.  
  29.  
  30.  
  31.  
  32.  
  33. #pragma mark Hooked SpringBoard messages
  34. #pragma mark
  35.  
  36.  
  37. HOOK(SpringBoard, applicationDidFinishLaunching$, void, UIApplication *app) {
  38. CALL_ORIG(SpringBoard, applicationDidFinishLaunching$, app);
  39. NSLog(@"Congratulations, you've hooked SpringBoard!");
  40. }
  41.  
  42.  
  43.  
  44.  
  45.  
  46. #pragma mark dylib initialization and initial hooks
  47. #pragma mark
  48.  
  49. extern "C" void OverboardInitialize() {
  50. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  51.  
  52. //Check open application and create hooks here:
  53. NSString *identifier = [[NSBundle mainBundle] bundleIdentifier];
  54. if ([identifier isEqualToString:@"com.apple.springboard"]) {
  55.  
  56. Class $SpringBoard(objc_getClass("SpringBoard"));
  57. _SpringBoard$applicationDidFinishLaunching$ = MSHookMessage($SpringBoard, @selector(applicationDidFinishLaunching:), &$SpringBoard$applicationDidFinishLaunching$);
  58. }
  59.  
  60.  
  61. [pool release];
  62. }
Add Comment
Please, Sign In to add comment