Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Overboard.mm
- // Overboard
- //
- // Created by Aaron Alexander on 10/24/09.
- // Copyright __MyCompanyName__ 2009. All rights reserved.
- //
- // MobileSubstrate, libsubstrate.dylib, and substrate.h are
- // created and copyrighted by Jay Freeman a.k.a saurik and
- // are protected by various means of open source licensing.
- //
- // Additional defines courtesy Lance Fetters a.k.a ashikase
- //
- #include <substrate.h>
- #import <SpringBoard/SpringBoard.h>
- #define HOOK(class, name, type, args...) \
- static type (*_ ## class ## $ ## name)(class *self, SEL sel, ## args); \
- static type $ ## class ## $ ## name(class *self, SEL sel, ## args)
- #define CALL_ORIG(class, name, args...) \
- _ ## class ## $ ## name(self, sel, ## args)
- #pragma mark Hooked SpringBoard messages
- #pragma mark
- HOOK(SpringBoard, applicationDidFinishLaunching$, void, UIApplication *app) {
- CALL_ORIG(SpringBoard, applicationDidFinishLaunching$, app);
- NSLog(@"Congratulations, you've hooked SpringBoard!");
- }
- #pragma mark dylib initialization and initial hooks
- #pragma mark
- extern "C" void OverboardInitialize() {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- //Check open application and create hooks here:
- NSString *identifier = [[NSBundle mainBundle] bundleIdentifier];
- if ([identifier isEqualToString:@"com.apple.springboard"]) {
- Class $SpringBoard(objc_getClass("SpringBoard"));
- _SpringBoard$applicationDidFinishLaunching$ = MSHookMessage($SpringBoard, @selector(applicationDidFinishLaunching:), &$SpringBoard$applicationDidFinishLaunching$);
- }
- [pool release];
- }
Add Comment
Please, Sign In to add comment