Skip to content

Commit

Permalink
fix dyld array generator and preference bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
jjolano committed May 15, 2019
1 parent 4595e1a commit 4b8a355
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 17 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .theos/last_package
Original file line number Diff line number Diff line change
@@ -1 +1 @@
./packages/me.jjolano.shadow_0.9-9+debug_iphoneos-arm.deb
./packages/me.jjolano.shadow_0.9-13+debug_iphoneos-arm.deb
Binary file added .vscode/ipch/d5766ed4ed372fac/mmap_address.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
install.exec "killall -9 SpringBoard"
SUBPROJECTS += shadowprefs
SUBPROJECTS += ShadowPreferences
include $(THEOS_MAKE_PATH)/aggregate.mk
2 changes: 1 addition & 1 deletion shadowprefs/Makefile → ShadowPreferences/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ include $(THEOS_MAKE_PATH)/bundle.mk

internal-stage::
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)
$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/shadowprefs.plist$(ECHO_END)
$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/ShadowPreferences.plist$(ECHO_END)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>shadowprefs</string>
<string>ShadowPreferences</string>
<key>CFBundleIdentifier</key>
<string>me.jjolano.shadow</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 12 additions & 13 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

NSMutableDictionary *jb_map = nil;
NSMutableArray *dyld_clean_array = nil;
uint32_t dyld_clean_array_count = 0;
uint32_t dyld_orig_count = 0;

NSMutableArray *generate_dyld_array(uint32_t count) {
Expand All @@ -37,7 +38,10 @@ NSMutableArray *generate_dyld_array(uint32_t count) {
|| [name containsString:@"cycript"]
|| [name containsString:@"SBInject"]
|| [name containsString:@"pspawn"]
|| [name containsString:@"applist"]) {
|| [name containsString:@"applist"]
|| [name hasPrefix:@"/Library/Frameworks"]
|| [name containsString:@"librocketbootstrap"]
|| [name containsString:@"libcolorpicker"]) {
// Skip adding this to clean dyld array.
continue;
}
Expand Down Expand Up @@ -402,30 +406,25 @@ BOOL is_path_restricted(NSMutableDictionary *map, NSString *path) {
%hookf(uint32_t, _dyld_image_count) {
uint32_t ret = %orig;

if(ret != dyld_orig_count) {
// Update dyld_clean_array
if(dyld_clean_array) {
[dyld_clean_array removeAllObjects];
}

dyld_orig_count = ret;
if(!dyld_clean_array) {
dyld_clean_array = generate_dyld_array(ret);
dyld_clean_array_count = [dyld_clean_array count];

#ifdef DEBUG
NSLog(@"[shadow] generated new clean dyld array");
NSLog(@"[shadow] generated new clean dyld array (%d/%d)", dyld_clean_array_count, ret);
#endif
}

if(dyld_clean_array && [dyld_clean_array count] > 0) {
return [dyld_clean_array count];
if(dyld_clean_array_count > 0) {
return dyld_clean_array_count;
}

return ret;
}

%hookf(const char *, _dyld_get_image_name, uint32_t image_index) {
if(dyld_clean_array && [dyld_clean_array count] > 0) {
if(image_index >= [dyld_clean_array count]) {
if(dyld_clean_array && dyld_clean_array_count > 0) {
if(image_index >= dyld_clean_array_count) {
return NULL;
}

Expand Down

0 comments on commit 4b8a355

Please sign in to comment.