├── .hgignore ├── .gitignore ├── mach_star ├── mach_inject │ ├── doxygen.command │ ├── main.c │ ├── mach_inject.h │ ├── mach_inject.xcodeproj │ │ └── project.pbxproj │ └── mach_inject.c ├── mach_override │ ├── doxygen.command │ ├── test_mach_override.cp │ ├── mach_override.h │ └── mach_override.xcodeproj │ │ └── project.pbxproj ├── mach_inject_sandbox │ ├── AppDelegate.h │ ├── InjectedBundleClass.h │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.nib │ │ │ ├── keyedobjects.nib │ │ │ ├── classes.nib │ │ │ └── info.nib │ ├── Japanese.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.nib │ │ │ ├── classes.nib │ │ │ ├── keyedobjects.nib │ │ │ └── info.nib │ ├── InjectedBundleClass.m │ ├── mach_inject_sandbox_Prefix.pch │ ├── main.m │ ├── AppDelegate.m │ ├── mach_inject_sandbox_bundle-Info.plist │ └── Info.plist ├── DisposeWindow+Beep_Injector │ ├── InjectorAppDelegate.h │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.nib │ │ │ ├── objects.nib │ │ │ ├── classes.nib │ │ │ └── info.nib │ ├── DisposeWindow+Beep_Injector_Prefix.pch │ ├── DisposeWindow+Beep_Injector.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── project.pbxproj │ ├── main.m │ ├── version.plist │ ├── Info.plist │ └── InjectorAppDelegate.m ├── mach_inject_test │ ├── injectee-AppDelegate.h │ ├── injected-PrincipalClass.h │ ├── injector-AppDelegate.h │ ├── English.lproj │ │ ├── injectee-InfoPlist.strings │ │ ├── injector-InfoPlist.strings │ │ ├── injectee-MainMenu.nib │ │ │ ├── keyedobjects.nib │ │ │ ├── classes.nib │ │ │ └── info.nib │ │ └── injector-MainMenu.nib │ │ │ ├── keyedobjects.nib │ │ │ ├── classes.nib │ │ │ └── info.nib │ ├── mach_inject_test_Prefix.pch │ ├── main.m │ ├── injected-Info.plist │ ├── injected-PrincipalClass.m │ ├── injectee-Info.plist │ ├── injectee-AppDelegate.m │ ├── injector-Info.plist │ └── injector-AppDelegate.m ├── DisposeWindow+Beep │ ├── English.lproj │ │ └── InfoPlist.strings │ ├── DisposeWindow+Beep_Prefix.pch │ ├── version.plist │ ├── DisposeWindow+Beep.c │ ├── Info.plist │ └── DisposeWindow+Beep.xcodeproj │ │ └── project.pbxproj ├── mach_inject_bundle │ ├── English.lproj │ │ └── InfoPlist.strings │ ├── main.c │ ├── mach_inject_bundle_Prefix.pch │ ├── mach_inject_bundle.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── project.pbxproj │ ├── version.plist │ ├── Info.plist │ ├── mach_inject_bundle.h │ └── mach_inject_bundle.c ├── mach_inject_bundle_stub │ ├── English.lproj │ │ └── InfoPlist.strings │ ├── mach_inject_bundle_stub_Prefix.pch │ ├── version.plist │ ├── mach_inject_bundle_stub.h │ ├── Info.plist │ ├── load_bundle.h │ ├── mach_inject_bundle_stub.c │ ├── load_bundle.c │ └── mach_inject_bundle_stub.xcodeproj │ │ └── project.pbxproj ├── .gitignore └── README.markdown ├── SIMBL Agent ├── English.lproj │ └── InfoPlist.strings ├── net.culater.SIMBL.Agent.plist ├── SIMBLAgent.h ├── Info.plist └── SIMBLAgent.m ├── SIMBL.xcodeproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── rez ├── SIMBL.sdef └── Info.plist ├── src ├── NSAlert_SIMBL.h ├── SIMBL_Prefix.pch ├── SIMBLPlugin.h ├── NSAlert_SIMBL.m ├── DTMacros.h ├── SIMBL.h ├── SIMBLPlugin.m └── SIMBL.m ├── pkg ├── uninstall ├── SIMBL.pmdoc │ ├── index.xml │ ├── 01simbl-contents.xml │ └── 01simbl.xml └── postflight ├── inject_helper └── main.c ├── install.sh ├── README.md └── CHANGES /.hgignore: -------------------------------------------------------------------------------- 1 | build 2 | .DS_Store 3 | rez/SIMBL.r 4 | .*\.xcodeproj/.*\.(mode*|pbxuser) 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | xcuserdata 3 | 4 | # generated file 5 | rez/SIMBL.r 6 | build 7 | -------------------------------------------------------------------------------- /mach_star/mach_inject/doxygen.command: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | cd "`dirname \"$0\"`" 3 | ~/Library/doxygen Doxyfile 4 | -------------------------------------------------------------------------------- /mach_star/mach_override/doxygen.command: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | cd "`dirname \"$0\"`" 3 | ~/Library/doxygen Doxyfile 4 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : NSObject {} 4 | @end 5 | -------------------------------------------------------------------------------- /SIMBL Agent/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/SIMBL Agent/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/InjectorAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface Injector : NSObject {} 4 | @end 5 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/InjectedBundleClass.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface InjectedBundleClass : NSObject {} 4 | @end 5 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injectee-AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface injectee_AppDelegate : NSObject {} 4 | @end 5 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injected-PrincipalClass.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface injected_PrincipalClass : NSObject {} 4 | @end 5 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injector-AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface injector_AppDelegate : NSObject 4 | { 5 | id pid; 6 | } 7 | @end 8 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/DisposeWindow+Beep/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_bundle/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_sandbox/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/Japanese.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_sandbox/Japanese.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_bundle_stub/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injectee-InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_test/English.lproj/injectee-InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injector-InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_test/English.lproj/injector-InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/DisposeWindow+Beep_Injector/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/main.c: -------------------------------------------------------------------------------- 1 | /* This is the default source file for new frameworks. */ 2 | 3 | /* You can either fill in code here or remove this and create or add new files. */ 4 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/Japanese.lproj/MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }); 3 | IBVersion = 1; 4 | } -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/English.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_sandbox/English.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/Japanese.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_sandbox/Japanese.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/English.lproj/MainMenu.nib/objects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/DisposeWindow+Beep_Injector/English.lproj/MainMenu.nib/objects.nib -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injectee-MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_test/English.lproj/injectee-MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injector-MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertz/simbl/HEAD/mach_star/mach_inject_test/English.lproj/injector-MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /mach_star/mach_inject/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (int argc, const char * argv[]) { 4 | // insert code here... 5 | printf("Hello, World!\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep/DisposeWindow+Beep_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'DisposeWindow+Beep' target in the 'DisposeWindow+Beep' project. 3 | // 4 | 5 | #include 6 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/InjectedBundleClass.m: -------------------------------------------------------------------------------- 1 | #import "InjectedBundleClass.h" 2 | 3 | @implementation InjectedBundleClass 4 | 5 | + (void)load { 6 | NSLog( @"+[InjectedBundleClass load]" ); 7 | } 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /SIMBL.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/mach_inject_bundle_stub_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'mach_inject_bundle_stub' target in the 'mach_inject_bundle_stub' project. 3 | // 4 | 5 | #include 6 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/mach_inject_test_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'mach_inject_test' target in the 'mach_inject_test' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/mach_inject_bundle_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'mach_inject_bundle' target in the 'mach_inject_bundle' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/mach_inject_sandbox_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'mach_inject_sandbox' target in the 'mach_inject_sandbox' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /mach_star/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | 3 | *.pbxuser 4 | *.perspectivev3 5 | *.mode1v3 6 | *.mode2v3 7 | !default.pbxuser 8 | !default.perspectivev3 9 | !default.mode1v3 10 | !default.mode2v3 11 | xcuserdata 12 | 13 | *~.nib 14 | *~.xib 15 | 16 | .DS_Store 17 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/DisposeWindow+Beep_Injector_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'DisposeWindow+Beep_Injector' target in the 'DisposeWindow+Beep_Injector' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/mach_inject_bundle.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/English.lproj/MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = AppDelegate; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/English.lproj/MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = Injector; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injectee-MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = "injectee_AppDelegate"; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injector-MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = "injector_AppDelegate"; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/DisposeWindow+Beep_Injector.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // mach_inject_test 4 | // 5 | // Created by wolf on 1/1/06. 6 | // Copyright __MyCompanyName__ 2006. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // mach_inject_sandbox 4 | // 5 | // Created by wolf on 1/1/06. 6 | // Copyright __MyCompanyName__ 2006. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /rez/SIMBL.sdef: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DisposeWindow+Beep_Injector 4 | // 5 | // Created by Jonathan 'Wolf' Rentzsch on 4/1/05. 6 | // Copyright __MyCompanyName__ 2005. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /src/NSAlert_SIMBL.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import 8 | 9 | @interface NSAlert (SIMBLAlert) 10 | 11 | + (void) errorAlert:(NSString*)_message withDetails:(NSString*)_details, ...; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #include "mach_inject_bundle/mach_inject_bundle.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 7 | printf("lol\n"); 8 | mach_error_t err = mach_inject_bundle_pid( [[[NSBundle mainBundle] pathForResource:@"mach_inject_sandbox_bundle" 9 | ofType:@"bundle"] fileSystemRepresentation], 10 | getpid() ); 11 | assert( !err ); 12 | } 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /SIMBL Agent/net.culater.SIMBL.Agent.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | net.culater.SIMBL.Agent 7 | Program 8 | /System/Library/Services/SIMBL.bundle/Contents/Resources/SIMBL Agent.app/Contents/MacOS/SIMBL Agent 9 | RunAtLoad 10 | 11 | OnDemand 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 92 7 | CFBundleVersion 8 | 1.0 9 | ProductBuildVersion 10 | 7K571 11 | ProjectName 12 | NibPBTemplates 13 | SourceVersion 14 | 1200000 15 | 16 | 17 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 12 7 | CFBundleVersion 8 | 1.0 9 | ProductBuildVersion 10 | 7K571 11 | ProjectName 12 | DevToolsWizardTemplates 13 | SourceVersion 14 | 3870000 15 | 16 | 17 | -------------------------------------------------------------------------------- /pkg/uninstall: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2003-2009, Mike Solomon 3 | # SIMBL is released under the GNU General Public License v2. 4 | # http://www.opensource.org/licenses/gpl-2.0.php 5 | 6 | LAUNCHD_PLIST="/Library/LaunchAgents/net.culater.SIMBL.Agent.plist" 7 | # stop any running agent by unloading it 8 | echo "Stopping SIMBL Agent..." 9 | /bin/launchctl unload -F -S Aqua "${LAUNCHD_PLIST}" 10 | 11 | echo "Removing SIMBL from LaunchAgents..." 12 | rm -f "$LAUNCHD_PLIST" 13 | 14 | echo "Removing SIMBL.osax..." 15 | rm -rf "/Library/ScriptingAdditions/SIMBL.osax" 16 | 17 | echo "SIMBL uninstalled." 18 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/Japanese.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 94 103 356 240 0 0 1280 1002 7 | IBEditorPositions 8 | 9 | 29 10 | 93 343 318 44 0 0 1280 1002 11 | 12 | IBFramework Version 13 | 403.0 14 | IBSystem Version 15 | 8A278 16 | 17 | 18 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep/version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 317 7 | CFBundleShortVersionString 8 | 1.0 9 | CFBundleVersion 10 | 1.0 11 | ProductBuildVersion 12 | 7K571 13 | ProjectName 14 | CarbonProjectTemplates 15 | SourceVersion 16 | 140000 17 | 18 | 19 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 317 7 | CFBundleShortVersionString 8 | 1.0 9 | CFBundleVersion 10 | 1.0 11 | ProductBuildVersion 12 | 7K571 13 | ProjectName 14 | CarbonProjectTemplates 15 | SourceVersion 16 | 140000 17 | 18 | 19 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/English.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 224 181 356 240 0 0 2560 1578 7 | IBEditorPositions 8 | 9 | 29 10 | 219 549 338 44 0 0 2560 1578 11 | 12 | IBFramework Version 13 | 443.0 14 | IBOpenObjects 15 | 16 | 29 17 | 18 | IBSystem Version 19 | 8F46 20 | 21 | 22 | -------------------------------------------------------------------------------- /SIMBL Agent/SIMBLAgent.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import 8 | 9 | @interface NSApplication (SystemVersion) 10 | 11 | - (void)getSystemVersionMajor:(unsigned *)major 12 | minor:(unsigned *)minor 13 | bugFix:(unsigned *)bugFix; 14 | 15 | @end 16 | 17 | 18 | @interface SIMBLAgent : NSObject { 19 | } 20 | 21 | - (void) applicationDidFinishLaunching:(NSNotification*)notification; 22 | - (void) loadInLaunchd; 23 | - (void) injectSIMBL:(NSNotification*)notification; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/English.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 25 67 356 240 0 0 1280 832 7 | IBEditorPositions 8 | 9 | 29 10 | 27 318 318 44 0 0 1280 832 11 | 12 | IBFramework Version 13 | 364.0 14 | IBOpenObjects 15 | 16 | 29 17 | 18 | IBSystem Version 19 | 7S215 20 | 21 | 22 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injectee-MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 383 188 356 240 0 0 2560 1578 7 | IBEditorPositions 8 | 9 | 29 10 | 219 549 338 44 0 0 2560 1578 11 | 12 | IBFramework Version 13 | 443.0 14 | IBOpenObjects 15 | 16 | 29 17 | 21 18 | 19 | IBSystem Version 20 | 8F46 21 | 22 | 23 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/English.lproj/injector-MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 11 183 356 240 0 0 2560 1578 7 | IBEditorPositions 8 | 9 | 29 10 | 219 549 338 44 0 0 2560 1578 11 | 12 | IBFramework Version 13 | 443.0 14 | IBOpenObjects 15 | 16 | 29 17 | 21 18 | 19 | IBSystem Version 20 | 8F46 21 | 22 | 23 | -------------------------------------------------------------------------------- /inject_helper/main.c: -------------------------------------------------------------------------------- 1 | // 2 | // main.c 3 | // inject_helper 4 | // 5 | // Created by Albert Zeyer on 07.09.11. 6 | // Copyright 2011 Albert Zeyer. All rights reserved. 7 | // 8 | 9 | /* 10 | We keep this as an extra small helper binary 11 | to have separate versions for each architecture 12 | for this. 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "SIMBL.h" 20 | 21 | int main (int argc, const char * argv[]) 22 | { 23 | assert(argc == 2); 24 | pid_t pid = atoi(argv[1]); 25 | assert(pid > 0); 26 | 27 | fprintf(stderr, "injecting into %i ...\n", pid); 28 | mach_inject_bundle_pid(SIMBLE_bundle_path, pid); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/mach_inject_sandbox_bundle-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.rentzsch.mach_inject_sandbox_bundle 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep/DisposeWindow+Beep.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "mach_override.h" 4 | 5 | // Override type & global. 6 | typedef void (*DisposeWindowProc)( WindowRef window ); 7 | DisposeWindowProc gDisposeWindow; 8 | 9 | // Funky Protos. 10 | void DisposeWindowOverride( WindowRef window ); 11 | 12 | __attribute__((constructor)) 13 | void load() 14 | { 15 | printf( "DisposeWindow+Beep loaded\n" ); 16 | if (mach_override( "_DisposeWindow", NULL, DisposeWindowOverride, (void**) &gDisposeWindow ) != 0) { 17 | printf("Override failed!\n"); 18 | } 19 | } 20 | 21 | void DisposeWindowOverride( WindowRef window ) { 22 | printf( "beep!\n" ); 23 | fflush(0); 24 | AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert); 25 | gDisposeWindow( window ); 26 | } -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/mach_inject_bundle_stub.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | mach_inject_bundle_stub.h 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | Design inspired by SCPatchLoader, by Jon Gotow of St. Clair Software: 7 | 8 | 9 | ***************************************************************************/ 10 | 11 | #ifndef _mach_inject_bundle_stub_ 12 | #define _mach_inject_bundle_stub_ 13 | 14 | #include // for ptrdiff_t 15 | 16 | typedef struct { 17 | ptrdiff_t codeOffset; 18 | char bundlePackageFileSystemRepresentation[1]; 19 | } mach_inject_bundle_stub_param; 20 | 21 | #endif // _mach_inject_bundle_stub_ -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injected-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.rentzsch.mach_inject_test_injected_bundle 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | NSPrincipalClass 20 | injected_PrincipalClass 21 | 22 | 23 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | DisposeWindow+Beep 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.apple.carbonbundletemplate 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | CSResourcesFileMapped 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | mach_inject_bundle 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.rentzsch.mach_inject_bundle 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/SIMBL_Prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | 4 | #import 5 | 6 | // make some debug logging available everywhere 7 | // FIXME: move this somewhere more reusable 8 | #ifdef DEBUG 9 | #define DTLogDebug(format, ...) asl_log(NULL, NULL, ASL_LEVEL_DEBUG, "%s", [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String]) 10 | #else 11 | #define DTLogDebug(format, ...) 12 | #endif 13 | #define DTLogInfo(format, ...) asl_log(NULL, NULL, ASL_LEVEL_INFO, "%s", [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String]) 14 | #define DTLogNotice(format, ...) asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "%s", [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String]) 15 | #define DTLogError(format, ...) asl_log(NULL, NULL, ASL_LEVEL_ERR, "%s", [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String]) 16 | #endif 17 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | mach_inject_bundle_stub 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.apple.carbonbundletemplate 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | CSResourcesFileMapped 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injected-PrincipalClass.m: -------------------------------------------------------------------------------- 1 | #import "injected-PrincipalClass.h" 2 | 3 | @interface NSObject (mach_inject_test_injectee_app) 4 | - (void)notifyInjecteeSuccessfullyInjected; 5 | @end 6 | 7 | @interface mach_inject_test_injected_bundle : NSObject {} 8 | - (unsigned)testInjectedBundle; 9 | @end 10 | @implementation mach_inject_test_injected_bundle 11 | - (unsigned)testInjectedBundle { 12 | return 42; 13 | } 14 | @end 15 | 16 | @implementation injected_PrincipalClass 17 | 18 | + (void)load { 19 | printf("LOADDDDDDDDDD!\n"); 20 | NSConnection *connection = [[NSConnection defaultConnection] retain]; 21 | [connection setRootObject:[[[mach_inject_test_injected_bundle alloc] init] autorelease]]; 22 | [connection registerName:[[connection rootObject] className]]; 23 | 24 | [[NSApp delegate] notifyInjecteeSuccessfullyInjected]; 25 | assert(0); 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injectee-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.rentzsch.mach_inject_test_injectee_app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | NSMainNibFile 20 | injectee-MainMenu 21 | NSPrincipalClass 22 | NSApplication 23 | 24 | 25 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injectee-AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "injectee-AppDelegate.h" 2 | 3 | @interface NSObject (mach_inject_test_injector_app) 4 | - (void)notifyInjectorReadyForInjection; 5 | - (void)notifyInjectorSuccessfullyInjected; 6 | @end 7 | 8 | @implementation injectee_AppDelegate 9 | 10 | - (void)applicationDidFinishLaunching:(NSNotification*)notification_ { 11 | return; 12 | id injector = [NSConnection rootProxyForConnectionWithRegisteredName:@"mach_inject_test_injector_app" host:nil]; 13 | printf("hi!!!\n"); 14 | assert( injector ); 15 | [injector notifyInjectorReadyForInjection]; 16 | } 17 | 18 | - (void)notifyInjecteeSuccessfullyInjected { 19 | return; 20 | printf("OMG injected!!!\n"); 21 | id injector = [NSConnection rootProxyForConnectionWithRegisteredName:@"mach_inject_test_injector_app" host:nil]; 22 | assert( injector ); 23 | [injector notifyInjectorSuccessfullyInjected]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | DisposeWindow+Beep_Injector 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.apple.myCocoaApp 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | APPL 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | NSMainNibFile 22 | MainMenu 23 | NSPrincipalClass 24 | NSApplication 25 | 26 | 27 | -------------------------------------------------------------------------------- /mach_star/mach_inject_sandbox/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.yourcompany.mach_inject_sandbox 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | cd "$(dirname "$0")" 4 | 5 | xcodebuild -workspace SIMBL.xcodeproj/project.xcworkspace -scheme SIMBL SYMROOT=$(pwd)/build || exit -1 6 | 7 | fr="build/Development/SIMBL.bundle" 8 | 9 | execpath="$fr/Contents/Resources/SIMBL Agent.app/Contents/MacOS/" 10 | 11 | for execname in "SIMBL Agent" "inject_helper_32" "inject_helper_64"; do 12 | install_name_tool -add_rpath \ 13 | "/System/Library/Services/SIMBL.bundle/Contents/Resources/SIMBL Agent.app/Contents" \ 14 | "$execpath/$execname" 15 | done 16 | 17 | echo "fixing permissions. setting SUID, etc. .." 18 | sudo chown root $execpath/inject_helper_* 19 | sudo chgrp procmod $execpath/inject_helper_* 20 | sudo chmod ug+s $execpath/inject_helper_* 21 | 22 | D="/System/Library/Services/" 23 | echo "copying .." 24 | sudo rm -rf "$D/SIMBL.bundle" 25 | sudo cp -a ${fr} $D 26 | 27 | # reinstall SIMBL Agent 28 | launchctl remove net.culater.SIMBL.Agent 29 | "$D/SIMBL.bundle/Contents/Resources/SIMBL Agent.app/Contents/MacOS/SIMBL Agent" -psn 30 | -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injector-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.rentzsch.mach_inject_test_injector_app 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | injector-MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/SIMBLPlugin.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import 8 | 9 | @interface SIMBLPlugin : NSObject 10 | { 11 | NSString* path; 12 | NSDictionary* info; 13 | } 14 | 15 | + (SIMBLPlugin*) bundleWithPath:(NSString*)_path; 16 | - (SIMBLPlugin*) initWithPath:(NSString*)_path; 17 | - (void) dealloc; 18 | 19 | - (NSString*) path; 20 | - (void) setPath:(NSString*)_path; 21 | - (NSDictionary*) info; 22 | - (void) setInfo:(NSDictionary*)_info; 23 | - (NSString*) bundleIdentifier; 24 | - (id) objectForInfoDictionaryKey:(NSString*)key; 25 | 26 | - (NSString*) _dt_info; 27 | - (NSString*) _dt_version; 28 | - (NSString*) _dt_bundleVersion; 29 | - (NSString*) _dt_name; 30 | 31 | @end 32 | 33 | 34 | @interface NSBundle (SIMBLCocoaExtensions) 35 | 36 | - (NSString*) _dt_info; 37 | - (NSString*) _dt_version; 38 | - (NSString*) _dt_bundleVersion; 39 | - (NSString*) _dt_name; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /pkg/SIMBL.pmdoc/index.xml: -------------------------------------------------------------------------------- 1 | SIMBL/Users/mike/Projects/simbl/dist/SIMBL-0.9.9/SIMBL-0.9.9b.pkgnet.culaterSIMBL for Leopards!FailureThis version of SIMBL only works with Mac OS X 10.5.x and newer.01simbl.xmldescriptionproperties.titleextraFilesproperties.customizeOptionpostinstallActions.actionsproperties.systemDomainproperties.anywhereDomain -------------------------------------------------------------------------------- /SIMBL Agent/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | net.culater.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | SIMa 21 | CFBundleVersion 22 | ${PRODUCT_VERSION} 23 | CFBundleShortVersionString 24 | ${PRODUCT_VERSION} 25 | NSMainNibFile 26 | MainMenu 27 | NSPrincipalClass 28 | NSApplication 29 | LSUIElement 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /pkg/SIMBL.pmdoc/01simbl-contents.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/NSAlert_SIMBL.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import "NSAlert_SIMBL.h" 8 | 9 | @implementation NSAlert (SIMBLAlert) 10 | 11 | + (void) errorAlert:(NSString*)_message withDetails:(NSString*)_details, ... 12 | { 13 | va_list ap; 14 | va_start(ap, _details); 15 | 16 | NSString* detailsFormatted = [[[NSString alloc] initWithFormat:_details arguments:ap] autorelease]; 17 | va_end(ap); 18 | 19 | NSBeginAlertSheet( 20 | _message, // sheet message 21 | nil, // default button label 22 | nil, // alternate button label 23 | nil, // no third button 24 | nil, // window sheet is attached to fixme: should i attach to the front-most window 25 | nil, // we don't need a delegate 26 | nil, // did-end selector 27 | nil, // no need for did-dismiss selector 28 | nil, // context info 29 | detailsFormatted, // additional text 30 | nil); // no parameters in message 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /rez/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${EXECUTABLE_NAME} ${PRODUCT_VERSION}, ©2003-2009 Mike Solomon 11 | CFBundleIdentifier 12 | net.culater.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | osax 19 | CFBundleShortVersionString 20 | ${PRODUCT_VERSION} 21 | CFBundleSignature 22 | SIM∞ 23 | CFBundleVersion 24 | ${PRODUCT_VERSION} 25 | OSAScriptingDefinition 26 | ${PRODUCT_NAME}.sdef 27 | OSAXHandlers 28 | 29 | Events 30 | 31 | SIMeload 32 | 33 | Context 34 | Process 35 | Handler 36 | InjectEventHandler 37 | ThreadSafe 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /pkg/SIMBL.pmdoc/01simbl.xml: -------------------------------------------------------------------------------- 1 | net.culater.simbl.SIMBL.pkg15../build/Deployment/SIMBL.osax/Library/ScriptingAdditionsallowRevertinstallFrom.isRelativeTypeparentlocationTypescripts.postinstall.isRelativeTypeinstallToversionpostflight01simbl-contents.xml/CVS$/\.svn$/\.cvsignore$/\.cvspass$/\.DS_Store$ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SIMBL - SIMBL is the SIMple Bundle Loader 2 | ========================================= 3 | 4 | Official homepage: 5 | 6 | This is a fork of SIMBL with a few additions / changes: 7 | 8 | * It fixes the "Please update this scripting addition to supply a value for ThreadSafe for each event handler" warning which occurs in console ([bug report](http://code.google.com/p/simbl/issues/detail?id=7)). This makes it incompatible with 10.5 and older (that is why upstream didn't want to patch it). 9 | 10 | * It searches for SIMBL plugins in all directories, i.e. also `/System/Library/Application Support/SIMBL/Plugins` where it hasn't searched earlier. Technically, earlier, it searched only in `NSUserDomainMask | NSLocalDomainMask | NSNetworkDomainMask` whereby now, it searches in `NSAllDomainsMask`. 11 | 12 | * It must be installed now into `/System/Library/Services/`. Run `sudo "/System/Library/Services/SIMBL.bundle/Contents/Resources/SIMBL Agent.app/Contents/MacOS/SIMBL Agent" -psn` for setup. 13 | 14 | * It uses `mach_inject_bundle_pid` from [mach_star](https://github.com/rentzsch/mach_star) ([my fork of mach_star](https://github.com/albertz/mach_star)). 15 | 16 | The changes regarding `/System/` are needed to make it working again with recent Chrome versions. See [here](http://stackoverflow.com/questions/7269704/google-chrome-openscripting-framework-cant-find-entry-point-injecteventhandle/) for details. 17 | 18 | Blacklist an application: 19 | 20 | defaults write net.culater.SIMBL_Agent SIMBLApplicationIdentifierBlacklist -array com.apple.Safari 21 | 22 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/InjectorAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "InjectorAppDelegate.h" 2 | #import 3 | 4 | @implementation Injector 5 | 6 | static 7 | OSErr 8 | FindProcessBySignature( 9 | OSType type, 10 | OSType creator, 11 | ProcessSerialNumber *psn ) 12 | { 13 | ProcessSerialNumber tempPSN = { 0, kNoProcess }; 14 | ProcessInfoRec procInfo; 15 | OSErr err = noErr; 16 | 17 | procInfo.processInfoLength = sizeof( ProcessInfoRec ); 18 | procInfo.processName = nil; 19 | //procInfo.processAppSpec = nil; 20 | 21 | while( !err ) { 22 | err = GetNextProcess( &tempPSN ); 23 | if( !err ) 24 | err = GetProcessInformation( &tempPSN, &procInfo ); 25 | if( !err 26 | && procInfo.processType == type 27 | && procInfo.processSignature == creator ) { 28 | *psn = tempPSN; 29 | return noErr; 30 | } 31 | } 32 | 33 | return err; 34 | } 35 | 36 | - (void)applicationDidFinishLaunching:(NSNotification*)notification_ { 37 | NSString *bundlePath = [[NSBundle mainBundle] 38 | pathForResource:@"DisposeWindow+Beep" ofType:@"bundle"]; 39 | 40 | // Find target by signature. 41 | ProcessSerialNumber psn; 42 | FindProcessBySignature( 'FNDR', 'MACS', &psn ); 43 | 44 | // Convert PSN to PID. 45 | pid_t pid; 46 | GetProcessPID( &psn, &pid ); 47 | 48 | printf("pid %d\n", pid); 49 | mach_error_t err = mach_inject_bundle_pid( 50 | [bundlePath fileSystemRepresentation], pid ); 51 | mach_error("shit", err); 52 | NSLog( @"err = %d", err ); 53 | [NSApp terminate:nil]; 54 | } 55 | 56 | @end -------------------------------------------------------------------------------- /CHANGES: -------------------------------------------------------------------------------- 1 | 0.9.9 - Integrated fix for postinstall script which could erroneously report failure. Incorporate patch for the Agent to more gracefully handle malformed bundles. 2 | 3 | 0.9.8 - Integrated fix for installer permissions. Fixed event handling on Leopard. Changed installer not to allow relocation. Fixed potential leak. Apps could reclaim almost 100-200 bytes. Don't spend it all in one place. 4 | 5 | 0.9.7 - Added variable-level logging. Tweaked the installer to prune the Leopard OSAX event. Added application blacklisting to alleviate odd and annoying crash bug in the ScriptingBridge. 6 | 7 | 0.9.6 - Fixed installer package now that I have a better understanding of how/when LaunchAgents get started. SIMBL Agent now only triggers an inject event when it is sure that there is a plugin present for the application that just loaded. This should cut down on the admittedly small overhead, but makes me feel it's much more efficient. 8 | 9 | 0.9.5 - Simpler AppleEvent delivery. Better installer package - fixes some permission issues with bad installs. Properly force agent to restart after the installer runs. Added uninstall script. 10 | 11 | 0.9.4 - Improved the bundle injection code which prevents an application from getting launched twice in some cases. 12 | 13 | 0.9.3 - Added compatibility with garbage collected applications. Installer now removes the InputManager version of SIMBL. 14 | 15 | 0.9.2 - Rebuilt the SIMBL as a combination OSAX and Agent. This addresses the issue InputManagers and 64-bit behavior on Snow Leopard (10.6). This release is backward compatible with Leopard (10.5) as well. This version also includes the packaging process, which is non-trivial. 16 | 17 | 0.8.3 - Imported the original SIMBL tree. Aside from minor source tweaks (adding license headers) this is functionally identical to 0.8.2. 18 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/load_bundle.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | load_bundle.h 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | ***************************************************************************/ 7 | 8 | #ifndef _loader_ 9 | #define _loader_ 10 | 11 | #include 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #define err_load_bundle_undefined_symbol (err_local|1) 18 | #define err_load_bundle_link_failed (err_local|2) 19 | #define err_load_bundle_url_from_path (err_local|3) 20 | #define err_load_bundle_create_bundle (err_local|4) 21 | #define err_load_bundle_package_executable_url (err_local|5) 22 | #define err_load_bundle_path_from_url (err_local|6) 23 | #define err_load_bundle_NSObjectFileImageFailure \ 24 | (err_local|7+NSObjectFileImageFailure) 25 | #define err_load_bundle_NSObjectFileImageInappropriateFile \ 26 | (err_local|7+NSObjectFileImageInappropriateFile) 27 | #define err_load_bundle_NSObjectFileImageArch \ 28 | (err_local|7+NSObjectFileImageArch) 29 | #define err_load_bundle_NSObjectFileImageFormat \ 30 | (err_local|7+NSObjectFileImageFormat) 31 | #define err_load_bundle_NSObjectFileImageAccess \ 32 | (err_local|7+NSObjectFileImageAccess) 33 | 34 | // High-level: For loading 'MyBundle.bundle'. Calls load_bundle_executable(). 35 | mach_error_t 36 | load_bundle_package( 37 | const char *bundlePackageFileSystemRepresentation ); 38 | 39 | // Low-level: For loading 'MyBundle.bundle/Contents/MacOS/MyBundle'. 40 | mach_error_t 41 | load_bundle_executable( 42 | const char *bundleExecutableFileSystemRepresentation ); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | #endif // _loader_ -------------------------------------------------------------------------------- /src/DTMacros.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import 8 | 9 | 10 | #define DTOwnerBundle [NSBundle bundleForClass:[self class]] 11 | 12 | #define DTPathFromComponents(...) [NSString pathWithComponents:[NSArray arrayWithObjects:__VA_ARGS__, nil]] 13 | 14 | #define Yes [NSNumber numberWithBool:YES] 15 | #define No [NSNumber numberWithBool:NO] 16 | 17 | #define Int(x) [NSNumber numberWithInt:x] 18 | 19 | enum DTLogLevel 20 | { 21 | DTLog_Developer = 0, 22 | DTLog_Debug = 10, 23 | DTLog_Log = 20, 24 | DTLog_Alert = 30, 25 | DTLog_Critical = 40, 26 | 27 | DebugLevel00 = 0, 28 | DebugLevel10 = 10, 29 | DebugLevel20 = 20, 30 | DebugLevel30 = 30, 31 | DebugLevel40 = 40, 32 | DebugLevel50 = 50, 33 | }; 34 | 35 | #define DLOG_0 0 36 | #define DLOG_10 10 37 | #define DLOG_20 20 38 | #define DLOG_30 30 39 | #define DLOG_40 40 40 | #define DLOG_50 50 41 | 42 | #define DTAssert(condition) NSAssert(condition, [NSString stringWithCString:"assert " #condition " failed"]) 43 | 44 | #ifdef DEBUG 45 | #define DLog(logLevel, arg) if (logLevel >= DEBUG) NSLog arg 46 | #define DTLog(logLevel, ...) if (logLevel >= DEBUG) NSLog(__VA_ARGS__) 47 | #define DTLogOnCondition(logLevel, condition, ...) if (logLevel >= DEBUG && (condition)) NSLog(__VA_ARGS__) 48 | #define DTLogMessage() NSLog(@"[%@ %@]", [self className], NSStringFromSelector(_cmd)) 49 | #define DTLogMessageCall() \ 50 | Method* method = class_getInstanceMethod([self class], _cmd); \ 51 | unsigned _numArgs = method_getNumberOfArguments(method); \ 52 | for (int i = 0; i < _numArgs; i++) \ 53 | { \ 54 | const char* type; \ 55 | int offset; \ 56 | unsigned _stackSize = method_getArgumentInfo(method, i, &type, &offset); \ 57 | } 58 | #else 59 | #define DLog(logLevel, arg) 60 | #define DTLog(logLevel, ...) 61 | #define DTLogOnCondition(logLevel, condition, ...) 62 | #define DTLogMessage() 63 | #endif 64 | -------------------------------------------------------------------------------- /src/SIMBL.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #define SIMBLE_bundle_path "/System/Library/Services/SIMBL.bundle" 8 | #define SIMBLEAGENT_bundle_path SIMBLE_bundle_path "/Contents/Resources/SIMBL Agent.app" 9 | 10 | #ifdef __OBJC__ 11 | 12 | #import 13 | #import "SIMBLPlugin.h" 14 | 15 | #define SIMBLPluginPath @"Application Support/SIMBL/Plugins" 16 | #define SIMBLStringTable @"SIMBLStringTable" 17 | #define SIMBLApplicationIdentifier @"SIMBLApplicationIdentifier" 18 | #define SIMBLTargetApplications @"SIMBLTargetApplications" 19 | #define SIMBLBundleIdentifier @"BundleIdentifier" 20 | #define SIMBLMinBundleVersion @"MinBundleVersion" 21 | #define SIMBLMaxBundleVersion @"MaxBundleVersion" 22 | #define SIMBLTargetApplicationPath @"TargetApplicationPath" 23 | #define SIMBLRequiredFrameworks @"RequiredFrameworks" 24 | 25 | #define SIMBLPrefKeyLogLevel @"SIMBLLogLevel" 26 | #define SIMBLLogLevelDefault 2 27 | #define SIMBLLogLevelNotice 2 28 | #define SIMBLLogLevelInfo 1 29 | #define SIMBLLogLevelDebug 0 30 | 31 | @protocol SIMBLPlugin 32 | + (void) install; 33 | @end 34 | 35 | #define SIMBLLogDebug(format, ...) [SIMBL logMessage:[NSString stringWithFormat:format, ##__VA_ARGS__] atLevel:SIMBLLogLevelDebug] 36 | #define SIMBLLogInfo(format, ...) [SIMBL logMessage:[NSString stringWithFormat:format, ##__VA_ARGS__] atLevel:SIMBLLogLevelInfo] 37 | #define SIMBLLogNotice(format, ...) [SIMBL logMessage:[NSString stringWithFormat:format, ##__VA_ARGS__] atLevel:SIMBLLogLevelNotice] 38 | 39 | 40 | @interface SIMBL : NSObject 41 | { 42 | } 43 | 44 | + (void) logMessage:(NSString*)message atLevel:(int)level; 45 | + (void) installPlugins; 46 | + (BOOL) shouldInstallPluginsIntoApplication:(NSBundle*)_appBundle; 47 | + (BOOL) loadBundleAtPath:(NSString*)_bundlePath; 48 | + (BOOL) shouldLoadBundleAtPath:(NSString*)_bundlePath; 49 | + (BOOL) shouldApplication:(NSBundle*)_appBundle loadBundleAtPath:(NSString*)_bundlePath; 50 | + (BOOL) shouldApplication:(NSBundle*)_appBundle loadBundle:(SIMBLPlugin*)_bundle withApplicationIdentifiers:(NSArray*)_applicationIdentifiers; 51 | + (BOOL) shouldApplication:(NSBundle*)_appBundle loadBundle:(SIMBLPlugin*)_bundle withTargetApplications:(NSArray*)_targetApplications; 52 | + (BOOL) loadBundle:(SIMBLPlugin*)_bundle; 53 | 54 | @end 55 | 56 | #endif // __OBJC__ 57 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/mach_inject_bundle.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | mach_inject_bundle.h 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | ***************************************************************************/ 7 | 8 | /***************************************************************************//** 9 | @mainpage mach_inject_bundle 10 | @author Jonathan 'Wolf' Rentzsch: 11 | 12 | Higher-level interface for mach_inject. This framework, intended to be 13 | embedded into your application, allows you to "inject and forget" an 14 | arbitrary bundle into an arbitrary process. It supplies the primitive code 15 | block that gets squirted across the address spaces 16 | (mach_inject_bundle_stub), which was the trickiest thing to write. 17 | 18 | It's a Cocoa framework right now, but I intend to make it usable from Carbon 19 | apps as well. Indeed, it already may be -- it doesn't use Cocoa or 20 | Objective-C at all. I just haven't tried yet. 21 | 22 | @todo Supply a higher-level interface to specifying processes than just a 23 | process ID. I'm thinking offering lookup via application ID 24 | ("com.apple.Finder") and via type/creator ('FNDR', 'MACS'). 25 | 26 | ***************************************************************************/ 27 | 28 | #ifndef _mach_inject_bundle_ 29 | #define _mach_inject_bundle_ 30 | 31 | #include 32 | #include 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | #define err_mach_inject_bundle_couldnt_load_framework_bundle (err_local|1) 39 | #define err_mach_inject_bundle_couldnt_find_injection_bundle (err_local|2) 40 | #define err_mach_inject_bundle_couldnt_load_injection_bundle (err_local|3) 41 | #define err_mach_inject_bundle_couldnt_find_inject_entry_symbol (err_local|4) 42 | 43 | /***************************************************************************//** 44 | 45 | 46 | @param bundlePackageFileSystemRepresentation -> Required pointer 47 | @param pid -> 48 | @result <- mach_error_t 49 | 50 | ***************************************************************************/ 51 | 52 | mach_error_t 53 | mach_inject_bundle_pid( 54 | const char *bundlePackageFileSystemRepresentation, 55 | pid_t pid ); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | #endif // _mach_inject_bundle_ -------------------------------------------------------------------------------- /mach_star/mach_inject_test/injector-AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "injector-AppDelegate.h" 2 | #import 3 | 4 | NSTask *gInjecteeTask; 5 | 6 | @interface NSObject (mach_inject_test_injected_bundle) 7 | - (unsigned)testInjectedBundle; 8 | @end 9 | 10 | @interface mach_inject_test_injector_app : NSObject {} 11 | - (void)notifyInjectorReadyForInjection; 12 | @end 13 | @implementation mach_inject_test_injector_app 14 | - (void)notifyInjectorReadyForInjection { 15 | NSString *injectedBundlePath = [[NSBundle mainBundle] pathForResource:@"mach_inject_test_injected" 16 | ofType:@"bundle"]; 17 | assert( injectedBundlePath ); 18 | 19 | printf("injecting pid\n"); 20 | mach_error_t err = mach_inject_bundle_pid( [injectedBundlePath fileSystemRepresentation], 21 | [gInjecteeTask processIdentifier] ); 22 | printf("hi\n"); 23 | assert( !err ); 24 | } 25 | - (void)notifyInjectorSuccessfullyInjected { 26 | printf("successfully!\n"); 27 | id injectedBundle = [NSConnection rootProxyForConnectionWithRegisteredName:@"mach_inject_test_injected_bundle" host:nil]; 28 | assert( injectedBundle ); 29 | assert( 42 == [injectedBundle testInjectedBundle] ); 30 | 31 | [gInjecteeTask terminate]; 32 | [NSApp terminate:nil]; 33 | } 34 | @end 35 | 36 | @implementation injector_AppDelegate 37 | 38 | - (void)inject:(IBOutlet)sender 39 | { 40 | pid_t process_id = [pid intValue]; 41 | printf("injecting into pid %d\n", process_id); 42 | NSString *injectedBundlePath = [[NSBundle mainBundle] pathForResource:@"mach_inject_test_injected" 43 | ofType:@"bundle"]; 44 | assert( injectedBundlePath ); 45 | 46 | printf("injecting pid\n"); 47 | mach_error_t err = mach_inject_bundle_pid( [injectedBundlePath fileSystemRepresentation], 48 | process_id ); 49 | printf("hi\n"); 50 | assert( !err ); 51 | } 52 | 53 | - (void)applicationDidFinishLaunching:(NSNotification*)notification_ { 54 | return; 55 | NSConnection *connection = [[NSConnection defaultConnection] retain]; 56 | [connection setRootObject:[[[mach_inject_test_injector_app alloc] init] autorelease]]; 57 | [connection registerName:[[connection rootObject] className]]; 58 | 59 | assert( ![NSConnection rootProxyForConnectionWithRegisteredName:@"mach_inject_test_injected_bundle" host:nil] ); 60 | 61 | NSString *injecteeAppPath = [[NSBundle mainBundle] pathForResource:@"mach_inject_test_injectee" 62 | ofType:@"app"]; 63 | assert( injecteeAppPath ); 64 | gInjecteeTask = [NSTask launchedTaskWithLaunchPath:[injecteeAppPath stringByAppendingString:@"/Contents/MacOS/mach_inject_test_injectee"] 65 | arguments:[NSArray array]]; 66 | assert( gInjecteeTask ); 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /mach_star/README.markdown: -------------------------------------------------------------------------------- 1 | #`mach_star` 2 | 3 | `mach_star` is an open-source code suite for suppressing, replacing and/or extending Mac OS X functionality at a very low level. Its principal components are `mach_override` (replace and/or extend existing functions at runtime) and `mach_inject` (dynamically load your code into a running process). 4 | 5 | Please use [`mach_star's` Lighthouse project site](http://rentzsch.lighthouseapp.com/projects/27728-mach_star/tickets) to [file bugs or feature requests](http://rentzsch.lighthouseapp.com/projects/27728-mach_star/tickets/new). 6 | 7 | ##Version History 8 | 9 | **`mach_star` 1.1.1 (Sun Dec 18 2005) [download](http://rentzsch.com/share/mach_star-1.1.1.zip)** 10 | 11 | * General Xcode 2.2 project cleanup. `mach_star` now includes `.xcodeproj` Xcode 2.2 project files for all of its projects. The old `.xcode` project files have been left in place, but they aren't maintained and may not work. Xcode 2.2 is the recommended `mach_star` development environment -- Xcode 2.1 had a bug with inter-project dependancies which would cause compilation failure. It works now again in Xcode 2.2. 12 | 13 | * Inter-project dependancies should working under Xcode 2.2. Any project you pick, you should just be able to hit the "Build" button and everything should Just Work™. 14 | 15 | * There was a stray reference to my username in one of the project, which causes compilation headaches for some folks. 16 | 17 | * Bug fix: in `mach_inject_bundle.c`'s `mach_inject_bundle_pid()` I no longer call `CFRelease()` on the framework bundle reference. Reported by Scott Kevill. 18 | 19 | * Added some explicit casts now required by gcc 4. 20 | 21 | * Added this document. 22 | 23 | **`mach_star` 1.1 (Wed Apr 06 2005) [download](http://rentzsch.com/share/mach_star-1.1.zip)** 24 | 25 | * New package added: `mach_inject_bundle`. It has a private subproject: `mach_inject_bundle_stub`. The stub is a generic reusable implementation of the code that gets squirted across the address spaces, which was always tricky to write. `mach_inject_bundle` is an embeddable framework that wraps `mach_inject` and the stub with a simple fire-and-forget API. 26 | 27 | * The "DisposeWindowBeeperOverride" example is replaced by "DisposeWindow+Beep". 28 | 29 | * The "FinderDisposeWindowBeeperInjector" is replaced by "DisposeWindow+Beep_Injector". 30 | 31 | * All the text is now wrapped to 80 chars wide. Done to print nicely in Scott Knaster's [Hacking Mac OS X Tiger](http://www.amazon.com/exec/obidos/ASIN/076458345X). Probably will undo this word-wrap in the future. We all have widescreens nowadays, right? ;-) 32 | 33 | * Thanks to Jon Gotow for letting me peek at `SCPatch`, which I used as a guide for `mach_inject_bundle`. It saved me a bunch of time. Also thanks to Bob Ippolito for `CALL_ON_LOAD` assistance. 34 | 35 | **`mach_star` 1.0 (Wed Jun 18 2003)** 36 | 37 | * Initial release at MacHack 2003. 38 | 39 | ##License 40 | 41 | mach_star used to be licensed under the [Creative Commons Attribution License 2.0](http://creativecommons.org/licenses/by/2.0/), but is [now released under the MIT License](http://opensource.org/licenses/mit-license.php). -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/mach_inject_bundle.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | mach_inject_bundle.c 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | ***************************************************************************/ 7 | 8 | #include "mach_inject_bundle.h" 9 | #include "mach_inject.h" 10 | #include "mach_inject_bundle_stub.h" 11 | #include 12 | 13 | mach_error_t 14 | mach_inject_bundle_pid( 15 | const char *bundlePackageFileSystemRepresentation, 16 | pid_t pid ) 17 | { 18 | assert( bundlePackageFileSystemRepresentation ); 19 | assert( pid > 0 ); 20 | 21 | mach_error_t err = err_none; 22 | 23 | // Get the framework's bundle. 24 | CFBundleRef frameworkBundle = NULL; 25 | if( !err ) { 26 | frameworkBundle = CFBundleGetBundleWithIdentifier( 27 | CFSTR("com.rentzsch.mach_inject_bundle")); 28 | if( frameworkBundle == NULL ) 29 | err = err_mach_inject_bundle_couldnt_load_framework_bundle; 30 | } 31 | 32 | // Find the injection bundle by name. 33 | CFURLRef injectionURL = NULL; 34 | if( !err ) { 35 | /*injectionURL = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, CFSTR("mach_inject_bundle_stub.bundle"), 36 | kCFURLPOSIXPathStyle, true );*/ 37 | injectionURL = CFBundleCopyResourceURL( frameworkBundle, 38 | CFSTR("mach_inject_bundle_stub.bundle"), NULL, NULL ); 39 | 40 | /*char url[1024]; 41 | CFURLGetFileSystemRepresentation(injectionURL, true, url, 1024); 42 | printf("got a URL %s\n", url);*/ 43 | if( !injectionURL ) 44 | err = err_mach_inject_bundle_couldnt_find_injection_bundle; 45 | } 46 | 47 | // Create injection bundle instance. 48 | CFBundleRef injectionBundle = NULL; 49 | if( !err ) { 50 | injectionBundle = CFBundleCreate( kCFAllocatorDefault, injectionURL ); 51 | if( !injectionBundle ) 52 | err = err_mach_inject_bundle_couldnt_load_injection_bundle; 53 | } 54 | 55 | // Load the thread code injection. 56 | void *injectionCode = NULL; 57 | if( !err ) { 58 | injectionCode = CFBundleGetFunctionPointerForName( injectionBundle, 59 | CFSTR( INJECT_ENTRY_SYMBOL )); 60 | if( injectionCode == NULL ) 61 | err = err_mach_inject_bundle_couldnt_find_inject_entry_symbol; 62 | } 63 | 64 | // Allocate and populate the parameter block. 65 | mach_inject_bundle_stub_param *param = NULL; 66 | size_t paramSize; 67 | if( !err ) { 68 | size_t bundlePathSize = strlen( bundlePackageFileSystemRepresentation ) 69 | + 1; 70 | paramSize = sizeof( ptrdiff_t ) + bundlePathSize; 71 | param = malloc( paramSize ); 72 | bcopy( bundlePackageFileSystemRepresentation, 73 | param->bundlePackageFileSystemRepresentation, 74 | bundlePathSize ); 75 | } 76 | 77 | // Inject the code. 78 | if( !err ) { 79 | err = mach_inject( injectionCode, param, paramSize, pid, 0 ); 80 | } 81 | 82 | // Clean up. 83 | if( param ) 84 | free( param ); 85 | /*if( injectionBundle ) 86 | CFRelease( injectionBundle );*/ 87 | if( injectionURL ) 88 | CFRelease( injectionURL ); 89 | 90 | return err; 91 | } -------------------------------------------------------------------------------- /mach_star/mach_inject/mach_inject.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | mach_inject.h 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | ***************************************************************************/ 7 | 8 | /***************************************************************************//** 9 | @mainpage mach_inject 10 | @author Jonathan 'Wolf' Rentzsch: 11 | 12 | This package, coded in C to the Mach API, allows you to "inject" code into 13 | an arbitrary process. "Injection" means both 1) copying over the necessary 14 | code into the target's address space and 2) remotely creating a new thread 15 | to execute the code. 16 | 17 | ***************************************************************************/ 18 | 19 | #ifndef _mach_inject_ 20 | #define _mach_inject_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include // for ptrdiff_t 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #define err_threadEntry_image_not_found (err_local|1) 32 | 33 | #define INJECT_ENTRY injectEntry 34 | #define INJECT_ENTRY_SYMBOL "injectEntry" 35 | 36 | typedef void (*mach_inject_entry)( ptrdiff_t codeOffset, void *paramBlock, 37 | size_t paramSize, void* dummy_pthread_data ); 38 | 39 | /***************************************************************************//** 40 | Starts executing threadEntry in a new thread in the process specified by 41 | targetProcess. 42 | 43 | @param threadEntry -> Required pointer to injected thread's entry 44 | point. 45 | @param paramBlock -> Optional pointer to block of memory to pass to 46 | the injected thread. 47 | @param paramSize -> Optional size of paramBlock. 48 | @param targetProcess -> Required target process ID. 49 | @param stackSize -> Optional stack size of threadEntry's thread. Set 50 | to zero for default (currently 8K usable). 51 | @result <- mach_error_t 52 | 53 | ***************************************************************************/ 54 | 55 | mach_error_t 56 | mach_inject( 57 | const mach_inject_entry threadEntry, 58 | const void *paramBlock, 59 | size_t paramSize, 60 | pid_t targetProcess, 61 | vm_size_t stackSize ); 62 | 63 | /***************************************************************************//** 64 | Given a pointer, returns its Mach-O image and image size. 65 | 66 | @param pointer -> Required pointer. 67 | @param image <- Optional returned pointer to image (really a 68 | mach_header). 69 | @param size <- Optional returned size of the image. 70 | @param jumpTableOffset <- Optional returned offset of jump table within image (useful on intel) 71 | @param jumpTableSize <- Optional returned size of jump table (useful on intel) 72 | @result <- mach_error_t 73 | 74 | ***************************************************************************/ 75 | 76 | mach_error_t 77 | machImageForPointer( 78 | const void *pointer, 79 | const void **image, 80 | unsigned long *size, 81 | unsigned int *jumpTableOffset, 82 | unsigned int *jumpTableSize ); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | #endif // _mach_inject_ -------------------------------------------------------------------------------- /src/SIMBLPlugin.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import "SIMBLPlugin.h" 8 | 9 | @implementation SIMBLPlugin 10 | 11 | + (SIMBLPlugin*) bundleWithPath:(NSString*)_path 12 | { 13 | return [[[SIMBLPlugin alloc] initWithPath:_path] autorelease]; 14 | } 15 | 16 | - (NSString*) path 17 | { 18 | return path; 19 | } 20 | 21 | - (void) setPath:(NSString*)_path 22 | { 23 | if (path && (!_path || ![path isEqualToString:_path])) 24 | [path autorelease]; 25 | 26 | if (_path) 27 | path = [_path copy]; 28 | else 29 | path = _path; 30 | } 31 | 32 | - (NSDictionary*) info 33 | { 34 | return info; 35 | } 36 | 37 | - (void) setInfo:(NSDictionary*)_info 38 | { 39 | if (info == _info) 40 | return; 41 | 42 | if (_info) 43 | [_info retain]; 44 | 45 | if (info) 46 | [info release]; 47 | 48 | info = _info; 49 | } 50 | 51 | - (SIMBLPlugin*) initWithPath:(NSString*)_path 52 | { 53 | if (!(self = [super init])) 54 | return nil; 55 | [self setPath:_path]; 56 | 57 | NSArray* bundlePathParts = [NSArray arrayWithObjects:_path, @"Contents", @"Info.plist", nil]; 58 | if (nil == bundlePathParts) 59 | return nil; 60 | NSString* bundlePath = [NSString pathWithComponents:bundlePathParts]; 61 | if (nil == bundlePath) { 62 | NSLog(@"Unable to create bundle path string from components: %@", bundlePathParts); 63 | return nil; 64 | } 65 | NSDictionary* bundleDict = [NSDictionary dictionaryWithContentsOfFile:bundlePath]; 66 | if (nil == bundleDict) { 67 | NSLog(@"Unable to create dictionary from bundle at path '%@'", bundlePath); 68 | return nil; 69 | } 70 | if (0 == [bundleDict count]) { 71 | NSLog(@"Warning: Empty dictionary created from bundle at path '%@'", bundlePath); 72 | return nil; 73 | } 74 | 75 | [self setInfo:bundleDict]; 76 | return self; 77 | 78 | } 79 | 80 | - (NSString*) bundleIdentifier 81 | { 82 | return [info objectForKey:@"CFBundleIdentifier"]; 83 | } 84 | 85 | - (id) objectForInfoDictionaryKey:(NSString*)key 86 | { 87 | return [info objectForKey:key]; 88 | } 89 | 90 | - (NSString*) _dt_info 91 | { 92 | return [self objectForInfoDictionaryKey: @"CFBundleGetInfoString"]; 93 | } 94 | 95 | - (NSString*) _dt_version 96 | { 97 | return [self objectForInfoDictionaryKey: @"CFBundleShortVersionString"]; 98 | } 99 | 100 | - (NSString*) _dt_bundleVersion 101 | { 102 | return [self objectForInfoDictionaryKey: @"CFBundleVersion"]; 103 | } 104 | 105 | - (NSString*) _dt_name 106 | { 107 | NSString* name = [self objectForInfoDictionaryKey:@"CFBundleName"]; 108 | if (name != nil) 109 | return name; 110 | else 111 | return [[self path] lastPathComponent]; 112 | } 113 | 114 | - (void) dealloc 115 | { 116 | if (path) 117 | [path release]; 118 | if (info) 119 | [info release]; 120 | [super dealloc]; 121 | } 122 | 123 | @end 124 | 125 | @implementation NSBundle (SIMBLCocoaExtensions) 126 | 127 | - (NSString*) _dt_info 128 | { 129 | return [self objectForInfoDictionaryKey: @"CFBundleGetInfoString"]; 130 | } 131 | 132 | - (NSString*) _dt_version 133 | { 134 | return [self objectForInfoDictionaryKey: @"CFBundleShortVersionString"]; 135 | } 136 | 137 | - (NSString*) _dt_bundleVersion 138 | { 139 | return [self objectForInfoDictionaryKey: @"CFBundleVersion"]; 140 | } 141 | 142 | - (NSString*) _dt_name 143 | { 144 | return [self objectForInfoDictionaryKey:@"CFBundleName"]; 145 | } 146 | 147 | @end 148 | -------------------------------------------------------------------------------- /mach_star/mach_override/test_mach_override.cp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "mach_override.h" 6 | 7 | #define assertStrEqual( EXPECTED, ACTUAL ) if( strcmp( (EXPECTED), (ACTUAL) ) != 0 ) { printf( "EXPECTED: %s\nACTUAL: %s\n", (EXPECTED), (ACTUAL)); assert( strcmp( (EXPECTED), (ACTUAL) ) == 0 ); } 8 | #define assertIntEqual( EXPECTED, ACTUAL ) if( (EXPECTED) != (ACTUAL) ) { printf( "EXPECTED: %d\nACTUAL: %d\n", (EXPECTED), (ACTUAL)); assert( (EXPECTED) == (ACTUAL) ); } 9 | 10 | //------------------------------------------------------------------------------ 11 | #pragma mark Test Local Override by Pointer 12 | 13 | const char* localFunction() { 14 | asm("nop;nop;nop;nop;"); 15 | return __FUNCTION__; 16 | } 17 | const char* (*localOriginalPtr)() = localFunction; 18 | 19 | void testLocalFunctionOverrideByPointer() { 20 | // Test original. 21 | assertStrEqual( "localFunction", localOriginalPtr() ); 22 | 23 | // Override local function by pointer. 24 | kern_return_t err; 25 | 26 | MACH_OVERRIDE( const char*, localFunction, (), err ) { 27 | // Test calling through the reentry island back into the original 28 | // implementation. 29 | assertStrEqual( "localFunction", localFunction_reenter() ); 30 | 31 | return "localFunctionOverride"; 32 | } END_MACH_OVERRIDE(localFunction); 33 | assert( !err ); 34 | 35 | // Test override took effect. 36 | assertStrEqual( "localFunctionOverride", localOriginalPtr() ); 37 | } 38 | 39 | //------------------------------------------------------------------------------ 40 | #pragma mark Test System Override by Pointer 41 | 42 | char* (*strerrorPtr)(int) = strerror; 43 | 44 | void testSystemFunctionOverrideByPointer() { 45 | // Test original. 46 | assertStrEqual( "Unknown error: 0", strerrorPtr( 0 ) ); 47 | 48 | // Override system function by pointer. 49 | kern_return_t err; 50 | MACH_OVERRIDE( char*, strerror, (int errnum), err ) { 51 | // Test calling through the reentry island back into the original 52 | // implementation. 53 | assertStrEqual( "Unknown error: 0", strerror_reenter( 0 ) ); 54 | 55 | return (char *)"strerrorOverride"; 56 | } END_MACH_OVERRIDE(strerror); 57 | assert( !err ); 58 | 59 | // Test override took effect. 60 | assertStrEqual( "strerrorOverride", strerrorPtr( 0 ) ); 61 | } 62 | 63 | //------------------------------------------------------------------------------ 64 | #pragma mark Test System Override by Name 65 | 66 | int strerror_rOverride( int errnum, char *strerrbuf, size_t buflen ); 67 | int (*strerror_rPtr)( int, char*, size_t ) = strerror_r; 68 | int (*gReentry_strerror_r)( int, char*, size_t ); 69 | 70 | void testSystemFunctionOverrideByName() { 71 | // Test original. 72 | assertIntEqual( ERANGE, strerror_rPtr( 0, NULL, 0 ) ); 73 | 74 | // Override local function by pointer. 75 | kern_return_t err = mach_override( (char*)"_strerror_r", 76 | NULL, 77 | (void*)&strerror_rOverride, 78 | (void**)&gReentry_strerror_r ); 79 | 80 | // Test override took effect. 81 | assertIntEqual( 0, strerror_rPtr( 0, NULL, 0 ) ); 82 | } 83 | 84 | int strerror_rOverride( int errnum, char *strerrbuf, size_t buflen ) { 85 | assertIntEqual( ERANGE, gReentry_strerror_r( 0, NULL, 0 ) ); 86 | 87 | return 0; 88 | } 89 | 90 | //------------------------------------------------------------------------------ 91 | #pragma mark main 92 | 93 | int main( int argc, const char *argv[] ) { 94 | testLocalFunctionOverrideByPointer(); 95 | testSystemFunctionOverrideByPointer(); 96 | testSystemFunctionOverrideByName(); 97 | 98 | printf( "success\n" ); 99 | return 0; 100 | } 101 | -------------------------------------------------------------------------------- /pkg/postflight: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2003-2009, Mike Solomon 3 | # SIMBL is released under the GNU General Public License v2. 4 | # http://www.opensource.org/licenses/gpl-2.0.php 5 | 6 | PACKAGE_PATH="$1" 7 | INSTALL_PATH="$2" 8 | INSTALL_VOLUME="$3" 9 | SYSTEM_ROOT="$4" 10 | 11 | RESOURCES="${PACKAGE_PATH}/Contents/Resources" 12 | 13 | # FIXME(mike) maybe we should copy this out of the install package instead? 14 | LAUNCHD_PLIST="/Library/ScriptingAdditions/SIMBL.osax/Contents/Resources/SIMBL Agent.app/Contents/Resources/net.culater.SIMBL.Agent.plist" 15 | OSAX_PLIST="/Library/ScriptingAdditions/SIMBL.osax/Contents/Info.plist" 16 | 17 | # remove old InputManager if it exists, otherwise these 18 | # two will contend when applications run under 32-bit mode 19 | SIMBL_INPUTMANAGER="/Library/InputManagers/SIMBL" 20 | if [ -d "$SIMBL_INPUTMANAGER" ]; then 21 | rm -rf "$SIMBL_INPUTMANAGER" 22 | fi 23 | 24 | LAUNCH_AGENTS_DIR="/Library/LaunchAgents" 25 | if [ ! -d "$LAUNCH_AGENTS_DIR" ]; then 26 | mkdir -p "$LAUNCH_AGENTS_DIR" 27 | chown root:wheel "$LAUNCH_AGENTS_DIR" 28 | fi 29 | # ensure agents are world-readable, but must be no more permissive 30 | # than 755, otherwise they are just skipped. 31 | chmod 755 "$LAUNCH_AGENTS_DIR" 32 | 33 | # ensure that this loads on restart 34 | cp "$LAUNCHD_PLIST" "$LAUNCH_AGENTS_DIR" 35 | if [ $? != 0 ]; then 36 | exit 1 37 | fi 38 | 39 | # create a system-wide location for plugins 40 | SIMBL_PLUGINS_DIR="/Library/Application Support/SIMBL/Plugins" 41 | if [ ! -d "$SIMBL_PLUGINS_DIR" ]; then 42 | mkdir -p "$SIMBL_PLUGINS_DIR" 43 | chown root:admin "$SIMBL_PLUGINS_DIR" 44 | fi 45 | # ensure plugins are world-readable 46 | chmod 775 "$SIMBL_PLUGINS_DIR" 47 | 48 | # ensure that ScriptingAdditions is world-readable 49 | SCRIPTING_ADDITIONS_DIR="/Library/ScriptingAdditions" 50 | chown root:admin "$SCRIPTING_ADDITIONS_DIR" 51 | chmod 775 "$SCRIPTING_ADDITIONS_DIR" 52 | if [ $? != 0 ]; then 53 | exit 1 54 | fi 55 | 56 | # stop any running agent by unloading it, in case we have made changes 57 | # to the agent that won't take effect until the application is restarted 58 | # NOTE: this runs *as* root, but $USER is the user that launched Installer.app 59 | # we don't want the agent running as root, nor do we want to force the user to 60 | # logout, so we try to kill any agents and then start the new version just for 61 | # this user. 62 | echo "Stop SIMBL Agent" 63 | echo su -l "$USER" /bin/bash -c "/bin/launchctl unload -F -S Aqua \"${LAUNCHD_PLIST}\"" 64 | sudo -u "$USER" -- /bin/launchctl unload -F -S Aqua "${LAUNCHD_PLIST}" 65 | 66 | 67 | # This clears out any buggy instance we may have started with previous versions 68 | # of the package. 69 | echo "Stop root SIMBL Agent" 70 | /bin/launchctl unload -F -S Aqua "${LAUNCHD_PLIST}" 71 | 72 | # If there are other users, kill the current agents - launchd will restart 73 | # them with the newly installed code 74 | /usr/bin/killall "SIMBL Agent" 75 | 76 | echo "Start SIMBL Agent" 77 | echo su -l "$USER" /bin/bash -c "/bin/launchctl load -F -S Aqua \"${LAUNCHD_PLIST}\"" 78 | sudo -u "$USER" -- /bin/launchctl load -F -S Aqua "${LAUNCHD_PLIST}" 79 | if [ $? != 0 ]; then 80 | exit 1 81 | fi 82 | 83 | # Under 10.6, the Leopard-compatible OSAX event causes a spurious entry in the 84 | # console. This is harmless and the warning is completely pointless, the event 85 | # won't ever be triggered on Snow Leopard. Equally pointless are the complaints 86 | # about this. If one reads the output of the Console, the least one can do is 87 | # be prepared to understand the statements made there. 88 | sw_vers | grep "ProductVersion:.*10\.6" 89 | if [ $? == 0 ]; then 90 | echo "pruning Leopard event handler" 91 | /usr/libexec/PlistBuddy -c "Delete :OSAXHandlers:Events:SIMeleop" "$OSAX_PLIST" 92 | fi 93 | 94 | exit 0 -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/mach_inject_bundle_stub.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | mach_inject_bundle_stub.c 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | Design inspired by SCPatchLoader, by Jon Gotow of St. Clair Software: 7 | 8 | 9 | ***************************************************************************/ 10 | 11 | #include "mach_inject_bundle_stub.h" 12 | #include "load_bundle.h" 13 | #include "mach_inject.h" // for INJECT_ENTRY 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | /************************** 22 | * 23 | * Funky Protos 24 | * 25 | **************************/ 26 | #pragma mark (Funky Protos) 27 | 28 | void 29 | INJECT_ENTRY( 30 | ptrdiff_t codeOffset, 31 | mach_inject_bundle_stub_param *param, 32 | size_t paramSize, 33 | char *dummy_pthread_struc ); 34 | 35 | void* 36 | pthread_entry( 37 | mach_inject_bundle_stub_param *param ); 38 | 39 | pascal 40 | void 41 | EventLoopTimerEntry( 42 | EventLoopTimerRef inTimer, 43 | mach_inject_bundle_stub_param *param ); 44 | 45 | /******************************************************************************* 46 | * 47 | * Implementation 48 | * 49 | *******************************************************************************/ 50 | #pragma mark - 51 | #pragma mark (Implementation) 52 | 53 | void 54 | INJECT_ENTRY( 55 | ptrdiff_t codeOffset, 56 | mach_inject_bundle_stub_param *param, 57 | size_t paramSize, 58 | char *dummy_pthread_struct ) 59 | { 60 | assert( param ); 61 | 62 | param->codeOffset = codeOffset; 63 | 64 | #if defined (__i386__) || defined(__x86_64__) 65 | // On intel, per-pthread data is a zone of data that must be allocated. 66 | // if not, all function trying to access per-pthread data (all mig functions for instance) 67 | // will crash. 68 | extern void __pthread_set_self(char*); 69 | __pthread_set_self(dummy_pthread_struct); 70 | #endif 71 | 72 | fprintf(stderr, "mach_inject_bundle: entered in %s, codeOffset: %td, param: %p, paramSize: %lu\n", 73 | INJECT_ENTRY_SYMBOL, codeOffset, param, paramSize); 74 | 75 | pthread_attr_t attr; 76 | pthread_attr_init(&attr); 77 | 78 | int policy; 79 | pthread_attr_getschedpolicy( &attr, &policy ); 80 | pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED ); 81 | pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED ); 82 | 83 | struct sched_param sched; 84 | sched.sched_priority = sched_get_priority_max( policy ); 85 | pthread_attr_setschedparam( &attr, &sched ); 86 | 87 | pthread_t thread; 88 | pthread_create( &thread, 89 | &attr, 90 | (void* (*)(void*))((long)pthread_entry + codeOffset), 91 | (void*) param ); 92 | pthread_attr_destroy(&attr); 93 | 94 | thread_suspend(mach_thread_self()); 95 | } 96 | 97 | void* 98 | pthread_entry( 99 | mach_inject_bundle_stub_param *param ) 100 | { 101 | fprintf(stderr, "mach_inject_bundle: entered in pthread_entry, param: %p\n", param); 102 | assert( param ); 103 | 104 | EventLoopTimerProcPtr proc = (EventLoopTimerProcPtr) EventLoopTimerEntry; 105 | proc += param->codeOffset; 106 | EventLoopTimerUPP upp = NewEventLoopTimerUPP( proc ); 107 | 108 | InstallEventLoopTimer( GetMainEventLoop(), 0, 0, upp, (void*)param, NULL ); 109 | return NULL; 110 | } 111 | 112 | pascal 113 | void 114 | EventLoopTimerEntry( 115 | EventLoopTimerRef inTimer, 116 | mach_inject_bundle_stub_param *param ) 117 | { 118 | fprintf(stderr, "mach_inject_bundle: entered in EventLoopTimerEntry, inTimer: %p, param: %p\n", inTimer, param); 119 | assert( inTimer ); 120 | assert( param ); 121 | load_bundle_package( param->bundlePackageFileSystemRepresentation ); 122 | } 123 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/load_bundle.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | load_bundle.c 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | ***************************************************************************/ 7 | 8 | #include "load_bundle.h" 9 | #include 10 | #include // for PATH_MAX. 11 | #include 12 | #include 13 | 14 | #include 15 | #define MACH_ERROR(msg, err) { if(err != err_none) mach_error(msg, err); } 16 | 17 | mach_error_t 18 | load_bundle_package( 19 | const char *bundlePackageFileSystemRepresentation ) 20 | { 21 | fprintf(stderr, "mach_inject_bundle load_bundle_package: %s\n", bundlePackageFileSystemRepresentation); 22 | assert( bundlePackageFileSystemRepresentation ); 23 | assert( strlen( bundlePackageFileSystemRepresentation ) ); 24 | 25 | mach_error_t err = err_none; 26 | MACH_ERROR("mach error on bundle load", err); 27 | 28 | // Morph the FSR into a URL. 29 | CFURLRef bundlePackageURL = NULL; 30 | if( !err ) { 31 | bundlePackageURL = CFURLCreateFromFileSystemRepresentation( 32 | kCFAllocatorDefault, 33 | (const UInt8*)bundlePackageFileSystemRepresentation, 34 | strlen(bundlePackageFileSystemRepresentation), 35 | true ); 36 | if( bundlePackageURL == NULL ) 37 | err = err_load_bundle_url_from_path; 38 | } 39 | MACH_ERROR("mach error on bundle load", err); 40 | 41 | // Create bundle. 42 | CFBundleRef bundle = NULL; 43 | if( !err ) { 44 | bundle = CFBundleCreate( kCFAllocatorDefault, bundlePackageURL ); 45 | if( bundle == NULL ) 46 | err = err_load_bundle_create_bundle; 47 | } 48 | MACH_ERROR("mach error on bundle load", err); 49 | 50 | // Discover the bundle's executable file. 51 | CFURLRef bundleExecutableURL = NULL; 52 | if( !err ) { 53 | assert( bundle ); 54 | bundleExecutableURL = CFBundleCopyExecutableURL( bundle ); 55 | if( bundleExecutableURL == NULL ) 56 | err = err_load_bundle_package_executable_url; 57 | } 58 | MACH_ERROR("mach error on bundle load", err); 59 | 60 | // Morph the executable's URL into an FSR. 61 | char bundleExecutableFileSystemRepresentation[PATH_MAX]; 62 | if( !err ) { 63 | assert( bundleExecutableURL ); 64 | if( !CFURLGetFileSystemRepresentation( 65 | bundleExecutableURL, 66 | true, 67 | (UInt8*)bundleExecutableFileSystemRepresentation, 68 | sizeof(bundleExecutableFileSystemRepresentation) ) ) 69 | { 70 | err = err_load_bundle_path_from_url; 71 | } 72 | } 73 | MACH_ERROR("mach error on bundle load", err); 74 | 75 | // Do the real work. 76 | if( !err ) { 77 | assert( strlen(bundleExecutableFileSystemRepresentation) ); 78 | err = load_bundle_executable( bundleExecutableFileSystemRepresentation); 79 | } 80 | 81 | // Clean up. 82 | if( bundleExecutableURL ) 83 | CFRelease( bundleExecutableURL ); 84 | /*if( bundle ) 85 | CFRelease( bundle );*/ 86 | if( bundlePackageURL ) 87 | CFRelease( bundlePackageURL ); 88 | 89 | MACH_ERROR("mach error on bundle load", err); 90 | return err; 91 | } 92 | 93 | mach_error_t 94 | load_bundle_executable( 95 | const char *bundleExecutableFileSystemRepresentation ) 96 | { 97 | assert( bundleExecutableFileSystemRepresentation ); 98 | 99 | /* 100 | NSBundle* bundle = [NSBundle bundleWithPath:[NSString stringWithUTF8String:bundleExecutableFileSystemRepresentation]]; 101 | 102 | if(![bundle load]) { 103 | fprintf(stderr, "mach_inject: failed to load %s\n", bundleExecutableFileSystemRepresentation); 104 | return err_load_bundle_NSObjectFileImageFailure; 105 | } 106 | else 107 | fprintf(stderr, "mach_inject: loaded succesfull: %s\n", bundleExecutableFileSystemRepresentation); 108 | */ 109 | 110 | //fprintf(stderr, "FS rep %s\n", bundleExecutableFileSystemRepresentation); 111 | void *image = dlopen(bundleExecutableFileSystemRepresentation, RTLD_NOW); 112 | //fprintf(stderr, "OH shit load? %p\n", image); 113 | if (!image) { 114 | dlerror(); 115 | return err_load_bundle_NSObjectFileImageFailure; 116 | } 117 | 118 | return 0; 119 | } -------------------------------------------------------------------------------- /mach_star/mach_override/mach_override.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | mach_override.h 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | ***************************************************************************/ 7 | 8 | /***************************************************************************//** 9 | @mainpage mach_override 10 | @author Jonathan 'Wolf' Rentzsch: 11 | 12 | This package, coded in C to the Mach API, allows you to override ("patch") 13 | program- and system-supplied functions at runtime. You can fully replace 14 | functions with your implementations, or merely head- or tail-patch the 15 | original implementations. 16 | 17 | Use it by #include'ing mach_override.h from your .c, .m or .mm file(s). 18 | 19 | @todo Discontinue use of Carbon's MakeDataExecutable() and 20 | CompareAndSwap() calls and start using the Mach equivalents, if they 21 | exist. If they don't, write them and roll them in. That way, this 22 | code will be pure Mach, which will make it easier to use everywhere. 23 | Update: MakeDataExecutable() has been replaced by 24 | msync(MS_INVALIDATE). There is an OSCompareAndSwap in libkern, but 25 | I'm currently unsure if I can link against it. May have to roll in 26 | my own version... 27 | @todo Stop using an entire 4K high-allocated VM page per 28-byte escape 28 | branch island. Done right, this will dramatically speed up escape 29 | island allocations when they number over 250. Then again, if you're 30 | overriding more than 250 functions, maybe speed isn't your main 31 | concern... 32 | @todo Add detection of: b, bl, bla, bc, bcl, bcla, bcctrl, bclrl 33 | first-instructions. Initially, we should refuse to override 34 | functions beginning with these instructions. Eventually, we should 35 | dynamically rewrite them to make them position-independent. 36 | @todo Write mach_unoverride(), which would remove an override placed on a 37 | function. Must be multiple-override aware, which means an almost 38 | complete rewrite under the covers, because the target address can't 39 | be spread across two load instructions like it is now since it will 40 | need to be atomically updatable. 41 | @todo Add non-rentry variants of overrides to test_mach_override. 42 | 43 | ***************************************************************************/ 44 | 45 | #ifndef _mach_override_ 46 | #define _mach_override_ 47 | 48 | #include 49 | #include 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | /** 56 | Returned if the function to be overrided begins with a 'mfctr' instruction. 57 | */ 58 | #define err_cannot_override (err_local|1) 59 | 60 | /************************************************************************************//** 61 | Dynamically overrides the function implementation referenced by 62 | originalFunctionAddress with the implentation pointed to by overrideFunctionAddress. 63 | Optionally returns a pointer to a "reentry island" which, if jumped to, will resume 64 | the original implementation. 65 | 66 | @param originalFunctionAddress -> Required address of the function to 67 | override (with overrideFunctionAddress). 68 | @param overrideFunctionAddress -> Required address to the overriding 69 | function. 70 | @param originalFunctionReentryIsland <- Optional pointer to pointer to the 71 | reentry island. Can be NULL. 72 | @result <- err_cannot_override if the original 73 | function's implementation begins with 74 | the 'mfctr' instruction. 75 | 76 | ************************************************************************************/ 77 | 78 | mach_error_t 79 | mach_override_ptr( 80 | void *originalFunctionAddress, 81 | const void *overrideFunctionAddress, 82 | void **originalFunctionReentryIsland ); 83 | 84 | /************************************************************************************//** 85 | 86 | 87 | ************************************************************************************/ 88 | 89 | #ifdef __cplusplus 90 | 91 | #define MACH_OVERRIDE( ORIGINAL_FUNCTION_RETURN_TYPE, ORIGINAL_FUNCTION_NAME, ORIGINAL_FUNCTION_ARGS, ERR ) \ 92 | { \ 93 | static ORIGINAL_FUNCTION_RETURN_TYPE (*ORIGINAL_FUNCTION_NAME##_reenter)ORIGINAL_FUNCTION_ARGS; \ 94 | static bool ORIGINAL_FUNCTION_NAME##_overriden = false; \ 95 | class mach_override_class__##ORIGINAL_FUNCTION_NAME { \ 96 | public: \ 97 | static kern_return_t override(void *originalFunctionPtr) { \ 98 | kern_return_t result = err_none; \ 99 | if (!ORIGINAL_FUNCTION_NAME##_overriden) { \ 100 | ORIGINAL_FUNCTION_NAME##_overriden = true; \ 101 | result = mach_override_ptr( (void*)originalFunctionPtr, \ 102 | (void*)mach_override_class__##ORIGINAL_FUNCTION_NAME::replacement, \ 103 | (void**)&ORIGINAL_FUNCTION_NAME##_reenter ); \ 104 | } \ 105 | return result; \ 106 | } \ 107 | static ORIGINAL_FUNCTION_RETURN_TYPE replacement ORIGINAL_FUNCTION_ARGS { 108 | 109 | #define END_MACH_OVERRIDE( ORIGINAL_FUNCTION_NAME ) \ 110 | } \ 111 | }; \ 112 | \ 113 | err = mach_override_class__##ORIGINAL_FUNCTION_NAME::override((void*)ORIGINAL_FUNCTION_NAME); \ 114 | } 115 | 116 | #endif 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | #endif // _mach_override_ 122 | -------------------------------------------------------------------------------- /SIMBL Agent/SIMBLAgent.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import "SIMBL.h" 8 | #import "SIMBLAgent.h" 9 | 10 | #include 11 | 12 | @implementation NSApplication (SystemVersion) 13 | 14 | - (void)getSystemVersionMajor:(unsigned *)major 15 | minor:(unsigned *)minor 16 | bugFix:(unsigned *)bugFix; 17 | { 18 | OSErr err; 19 | SInt32 systemVersion, versionMajor, versionMinor, versionBugFix; 20 | if ((err = Gestalt(gestaltSystemVersion, &systemVersion)) != noErr) goto fail; 21 | if (systemVersion < 0x1040) 22 | { 23 | if (major) *major = ((systemVersion & 0xF000) >> 12) * 10 + 24 | ((systemVersion & 0x0F00) >> 8); 25 | if (minor) *minor = (systemVersion & 0x00F0) >> 4; 26 | if (bugFix) *bugFix = (systemVersion & 0x000F); 27 | } 28 | else 29 | { 30 | if ((err = Gestalt(gestaltSystemVersionMajor, &versionMajor)) != noErr) goto fail; 31 | if ((err = Gestalt(gestaltSystemVersionMinor, &versionMinor)) != noErr) goto fail; 32 | if ((err = Gestalt(gestaltSystemVersionBugFix, &versionBugFix)) != noErr) goto fail; 33 | if (major) *major = versionMajor; 34 | if (minor) *minor = versionMinor; 35 | if (bugFix) *bugFix = versionBugFix; 36 | } 37 | 38 | return; 39 | 40 | fail: 41 | SIMBLLogNotice(@"Unable to obtain system version: %ld", (long)err); 42 | if (major) *major = 10; 43 | if (minor) *minor = 0; 44 | if (bugFix) *bugFix = 0; 45 | } 46 | 47 | @end 48 | 49 | 50 | @implementation SIMBLAgent 51 | 52 | - (void) applicationDidFinishLaunching:(NSNotification*)notificaion 53 | { 54 | NSProcessInfo* procInfo = [NSProcessInfo processInfo]; 55 | if ([(NSString*)[[procInfo arguments] lastObject] hasPrefix:@"-psn"]) { 56 | // if we were started interactively, load in launchd and terminate 57 | SIMBLLogNotice(@"installing into launchd"); 58 | [self loadInLaunchd]; 59 | [NSApp terminate:nil]; 60 | } 61 | else { 62 | SIMBLLogInfo(@"agent started"); 63 | [[[NSWorkspace sharedWorkspace] notificationCenter] 64 | addObserver:self selector:@selector(injectSIMBL:) 65 | name:NSWorkspaceDidLaunchApplicationNotification object:nil]; 66 | } 67 | } 68 | 69 | - (void) loadInLaunchd 70 | { 71 | NSTask* task = [NSTask launchedTaskWithLaunchPath:@"/bin/launchctl" arguments:[NSArray arrayWithObjects:@"load", @"-F", @"-S", @"Aqua", @ SIMBLEAGENT_bundle_path "/Contents/Resources/net.culater.SIMBL.Agent.plist", nil]]; 72 | [task waitUntilExit]; 73 | if ([task terminationStatus] != 0) 74 | SIMBLLogNotice(@"launchctl returned %d", [task terminationStatus]); 75 | } 76 | 77 | - (void) injectSIMBL:(NSNotification*)notification 78 | { 79 | // NOTE: if you change the log level externally, there is pretty much no way 80 | // to know when the changed. Just reading from the defaults doesn't validate 81 | // against the backing file very ofter, or so it seems. 82 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 83 | [defaults synchronize]; 84 | 85 | NSDictionary* appInfo = [notification userInfo]; 86 | NSString* appName = [appInfo objectForKey:@"NSApplicationName"]; 87 | SIMBLLogInfo(@"%@ started", appName); 88 | SIMBLLogDebug(@"app start notification: %@", appInfo); 89 | 90 | // check to see if there are plugins to load 91 | if ([SIMBL shouldInstallPluginsIntoApplication:[NSBundle bundleWithPath:[appInfo objectForKey:@"NSApplicationPath"]]] == NO) { 92 | SIMBLLogDebug(@"no plugins for %@", appName); 93 | return; 94 | } 95 | 96 | // BUG: http://code.google.com/p/simbl/issues/detail?id=11 97 | // NOTE: believe it or not, some applications cause a crash deep in the 98 | // ScriptingBridge code. Due to the launchd behavior of restarting crashed 99 | // agents, this is mostly harmless. To reduce the crashing we leave a 100 | // blacklist to prevent injection. By default, this is empty. 101 | NSString* appIdentifier = [appInfo objectForKey:@"NSApplicationBundleIdentifier"]; 102 | NSArray* blacklistedIdentifiers = [defaults stringArrayForKey:@"SIMBLApplicationIdentifierBlacklist"]; 103 | if (blacklistedIdentifiers != nil && 104 | [blacklistedIdentifiers containsObject:appIdentifier]) { 105 | SIMBLLogNotice(@"ignoring injection attempt for blacklisted application %@ (%@)", appName, appIdentifier); 106 | return; 107 | } 108 | 109 | fprintf(stderr, "send inject event to %s\n", [appName UTF8String]); 110 | SIMBLLogDebug(@"send inject event"); 111 | 112 | // Find the process to target 113 | pid_t pid = [[appInfo objectForKey:@"NSApplicationProcessIdentifier"] intValue]; 114 | 115 | NSInteger progarch = [(NSRunningApplication*)[appInfo objectForKey:@"NSWorkspaceApplicationKey"] executableArchitecture]; 116 | NSMutableString* cmd = [NSMutableString stringWithUTF8String:"\"" SIMBLEAGENT_bundle_path "/Contents/MacOS/inject_helper"]; 117 | switch(progarch) { 118 | case NSBundleExecutableArchitectureI386: 119 | [cmd appendString:@"_32"]; 120 | break; 121 | case NSBundleExecutableArchitectureX86_64: 122 | [cmd appendString:@"_64"]; 123 | break; 124 | case NSBundleExecutableArchitecturePPC: 125 | case NSBundleExecutableArchitecturePPC64: 126 | SIMBLLogNotice(@"PPC/PPC64 not supported of %@ (%@)", appName, appIdentifier); 127 | return; 128 | default: 129 | SIMBLLogNotice(@"unknown architecture of %@ (%@)", appName, appIdentifier); 130 | return; 131 | } 132 | [cmd appendFormat:@"\" %i", pid]; 133 | system([cmd UTF8String]); 134 | } 135 | @end 136 | 137 | 138 | int main(int argc, char *argv[]) 139 | { 140 | return NSApplicationMain(argc, (const char **)argv); 141 | } 142 | 143 | -------------------------------------------------------------------------------- /mach_star/mach_inject/mach_inject.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 79797DFA07F62C5F00E7262E /* mach_inject.c in Sources */ = {isa = PBXBuildFile; fileRef = 79797DF807F62C5E00E7262E /* mach_inject.c */; }; 11 | 79797DFB07F62C5F00E7262E /* mach_inject.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 79797DF907F62C5F00E7262E /* mach_inject.h */; }; 12 | 8DD76F870486A9BA00D96B5E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; }; 13 | 8DD76F890486A9BA00D96B5E /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 097DBE83FE8419DDC02AAC07 /* CoreServices.framework */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXCopyFilesBuildPhase section */ 17 | 8DD76F8B0486A9BA00D96B5E /* CopyFiles */ = { 18 | isa = PBXCopyFilesBuildPhase; 19 | buildActionMask = 8; 20 | dstPath = /usr/share/man/man1/; 21 | dstSubfolderSpec = 0; 22 | files = ( 23 | 79797DFB07F62C5F00E7262E /* mach_inject.h in CopyFiles */, 24 | ); 25 | runOnlyForDeploymentPostprocessing = 1; 26 | }; 27 | /* End PBXCopyFilesBuildPhase section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 08FB7796FE84155DC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; 31 | 097DBE83FE8419DDC02AAC07 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = ""; }; 32 | 79797DF807F62C5E00E7262E /* mach_inject.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mach_inject.c; sourceTree = ""; }; 33 | 79797DF907F62C5F00E7262E /* mach_inject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mach_inject.h; sourceTree = ""; }; 34 | 8DD76F8E0486A9BA00D96B5E /* mach_inject */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mach_inject; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 8DD76F880486A9BA00D96B5E /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 8DD76F890486A9BA00D96B5E /* CoreServices.framework in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 08FB7794FE84155DC02AAC07 /* mach_inject */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 08FB7795FE84155DC02AAC07 /* Source */, 53 | 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, 54 | 1A8B4A8EFE9D542A11CA2CBB /* Products */, 55 | ); 56 | name = mach_inject; 57 | sourceTree = ""; 58 | }; 59 | 08FB7795FE84155DC02AAC07 /* Source */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 79797DF807F62C5E00E7262E /* mach_inject.c */, 63 | 79797DF907F62C5F00E7262E /* mach_inject.h */, 64 | 08FB7796FE84155DC02AAC07 /* main.c */, 65 | ); 66 | name = Source; 67 | sourceTree = ""; 68 | }; 69 | 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 097DBE83FE8419DDC02AAC07 /* CoreServices.framework */, 73 | ); 74 | name = "External Frameworks and Libraries"; 75 | sourceTree = ""; 76 | }; 77 | 1A8B4A8EFE9D542A11CA2CBB /* Products */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 8DD76F8E0486A9BA00D96B5E /* mach_inject */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | /* End PBXGroup section */ 86 | 87 | /* Begin PBXNativeTarget section */ 88 | 8DD76F840486A9BA00D96B5E /* mach_inject */ = { 89 | isa = PBXNativeTarget; 90 | buildConfigurationList = 33B2AC34092854CE004B1632 /* Build configuration list for PBXNativeTarget "mach_inject" */; 91 | buildPhases = ( 92 | 8DD76F860486A9BA00D96B5E /* Sources */, 93 | 8DD76F880486A9BA00D96B5E /* Frameworks */, 94 | 8DD76F8B0486A9BA00D96B5E /* CopyFiles */, 95 | ); 96 | buildRules = ( 97 | ); 98 | dependencies = ( 99 | ); 100 | name = mach_inject; 101 | productInstallPath = "$(HOME)/bin"; 102 | productName = mach_inject; 103 | productReference = 8DD76F8E0486A9BA00D96B5E /* mach_inject */; 104 | productType = "com.apple.product-type.tool"; 105 | }; 106 | /* End PBXNativeTarget section */ 107 | 108 | /* Begin PBXProject section */ 109 | 08FB7793FE84155DC02AAC07 /* Project object */ = { 110 | isa = PBXProject; 111 | buildConfigurationList = 33B2AC38092854CE004B1632 /* Build configuration list for PBXProject "mach_inject" */; 112 | compatibilityVersion = "Xcode 3.1"; 113 | hasScannedForEncodings = 1; 114 | mainGroup = 08FB7794FE84155DC02AAC07 /* mach_inject */; 115 | projectDirPath = ""; 116 | projectRoot = ""; 117 | targets = ( 118 | 8DD76F840486A9BA00D96B5E /* mach_inject */, 119 | ); 120 | }; 121 | /* End PBXProject section */ 122 | 123 | /* Begin PBXSourcesBuildPhase section */ 124 | 8DD76F860486A9BA00D96B5E /* Sources */ = { 125 | isa = PBXSourcesBuildPhase; 126 | buildActionMask = 2147483647; 127 | files = ( 128 | 8DD76F870486A9BA00D96B5E /* main.c in Sources */, 129 | 79797DFA07F62C5F00E7262E /* mach_inject.c in Sources */, 130 | ); 131 | runOnlyForDeploymentPostprocessing = 0; 132 | }; 133 | /* End PBXSourcesBuildPhase section */ 134 | 135 | /* Begin XCBuildConfiguration section */ 136 | 33B2AC35092854CE004B1632 /* Development */ = { 137 | isa = XCBuildConfiguration; 138 | buildSettings = { 139 | ARCHS = ( 140 | ppc, 141 | i386, 142 | x86_64, 143 | ); 144 | COPY_PHASE_STRIP = NO; 145 | GCC_DYNAMIC_NO_PIC = NO; 146 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 147 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 148 | GCC_OPTIMIZATION_LEVEL = 0; 149 | INSTALL_PATH = "$(HOME)/bin"; 150 | PRODUCT_NAME = mach_inject; 151 | ZERO_LINK = YES; 152 | }; 153 | name = Development; 154 | }; 155 | 33B2AC36092854CE004B1632 /* Deployment */ = { 156 | isa = XCBuildConfiguration; 157 | buildSettings = { 158 | COPY_PHASE_STRIP = YES; 159 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 160 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 161 | INSTALL_PATH = "$(HOME)/bin"; 162 | PRODUCT_NAME = mach_inject; 163 | ZERO_LINK = NO; 164 | }; 165 | name = Deployment; 166 | }; 167 | 33B2AC37092854CE004B1632 /* Default */ = { 168 | isa = XCBuildConfiguration; 169 | buildSettings = { 170 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 171 | INSTALL_PATH = "$(HOME)/bin"; 172 | PRODUCT_NAME = mach_inject; 173 | }; 174 | name = Default; 175 | }; 176 | 33B2AC39092854CE004B1632 /* Development */ = { 177 | isa = XCBuildConfiguration; 178 | buildSettings = { 179 | }; 180 | name = Development; 181 | }; 182 | 33B2AC3A092854CE004B1632 /* Deployment */ = { 183 | isa = XCBuildConfiguration; 184 | buildSettings = { 185 | }; 186 | name = Deployment; 187 | }; 188 | 33B2AC3B092854CE004B1632 /* Default */ = { 189 | isa = XCBuildConfiguration; 190 | buildSettings = { 191 | }; 192 | name = Default; 193 | }; 194 | /* End XCBuildConfiguration section */ 195 | 196 | /* Begin XCConfigurationList section */ 197 | 33B2AC34092854CE004B1632 /* Build configuration list for PBXNativeTarget "mach_inject" */ = { 198 | isa = XCConfigurationList; 199 | buildConfigurations = ( 200 | 33B2AC35092854CE004B1632 /* Development */, 201 | 33B2AC36092854CE004B1632 /* Deployment */, 202 | 33B2AC37092854CE004B1632 /* Default */, 203 | ); 204 | defaultConfigurationIsVisible = 0; 205 | defaultConfigurationName = Default; 206 | }; 207 | 33B2AC38092854CE004B1632 /* Build configuration list for PBXProject "mach_inject" */ = { 208 | isa = XCConfigurationList; 209 | buildConfigurations = ( 210 | 33B2AC39092854CE004B1632 /* Development */, 211 | 33B2AC3A092854CE004B1632 /* Deployment */, 212 | 33B2AC3B092854CE004B1632 /* Default */, 213 | ); 214 | defaultConfigurationIsVisible = 0; 215 | defaultConfigurationName = Default; 216 | }; 217 | /* End XCConfigurationList section */ 218 | }; 219 | rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; 220 | } 221 | -------------------------------------------------------------------------------- /mach_star/mach_override/mach_override.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 794FB6B0095E50DE00FEA73E /* test_mach_override.cp in Sources */ = {isa = PBXBuildFile; fileRef = 794FB6AE095E50DE00FEA73E /* test_mach_override.cp */; }; 11 | 79797E0A07F6327800E7262E /* mach_override.c in Sources */ = {isa = PBXBuildFile; fileRef = 79797E0707F6327800E7262E /* mach_override.c */; }; 12 | 79797E0B07F6327800E7262E /* mach_override.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 79797E0807F6327800E7262E /* mach_override.h */; }; 13 | 8DD76F890486A9BA00D96B5E /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 097DBE83FE8419DDC02AAC07 /* CoreServices.framework */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXCopyFilesBuildPhase section */ 17 | 8DD76F8B0486A9BA00D96B5E /* CopyFiles */ = { 18 | isa = PBXCopyFilesBuildPhase; 19 | buildActionMask = 8; 20 | dstPath = /usr/share/man/man1/; 21 | dstSubfolderSpec = 0; 22 | files = ( 23 | 79797E0B07F6327800E7262E /* mach_override.h in CopyFiles */, 24 | ); 25 | runOnlyForDeploymentPostprocessing = 1; 26 | }; 27 | /* End PBXCopyFilesBuildPhase section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 097DBE83FE8419DDC02AAC07 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = ""; }; 31 | 794FB6AE095E50DE00FEA73E /* test_mach_override.cp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_mach_override.cp; sourceTree = ""; }; 32 | 79797E0707F6327800E7262E /* mach_override.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mach_override.c; sourceTree = ""; }; 33 | 79797E0807F6327800E7262E /* mach_override.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mach_override.h; sourceTree = ""; }; 34 | 8DD76F8E0486A9BA00D96B5E /* mach_override */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mach_override; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 8DD76F880486A9BA00D96B5E /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 8DD76F890486A9BA00D96B5E /* CoreServices.framework in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 08FB7794FE84155DC02AAC07 /* mach_override */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 08FB7795FE84155DC02AAC07 /* Source */, 53 | 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, 54 | 1A8B4A8EFE9D542A11CA2CBB /* Products */, 55 | ); 56 | name = mach_override; 57 | sourceTree = ""; 58 | }; 59 | 08FB7795FE84155DC02AAC07 /* Source */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 79797E0707F6327800E7262E /* mach_override.c */, 63 | 79797E0807F6327800E7262E /* mach_override.h */, 64 | 794FB6AE095E50DE00FEA73E /* test_mach_override.cp */, 65 | ); 66 | name = Source; 67 | sourceTree = ""; 68 | }; 69 | 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 097DBE83FE8419DDC02AAC07 /* CoreServices.framework */, 73 | ); 74 | name = "External Frameworks and Libraries"; 75 | sourceTree = ""; 76 | }; 77 | 1A8B4A8EFE9D542A11CA2CBB /* Products */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 8DD76F8E0486A9BA00D96B5E /* mach_override */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | /* End PBXGroup section */ 86 | 87 | /* Begin PBXNativeTarget section */ 88 | 8DD76F840486A9BA00D96B5E /* mach_override */ = { 89 | isa = PBXNativeTarget; 90 | buildConfigurationList = 33B2AC16092852F2004B1632 /* Build configuration list for PBXNativeTarget "mach_override" */; 91 | buildPhases = ( 92 | 8DD76F860486A9BA00D96B5E /* Sources */, 93 | 8DD76F880486A9BA00D96B5E /* Frameworks */, 94 | 8DD76F8B0486A9BA00D96B5E /* CopyFiles */, 95 | ); 96 | buildRules = ( 97 | ); 98 | dependencies = ( 99 | ); 100 | name = mach_override; 101 | productInstallPath = "$(HOME)/bin"; 102 | productName = mach_override; 103 | productReference = 8DD76F8E0486A9BA00D96B5E /* mach_override */; 104 | productType = "com.apple.product-type.tool"; 105 | }; 106 | /* End PBXNativeTarget section */ 107 | 108 | /* Begin PBXProject section */ 109 | 08FB7793FE84155DC02AAC07 /* Project object */ = { 110 | isa = PBXProject; 111 | buildConfigurationList = 33B2AC1A092852F2004B1632 /* Build configuration list for PBXProject "mach_override" */; 112 | compatibilityVersion = "Xcode 3.1"; 113 | hasScannedForEncodings = 1; 114 | mainGroup = 08FB7794FE84155DC02AAC07 /* mach_override */; 115 | projectDirPath = ""; 116 | projectRoot = ""; 117 | targets = ( 118 | 8DD76F840486A9BA00D96B5E /* mach_override */, 119 | ); 120 | }; 121 | /* End PBXProject section */ 122 | 123 | /* Begin PBXSourcesBuildPhase section */ 124 | 8DD76F860486A9BA00D96B5E /* Sources */ = { 125 | isa = PBXSourcesBuildPhase; 126 | buildActionMask = 2147483647; 127 | files = ( 128 | 79797E0A07F6327800E7262E /* mach_override.c in Sources */, 129 | 794FB6B0095E50DE00FEA73E /* test_mach_override.cp in Sources */, 130 | ); 131 | runOnlyForDeploymentPostprocessing = 0; 132 | }; 133 | /* End PBXSourcesBuildPhase section */ 134 | 135 | /* Begin XCBuildConfiguration section */ 136 | 33B2AC17092852F2004B1632 /* Development */ = { 137 | isa = XCBuildConfiguration; 138 | buildSettings = { 139 | ARCHS = ( 140 | ppc, 141 | i386, 142 | x86_64, 143 | ); 144 | COPY_PHASE_STRIP = NO; 145 | GCC_DYNAMIC_NO_PIC = NO; 146 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 147 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 148 | GCC_OPTIMIZATION_LEVEL = 0; 149 | INSTALL_PATH = "$(HOME)/bin"; 150 | PRODUCT_NAME = mach_override; 151 | ZERO_LINK = YES; 152 | }; 153 | name = Development; 154 | }; 155 | 33B2AC18092852F2004B1632 /* Deployment */ = { 156 | isa = XCBuildConfiguration; 157 | buildSettings = { 158 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 159 | COPY_PHASE_STRIP = YES; 160 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 161 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 162 | GCC_OPTIMIZATION_LEVEL = s; 163 | INSTALL_PATH = "$(HOME)/bin"; 164 | PRODUCT_NAME = mach_override; 165 | ZERO_LINK = NO; 166 | }; 167 | name = Deployment; 168 | }; 169 | 33B2AC19092852F2004B1632 /* Default */ = { 170 | isa = XCBuildConfiguration; 171 | buildSettings = { 172 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 173 | INSTALL_PATH = "$(HOME)/bin"; 174 | PRODUCT_NAME = mach_override; 175 | }; 176 | name = Default; 177 | }; 178 | 33B2AC1B092852F2004B1632 /* Development */ = { 179 | isa = XCBuildConfiguration; 180 | buildSettings = { 181 | }; 182 | name = Development; 183 | }; 184 | 33B2AC1C092852F2004B1632 /* Deployment */ = { 185 | isa = XCBuildConfiguration; 186 | buildSettings = { 187 | ARCHS = "$(NATIVE_ARCH_ACTUAL)"; 188 | GCC_VERSION = ""; 189 | }; 190 | name = Deployment; 191 | }; 192 | 33B2AC1D092852F2004B1632 /* Default */ = { 193 | isa = XCBuildConfiguration; 194 | buildSettings = { 195 | }; 196 | name = Default; 197 | }; 198 | /* End XCBuildConfiguration section */ 199 | 200 | /* Begin XCConfigurationList section */ 201 | 33B2AC16092852F2004B1632 /* Build configuration list for PBXNativeTarget "mach_override" */ = { 202 | isa = XCConfigurationList; 203 | buildConfigurations = ( 204 | 33B2AC17092852F2004B1632 /* Development */, 205 | 33B2AC18092852F2004B1632 /* Deployment */, 206 | 33B2AC19092852F2004B1632 /* Default */, 207 | ); 208 | defaultConfigurationIsVisible = 0; 209 | defaultConfigurationName = Default; 210 | }; 211 | 33B2AC1A092852F2004B1632 /* Build configuration list for PBXProject "mach_override" */ = { 212 | isa = XCConfigurationList; 213 | buildConfigurations = ( 214 | 33B2AC1B092852F2004B1632 /* Development */, 215 | 33B2AC1C092852F2004B1632 /* Deployment */, 216 | 33B2AC1D092852F2004B1632 /* Default */, 217 | ); 218 | defaultConfigurationIsVisible = 0; 219 | defaultConfigurationName = Default; 220 | }; 221 | /* End XCConfigurationList section */ 222 | }; 223 | rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; 224 | } 225 | -------------------------------------------------------------------------------- /src/SIMBL.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2003-2009, Mike Solomon 3 | * SIMBL is released under the GNU General Public License v2. 4 | * http://www.opensource.org/licenses/gpl-2.0.php 5 | */ 6 | 7 | #import "DTMacros.h" 8 | #import "SIMBL.h" 9 | #import "SIMBLPlugin.h" 10 | #import "NSAlert_SIMBL.h" 11 | 12 | #import 13 | 14 | /* 15 | SIMBLTargetApplications 16 | 17 | 18 | BundleIdentifier 19 | com.apple.Safari 20 | MinBundleVersion 21 | 125 22 | MaxBundleVersion 23 | 125 24 | 25 | 26 | */ 27 | 28 | @interface SIMBL_Loader : NSObject {} 29 | + (void)initme:(NSObject*)arg; 30 | @end 31 | @implementation SIMBL_Loader 32 | + (void)initme:(NSObject*)arg { 33 | fprintf(stderr, "SIMBL in %s\n", [[[NSBundle mainBundle] executablePath] UTF8String]); 34 | if(![[[NSBundle mainBundle] executablePath] hasSuffix:@"/SIMBL Agent"]) { 35 | SIMBLLogInfo(@"load SIMBL plugins"); 36 | [SIMBL installPlugins]; 37 | } 38 | } 39 | @end 40 | 41 | __attribute__((constructor)) 42 | void initme() { 43 | if([NSBundle mainBundle]) { 44 | [SIMBL_Loader performSelectorOnMainThread:@selector(initme:) withObject:nil waitUntilDone:NO]; 45 | } 46 | } 47 | 48 | @implementation SIMBL 49 | 50 | static NSMutableDictionary* loadedBundleIdentifiers = nil; 51 | 52 | // This is the handler function which is called when the send the AppleEvent 'SIMeload'. 53 | // This is send from the SIMBL Agent in SIMBLAgent.m:injectSIMBL. 54 | // See http://developer.apple.com/library/mac/#technotes/tn1164/_index.html "Scripting Additions for Mac OS X". 55 | // See http://developer.apple.com/legacy/mac/library/documentation/AppleScript/Conceptual/AppleEvents/AppleEvents.pdf "Apple Event Programming Guide". 56 | OSErr pascal InjectEventHandler(const AppleEvent *ev, AppleEvent *reply, SInt32 refcon) 57 | { 58 | OSErr resultCode = noErr; 59 | SIMBLLogInfo(@"load SIMBL plugins"); 60 | [SIMBL installPlugins]; 61 | return resultCode; 62 | } 63 | 64 | + (void) initialize 65 | { 66 | NSUserDefaults* defaults = [[NSUserDefaults alloc] init]; 67 | [defaults addSuiteNamed:@"net.culater.SIMBL"]; 68 | [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:SIMBLLogLevelDefault], SIMBLPrefKeyLogLevel, nil]]; 69 | [defaults release]; 70 | } 71 | 72 | + (void) logMessage:(NSString*)message atLevel:(int)level 73 | { 74 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 75 | [defaults addSuiteNamed:@"net.culater.SIMBL"]; 76 | if ([defaults integerForKey:SIMBLPrefKeyLogLevel] <= level) { 77 | NSLog(@"%@", message); 78 | } 79 | } 80 | 81 | + (NSArray*) pluginPathList 82 | { 83 | NSMutableArray* pluginPathList = [NSMutableArray array]; 84 | NSArray* paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSAllDomainsMask, YES); 85 | for (NSString* libraryPath in paths) { 86 | NSString* simblPath = [libraryPath stringByAppendingPathComponent:SIMBLPluginPath]; 87 | NSArray* simblBundles = [[[NSFileManager defaultManager] directoryContentsAtPath:simblPath] pathsMatchingExtensions:[NSArray arrayWithObject:@"bundle"]]; 88 | for (NSString* bundleName in simblBundles) { 89 | [pluginPathList addObject:[simblPath stringByAppendingPathComponent:bundleName]]; 90 | } 91 | } 92 | return pluginPathList; 93 | } 94 | 95 | 96 | + (void) installPlugins 97 | { 98 | if (loadedBundleIdentifiers == nil) 99 | loadedBundleIdentifiers = [[NSMutableDictionary alloc] init]; 100 | 101 | SIMBLLogDebug(@"SIMBL loaded by path %@ <%@>", [[NSBundle mainBundle] bundlePath], [[NSBundle mainBundle] bundleIdentifier]); 102 | 103 | for (NSString* path in [SIMBL pluginPathList]) { 104 | BOOL bundleLoaded = [SIMBL loadBundleAtPath:path]; 105 | if (bundleLoaded) 106 | SIMBLLogDebug(@"loaded %@", path); 107 | } 108 | } 109 | 110 | 111 | + (BOOL) shouldInstallPluginsIntoApplication:(NSBundle*)_appBundle 112 | { 113 | for (NSString* path in [SIMBL pluginPathList]) { 114 | BOOL bundleLoaded = [SIMBL shouldApplication:_appBundle loadBundleAtPath:path]; 115 | if (bundleLoaded) 116 | return YES; 117 | } 118 | return NO; 119 | } 120 | 121 | 122 | /** 123 | * get this list of allowed application identifiers from the plugin's Info.plist 124 | * the special value * will cause any Cocoa app to load a bundle 125 | * @return YES if this should be loaded 126 | */ 127 | + (BOOL) shouldLoadBundleAtPath:(NSString*)_bundlePath 128 | { 129 | NSBundle* appBundle = [NSBundle mainBundle]; 130 | return [SIMBL shouldApplication:appBundle loadBundleAtPath:_bundlePath]; 131 | } 132 | 133 | 134 | /** 135 | * get this list of allowed application identifiers from the plugin's Info.plist 136 | * the special value * will cause any Cocoa app to load a bundle 137 | * @return YES if this should be loaded 138 | */ 139 | + (BOOL) shouldApplication:(NSBundle*)_appBundle loadBundleAtPath:(NSString*)_bundlePath 140 | { 141 | SIMBLLogDebug(@"checking bundle %@", _bundlePath); 142 | _bundlePath = [_bundlePath stringByStandardizingPath]; 143 | SIMBLPlugin* pluginBundle = [SIMBLPlugin bundleWithPath:_bundlePath]; 144 | if (pluginBundle == nil) { 145 | SIMBLLogNotice(@"Unable to load bundle at path '%@'", _bundlePath); 146 | return NO; 147 | } 148 | 149 | NSString* pluginIdentifier = [pluginBundle bundleIdentifier]; 150 | if (pluginIdentifier == nil) { 151 | SIMBLLogNotice(@"No identifier for bundle at path '%@'", _bundlePath); 152 | return NO; 153 | } 154 | 155 | // this is the new way of specifying when to load a bundle 156 | NSArray* targetApplications = [pluginBundle objectForInfoDictionaryKey:SIMBLTargetApplications]; 157 | if (targetApplications) 158 | return [self shouldApplication:_appBundle loadBundle:pluginBundle withTargetApplications:targetApplications]; 159 | 160 | // fall back to the old method for older plugins - we should probably throw a depreaction warning 161 | NSArray* applicationIdentifiers = [pluginBundle objectForInfoDictionaryKey:SIMBLApplicationIdentifier]; 162 | if (applicationIdentifiers) 163 | return [self shouldApplication:_appBundle loadBundle:pluginBundle withApplicationIdentifiers:applicationIdentifiers]; 164 | 165 | return NO; 166 | } 167 | 168 | 169 | /** 170 | * get this list of allowed application identifiers from the plugin's Info.plist 171 | * the special value * will cause any Cocoa app to load a bundle 172 | * if there is a match, this calls the main bundle's load method 173 | * @return YES if this bundle was loaded 174 | */ 175 | + (BOOL) loadBundleAtPath:(NSString*)_bundlePath 176 | { 177 | if ([SIMBL shouldLoadBundleAtPath:_bundlePath] == NO) { 178 | return NO; 179 | } 180 | 181 | SIMBLPlugin* pluginBundle = [SIMBLPlugin bundleWithPath:_bundlePath]; 182 | 183 | // check to see if we already loaded code for this identifier (keeps us from double loading) 184 | // this is common if you have User vs. System-wide installs - probably mostly for developers 185 | // "physician, heal thyself!" 186 | NSString* pluginIdentifier = [pluginBundle bundleIdentifier]; 187 | if ([loadedBundleIdentifiers objectForKey:pluginIdentifier] != nil) 188 | return NO; 189 | return [SIMBL loadBundle:pluginBundle]; 190 | } 191 | 192 | 193 | /** 194 | * get this list of allowed application identifiers from the plugin's Info.plist 195 | * the special value * will cause any Cocoa app to load a bundle 196 | * if there is a match, this calls the main bundle's load method 197 | * @return YES if this bundle was loaded 198 | */ 199 | + (BOOL) shouldApplication:(NSBundle*)_appBundle loadBundle:(SIMBLPlugin*)_bundle withApplicationIdentifiers:(NSArray*)_applicationIdentifiers 200 | { 201 | NSString* appIdentifier = [_appBundle bundleIdentifier]; 202 | for (NSString* specifiedIdentifier in _applicationIdentifiers) { 203 | SIMBLLogDebug(@"checking bundle %@ for identifier %@", [_bundle bundleIdentifier], specifiedIdentifier); 204 | if ([specifiedIdentifier isEqualToString:appIdentifier] == YES || 205 | [specifiedIdentifier isEqualToString:@"*"] == YES) { 206 | SIMBLLogDebug(@"load bundle %@", [_bundle bundleIdentifier]); 207 | SIMBLLogNotice(@"The plugin %@ (%@) is using a deprecated interface to SIMBL. Please contact the appropriate developer (not the SIMBL author) and refer them to http://code.google.com/p/simbl/wiki/Tutorial", [_bundle path], [_bundle bundleIdentifier]); 208 | return YES; 209 | } 210 | } 211 | 212 | return NO; 213 | } 214 | 215 | 216 | /** 217 | * get this list of allowed target applications from the plugin's Info.plist 218 | * the special value * will cause any Cocoa app to load a bundle 219 | * if there is a match, this calls the main bundle's load method 220 | * @return YES if this bundle was loaded 221 | */ 222 | + (BOOL) shouldApplication:(NSBundle*)_appBundle loadBundle:(SIMBLPlugin*)_bundle withTargetApplications:(NSArray*)_targetApplications 223 | { 224 | NSString* appIdentifier = [_appBundle bundleIdentifier]; 225 | for (NSDictionary* targetAppProperties in _targetApplications) { 226 | NSString* targetAppIdentifier = [targetAppProperties objectForKey:SIMBLBundleIdentifier]; 227 | SIMBLLogDebug(@"checking target identifier %@", targetAppIdentifier); 228 | if ([targetAppIdentifier isEqualToString:appIdentifier] == NO && 229 | [targetAppIdentifier isEqualToString:@"*"] == NO) 230 | continue; 231 | 232 | NSString* targetAppPath = [targetAppProperties objectForKey:SIMBLTargetApplicationPath]; 233 | if (targetAppPath && [targetAppPath isEqualToString:[_appBundle bundlePath]] == NO) 234 | continue; 235 | 236 | // FIXME: this has never been used - it should probably be removed. 237 | NSArray* requiredFrameworks = [targetAppProperties objectForKey:SIMBLRequiredFrameworks]; 238 | BOOL missingFramework = NO; 239 | if (requiredFrameworks) 240 | { 241 | SIMBLLogDebug(@"requiredFrameworks: %@", requiredFrameworks); 242 | NSEnumerator* requiredFrameworkEnum = [requiredFrameworks objectEnumerator]; 243 | NSDictionary* requiredFramework; 244 | while ((requiredFramework = [requiredFrameworkEnum nextObject]) && missingFramework == NO) 245 | { 246 | NSBundle* framework = [NSBundle bundleWithIdentifier:[requiredFramework objectForKey:@"BundleIdentifier"]]; 247 | NSString* frameworkPath = [framework bundlePath]; 248 | NSString* requiredPath = [requiredFramework objectForKey:@"BundlePath"]; 249 | if ([frameworkPath isEqualToString:requiredPath] == NO) { 250 | missingFramework = YES; 251 | } 252 | } 253 | } 254 | 255 | if (missingFramework) 256 | continue; 257 | 258 | int appVersion = [[_appBundle _dt_bundleVersion] intValue]; 259 | 260 | int minVersion = 0; 261 | NSNumber* number; 262 | if ((number = [targetAppProperties objectForKey:SIMBLMinBundleVersion])) 263 | minVersion = [number intValue]; 264 | 265 | int maxVersion = 0; 266 | if ((number = [targetAppProperties objectForKey:SIMBLMaxBundleVersion])) 267 | maxVersion = [number intValue]; 268 | 269 | if ((maxVersion && appVersion > maxVersion) || (minVersion && appVersion < minVersion)) 270 | { 271 | [NSAlert errorAlert:NSLocalizedStringFromTableInBundle(@"Error", SIMBLStringTable, DTOwnerBundle, @"Error alert primary message") withDetails:NSLocalizedStringFromTableInBundle(@"%@ %@ (v%@) has not been tested with the plugin %@ %@ (v%@). As a precaution, it has not been loaded. Please contact the plugin developer for further information.", SIMBLStringTable, DTOwnerBundle, @"Error alert details, substitute application and plugin version strings"), [_appBundle _dt_name], [_appBundle _dt_version], [_appBundle _dt_bundleVersion], [_bundle _dt_name], [_bundle _dt_version], [_bundle _dt_bundleVersion]]; 272 | continue; 273 | } 274 | 275 | return YES; 276 | } 277 | 278 | return NO; 279 | } 280 | 281 | 282 | + (BOOL) loadBundle:(SIMBLPlugin*)_plugin 283 | { 284 | @try 285 | { 286 | // getting the principalClass should force the bundle to load 287 | NSBundle* bundle = [NSBundle bundleWithPath:[_plugin path]]; 288 | Class principalClass = [bundle principalClass]; 289 | 290 | // if the principal class has an + (void) install message, call it 291 | if (principalClass && class_getClassMethod(principalClass, @selector(install))) 292 | [principalClass install]; 293 | 294 | // set that we've loaded this bundle to prevent collisions 295 | [loadedBundleIdentifiers setObject:@"loaded" forKey:[bundle bundleIdentifier]]; 296 | 297 | return YES; 298 | } 299 | @catch (NSException* exception) 300 | { 301 | [NSAlert errorAlert:NSLocalizedStringFromTableInBundle(@"Error", SIMBLStringTable, DTOwnerBundle, @"Error alert primary message") withDetails:NSLocalizedStringFromTableInBundle(@"Failed to load the %@ plugin.\n%@", SIMBLStringTable, DTOwnerBundle, @"Error alert details, sub plugin name and error reason"), [_plugin _dt_name], [exception reason]]; 302 | } 303 | 304 | return NO; 305 | } 306 | 307 | @end 308 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep/DisposeWindow+Beep.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 42; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 10246EDB0FE737AD00EA5607 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10246EDA0FE737AD00EA5607 /* AudioToolbox.framework */; }; 11 | 79ACC9A607FD4A8A00D4147B /* mach_override.c in Sources */ = {isa = PBXBuildFile; fileRef = 79ACC9A407FD4A8A00D4147B /* mach_override.c */; }; 12 | 79ACC9A707FD4A8A00D4147B /* mach_override.h in Headers */ = {isa = PBXBuildFile; fileRef = 79ACC9A507FD4A8A00D4147B /* mach_override.h */; }; 13 | 8D01CCC80486CAD60068D4B7 /* DisposeWindow+Beep_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32BAE0B30371A71500C91783 /* DisposeWindow+Beep_Prefix.pch */; }; 14 | 8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 15 | 8D01CCCC0486CAD60068D4B7 /* DisposeWindow+Beep.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB77B2FE8417CDC02AAC07 /* DisposeWindow+Beep.c */; settings = {ATTRIBUTES = (); }; }; 16 | 8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 21 | 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 22 | 08FB77B2FE8417CDC02AAC07 /* DisposeWindow+Beep.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "DisposeWindow+Beep.c"; sourceTree = ""; }; 23 | 10246EDA0FE737AD00EA5607 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = ""; }; 24 | 32BAE0B30371A71500C91783 /* DisposeWindow+Beep_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DisposeWindow+Beep_Prefix.pch"; sourceTree = ""; }; 25 | 79ACC9A407FD4A8A00D4147B /* mach_override.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mach_override.c; path = ../mach_override/mach_override.c; sourceTree = SOURCE_ROOT; }; 26 | 79ACC9A507FD4A8A00D4147B /* mach_override.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mach_override.h; path = ../mach_override/mach_override.h; sourceTree = SOURCE_ROOT; }; 27 | 8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 28 | 8D01CCD20486CAD60068D4B7 /* DisposeWindow+Beep.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "DisposeWindow+Beep.bundle"; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 8D01CCCD0486CAD60068D4B7 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | 8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */, 37 | 10246EDB0FE737AD00EA5607 /* AudioToolbox.framework in Frameworks */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 089C166AFE841209C02AAC07 /* DisposeWindow+Beep */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | 08FB77ADFE841716C02AAC07 /* Source */, 48 | 089C167CFE841241C02AAC07 /* Resources */, 49 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, 50 | 19C28FB4FE9D528D11CA2CBB /* Products */, 51 | ); 52 | name = "DisposeWindow+Beep"; 53 | sourceTree = ""; 54 | }; 55 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */, 59 | 10246EDA0FE737AD00EA5607 /* AudioToolbox.framework */, 60 | ); 61 | name = "External Frameworks and Libraries"; 62 | sourceTree = ""; 63 | }; 64 | 089C167CFE841241C02AAC07 /* Resources */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 8D01CCD10486CAD60068D4B7 /* Info.plist */, 68 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */, 69 | ); 70 | name = Resources; 71 | sourceTree = ""; 72 | }; 73 | 08FB77ADFE841716C02AAC07 /* Source */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 08FB77B2FE8417CDC02AAC07 /* DisposeWindow+Beep.c */, 77 | 79ACC9A407FD4A8A00D4147B /* mach_override.c */, 78 | 79ACC9A507FD4A8A00D4147B /* mach_override.h */, 79 | 32BAE0B30371A71500C91783 /* DisposeWindow+Beep_Prefix.pch */, 80 | ); 81 | name = Source; 82 | sourceTree = ""; 83 | }; 84 | 19C28FB4FE9D528D11CA2CBB /* Products */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 8D01CCD20486CAD60068D4B7 /* DisposeWindow+Beep.bundle */, 88 | ); 89 | name = Products; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXHeadersBuildPhase section */ 95 | 8D01CCC70486CAD60068D4B7 /* Headers */ = { 96 | isa = PBXHeadersBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | 8D01CCC80486CAD60068D4B7 /* DisposeWindow+Beep_Prefix.pch in Headers */, 100 | 79ACC9A707FD4A8A00D4147B /* mach_override.h in Headers */, 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | /* End PBXHeadersBuildPhase section */ 105 | 106 | /* Begin PBXNativeTarget section */ 107 | 8D01CCC60486CAD60068D4B7 /* DisposeWindow+Beep */ = { 108 | isa = PBXNativeTarget; 109 | buildConfigurationList = 33B2ACCA092857D7004B1632 /* Build configuration list for PBXNativeTarget "DisposeWindow+Beep" */; 110 | buildPhases = ( 111 | 8D01CCC70486CAD60068D4B7 /* Headers */, 112 | 8D01CCC90486CAD60068D4B7 /* Resources */, 113 | 8D01CCCB0486CAD60068D4B7 /* Sources */, 114 | 8D01CCCD0486CAD60068D4B7 /* Frameworks */, 115 | 8D01CCCF0486CAD60068D4B7 /* Rez */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = "DisposeWindow+Beep"; 122 | productInstallPath = "$(HOME)/Library/Bundles"; 123 | productName = "DisposeWindow+Beep"; 124 | productReference = 8D01CCD20486CAD60068D4B7 /* DisposeWindow+Beep.bundle */; 125 | productType = "com.apple.product-type.bundle"; 126 | }; 127 | /* End PBXNativeTarget section */ 128 | 129 | /* Begin PBXProject section */ 130 | 089C1669FE841209C02AAC07 /* Project object */ = { 131 | isa = PBXProject; 132 | buildConfigurationList = 33B2ACCE092857D7004B1632 /* Build configuration list for PBXProject "DisposeWindow+Beep" */; 133 | compatibilityVersion = "Xcode 2.4"; 134 | hasScannedForEncodings = 1; 135 | mainGroup = 089C166AFE841209C02AAC07 /* DisposeWindow+Beep */; 136 | projectDirPath = ""; 137 | projectRoot = ""; 138 | targets = ( 139 | 8D01CCC60486CAD60068D4B7 /* DisposeWindow+Beep */, 140 | ); 141 | }; 142 | /* End PBXProject section */ 143 | 144 | /* Begin PBXResourcesBuildPhase section */ 145 | 8D01CCC90486CAD60068D4B7 /* Resources */ = { 146 | isa = PBXResourcesBuildPhase; 147 | buildActionMask = 2147483647; 148 | files = ( 149 | 8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | /* End PBXResourcesBuildPhase section */ 154 | 155 | /* Begin PBXRezBuildPhase section */ 156 | 8D01CCCF0486CAD60068D4B7 /* Rez */ = { 157 | isa = PBXRezBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXRezBuildPhase section */ 164 | 165 | /* Begin PBXSourcesBuildPhase section */ 166 | 8D01CCCB0486CAD60068D4B7 /* Sources */ = { 167 | isa = PBXSourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 8D01CCCC0486CAD60068D4B7 /* DisposeWindow+Beep.c in Sources */, 171 | 79ACC9A607FD4A8A00D4147B /* mach_override.c in Sources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXSourcesBuildPhase section */ 176 | 177 | /* Begin PBXVariantGroup section */ 178 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { 179 | isa = PBXVariantGroup; 180 | children = ( 181 | 089C167EFE841241C02AAC07 /* English */, 182 | ); 183 | name = InfoPlist.strings; 184 | sourceTree = ""; 185 | }; 186 | /* End PBXVariantGroup section */ 187 | 188 | /* Begin XCBuildConfiguration section */ 189 | 33B2ACCB092857D7004B1632 /* Development */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; 193 | ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; 194 | COPY_PHASE_STRIP = NO; 195 | DEBUGGING_SYMBOLS = YES; 196 | FRAMEWORK_SEARCH_PATHS = ""; 197 | GCC_DYNAMIC_NO_PIC = NO; 198 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 199 | GCC_ENABLE_TRIGRAPHS = NO; 200 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 201 | GCC_OPTIMIZATION_LEVEL = 0; 202 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 203 | GCC_PREFIX_HEADER = "DisposeWindow+Beep_Prefix.pch"; 204 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; 205 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 206 | GCC_WARN_UNKNOWN_PRAGMAS = NO; 207 | HEADER_SEARCH_PATHS = ""; 208 | INFOPLIST_FILE = Info.plist; 209 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 210 | LIBRARY_SEARCH_PATHS = ""; 211 | LIBRARY_STYLE = Bundle; 212 | OTHER_CFLAGS = ""; 213 | OTHER_LDFLAGS = ""; 214 | OTHER_REZFLAGS = ""; 215 | PRODUCT_NAME = "DisposeWindow+Beep"; 216 | SECTORDER_FLAGS = ""; 217 | WARNING_CFLAGS = ( 218 | "-Wmost", 219 | "-Wno-four-char-constants", 220 | "-Wno-unknown-pragmas", 221 | ); 222 | WRAPPER_EXTENSION = bundle; 223 | ZERO_LINK = YES; 224 | }; 225 | name = Development; 226 | }; 227 | 33B2ACCC092857D7004B1632 /* Deployment */ = { 228 | isa = XCBuildConfiguration; 229 | buildSettings = { 230 | ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; 231 | ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; 232 | COPY_PHASE_STRIP = YES; 233 | FRAMEWORK_SEARCH_PATHS = ""; 234 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 235 | GCC_ENABLE_TRIGRAPHS = NO; 236 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 237 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 238 | GCC_PREFIX_HEADER = "DisposeWindow+Beep_Prefix.pch"; 239 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; 240 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 241 | GCC_WARN_UNKNOWN_PRAGMAS = NO; 242 | HEADER_SEARCH_PATHS = ""; 243 | INFOPLIST_FILE = Info.plist; 244 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 245 | LIBRARY_SEARCH_PATHS = ""; 246 | LIBRARY_STYLE = Bundle; 247 | OTHER_CFLAGS = ""; 248 | OTHER_LDFLAGS = ""; 249 | OTHER_REZFLAGS = ""; 250 | PRODUCT_NAME = "DisposeWindow+Beep"; 251 | SECTORDER_FLAGS = ""; 252 | WARNING_CFLAGS = ( 253 | "-Wmost", 254 | "-Wno-four-char-constants", 255 | "-Wno-unknown-pragmas", 256 | ); 257 | WRAPPER_EXTENSION = bundle; 258 | ZERO_LINK = NO; 259 | }; 260 | name = Deployment; 261 | }; 262 | 33B2ACCD092857D7004B1632 /* Default */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | FRAMEWORK_SEARCH_PATHS = ""; 266 | GCC_ENABLE_TRIGRAPHS = NO; 267 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 268 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 269 | GCC_PREFIX_HEADER = "DisposeWindow+Beep_Prefix.pch"; 270 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; 271 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 272 | GCC_WARN_UNKNOWN_PRAGMAS = NO; 273 | HEADER_SEARCH_PATHS = ""; 274 | INFOPLIST_FILE = Info.plist; 275 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 276 | LIBRARY_SEARCH_PATHS = ""; 277 | LIBRARY_STYLE = Bundle; 278 | OTHER_CFLAGS = ""; 279 | OTHER_LDFLAGS = ""; 280 | OTHER_REZFLAGS = ""; 281 | PRODUCT_NAME = "DisposeWindow+Beep"; 282 | SECTORDER_FLAGS = ""; 283 | WARNING_CFLAGS = ( 284 | "-Wmost", 285 | "-Wno-four-char-constants", 286 | "-Wno-unknown-pragmas", 287 | ); 288 | WRAPPER_EXTENSION = bundle; 289 | }; 290 | name = Default; 291 | }; 292 | 33B2ACCF092857D7004B1632 /* Development */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | }; 296 | name = Development; 297 | }; 298 | 33B2ACD0092857D7004B1632 /* Deployment */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | }; 302 | name = Deployment; 303 | }; 304 | 33B2ACD1092857D7004B1632 /* Default */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | }; 308 | name = Default; 309 | }; 310 | /* End XCBuildConfiguration section */ 311 | 312 | /* Begin XCConfigurationList section */ 313 | 33B2ACCA092857D7004B1632 /* Build configuration list for PBXNativeTarget "DisposeWindow+Beep" */ = { 314 | isa = XCConfigurationList; 315 | buildConfigurations = ( 316 | 33B2ACCB092857D7004B1632 /* Development */, 317 | 33B2ACCC092857D7004B1632 /* Deployment */, 318 | 33B2ACCD092857D7004B1632 /* Default */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | defaultConfigurationName = Default; 322 | }; 323 | 33B2ACCE092857D7004B1632 /* Build configuration list for PBXProject "DisposeWindow+Beep" */ = { 324 | isa = XCConfigurationList; 325 | buildConfigurations = ( 326 | 33B2ACCF092857D7004B1632 /* Development */, 327 | 33B2ACD0092857D7004B1632 /* Deployment */, 328 | 33B2ACD1092857D7004B1632 /* Default */, 329 | ); 330 | defaultConfigurationIsVisible = 0; 331 | defaultConfigurationName = Default; 332 | }; 333 | /* End XCConfigurationList section */ 334 | }; 335 | rootObject = 089C1669FE841209C02AAC07 /* Project object */; 336 | } 337 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle_stub/mach_inject_bundle_stub.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 79ACC4F507FD370C00D4147B /* load_bundle.c in Sources */ = {isa = PBXBuildFile; fileRef = 79ACC4F307FD370C00D4147B /* load_bundle.c */; }; 11 | 79ACC4F607FD370C00D4147B /* load_bundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 79ACC4F407FD370C00D4147B /* load_bundle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 79ACC4FC07FD376D00D4147B /* mach_inject_bundle_stub.h in Headers */ = {isa = PBXBuildFile; fileRef = 79ACC4FB07FD376D00D4147B /* mach_inject_bundle_stub.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | 79ACC50B07FD3CE100D4147B /* mach_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 79ACC50A07FD3CE100D4147B /* mach_inject.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 79ACC83D07FD3DA800D4147B /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79ACC83C07FD3DA800D4147B /* Carbon.framework */; }; 15 | 8D01CCC80486CAD60068D4B7 /* mach_inject_bundle_stub_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32BAE0B30371A71500C91783 /* mach_inject_bundle_stub_Prefix.pch */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | 8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 17 | 8D01CCCC0486CAD60068D4B7 /* mach_inject_bundle_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB77B2FE8417CDC02AAC07 /* mach_inject_bundle_stub.c */; settings = {ATTRIBUTES = (); }; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 22 | 08FB77B2FE8417CDC02AAC07 /* mach_inject_bundle_stub.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mach_inject_bundle_stub.c; sourceTree = ""; }; 23 | 23A925321415A34F00EE4B17 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = ../../../../../../System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 24 | 23A925341415A35900EE4B17 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = ../../../../../../System/Library/Frameworks/CoreServices.framework; sourceTree = ""; }; 25 | 23A925361415A36B00EE4B17 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = ../../../../../../System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 26 | 23A925381415A37800EE4B17 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = ../../../../../../System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 27 | 32BAE0B30371A71500C91783 /* mach_inject_bundle_stub_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mach_inject_bundle_stub_Prefix.pch; sourceTree = ""; }; 28 | 79ACC4F307FD370C00D4147B /* load_bundle.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = load_bundle.c; sourceTree = ""; }; 29 | 79ACC4F407FD370C00D4147B /* load_bundle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = load_bundle.h; sourceTree = ""; }; 30 | 79ACC4FB07FD376D00D4147B /* mach_inject_bundle_stub.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mach_inject_bundle_stub.h; sourceTree = ""; }; 31 | 79ACC50A07FD3CE100D4147B /* mach_inject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mach_inject.h; path = ../mach_inject/mach_inject.h; sourceTree = SOURCE_ROOT; }; 32 | 79ACC83C07FD3DA800D4147B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 33 | 8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 34 | 8D01CCD20486CAD60068D4B7 /* mach_inject_bundle_stub.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = mach_inject_bundle_stub.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 8D01CCCD0486CAD60068D4B7 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 79ACC83D07FD3DA800D4147B /* Carbon.framework in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 089C166AFE841209C02AAC07 /* mach_inject_bundle_stub */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 23A925381415A37800EE4B17 /* Cocoa.framework */, 53 | 23A925361415A36B00EE4B17 /* CoreFoundation.framework */, 54 | 23A925341415A35900EE4B17 /* CoreServices.framework */, 55 | 23A925321415A34F00EE4B17 /* Cocoa.framework */, 56 | 08FB77ADFE841716C02AAC07 /* Source */, 57 | 089C167CFE841241C02AAC07 /* Resources */, 58 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, 59 | 19C28FB4FE9D528D11CA2CBB /* Products */, 60 | ); 61 | name = mach_inject_bundle_stub; 62 | sourceTree = ""; 63 | }; 64 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 79ACC83C07FD3DA800D4147B /* Carbon.framework */, 68 | ); 69 | name = "External Frameworks and Libraries"; 70 | sourceTree = ""; 71 | }; 72 | 089C167CFE841241C02AAC07 /* Resources */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 8D01CCD10486CAD60068D4B7 /* Info.plist */, 76 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */, 77 | ); 78 | name = Resources; 79 | sourceTree = ""; 80 | }; 81 | 08FB77ADFE841716C02AAC07 /* Source */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 08FB77B2FE8417CDC02AAC07 /* mach_inject_bundle_stub.c */, 85 | 79ACC4FB07FD376D00D4147B /* mach_inject_bundle_stub.h */, 86 | 79ACC4F307FD370C00D4147B /* load_bundle.c */, 87 | 79ACC4F407FD370C00D4147B /* load_bundle.h */, 88 | 79ACC50A07FD3CE100D4147B /* mach_inject.h */, 89 | 32BAE0B30371A71500C91783 /* mach_inject_bundle_stub_Prefix.pch */, 90 | ); 91 | name = Source; 92 | sourceTree = ""; 93 | }; 94 | 19C28FB4FE9D528D11CA2CBB /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 8D01CCD20486CAD60068D4B7 /* mach_inject_bundle_stub.bundle */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | /* End PBXGroup section */ 103 | 104 | /* Begin PBXHeadersBuildPhase section */ 105 | 8D01CCC70486CAD60068D4B7 /* Headers */ = { 106 | isa = PBXHeadersBuildPhase; 107 | buildActionMask = 2147483647; 108 | files = ( 109 | 8D01CCC80486CAD60068D4B7 /* mach_inject_bundle_stub_Prefix.pch in Headers */, 110 | 79ACC4F607FD370C00D4147B /* load_bundle.h in Headers */, 111 | 79ACC4FC07FD376D00D4147B /* mach_inject_bundle_stub.h in Headers */, 112 | 79ACC50B07FD3CE100D4147B /* mach_inject.h in Headers */, 113 | ); 114 | runOnlyForDeploymentPostprocessing = 0; 115 | }; 116 | /* End PBXHeadersBuildPhase section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | 8D01CCC60486CAD60068D4B7 /* mach_inject_bundle_stub */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = 33B2AC4A092854FB004B1632 /* Build configuration list for PBXNativeTarget "mach_inject_bundle_stub" */; 122 | buildPhases = ( 123 | 8D01CCC70486CAD60068D4B7 /* Headers */, 124 | 8D01CCC90486CAD60068D4B7 /* Resources */, 125 | 8D01CCCB0486CAD60068D4B7 /* Sources */, 126 | 8D01CCCD0486CAD60068D4B7 /* Frameworks */, 127 | 8D01CCCF0486CAD60068D4B7 /* Rez */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = mach_inject_bundle_stub; 134 | productInstallPath = "$(HOME)/Library/Bundles"; 135 | productName = mach_inject_bundle_stub; 136 | productReference = 8D01CCD20486CAD60068D4B7 /* mach_inject_bundle_stub.bundle */; 137 | productType = "com.apple.product-type.bundle"; 138 | }; 139 | /* End PBXNativeTarget section */ 140 | 141 | /* Begin PBXProject section */ 142 | 089C1669FE841209C02AAC07 /* Project object */ = { 143 | isa = PBXProject; 144 | attributes = { 145 | LastUpgradeCheck = 0410; 146 | }; 147 | buildConfigurationList = 33B2AC4E092854FB004B1632 /* Build configuration list for PBXProject "mach_inject_bundle_stub" */; 148 | compatibilityVersion = "Xcode 3.2"; 149 | developmentRegion = English; 150 | hasScannedForEncodings = 1; 151 | knownRegions = ( 152 | en, 153 | ); 154 | mainGroup = 089C166AFE841209C02AAC07 /* mach_inject_bundle_stub */; 155 | projectDirPath = ""; 156 | projectRoot = ""; 157 | targets = ( 158 | 8D01CCC60486CAD60068D4B7 /* mach_inject_bundle_stub */, 159 | ); 160 | }; 161 | /* End PBXProject section */ 162 | 163 | /* Begin PBXResourcesBuildPhase section */ 164 | 8D01CCC90486CAD60068D4B7 /* Resources */ = { 165 | isa = PBXResourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXResourcesBuildPhase section */ 173 | 174 | /* Begin PBXRezBuildPhase section */ 175 | 8D01CCCF0486CAD60068D4B7 /* Rez */ = { 176 | isa = PBXRezBuildPhase; 177 | buildActionMask = 2147483647; 178 | files = ( 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXRezBuildPhase section */ 183 | 184 | /* Begin PBXSourcesBuildPhase section */ 185 | 8D01CCCB0486CAD60068D4B7 /* Sources */ = { 186 | isa = PBXSourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 8D01CCCC0486CAD60068D4B7 /* mach_inject_bundle_stub.c in Sources */, 190 | 79ACC4F507FD370C00D4147B /* load_bundle.c in Sources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXSourcesBuildPhase section */ 195 | 196 | /* Begin PBXVariantGroup section */ 197 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { 198 | isa = PBXVariantGroup; 199 | children = ( 200 | 089C167EFE841241C02AAC07 /* English */, 201 | ); 202 | name = InfoPlist.strings; 203 | sourceTree = ""; 204 | }; 205 | /* End PBXVariantGroup section */ 206 | 207 | /* Begin XCBuildConfiguration section */ 208 | 33B2AC4B092854FB004B1632 /* Development */ = { 209 | isa = XCBuildConfiguration; 210 | buildSettings = { 211 | ARCHS = ( 212 | ppc, 213 | i386, 214 | x86_64, 215 | ); 216 | COPY_PHASE_STRIP = NO; 217 | DEBUGGING_SYMBOLS = YES; 218 | FRAMEWORK_SEARCH_PATHS = ""; 219 | GCC_DYNAMIC_NO_PIC = NO; 220 | GCC_ENABLE_TRIGRAPHS = NO; 221 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 224 | GCC_PREFIX_HEADER = mach_inject_bundle_stub_Prefix.pch; 225 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; 226 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 227 | GCC_WARN_UNKNOWN_PRAGMAS = NO; 228 | HEADER_SEARCH_PATHS = ""; 229 | INFOPLIST_FILE = Info.plist; 230 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 231 | LIBRARY_SEARCH_PATHS = ""; 232 | LIBRARY_STYLE = Bundle; 233 | OTHER_CFLAGS = ""; 234 | OTHER_LDFLAGS = ""; 235 | OTHER_REZFLAGS = ""; 236 | PRODUCT_NAME = mach_inject_bundle_stub; 237 | SECTORDER_FLAGS = ""; 238 | WARNING_CFLAGS = ( 239 | "-Wmost", 240 | "-Wno-four-char-constants", 241 | "-Wno-unknown-pragmas", 242 | ); 243 | WRAPPER_EXTENSION = bundle; 244 | ZERO_LINK = YES; 245 | }; 246 | name = Development; 247 | }; 248 | 33B2AC4C092854FB004B1632 /* Deployment */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 252 | COPY_PHASE_STRIP = YES; 253 | FRAMEWORK_SEARCH_PATHS = ""; 254 | GCC_ENABLE_TRIGRAPHS = NO; 255 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 256 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 257 | GCC_PREFIX_HEADER = mach_inject_bundle_stub_Prefix.pch; 258 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; 259 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 260 | GCC_WARN_UNKNOWN_PRAGMAS = NO; 261 | HEADER_SEARCH_PATHS = ""; 262 | INFOPLIST_FILE = Info.plist; 263 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 264 | LIBRARY_SEARCH_PATHS = ""; 265 | LIBRARY_STYLE = Bundle; 266 | OTHER_CFLAGS = ""; 267 | OTHER_LDFLAGS = ""; 268 | OTHER_REZFLAGS = ""; 269 | PRODUCT_NAME = mach_inject_bundle_stub; 270 | SECTORDER_FLAGS = ""; 271 | WARNING_CFLAGS = ( 272 | "-Wmost", 273 | "-Wno-four-char-constants", 274 | "-Wno-unknown-pragmas", 275 | ); 276 | WRAPPER_EXTENSION = bundle; 277 | ZERO_LINK = NO; 278 | }; 279 | name = Deployment; 280 | }; 281 | 33B2AC4D092854FB004B1632 /* Default */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ARCHS = ( 285 | ppc, 286 | i386, 287 | ); 288 | FRAMEWORK_SEARCH_PATHS = ""; 289 | GCC_ENABLE_TRIGRAPHS = NO; 290 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 291 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 292 | GCC_PREFIX_HEADER = mach_inject_bundle_stub_Prefix.pch; 293 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; 294 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 295 | GCC_WARN_UNKNOWN_PRAGMAS = NO; 296 | HEADER_SEARCH_PATHS = ""; 297 | INFOPLIST_FILE = Info.plist; 298 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 299 | LIBRARY_SEARCH_PATHS = ""; 300 | LIBRARY_STYLE = Bundle; 301 | OTHER_CFLAGS = ""; 302 | OTHER_LDFLAGS = ""; 303 | OTHER_REZFLAGS = ""; 304 | PRODUCT_NAME = mach_inject_bundle_stub; 305 | SECTORDER_FLAGS = ""; 306 | WARNING_CFLAGS = ( 307 | "-Wmost", 308 | "-Wno-four-char-constants", 309 | "-Wno-unknown-pragmas", 310 | ); 311 | WRAPPER_EXTENSION = bundle; 312 | }; 313 | name = Default; 314 | }; 315 | 33B2AC4F092854FB004B1632 /* Development */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | }; 319 | name = Development; 320 | }; 321 | 33B2AC50092854FB004B1632 /* Deployment */ = { 322 | isa = XCBuildConfiguration; 323 | buildSettings = { 324 | }; 325 | name = Deployment; 326 | }; 327 | 33B2AC51092854FB004B1632 /* Default */ = { 328 | isa = XCBuildConfiguration; 329 | buildSettings = { 330 | }; 331 | name = Default; 332 | }; 333 | /* End XCBuildConfiguration section */ 334 | 335 | /* Begin XCConfigurationList section */ 336 | 33B2AC4A092854FB004B1632 /* Build configuration list for PBXNativeTarget "mach_inject_bundle_stub" */ = { 337 | isa = XCConfigurationList; 338 | buildConfigurations = ( 339 | 33B2AC4B092854FB004B1632 /* Development */, 340 | 33B2AC4C092854FB004B1632 /* Deployment */, 341 | 33B2AC4D092854FB004B1632 /* Default */, 342 | ); 343 | defaultConfigurationIsVisible = 0; 344 | defaultConfigurationName = Default; 345 | }; 346 | 33B2AC4E092854FB004B1632 /* Build configuration list for PBXProject "mach_inject_bundle_stub" */ = { 347 | isa = XCConfigurationList; 348 | buildConfigurations = ( 349 | 33B2AC4F092854FB004B1632 /* Development */, 350 | 33B2AC50092854FB004B1632 /* Deployment */, 351 | 33B2AC51092854FB004B1632 /* Default */, 352 | ); 353 | defaultConfigurationIsVisible = 0; 354 | defaultConfigurationName = Default; 355 | }; 356 | /* End XCConfigurationList section */ 357 | }; 358 | rootObject = 089C1669FE841209C02AAC07 /* Project object */; 359 | } 360 | -------------------------------------------------------------------------------- /mach_star/mach_inject/mach_inject.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | mach_inject.c 3 | Copyright (c) 2003-2009 Jonathan 'Wolf' Rentzsch: 4 | Some rights reserved: 5 | 6 | ***************************************************************************/ 7 | 8 | #include "mach_inject.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include // for malloc() 17 | #include // for printf() 18 | #include // for fat structure decoding 19 | #include // to know which is local arch 20 | #include // for open/close 21 | // for mmap() 22 | #include 23 | #include 24 | 25 | #ifndef COMPILE_TIME_ASSERT( exp ) 26 | #define COMPILE_TIME_ASSERT( exp ) { switch (0) { case 0: case (exp):; } } 27 | #endif 28 | #define ASSERT_CAST( CAST_TO, CAST_FROM ) \ 29 | COMPILE_TIME_ASSERT( sizeof(CAST_TO)==sizeof(CAST_FROM) ) 30 | 31 | #if defined(__i386__) 32 | void* fixedUpImageFromImage ( 33 | const void *image, 34 | unsigned long imageSize, 35 | unsigned int jumpTableOffset, 36 | unsigned int jumpTableSize, 37 | ptrdiff_t fixUpOffset); 38 | #endif /* __i386__ */ 39 | 40 | #include 41 | #define MACH_ERROR(msg, err) { if(err != err_none) mach_error(msg, err); } 42 | 43 | /******************************************************************************* 44 | * 45 | * Interface 46 | * 47 | *******************************************************************************/ 48 | #pragma mark - 49 | #pragma mark (Interface) 50 | 51 | mach_error_t 52 | mach_inject( 53 | const mach_inject_entry threadEntry, 54 | const void *paramBlock, 55 | size_t paramSize, 56 | pid_t targetProcess, 57 | vm_size_t stackSize ) 58 | { 59 | assert( threadEntry ); 60 | assert( targetProcess > 0 ); 61 | assert( stackSize == 0 || stackSize > 1024 ); 62 | 63 | // Find the image. 64 | const void *image; 65 | unsigned long imageSize; 66 | unsigned int jumpTableOffset; 67 | unsigned int jumpTableSize; 68 | mach_error_t err = machImageForPointer( threadEntry, &image, &imageSize, &jumpTableOffset, &jumpTableSize ); 69 | //fprintf(stderr, "mach_inject: found threadEntry image at: %p with size: %lu\n", image, imageSize); 70 | 71 | // Initialize stackSize to default if requested. 72 | if( stackSize == 0 ) 73 | /** @bug 74 | We only want an 8K default, fix the plop-in-the-middle code below. 75 | */ 76 | stackSize = 16 * 1024; 77 | 78 | // Convert PID to Mach Task ref. 79 | mach_port_t remoteTask = 0; 80 | if( !err ) { 81 | err = task_for_pid( mach_task_self(), targetProcess, &remoteTask ); 82 | #if defined(__i386__) || defined(__x86_64__) 83 | if (err == 5) fprintf(stderr, "Could not access task for pid %d. You probably need to add user to procmod group\n", targetProcess); 84 | #endif 85 | } 86 | 87 | /** @todo 88 | Would be nice to just allocate one block for both the remote stack 89 | *and* the remoteCode (including the parameter data block once that's 90 | written. 91 | */ 92 | 93 | // Allocate the remoteStack. 94 | vm_address_t remoteStack = (vm_address_t)NULL; 95 | if( !err ) 96 | err = vm_allocate( remoteTask, &remoteStack, stackSize, 1 ); 97 | 98 | 99 | // Allocate the code. 100 | vm_address_t remoteCode = (vm_address_t)NULL; 101 | if( !err ) 102 | err = vm_allocate( remoteTask, &remoteCode, imageSize, 1 ); 103 | err = vm_protect(remoteTask, remoteCode, imageSize, 0, VM_PROT_EXECUTE | VM_PROT_WRITE | VM_PROT_READ); 104 | if( !err ) { 105 | ASSERT_CAST( pointer_t, image ); 106 | #if defined (__ppc__) || defined (__ppc64__) || defined(__x86_64__) 107 | err = vm_write( remoteTask, remoteCode, (pointer_t) image, imageSize ); 108 | #elif defined (__i386__) 109 | // on x86, jump table use relative jump instructions (jmp), which means 110 | // the offset needs to be corrected. We thus copy the image and fix the offset by hand. 111 | ptrdiff_t fixUpOffset = (ptrdiff_t) (image - remoteCode); 112 | void * fixedUpImage = fixedUpImageFromImage(image, imageSize, jumpTableOffset, jumpTableSize, fixUpOffset); 113 | err = vm_write( remoteTask, remoteCode, (pointer_t) fixedUpImage, imageSize ); 114 | free(fixedUpImage); 115 | #endif 116 | } 117 | 118 | // Allocate the paramBlock if specified. 119 | vm_address_t remoteParamBlock = (vm_address_t)NULL; 120 | if( !err && paramBlock != NULL && paramSize ) { 121 | err = vm_allocate( remoteTask, &remoteParamBlock, paramSize, 1 ); 122 | if( !err ) { 123 | ASSERT_CAST( pointer_t, paramBlock ); 124 | err = vm_write( remoteTask, remoteParamBlock, 125 | (pointer_t) paramBlock, paramSize ); 126 | } 127 | } 128 | 129 | // Calculate offsets. 130 | ptrdiff_t threadEntryOffset, imageOffset; 131 | if( !err ) { 132 | //assert( (void*)threadEntry >= image && (void*)threadEntry <= (image+imageSize) ); 133 | ASSERT_CAST( void*, threadEntry ); 134 | threadEntryOffset = ((void*) threadEntry) - image; 135 | 136 | #if defined(__x86_64__) 137 | imageOffset = 0; // RIP-relative addressing 138 | #else 139 | //ASSERT_CAST( void*, remoteCode ); 140 | //imageOffset = ((void*) remoteCode) - image; 141 | // WARNING: See bug https://github.com/rentzsch/mach_star/issues/11 . Not sure about this. 142 | imageOffset = 0; 143 | #endif 144 | } 145 | 146 | // Allocate the thread. 147 | thread_act_t remoteThread; 148 | #if defined (__ppc__) || defined (__ppc64__) 149 | if( !err ) { 150 | ppc_thread_state_t remoteThreadState; 151 | 152 | /** @bug 153 | Stack math should be more sophisticated than this (ala redzone). 154 | */ 155 | remoteStack += stackSize / 2; 156 | 157 | bzero( &remoteThreadState, sizeof(remoteThreadState) ); 158 | 159 | ASSERT_CAST( unsigned int, remoteCode ); 160 | remoteThreadState.__srr0 = (unsigned int) remoteCode; 161 | remoteThreadState.__srr0 += threadEntryOffset; 162 | assert( remoteThreadState.__srr0 < (remoteCode + imageSize) ); 163 | 164 | ASSERT_CAST( unsigned int, remoteStack ); 165 | remoteThreadState.__r1 = (unsigned int) remoteStack; 166 | 167 | ASSERT_CAST( unsigned int, imageOffset ); 168 | remoteThreadState.__r3 = (unsigned int) imageOffset; 169 | 170 | ASSERT_CAST( unsigned int, remoteParamBlock ); 171 | remoteThreadState.__r4 = (unsigned int) remoteParamBlock; 172 | 173 | ASSERT_CAST( unsigned int, paramSize ); 174 | remoteThreadState.__r5 = (unsigned int) paramSize; 175 | 176 | ASSERT_CAST( unsigned int, 0xDEADBEEF ); 177 | remoteThreadState.__lr = (unsigned int) 0xDEADBEEF; 178 | 179 | #if 0 180 | printf( "remoteCode start: %p\n", (void*) remoteCode ); 181 | printf( "remoteCode size: %ld\n", imageSize ); 182 | printf( "remoteCode pc: %p\n", (void*) remoteThreadState.srr0 ); 183 | printf( "remoteCode end: %p\n", 184 | (void*) (((char*)remoteCode)+imageSize) ); 185 | fflush(0); 186 | #endif 187 | 188 | err = thread_create_running( remoteTask, PPC_THREAD_STATE, 189 | (thread_state_t) &remoteThreadState, PPC_THREAD_STATE_COUNT, 190 | &remoteThread ); 191 | } 192 | #elif defined (__i386__) 193 | if( !err ) { 194 | 195 | i386_thread_state_t remoteThreadState; 196 | bzero( &remoteThreadState, sizeof(remoteThreadState) ); 197 | 198 | vm_address_t dummy_thread_struct = remoteStack; 199 | remoteStack += (stackSize / 2); // this is the real stack 200 | // (*) increase the stack, since we're simulating a CALL instruction, which normally pushes return address on the stack 201 | remoteStack -= 4; 202 | 203 | #define PARAM_COUNT 4 204 | #define STACK_CONTENTS_SIZE ((1+PARAM_COUNT) * sizeof(unsigned int)) 205 | unsigned int stackContents[1 + PARAM_COUNT]; // 1 for the return address and 1 for each param 206 | // first entry is return address (see above *) 207 | stackContents[0] = 0xDEADBEEF; // invalid return address. 208 | // then we push function parameters one by one. 209 | stackContents[1] = imageOffset; 210 | stackContents[2] = remoteParamBlock; 211 | stackContents[3] = paramSize; 212 | // We use the remote stack we allocated as the fake thread struct. We should probably use a dedicated memory zone. 213 | // We don't fill it with 0, vm_allocate did it for us 214 | stackContents[4] = dummy_thread_struct; 215 | 216 | // push stackContents 217 | err = vm_write( remoteTask, remoteStack, 218 | (pointer_t) stackContents, STACK_CONTENTS_SIZE); 219 | 220 | // set remote Program Counter 221 | remoteThreadState.__eip = (unsigned int) (remoteCode); 222 | remoteThreadState.__eip += threadEntryOffset; 223 | 224 | // set remote Stack Pointer 225 | ASSERT_CAST( unsigned int, remoteStack ); 226 | remoteThreadState.__esp = (unsigned int) remoteStack; 227 | 228 | // create thread and launch it 229 | err = thread_create_running( remoteTask, i386_THREAD_STATE, 230 | (thread_state_t) &remoteThreadState, i386_THREAD_STATE_COUNT, 231 | &remoteThread ); 232 | } 233 | #elif defined(__x86_64__) 234 | if( !err ) { 235 | 236 | x86_thread_state64_t remoteThreadState; 237 | bzero( &remoteThreadState, sizeof(remoteThreadState) ); 238 | 239 | vm_address_t dummy_thread_struct = remoteStack; 240 | remoteStack += (stackSize / 2); // this is the real stack 241 | // (*) increase the stack, since we're simulating a CALL instruction, which normally pushes return address on the stack 242 | remoteStack -= 4; 243 | 244 | #define PARAM_COUNT 0 245 | #define STACK_CONTENTS_SIZE ((1+PARAM_COUNT) * sizeof(unsigned long long)) 246 | unsigned long long stackContents[1 + PARAM_COUNT]; // 1 for the return address and 1 for each param 247 | // first entry is return address (see above *) 248 | stackContents[0] = 0x00000DEADBEA7DAD; // invalid return address. 249 | 250 | // push stackContents 251 | err = vm_write( remoteTask, remoteStack, 252 | (pointer_t) stackContents, STACK_CONTENTS_SIZE); 253 | 254 | remoteThreadState.__rdi = (unsigned long long) (imageOffset); 255 | remoteThreadState.__rsi = (unsigned long long) (remoteParamBlock); 256 | remoteThreadState.__rdx = (unsigned long long) (paramSize); 257 | remoteThreadState.__rcx = (unsigned long long) (dummy_thread_struct); 258 | 259 | // set remote Program Counter 260 | remoteThreadState.__rip = (unsigned long long) (remoteCode); 261 | remoteThreadState.__rip += threadEntryOffset; 262 | 263 | // set remote Stack Pointer 264 | ASSERT_CAST( unsigned long long, remoteStack ); 265 | remoteThreadState.__rsp = (unsigned long long) remoteStack; 266 | 267 | // create thread and launch it 268 | err = thread_create_running( remoteTask, x86_THREAD_STATE64, 269 | (thread_state_t) &remoteThreadState, x86_THREAD_STATE64_COUNT, 270 | &remoteThread ); 271 | } 272 | #else 273 | #error architecture not supported 274 | #endif 275 | 276 | if( err ) { 277 | MACH_ERROR("mach_inject failing..", err); 278 | if( remoteParamBlock ) 279 | vm_deallocate( remoteTask, remoteParamBlock, paramSize ); 280 | if( remoteCode ) 281 | vm_deallocate( remoteTask, remoteCode, imageSize ); 282 | if( remoteStack ) 283 | vm_deallocate( remoteTask, remoteStack, stackSize ); 284 | } 285 | 286 | return err; 287 | } 288 | 289 | mach_error_t 290 | machImageForPointer( 291 | const void *pointer, 292 | const void **image, 293 | unsigned long *size, 294 | unsigned int *jumpTableOffset, 295 | unsigned int *jumpTableSize ) 296 | { 297 | assert( pointer ); 298 | assert( image ); 299 | assert( size ); 300 | 301 | unsigned long p = (unsigned long) pointer; 302 | 303 | if (jumpTableOffset && jumpTableSize) { 304 | *jumpTableOffset = 0; 305 | *jumpTableSize = 0; 306 | } 307 | 308 | unsigned long imageIndex, imageCount = _dyld_image_count(); 309 | for( imageIndex = 0; imageIndex < imageCount; imageIndex++ ) { 310 | #if defined(__x86_64__) 311 | const struct mach_header_64 *header = (const struct mach_header_64 *)_dyld_get_image_header( imageIndex ); // why no function that returns mach_header_64 312 | const struct section_64 *section = getsectbynamefromheader_64( header, SEG_TEXT, SECT_TEXT ); 313 | #else 314 | const struct mach_header *header = (const struct mach_header *)_dyld_get_image_header( imageIndex ); 315 | const struct section *section = getsectbynamefromheader( header, SEG_TEXT, SECT_TEXT ); 316 | #endif 317 | if (section == 0) continue; 318 | long start = section->addr + _dyld_get_image_vmaddr_slide( imageIndex ); 319 | long stop = start + section->size; 320 | //printf("start %ld %p %s b\n", start, header, _dyld_get_image_name(imageIndex)); 321 | if( p >= start && p <= stop ) { 322 | // It is truely insane we have to stat() the file system in order 323 | // to discover the size of an in-memory data structure. 324 | const char *imageName = _dyld_get_image_name( imageIndex ); 325 | assert( imageName ); 326 | struct stat sb; 327 | if( stat( imageName, &sb ) ) 328 | return unix_err( errno ); 329 | if( image ) { 330 | ASSERT_CAST( void*, header ); 331 | *image = (void*) header; 332 | } 333 | if( size ) { 334 | ;//assertUInt32( st_size ); 335 | *size = sb.st_size; 336 | 337 | // needed for Universal binaries. Check if file is fat and get image size from there. 338 | int fd = open (imageName, O_RDONLY); 339 | size_t mapSize = *size; 340 | char * fileImage = mmap (NULL, mapSize, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0); 341 | 342 | assert(fileImage != MAP_FAILED); 343 | struct fat_header* fatHeader = (struct fat_header *)fileImage; 344 | if (fatHeader->magic == OSSwapBigToHostInt32(FAT_MAGIC)) { 345 | //printf("This is a fat binary\n"); 346 | uint32_t archCount = OSSwapBigToHostInt32(fatHeader->nfat_arch); 347 | 348 | NXArchInfo const *localArchInfo = NXGetLocalArchInfo(); 349 | 350 | struct fat_arch* arch = (struct fat_arch *)(fileImage + sizeof(struct fat_header)); 351 | struct fat_arch* matchingArch = NULL; 352 | 353 | int archIndex = 0; 354 | for (archIndex = 0; archIndex < archCount; archIndex++) { 355 | cpu_type_t cpuType = OSSwapBigToHostInt32(arch[archIndex].cputype); 356 | cpu_subtype_t cpuSubtype = OSSwapBigToHostInt32(arch[archIndex].cpusubtype); 357 | 358 | if (localArchInfo->cputype == cpuType) { 359 | matchingArch = arch + archIndex; 360 | if (localArchInfo->cpusubtype == cpuSubtype) break; 361 | } 362 | } 363 | 364 | if (matchingArch) { 365 | *size = OSSwapBigToHostInt32(matchingArch->size); 366 | //printf ("found arch-specific size : %p\n", *size); 367 | } 368 | } 369 | 370 | munmap (fileImage, mapSize); 371 | close (fd); 372 | } 373 | #if defined(__i386__) // this segment is only available on IA-32 374 | if (jumpTableOffset && jumpTableSize) { 375 | const struct section * jumpTableSection = getsectbynamefromheader( header, SEG_IMPORT, "__jump_table" ); 376 | 377 | if (!jumpTableSection) { 378 | unsigned char *start, *end; 379 | jumpTableSection = getsectbynamefromheader( header, SEG_TEXT, "__symbol_stub" ); 380 | /* 381 | start = end = (char *) header + jumpTableSection->offset; 382 | end += jumpTableSection->size; 383 | 384 | fprintf(stderr, "start: %p\n", start); 385 | for (; start < end; start += 6) { 386 | fprintf(stderr, "%p: %p: %p\n", 387 | start, 388 | *(void **)(start+2), 389 | **(void ***)(start+2)); 390 | } 391 | */ 392 | } 393 | 394 | if (jumpTableSection) { 395 | *jumpTableOffset = jumpTableSection->offset; 396 | *jumpTableSize = jumpTableSection->size; 397 | } 398 | } 399 | #endif 400 | return err_none; 401 | } 402 | } 403 | 404 | return err_threadEntry_image_not_found; 405 | } 406 | 407 | #if defined(__i386__) 408 | void* fixedUpImageFromImage ( 409 | const void *image, 410 | unsigned long imageSize, 411 | unsigned int jumpTableOffset, 412 | unsigned int jumpTableSize, 413 | ptrdiff_t fixUpOffset) 414 | { 415 | // first copy the full image 416 | void *fixedUpImage = (void *) malloc ((size_t)imageSize); 417 | bcopy(image, fixedUpImage, imageSize); 418 | 419 | // address of jump table in copied image 420 | void *jumpTable = fixedUpImage + jumpTableOffset; 421 | 422 | 423 | /* indirect jump table */ 424 | if (*(unsigned char *) jumpTable == 0xff) { 425 | // each indirect JMP instruction is 6 bytes (FF xx xx xx xx xx) where FF is the opcode for JMP 426 | int jumpTableCount = jumpTableSize / 6; 427 | 428 | // skip first "ff xx" 429 | jumpTable += 2; 430 | 431 | int entry=0; 432 | for (entry = 0; entry < jumpTableCount; entry++) { 433 | void *jmpValue = *((void **)jumpTable); 434 | /* 435 | fprintf(stderr, "at %p correcting %p to %p\n", 436 | (char *)jumpTable -2, 437 | jmpValue, jmpValue + fixUpOffset); 438 | */ 439 | jmpValue -= fixUpOffset; 440 | *((void **)jumpTable) = jmpValue; 441 | jumpTable+=6; 442 | } 443 | } 444 | else { 445 | // each JMP instruction is 5 bytes (E9 xx xx xx xx) where E9 is the opcode for JMP 446 | int jumpTableCount = jumpTableSize / 5; 447 | 448 | // skip first "E9" 449 | jumpTable++; 450 | 451 | int entry=0; 452 | for (entry = 0; entry < jumpTableCount; entry++) { 453 | unsigned int jmpValue = *((unsigned int *)jumpTable); 454 | jmpValue += fixUpOffset; 455 | *((unsigned int *)jumpTable) = jmpValue; 456 | jumpTable+=5; 457 | } 458 | } 459 | 460 | return fixedUpImage; 461 | } 462 | #endif /* __i386__ */ 463 | -------------------------------------------------------------------------------- /mach_star/mach_inject_bundle/mach_inject_bundle.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 23A92516141586E900EE4B17 /* mach_inject_bundle_stub.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 33B2AC8809285572004B1632 /* mach_inject_bundle_stub.bundle */; }; 11 | 79ACC85907FD3EBD00D4147B /* mach_inject_bundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 79ACC85707FD3EBD00D4147B /* mach_inject_bundle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 79ACC85A07FD3EBD00D4147B /* mach_inject_bundle.c in Sources */ = {isa = PBXBuildFile; fileRef = 79ACC85807FD3EBD00D4147B /* mach_inject_bundle.c */; }; 13 | 79ACC88707FD40D700D4147B /* mach_inject.c in Sources */ = {isa = PBXBuildFile; fileRef = 79ACC88507FD40D700D4147B /* mach_inject.c */; }; 14 | 79ACC88807FD40D700D4147B /* mach_inject.h in Headers */ = {isa = PBXBuildFile; fileRef = 79ACC88607FD40D700D4147B /* mach_inject.h */; }; 15 | 79ACC8DC07FD452E00D4147B /* mach_inject_bundle_stub.h in Headers */ = {isa = PBXBuildFile; fileRef = 79ACC8DB07FD452E00D4147B /* mach_inject_bundle_stub.h */; }; 16 | 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; 17 | 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 33B2AC8709285572004B1632 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 33B2AC8109285572004B1632 /* mach_inject_bundle_stub.xcodeproj */; 24 | proxyType = 2; 25 | remoteGlobalIDString = 8D01CCD20486CAD60068D4B7; 26 | remoteInfo = mach_inject_bundle_stub; 27 | }; 28 | 33B2AC8909285578004B1632 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 33B2AC8109285572004B1632 /* mach_inject_bundle_stub.xcodeproj */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 8D01CCC60486CAD60068D4B7; 33 | remoteInfo = mach_inject_bundle_stub; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXCopyFilesBuildPhase section */ 38 | 33B2ACA2092856E1004B1632 /* CopyFiles */ = { 39 | isa = PBXCopyFilesBuildPhase; 40 | buildActionMask = 2147483647; 41 | dstPath = ""; 42 | dstSubfolderSpec = 16; 43 | files = ( 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXCopyFilesBuildPhase section */ 48 | 49 | /* Begin PBXFileReference section */ 50 | 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 51 | 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 52 | 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 53 | 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 54 | 32DBCF5E0370ADEE00C91783 /* mach_inject_bundle_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mach_inject_bundle_Prefix.pch; sourceTree = ""; }; 55 | 33B2AC8109285572004B1632 /* mach_inject_bundle_stub.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = mach_inject_bundle_stub.xcodeproj; path = ../mach_inject_bundle_stub/mach_inject_bundle_stub.xcodeproj; sourceTree = SOURCE_ROOT; }; 56 | 79ACC85707FD3EBD00D4147B /* mach_inject_bundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mach_inject_bundle.h; sourceTree = ""; }; 57 | 79ACC85807FD3EBD00D4147B /* mach_inject_bundle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mach_inject_bundle.c; sourceTree = ""; }; 58 | 79ACC88507FD40D700D4147B /* mach_inject.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mach_inject.c; path = ../mach_inject/mach_inject.c; sourceTree = SOURCE_ROOT; }; 59 | 79ACC88607FD40D700D4147B /* mach_inject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mach_inject.h; path = ../mach_inject/mach_inject.h; sourceTree = SOURCE_ROOT; }; 60 | 79ACC8DB07FD452E00D4147B /* mach_inject_bundle_stub.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mach_inject_bundle_stub.h; path = ../mach_inject_bundle_stub/mach_inject_bundle_stub.h; sourceTree = SOURCE_ROOT; }; 61 | 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 62 | 8DC2EF5B0486A6940098B216 /* mach_inject_bundle.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mach_inject_bundle.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 8DC2EF560486A6940098B216 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 034768DFFF38A50411DB9C8B /* Products */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 8DC2EF5B0486A6940098B216 /* mach_inject_bundle.framework */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | 0867D691FE84028FC02AAC07 /* mach_inject_bundle */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 33B2AC8109285572004B1632 /* mach_inject_bundle_stub.xcodeproj */, 89 | 32C88DFF0371C24200C91783 /* Other Sources */, 90 | 089C1665FE841158C02AAC07 /* Resources */, 91 | 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 92 | 034768DFFF38A50411DB9C8B /* Products */, 93 | ); 94 | name = mach_inject_bundle; 95 | sourceTree = ""; 96 | }; 97 | 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, 101 | 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, 102 | ); 103 | name = "External Frameworks and Libraries"; 104 | sourceTree = ""; 105 | }; 106 | 089C1665FE841158C02AAC07 /* Resources */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 8DC2EF5A0486A6940098B216 /* Info.plist */, 110 | 089C1666FE841158C02AAC07 /* InfoPlist.strings */, 111 | ); 112 | name = Resources; 113 | sourceTree = ""; 114 | }; 115 | 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, 119 | ); 120 | name = "Linked Frameworks"; 121 | sourceTree = ""; 122 | }; 123 | 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 127 | 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 128 | ); 129 | name = "Other Frameworks"; 130 | sourceTree = ""; 131 | }; 132 | 32C88DFF0371C24200C91783 /* Other Sources */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 79ACC85707FD3EBD00D4147B /* mach_inject_bundle.h */, 136 | 79ACC85807FD3EBD00D4147B /* mach_inject_bundle.c */, 137 | 79ACC88507FD40D700D4147B /* mach_inject.c */, 138 | 79ACC88607FD40D700D4147B /* mach_inject.h */, 139 | 79ACC8DB07FD452E00D4147B /* mach_inject_bundle_stub.h */, 140 | 32DBCF5E0370ADEE00C91783 /* mach_inject_bundle_Prefix.pch */, 141 | ); 142 | name = "Other Sources"; 143 | sourceTree = ""; 144 | }; 145 | 33B2AC8409285572004B1632 /* Products */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 33B2AC8809285572004B1632 /* mach_inject_bundle_stub.bundle */, 149 | ); 150 | name = Products; 151 | sourceTree = ""; 152 | }; 153 | /* End PBXGroup section */ 154 | 155 | /* Begin PBXHeadersBuildPhase section */ 156 | 8DC2EF500486A6940098B216 /* Headers */ = { 157 | isa = PBXHeadersBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 79ACC85907FD3EBD00D4147B /* mach_inject_bundle.h in Headers */, 161 | 79ACC88807FD40D700D4147B /* mach_inject.h in Headers */, 162 | 79ACC8DC07FD452E00D4147B /* mach_inject_bundle_stub.h in Headers */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXHeadersBuildPhase section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 8DC2EF4F0486A6940098B216 /* mach_inject_bundle */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 33B2AC7709285567004B1632 /* Build configuration list for PBXNativeTarget "mach_inject_bundle" */; 172 | buildPhases = ( 173 | 8DC2EF500486A6940098B216 /* Headers */, 174 | 33B2ACA2092856E1004B1632 /* CopyFiles */, 175 | 8DC2EF520486A6940098B216 /* Resources */, 176 | 8DC2EF540486A6940098B216 /* Sources */, 177 | 8DC2EF560486A6940098B216 /* Frameworks */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | 33B2AC8A09285578004B1632 /* PBXTargetDependency */, 183 | ); 184 | name = mach_inject_bundle; 185 | productInstallPath = "$(HOME)/Library/Frameworks"; 186 | productName = mach_inject_bundle; 187 | productReference = 8DC2EF5B0486A6940098B216 /* mach_inject_bundle.framework */; 188 | productType = "com.apple.product-type.framework"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 0867D690FE84028FC02AAC07 /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastUpgradeCheck = 0410; 197 | }; 198 | buildConfigurationList = 33B2AC7B09285567004B1632 /* Build configuration list for PBXProject "mach_inject_bundle" */; 199 | compatibilityVersion = "Xcode 3.2"; 200 | developmentRegion = English; 201 | hasScannedForEncodings = 1; 202 | knownRegions = ( 203 | en, 204 | ); 205 | mainGroup = 0867D691FE84028FC02AAC07 /* mach_inject_bundle */; 206 | productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 207 | projectDirPath = ""; 208 | projectReferences = ( 209 | { 210 | ProductGroup = 33B2AC8409285572004B1632 /* Products */; 211 | ProjectRef = 33B2AC8109285572004B1632 /* mach_inject_bundle_stub.xcodeproj */; 212 | }, 213 | ); 214 | projectRoot = ""; 215 | targets = ( 216 | 8DC2EF4F0486A6940098B216 /* mach_inject_bundle */, 217 | ); 218 | }; 219 | /* End PBXProject section */ 220 | 221 | /* Begin PBXReferenceProxy section */ 222 | 33B2AC8809285572004B1632 /* mach_inject_bundle_stub.bundle */ = { 223 | isa = PBXReferenceProxy; 224 | fileType = wrapper.cfbundle; 225 | path = mach_inject_bundle_stub.bundle; 226 | remoteRef = 33B2AC8709285572004B1632 /* PBXContainerItemProxy */; 227 | sourceTree = BUILT_PRODUCTS_DIR; 228 | }; 229 | /* End PBXReferenceProxy section */ 230 | 231 | /* Begin PBXResourcesBuildPhase section */ 232 | 8DC2EF520486A6940098B216 /* Resources */ = { 233 | isa = PBXResourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, 237 | 23A92516141586E900EE4B17 /* mach_inject_bundle_stub.bundle in Resources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | /* End PBXResourcesBuildPhase section */ 242 | 243 | /* Begin PBXSourcesBuildPhase section */ 244 | 8DC2EF540486A6940098B216 /* Sources */ = { 245 | isa = PBXSourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 79ACC85A07FD3EBD00D4147B /* mach_inject_bundle.c in Sources */, 249 | 79ACC88707FD40D700D4147B /* mach_inject.c in Sources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | /* End PBXSourcesBuildPhase section */ 254 | 255 | /* Begin PBXTargetDependency section */ 256 | 33B2AC8A09285578004B1632 /* PBXTargetDependency */ = { 257 | isa = PBXTargetDependency; 258 | name = mach_inject_bundle_stub; 259 | targetProxy = 33B2AC8909285578004B1632 /* PBXContainerItemProxy */; 260 | }; 261 | /* End PBXTargetDependency section */ 262 | 263 | /* Begin PBXVariantGroup section */ 264 | 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { 265 | isa = PBXVariantGroup; 266 | children = ( 267 | 089C1667FE841158C02AAC07 /* English */, 268 | ); 269 | name = InfoPlist.strings; 270 | sourceTree = ""; 271 | }; 272 | /* End PBXVariantGroup section */ 273 | 274 | /* Begin XCBuildConfiguration section */ 275 | 33B2AC7809285567004B1632 /* Development */ = { 276 | isa = XCBuildConfiguration; 277 | buildSettings = { 278 | ARCHS = ( 279 | ppc, 280 | i386, 281 | x86_64, 282 | ); 283 | COPY_PHASE_STRIP = NO; 284 | DYLIB_COMPATIBILITY_VERSION = 1; 285 | DYLIB_CURRENT_VERSION = 1; 286 | FRAMEWORK_VERSION = A; 287 | GCC_DYNAMIC_NO_PIC = NO; 288 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 289 | GCC_OPTIMIZATION_LEVEL = 0; 290 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 291 | GCC_PREFIX_HEADER = mach_inject_bundle_Prefix.pch; 292 | INFOPLIST_FILE = Info.plist; 293 | INSTALL_PATH = "@executable_path/../Frameworks"; 294 | LD_DYLIB_INSTALL_NAME = "@rpath/Frameworks/$(EXECUTABLE_PATH)"; 295 | LIBRARY_STYLE = DYNAMIC; 296 | MACH_O_TYPE = mh_dylib; 297 | OTHER_LDFLAGS = ( 298 | "-seg1addr", 299 | 0xc0000000, 300 | ); 301 | PRODUCT_NAME = mach_inject_bundle; 302 | WRAPPER_EXTENSION = framework; 303 | ZERO_LINK = YES; 304 | }; 305 | name = Development; 306 | }; 307 | 33B2AC7909285567004B1632 /* Deployment */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 311 | COPY_PHASE_STRIP = YES; 312 | DYLIB_COMPATIBILITY_VERSION = 1; 313 | DYLIB_CURRENT_VERSION = 1; 314 | FRAMEWORK_VERSION = A; 315 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 316 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 317 | GCC_PREFIX_HEADER = mach_inject_bundle_Prefix.pch; 318 | INFOPLIST_FILE = Info.plist; 319 | INSTALL_PATH = "@executable_path/../Frameworks"; 320 | LD_DYLIB_INSTALL_NAME = "@rpath/Frameworks/$(EXECUTABLE_PATH)"; 321 | LIBRARY_STYLE = DYNAMIC; 322 | MACH_O_TYPE = mh_dylib; 323 | OTHER_LDFLAGS = ( 324 | "-seg1addr", 325 | 0xc0000000, 326 | ); 327 | PRODUCT_NAME = mach_inject_bundle; 328 | WRAPPER_EXTENSION = framework; 329 | ZERO_LINK = NO; 330 | }; 331 | name = Deployment; 332 | }; 333 | 33B2AC7A09285567004B1632 /* Default */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | DYLIB_COMPATIBILITY_VERSION = 1; 337 | DYLIB_CURRENT_VERSION = 1; 338 | FRAMEWORK_VERSION = A; 339 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 340 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 341 | GCC_PREFIX_HEADER = mach_inject_bundle_Prefix.pch; 342 | INFOPLIST_FILE = Info.plist; 343 | INSTALL_PATH = "@executable_path/../Frameworks"; 344 | LD_DYLIB_INSTALL_NAME = "@rpath/Frameworks/$(EXECUTABLE_PATH)"; 345 | LIBRARY_STYLE = DYNAMIC; 346 | MACH_O_TYPE = mh_dylib; 347 | OTHER_LDFLAGS = ( 348 | "-seg1addr", 349 | 0xc0000000, 350 | ); 351 | PRODUCT_NAME = mach_inject_bundle; 352 | WRAPPER_EXTENSION = framework; 353 | }; 354 | name = Default; 355 | }; 356 | 33B2AC7C09285567004B1632 /* Development */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | }; 360 | name = Development; 361 | }; 362 | 33B2AC7D09285567004B1632 /* Deployment */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | }; 366 | name = Deployment; 367 | }; 368 | 33B2AC7E09285567004B1632 /* Default */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | }; 372 | name = Default; 373 | }; 374 | /* End XCBuildConfiguration section */ 375 | 376 | /* Begin XCConfigurationList section */ 377 | 33B2AC7709285567004B1632 /* Build configuration list for PBXNativeTarget "mach_inject_bundle" */ = { 378 | isa = XCConfigurationList; 379 | buildConfigurations = ( 380 | 33B2AC7809285567004B1632 /* Development */, 381 | 33B2AC7909285567004B1632 /* Deployment */, 382 | 33B2AC7A09285567004B1632 /* Default */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | defaultConfigurationName = Default; 386 | }; 387 | 33B2AC7B09285567004B1632 /* Build configuration list for PBXProject "mach_inject_bundle" */ = { 388 | isa = XCConfigurationList; 389 | buildConfigurations = ( 390 | 33B2AC7C09285567004B1632 /* Development */, 391 | 33B2AC7D09285567004B1632 /* Deployment */, 392 | 33B2AC7E09285567004B1632 /* Default */, 393 | ); 394 | defaultConfigurationIsVisible = 0; 395 | defaultConfigurationName = Default; 396 | }; 397 | /* End XCConfigurationList section */ 398 | }; 399 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */; 400 | } 401 | -------------------------------------------------------------------------------- /mach_star/DisposeWindow+Beep_Injector/DisposeWindow+Beep_Injector.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 42; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 33635B07095492BE002C5F77 /* mach_inject_bundle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33635B06095492BE002C5F77 /* mach_inject_bundle.framework */; }; 11 | 33635B2F09549461002C5F77 /* mach_inject_bundle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33635B06095492BE002C5F77 /* mach_inject_bundle.framework */; }; 12 | 79ACCB1B07FD4D6300D4147B /* DisposeWindow+Beep.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 79ACCB1A07FD4D6300D4147B /* DisposeWindow+Beep.bundle */; }; 13 | 79ACCB3007FD4DD100D4147B /* InjectorAppDelegate.h in Resources */ = {isa = PBXBuildFile; fileRef = 79ACCB2E07FD4DD100D4147B /* InjectorAppDelegate.h */; }; 14 | 79ACCB3107FD4DD100D4147B /* InjectorAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 79ACCB2F07FD4DD100D4147B /* InjectorAppDelegate.m */; }; 15 | 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 16 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 17 | 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 18 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 33635B18095493BA002C5F77 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 33635B14095493BA002C5F77 /* mach_inject_bundle.xcodeproj */; 25 | proxyType = 2; 26 | remoteGlobalIDString = 8DC2EF5B0486A6940098B216; 27 | remoteInfo = mach_inject_bundle; 28 | }; 29 | 33635B1A095493C0002C5F77 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 33635B14095493BA002C5F77 /* mach_inject_bundle.xcodeproj */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 8DC2EF4F0486A6940098B216; 34 | remoteInfo = mach_inject_bundle; 35 | }; 36 | 33635B20095493CB002C5F77 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 33635B1C095493CB002C5F77 /* DisposeWindow+Beep.xcodeproj */; 39 | proxyType = 2; 40 | remoteGlobalIDString = 8D01CCD20486CAD60068D4B7; 41 | remoteInfo = "DisposeWindow+Beep"; 42 | }; 43 | 33635B22095493D4002C5F77 /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = 33635B1C095493CB002C5F77 /* DisposeWindow+Beep.xcodeproj */; 46 | proxyType = 1; 47 | remoteGlobalIDString = 8D01CCC60486CAD60068D4B7; 48 | remoteInfo = "DisposeWindow+Beep"; 49 | }; 50 | /* End PBXContainerItemProxy section */ 51 | 52 | /* Begin PBXCopyFilesBuildPhase section */ 53 | 79ACCB1607FD4D4000D4147B /* CopyFiles */ = { 54 | isa = PBXCopyFilesBuildPhase; 55 | buildActionMask = 2147483647; 56 | dstPath = ""; 57 | dstSubfolderSpec = 10; 58 | files = ( 59 | 33635B2F09549461002C5F77 /* mach_inject_bundle.framework in CopyFiles */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXCopyFilesBuildPhase section */ 64 | 65 | /* Begin PBXFileReference section */ 66 | 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 67 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 68 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 69 | 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; 70 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 71 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 72 | 32CA4F630368D1EE00C91783 /* DisposeWindow+Beep_Injector_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DisposeWindow+Beep_Injector_Prefix.pch"; sourceTree = ""; }; 73 | 33635B06095492BE002C5F77 /* mach_inject_bundle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mach_inject_bundle.framework; path = ../mach_inject_bundle/build/Development/mach_inject_bundle.framework; sourceTree = SOURCE_ROOT; }; 74 | 33635B14095493BA002C5F77 /* mach_inject_bundle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = mach_inject_bundle.xcodeproj; path = ../mach_inject_bundle/mach_inject_bundle.xcodeproj; sourceTree = SOURCE_ROOT; }; 75 | 33635B1C095493CB002C5F77 /* DisposeWindow+Beep.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "DisposeWindow+Beep.xcodeproj"; path = "../DisposeWindow+Beep/DisposeWindow+Beep.xcodeproj"; sourceTree = SOURCE_ROOT; }; 76 | 79ACCB1A07FD4D6300D4147B /* DisposeWindow+Beep.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = "DisposeWindow+Beep.bundle"; path = "../DisposeWindow+Beep/build/Development/DisposeWindow+Beep.bundle"; sourceTree = SOURCE_ROOT; }; 77 | 79ACCB2E07FD4DD100D4147B /* InjectorAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectorAppDelegate.h; sourceTree = ""; }; 78 | 79ACCB2F07FD4DD100D4147B /* InjectorAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InjectorAppDelegate.m; sourceTree = ""; }; 79 | 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 80 | 8D1107320486CEB800E47090 /* DisposeWindow+Beep_Injector.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DisposeWindow+Beep_Injector.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 81 | /* End PBXFileReference section */ 82 | 83 | /* Begin PBXFrameworksBuildPhase section */ 84 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 89 | 33635B07095492BE002C5F77 /* mach_inject_bundle.framework in Frameworks */, 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXFrameworksBuildPhase section */ 94 | 95 | /* Begin PBXGroup section */ 96 | 080E96DDFE201D6D7F000001 /* Classes */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 79ACCB2E07FD4DD100D4147B /* InjectorAppDelegate.h */, 100 | 79ACCB2F07FD4DD100D4147B /* InjectorAppDelegate.m */, 101 | ); 102 | name = Classes; 103 | sourceTree = ""; 104 | }; 105 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 33635B06095492BE002C5F77 /* mach_inject_bundle.framework */, 109 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 110 | ); 111 | name = "Linked Frameworks"; 112 | sourceTree = ""; 113 | }; 114 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 118 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 119 | ); 120 | name = "Other Frameworks"; 121 | sourceTree = ""; 122 | }; 123 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 8D1107320486CEB800E47090 /* DisposeWindow+Beep_Injector.app */, 127 | ); 128 | name = Products; 129 | sourceTree = ""; 130 | }; 131 | 29B97314FDCFA39411CA2CEA /* DisposeWindow+Beep_Injector */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 33635B14095493BA002C5F77 /* mach_inject_bundle.xcodeproj */, 135 | 33635B1C095493CB002C5F77 /* DisposeWindow+Beep.xcodeproj */, 136 | 080E96DDFE201D6D7F000001 /* Classes */, 137 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 138 | 29B97317FDCFA39411CA2CEA /* Resources */, 139 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 140 | 19C28FACFE9D520D11CA2CBB /* Products */, 141 | ); 142 | name = "DisposeWindow+Beep_Injector"; 143 | sourceTree = ""; 144 | }; 145 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 32CA4F630368D1EE00C91783 /* DisposeWindow+Beep_Injector_Prefix.pch */, 149 | 29B97316FDCFA39411CA2CEA /* main.m */, 150 | ); 151 | name = "Other Sources"; 152 | sourceTree = ""; 153 | }; 154 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 79ACCB1A07FD4D6300D4147B /* DisposeWindow+Beep.bundle */, 158 | 8D1107310486CEB800E47090 /* Info.plist */, 159 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 160 | 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, 161 | ); 162 | name = Resources; 163 | sourceTree = ""; 164 | }; 165 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 169 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 170 | ); 171 | name = Frameworks; 172 | sourceTree = ""; 173 | }; 174 | 33635B15095493BA002C5F77 /* Products */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 33635B19095493BA002C5F77 /* mach_inject_bundle.framework */, 178 | ); 179 | name = Products; 180 | sourceTree = ""; 181 | }; 182 | 33635B1D095493CB002C5F77 /* Products */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | 33635B21095493CB002C5F77 /* DisposeWindow+Beep.bundle */, 186 | ); 187 | name = Products; 188 | sourceTree = ""; 189 | }; 190 | /* End PBXGroup section */ 191 | 192 | /* Begin PBXNativeTarget section */ 193 | 8D1107260486CEB800E47090 /* DisposeWindow+Beep_Injector */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = 33A73B340928584700F6FEA5 /* Build configuration list for PBXNativeTarget "DisposeWindow+Beep_Injector" */; 196 | buildPhases = ( 197 | 8D1107290486CEB800E47090 /* Resources */, 198 | 8D11072C0486CEB800E47090 /* Sources */, 199 | 8D11072E0486CEB800E47090 /* Frameworks */, 200 | 79ACCB1607FD4D4000D4147B /* CopyFiles */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 33635B1B095493C0002C5F77 /* PBXTargetDependency */, 206 | 33635B23095493D4002C5F77 /* PBXTargetDependency */, 207 | ); 208 | name = "DisposeWindow+Beep_Injector"; 209 | productInstallPath = "$(HOME)/Applications"; 210 | productName = "DisposeWindow+Beep_Injector"; 211 | productReference = 8D1107320486CEB800E47090 /* DisposeWindow+Beep_Injector.app */; 212 | productType = "com.apple.product-type.application"; 213 | }; 214 | /* End PBXNativeTarget section */ 215 | 216 | /* Begin PBXProject section */ 217 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 218 | isa = PBXProject; 219 | buildConfigurationList = 33A73B380928584700F6FEA5 /* Build configuration list for PBXProject "DisposeWindow+Beep_Injector" */; 220 | compatibilityVersion = "Xcode 2.4"; 221 | developmentRegion = English; 222 | hasScannedForEncodings = 1; 223 | knownRegions = ( 224 | en, 225 | ); 226 | mainGroup = 29B97314FDCFA39411CA2CEA /* DisposeWindow+Beep_Injector */; 227 | projectDirPath = ""; 228 | projectReferences = ( 229 | { 230 | ProductGroup = 33635B1D095493CB002C5F77 /* Products */; 231 | ProjectRef = 33635B1C095493CB002C5F77 /* DisposeWindow+Beep.xcodeproj */; 232 | }, 233 | { 234 | ProductGroup = 33635B15095493BA002C5F77 /* Products */; 235 | ProjectRef = 33635B14095493BA002C5F77 /* mach_inject_bundle.xcodeproj */; 236 | }, 237 | ); 238 | projectRoot = ""; 239 | targets = ( 240 | 8D1107260486CEB800E47090 /* DisposeWindow+Beep_Injector */, 241 | ); 242 | }; 243 | /* End PBXProject section */ 244 | 245 | /* Begin PBXReferenceProxy section */ 246 | 33635B19095493BA002C5F77 /* mach_inject_bundle.framework */ = { 247 | isa = PBXReferenceProxy; 248 | fileType = wrapper.framework; 249 | path = mach_inject_bundle.framework; 250 | remoteRef = 33635B18095493BA002C5F77 /* PBXContainerItemProxy */; 251 | sourceTree = BUILT_PRODUCTS_DIR; 252 | }; 253 | 33635B21095493CB002C5F77 /* DisposeWindow+Beep.bundle */ = { 254 | isa = PBXReferenceProxy; 255 | fileType = wrapper.cfbundle; 256 | path = "DisposeWindow+Beep.bundle"; 257 | remoteRef = 33635B20095493CB002C5F77 /* PBXContainerItemProxy */; 258 | sourceTree = BUILT_PRODUCTS_DIR; 259 | }; 260 | /* End PBXReferenceProxy section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | 8D1107290486CEB800E47090 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, 268 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 269 | 79ACCB1B07FD4D6300D4147B /* DisposeWindow+Beep.bundle in Resources */, 270 | 79ACCB3007FD4DD100D4147B /* InjectorAppDelegate.h in Resources */, 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | /* End PBXResourcesBuildPhase section */ 275 | 276 | /* Begin PBXSourcesBuildPhase section */ 277 | 8D11072C0486CEB800E47090 /* Sources */ = { 278 | isa = PBXSourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | 8D11072D0486CEB800E47090 /* main.m in Sources */, 282 | 79ACCB3107FD4DD100D4147B /* InjectorAppDelegate.m in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | /* End PBXSourcesBuildPhase section */ 287 | 288 | /* Begin PBXTargetDependency section */ 289 | 33635B1B095493C0002C5F77 /* PBXTargetDependency */ = { 290 | isa = PBXTargetDependency; 291 | name = mach_inject_bundle; 292 | targetProxy = 33635B1A095493C0002C5F77 /* PBXContainerItemProxy */; 293 | }; 294 | 33635B23095493D4002C5F77 /* PBXTargetDependency */ = { 295 | isa = PBXTargetDependency; 296 | name = "DisposeWindow+Beep"; 297 | targetProxy = 33635B22095493D4002C5F77 /* PBXContainerItemProxy */; 298 | }; 299 | /* End PBXTargetDependency section */ 300 | 301 | /* Begin PBXVariantGroup section */ 302 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { 303 | isa = PBXVariantGroup; 304 | children = ( 305 | 089C165DFE840E0CC02AAC07 /* English */, 306 | ); 307 | name = InfoPlist.strings; 308 | sourceTree = ""; 309 | }; 310 | 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { 311 | isa = PBXVariantGroup; 312 | children = ( 313 | 29B97319FDCFA39411CA2CEA /* English */, 314 | ); 315 | name = MainMenu.nib; 316 | sourceTree = ""; 317 | }; 318 | /* End PBXVariantGroup section */ 319 | 320 | /* Begin XCBuildConfiguration section */ 321 | 33A73B350928584700F6FEA5 /* Development */ = { 322 | isa = XCBuildConfiguration; 323 | buildSettings = { 324 | ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; 325 | ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; 326 | COPY_PHASE_STRIP = NO; 327 | FRAMEWORK_SEARCH_PATHS = ( 328 | "$(SRCROOT)/../mach_inject_bundle/build/Development", 329 | "$(SRCROOT)/../mach_inject_bundle/build/Deployment", 330 | ); 331 | GCC_DYNAMIC_NO_PIC = NO; 332 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 333 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 334 | GCC_OPTIMIZATION_LEVEL = 0; 335 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 336 | GCC_PREFIX_HEADER = "DisposeWindow+Beep_Injector_Prefix.pch"; 337 | INFOPLIST_FILE = Info.plist; 338 | INSTALL_PATH = "$(HOME)/Applications"; 339 | PRODUCT_NAME = "DisposeWindow+Beep_Injector"; 340 | WRAPPER_EXTENSION = app; 341 | ZERO_LINK = YES; 342 | }; 343 | name = Development; 344 | }; 345 | 33A73B360928584700F6FEA5 /* Deployment */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | COPY_PHASE_STRIP = YES; 349 | FRAMEWORK_SEARCH_PATHS = ( 350 | "$(SRCROOT)/../mach_inject_bundle/build/Development", 351 | "$(SRCROOT)/../mach_inject_bundle/build/Deployment", 352 | ); 353 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 354 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 355 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 356 | GCC_PREFIX_HEADER = "DisposeWindow+Beep_Injector_Prefix.pch"; 357 | INFOPLIST_FILE = Info.plist; 358 | INSTALL_PATH = "$(HOME)/Applications"; 359 | PRODUCT_NAME = "DisposeWindow+Beep_Injector"; 360 | WRAPPER_EXTENSION = app; 361 | ZERO_LINK = NO; 362 | }; 363 | name = Deployment; 364 | }; 365 | 33A73B370928584700F6FEA5 /* Default */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | FRAMEWORK_SEARCH_PATHS = ( 369 | "$(SRCROOT)/../mach_inject_bundle/build/Development", 370 | "$(SRCROOT)/../mach_inject_bundle/build/Deployment", 371 | ); 372 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO; 373 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 374 | GCC_PREFIX_HEADER = "DisposeWindow+Beep_Injector_Prefix.pch"; 375 | INFOPLIST_FILE = Info.plist; 376 | INSTALL_PATH = "$(HOME)/Applications"; 377 | PRODUCT_NAME = "DisposeWindow+Beep_Injector"; 378 | WRAPPER_EXTENSION = app; 379 | }; 380 | name = Default; 381 | }; 382 | 33A73B390928584700F6FEA5 /* Development */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | }; 386 | name = Development; 387 | }; 388 | 33A73B3A0928584700F6FEA5 /* Deployment */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | }; 392 | name = Deployment; 393 | }; 394 | 33A73B3B0928584700F6FEA5 /* Default */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | }; 398 | name = Default; 399 | }; 400 | /* End XCBuildConfiguration section */ 401 | 402 | /* Begin XCConfigurationList section */ 403 | 33A73B340928584700F6FEA5 /* Build configuration list for PBXNativeTarget "DisposeWindow+Beep_Injector" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | 33A73B350928584700F6FEA5 /* Development */, 407 | 33A73B360928584700F6FEA5 /* Deployment */, 408 | 33A73B370928584700F6FEA5 /* Default */, 409 | ); 410 | defaultConfigurationIsVisible = 0; 411 | defaultConfigurationName = Default; 412 | }; 413 | 33A73B380928584700F6FEA5 /* Build configuration list for PBXProject "DisposeWindow+Beep_Injector" */ = { 414 | isa = XCConfigurationList; 415 | buildConfigurations = ( 416 | 33A73B390928584700F6FEA5 /* Development */, 417 | 33A73B3A0928584700F6FEA5 /* Deployment */, 418 | 33A73B3B0928584700F6FEA5 /* Default */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Default; 422 | }; 423 | /* End XCConfigurationList section */ 424 | }; 425 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 426 | } 427 | --------------------------------------------------------------------------------