From 905672341f1a702b78286ce1b84a9c7e768fd8d9 Mon Sep 17 00:00:00 2001 From: Patrick Wardle Date: Sun, 21 Feb 2016 21:33:11 -1000 Subject: [PATCH] added exception handling to XPC service set max window width for search window --- AppDelegate.m | 1 + Exception.h | 2 +- TaskExplorer.xcodeproj/project.pbxproj | 2 ++ UI/SearchWindow.xib | 7 ++++--- en.lproj/MainMenu.xib | 4 ++-- remoteTaskService/main.m | 21 ++++++++++++++++----- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/AppDelegate.m b/AppDelegate.m index 3aa18c3..a815cf2 100755 --- a/AppDelegate.m +++ b/AppDelegate.m @@ -20,6 +20,7 @@ //TODO: autolayout vertically //TODO: show 'from where' via quarantine attrz or database!! (simon email) //TODO: detect as procs die via GCD (simon blog post) +//TODO: max'd out window ->set max? (dual monitors) @implementation AppDelegate diff --git a/Exception.h b/Exception.h index acbfc85..ba3038d 100755 --- a/Exception.h +++ b/Exception.h @@ -3,7 +3,7 @@ #import #import - +#import //install exception/signal handlers void installExceptionHandlers(); diff --git a/TaskExplorer.xcodeproj/project.pbxproj b/TaskExplorer.xcodeproj/project.pbxproj index 01d8a4b..5c8232e 100755 --- a/TaskExplorer.xcodeproj/project.pbxproj +++ b/TaskExplorer.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 7D7348111BCB82C900CD7235 /* flaggedRedOver.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D73480E1BCB82C900CD7235 /* flaggedRedOver.png */; }; 7DA5CA0F1C7AA8CB00627DD7 /* MachO.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DA5CA0E1C7AA8CB00627DD7 /* MachO.m */; }; 7DAA78091B903BF1004840B9 /* CustomTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DAA78081B903BF1004840B9 /* CustomTextField.m */; }; + 7DB0FCA21C7AECB300D2CE0D /* Exception.m in Sources */ = {isa = PBXBuildFile; fileRef = CD7B9F4F1ACB9A8400DF3C71 /* Exception.m */; }; CD001B381AB903040089014A /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = CD001B351AB903040089014A /* logo.png */; }; CD001B391AB903040089014A /* logoApple.png in Resources */ = {isa = PBXBuildFile; fileRef = CD001B361AB903040089014A /* logoApple.png */; }; CD02194F1AD34D8B005148A2 /* AboutWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD02194D1AD34D8B005148A2 /* AboutWindow.xib */; }; @@ -833,6 +834,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7DB0FCA21C7AECB300D2CE0D /* Exception.m in Sources */, CDA5F6B61B16D805003CE340 /* main.m in Sources */, CDA5F6B41B16D805003CE340 /* remoteTaskService.m in Sources */, 7D2A4C6C1BC789070029A284 /* Utilities.m in Sources */, diff --git a/UI/SearchWindow.xib b/UI/SearchWindow.xib index a8cd2a0..853e85d 100644 --- a/UI/SearchWindow.xib +++ b/UI/SearchWindow.xib @@ -23,6 +23,7 @@ + @@ -75,7 +76,7 @@ - + @@ -198,7 +199,7 @@ - + @@ -304,7 +305,7 @@ - + diff --git a/en.lproj/MainMenu.xib b/en.lproj/MainMenu.xib index c6c8bad..a15175a 100755 --- a/en.lproj/MainMenu.xib +++ b/en.lproj/MainMenu.xib @@ -1,9 +1,9 @@ - + - + diff --git a/remoteTaskService/main.m b/remoteTaskService/main.m index 4e2a2f3..73ffc09 100644 --- a/remoteTaskService/main.m +++ b/remoteTaskService/main.m @@ -8,6 +8,7 @@ #import "serviceInterface.h" #import "remoteTaskService.h" +#import "../Exception.h" #import #import @@ -101,20 +102,30 @@ bail: @end -//TODO: add exception handling!!!! - +//main entrypoint +// ->install exception handlers & setup/kickoff listener int main(int argc, const char *argv[]) { + //service delegate + ServiceDelegate* delegate = nil; + + //listener + NSXPCListener* listener = nil; + + //first thing... + // ->install exception handlers! + installExceptionHandlers(); + //make really r00t - // ->needed for exec'ing vmmap + // ->needed for exec'ing vmmap, etc setuid(0); //create the delegate for the service. - ServiceDelegate *delegate = [ServiceDelegate new]; + delegate = [ServiceDelegate new]; //set up the one NSXPCListener for this service // ->handles incoming connections - NSXPCListener *listener = [NSXPCListener serviceListener]; + listener = [NSXPCListener serviceListener]; //set delegate listener.delegate = delegate;