1 #import <Foundation/Foundation.h>
2 #include <objc/runtime.h>
6 void WBRename(const char *classname, const char *oldname) {
7 Class class = objc_getClass(classname);
8 size_t namelen = strlen(oldname);
9 char newname[sizeof(WBPrefix) + namelen];
10 memcpy(newname, WBPrefix, sizeof(WBPrefix) - 1);
11 memcpy(newname + sizeof(WBPrefix) - 1, oldname, namelen + 1);
12 Method method = class_getInstanceMethod(class, sel_getUid(oldname));
13 if (!class_addMethod(class, sel_registerName(newname), method->method_imp, method->method_types))
14 NSLog(@"WB: failed to rename %s::%s", classname, oldname);
18 if (NSClassFromString(@"SpringBoard") == nil)
21 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
23 NSLog(@"WB: changing season");
25 WBRename("SBBluetoothController", "noteDevicesChanged");
27 NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/WinterBoard.framework"];
29 NSLog(@"WB: there is no Santa :(");
30 else if (![bundle load])
31 NSLog(@"WB: sleigh was too heavy");