From a8a6d9355ad74c9f6fd6b26a41972c9823240064 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 20 Sep 2012 22:11:03 +0000 Subject: [PATCH] Add some commented out code to debug open() calls. --- Library.mm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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: -- 2.47.2