-#define Dylib_ "/Library/MobileSubstrate/MobileSubstrate.dylib"
-
-extern "C" void MSInitialize() {
- NSLog(@"MS:Warning: Entering Safe Mode");
-
- MSHookMessage(objc_getClass("SBButtonBar"), @selector(maxIconColumns), (IMP) &SBButtonBar$maxIconColumns, "ms$");
- MSHookMessage(objc_getClass("SBContentLayer"), @selector(initWithSize:), (IMP) &SBContentLayer$initWithSize$, "ms$");
- _SBStatusBar$mouseDown$ = MSHookMessage(objc_getClass("SBStatusBar"), @selector(mouseDown:), &$SBStatusBar$mouseDown$);
- _SBStatusBarTimeView$tile = MSHookMessage(objc_getClass("SBStatusBarTimeView"), @selector(tile), &$SBStatusBarTimeView$tile);
-
- char *dil = getenv("DYLD_INSERT_LIBRARIES");
- if (dil == NULL)
- NSLog(@"MS:Error: DYLD_INSERT_LIBRARIES is unset?");
- else {
- NSArray *dylibs([[NSString stringWithUTF8String:dil] componentsSeparatedByString:@":"]);
- NSUInteger index([dylibs indexOfObject:@ Dylib_]);
- if (index == NSNotFound)
- NSLog(@"MS:Error: dylib not in DYLD_INSERT_LIBRARIES?");
- else if ([dylibs count] == 1)
- unsetenv("DYLD_INSERT_LIBRARIES");
- else {
- NSMutableArray *value([[[NSMutableArray alloc] init] autorelease]);
- [value setArray:dylibs];
- [value removeObjectAtIndex:index];
- setenv("DYLD_INSERT_LIBRARIES", [[value componentsJoinedByString:@":"] UTF8String], !0);
- }
- }