From: Jay Freeman (saurik) Date: Thu, 20 Sep 2012 22:11:03 +0000 (+0000) Subject: Add some commented out code to debug open() calls. X-Git-Tag: v0.9.3906^0 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/a8a6d9355ad74c9f6fd6b26a41972c9823240064 Add some commented out code to debug open() calls. --- diff --git a/Library.mm b/Library.mm index 7b5a2b0..fb485cb 100644 --- a/Library.mm +++ b/Library.mm @@ -2141,6 +2141,25 @@ static void SBInitialize() { English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"]; } +/*MSHook(int, open, const char *path, int oflag, mode_t mode) { + int fd(_open(path, oflag, mode)); + + static bool no(false); + if (no) return fd; + no = true; + + if (strstr(path, "/icon") != NULL) + MSHookProcess(-1, ""); + + if (fd == -1 && errno == EFAULT) + NSLog(@"open(%p, %#x, %#o) = %d\n", path, oflag, mode, fd); + else + NSLog(@"open(\"%s\", %#x, %#o) = %d\n", path, oflag, mode, fd); + + no = false; + return fd; +}*/ + MSInitialize { $objc_setAssociatedObject = reinterpret_cast(dlsym(RTLD_DEFAULT, "objc_setAssociatedObject")); $objc_getAssociatedObject = reinterpret_cast(dlsym(RTLD_DEFAULT, "objc_getAssociatedObject")); @@ -2292,6 +2311,8 @@ MSInitialize { } // }}} + //MSHookFunction(reinterpret_cast(&open), MSHake(open)); + if (UIDebug_ && ![Manager_ fileExistsAtPath:@"/tmp/UIImages"]) { NSError *error(nil); if (![Manager_ createDirectoryAtPath:@"/tmp/UIImages" withIntermediateDirectories:NO attributes:[NSDictionary dictionaryWithObjectsAndKeys: