Changeset 342 for trunk/Cocoa


Ignore:
Timestamp:
10/12/07 21:53:46 (17 years ago)
Author:
rchin
Message:

Leopard compatibility changes:

  • Removed some icon caching code that was causing crashes (not sure we really needed those optimizations anyway -- doesn't appear to affect performance)
  • Added code to automatically try to add certificate to keychain, for new code signing behavior (replaces previous procmod nonesense).
  • Note that the enclosed public certificate is mine, and so it will need to be signed by me. In the case that someone else wants to distribute this binary, please replace Certficiate.cer with your own public certificate, and then make sure o code sign the binary after it is built.
Location:
trunk/Cocoa/F-Script Anywhere
Files:
1 added
2 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/F-Script Anywhere/Source/DeVercruesseProcessManager.m

    r230 r342  
    5454    if( self == defaultManager )
    5555        defaultManager = nil;
     56        [super dealloc];
    5657}
    5758
  • trunk/Cocoa/F-Script Anywhere/Source/F-Script Anywhere.xcodeproj/project.pbxproj

    r231 r342  
    88
    99/* Begin PBXBuildFile section */
    10                 256669AE0A1D8DE30006AC79 /* DSCL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 256669AD0A1D8DE30006AC79 /* DSCL.framework */; };
    11                 25666AD30A1D96DE0006AC79 /* DSCL.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 256669AD0A1D8DE30006AC79 /* DSCL.framework */; };
    1210                25666ADA0A1D97B50006AC79 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25666AD90A1D97B50006AC79 /* CoreFoundation.framework */; };
    13                 25666BE70A1DAA1D0006AC79 /* AddToProcMod in Resources */ = {isa = PBXBuildFile; fileRef = 25666BE10A1DAA050006AC79 /* AddToProcMod */; };
    14                 25666BEC0A1DAA410006AC79 /* procmod.m in Sources */ = {isa = PBXBuildFile; fileRef = 25666BEB0A1DAA410006AC79 /* procmod.m */; };
    15                 25666C100A1DACEB0006AC79 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25666C0F0A1DACEB0006AC79 /* Foundation.framework */; };
    1611                25666C4E0A1DAE4D0006AC79 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25666C4D0A1DAE4D0006AC79 /* Security.framework */; };
    17                 25666CA60A1DB1BD0006AC79 /* DSCL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 256669AD0A1D8DE30006AC79 /* DSCL.framework */; };
    1812                258C27790A25A57200AC22BB /* FScript.framework in Resources */ = {isa = PBXBuildFile; fileRef = F5EFC2C3020A6C2601AEEDB1 /* FScript.framework */; };
     13                25D8A24C0CBD347A00EFA0BD /* Certificate.cer in Resources */ = {isa = PBXBuildFile; fileRef = 25D8A24B0CBD347A00EFA0BD /* Certificate.cer */; };
    1914                25EADA9609CD2D7100BCD8E1 /* bytesex.c in Sources */ = {isa = PBXBuildFile; fileRef = 25EADA9509CD2D7100BCD8E1 /* bytesex.c */; };
    2015                E14C18BD05A4DE25000D4AF3 /* FSAInterpreterPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = F5680F7A020D0D0401AEEC37 /* FSAInterpreterPanel.nib */; };
     
    9691
    9792/* Begin PBXContainerItemProxy section */
    98                 25666BE50A1DAA120006AC79 /* PBXContainerItemProxy */ = {
    99                         isa = PBXContainerItemProxy;
    100                         containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
    101                         proxyType = 1;
    102                         remoteGlobalIDString = 25666BE00A1DAA050006AC79;
    103                         remoteInfo = AddToProcMod;
    104                 };
    10593                E1D652BB057666690054F5D1 /* PBXContainerItemProxy */ = {
    10694                        isa = PBXContainerItemProxy;
     
    126114                        dstSubfolderSpec = 10;
    127115                        files = (
    128                                 25666AD30A1D96DE0006AC79 /* DSCL.framework in CopyFiles */,
    129116                        );
    130117                        runOnlyForDeploymentPostprocessing = 0;
     
    150137                256669AD0A1D8DE30006AC79 /* DSCL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = DSCL.framework; sourceTree = "<group>"; };
    151138                25666AD90A1D97B50006AC79 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
    152                 25666BE10A1DAA050006AC79 /* AddToProcMod */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = AddToProcMod; sourceTree = BUILT_PRODUCTS_DIR; };
    153                 25666BEB0A1DAA410006AC79 /* procmod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = procmod.m; sourceTree = "<group>"; };
    154139                25666C0F0A1DACEB0006AC79 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
    155140                25666C4D0A1DAE4D0006AC79 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
    156141                258C25590A259B6E00AC22BB /* FScript.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FScript.framework; sourceTree = "<group>"; };
     142                25D8A24B0CBD347A00EFA0BD /* Certificate.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = Certificate.cer; sourceTree = "<group>"; };
    157143                25EADA9509CD2D7100BCD8E1 /* bytesex.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = bytesex.c; path = "../Darwin source/Commands/Apple/cctools/libstuff/bytesex.c"; sourceTree = SOURCE_ROOT; };
    158144                29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
     
    223209
    224210/* Begin PBXFrameworksBuildPhase section */
    225                 25666BDF0A1DAA050006AC79 /* Frameworks */ = {
    226                         isa = PBXFrameworksBuildPhase;
    227                         buildActionMask = 2147483647;
    228                         files = (
    229                                 25666CA60A1DB1BD0006AC79 /* DSCL.framework in Frameworks */,
    230                                 25666C100A1DACEB0006AC79 /* Foundation.framework in Frameworks */,
    231                         );
    232                         runOnlyForDeploymentPostprocessing = 0;
    233                 };
    234211                E1D652010575B3D50054F5D1 /* Frameworks */ = {
    235212                        isa = PBXFrameworksBuildPhase;
     
    246223                                E1EE9A270575769600F2D92C /* Cocoa.framework in Frameworks */,
    247224                                E1EE9A280575769600F2D92C /* Carbon.framework in Frameworks */,
    248                                 256669AE0A1D8DE30006AC79 /* DSCL.framework in Frameworks */,
    249225                                25666ADA0A1D97B50006AC79 /* CoreFoundation.framework in Frameworks */,
    250226                                25666C4E0A1DAE4D0006AC79 /* Security.framework in Frameworks */,
     
    271247                                E1EE9A4F057576A700F2D92C /* F-Script Anywhere.bundle */,
    272248                                E1D652040575B3D50054F5D1 /* SCPatchLoader.bundle */,
    273                                 25666BE10A1DAA050006AC79 /* AddToProcMod */,
    274249                        );
    275250                        name = Products;
    276                         sourceTree = "<group>";
    277                 };
    278                 256666B80A1D86D80006AC79 /* procmod */ = {
    279                         isa = PBXGroup;
    280                         children = (
    281                                 25666BEB0A1DAA410006AC79 /* procmod.m */,
    282                         );
    283                         name = procmod;
    284251                        sourceTree = "<group>";
    285252                };
     
    319286                        isa = PBXGroup;
    320287                        children = (
     288                                25D8A24B0CBD347A00EFA0BD /* Certificate.cer */,
    321289                                258C25590A259B6E00AC22BB /* FScript.framework */,
    322290                                29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
     
    449417                                F574ADD6020AC10F01AEEDB1 /* NJRScrollView.h */,
    450418                                F574ADD5020AC10F01AEEDB1 /* NJRScrollView.m */,
    451                                 256666B80A1D86D80006AC79 /* procmod */,
    452419                                F5EFC2E7020A8F7F01AEEDB1 /* libMatch.h */,
    453420                                F5EFC2E8020A8F7F01AEEDB1 /* libMatch.c */,
     
    512479
    513480/* Begin PBXNativeTarget section */
    514                 25666BE00A1DAA050006AC79 /* AddToProcMod */ = {
    515                         isa = PBXNativeTarget;
    516                         buildConfigurationList = 25666BED0A1DAA410006AC79 /* Build configuration list for PBXNativeTarget "AddToProcMod" */;
    517                         buildPhases = (
    518                                 25666BDE0A1DAA050006AC79 /* Sources */,
    519                                 25666BDF0A1DAA050006AC79 /* Frameworks */,
    520                         );
    521                         buildRules = (
    522                         );
    523                         dependencies = (
    524                         );
    525                         name = AddToProcMod;
    526                         productName = AddToProcMod;
    527                         productReference = 25666BE10A1DAA050006AC79 /* AddToProcMod */;
    528                         productType = "com.apple.product-type.tool";
    529                 };
    530481                E1D651FA0575B3D50054F5D1 /* Bundle Loader */ = {
    531482                        isa = PBXNativeTarget;
     
    563514                                E1EE9AA60575939700F2D92C /* PBXTargetDependency */,
    564515                                E1D652BC057666690054F5D1 /* PBXTargetDependency */,
    565                                 25666BE60A1DAA120006AC79 /* PBXTargetDependency */,
    566516                        );
    567517                        name = Application;
     
    595545                        isa = PBXProject;
    596546                        buildConfigurationList = 25EAD8F709CD1E3900BCD8E1 /* Build configuration list for PBXProject "F-Script Anywhere" */;
     547                        compatibilityVersion = "Xcode 2.4";
    597548                        hasScannedForEncodings = 1;
    598549                        mainGroup = 29B97314FDCFA39411CA2CEA /* PatchTest */;
    599550                        projectDirPath = "";
     551                        projectRoot = "";
    600552                        targets = (
    601553                                E1EE9A010575769600F2D92C /* Application */,
    602554                                E1EE9A4E057576A700F2D92C /* Bundle */,
    603555                                E1D651FA0575B3D50054F5D1 /* Bundle Loader */,
    604                                 25666BE00A1DAA050006AC79 /* AddToProcMod */,
    605556                        );
    606557                };
     
    619570                        buildActionMask = 2147483647;
    620571                        files = (
    621                                 25666BE70A1DAA1D0006AC79 /* AddToProcMod in Resources */,
    622572                                E1D652AA0575B5F10054F5D1 /* SCPatchLoader.bundle in Resources */,
    623573                                E1EE9AA90575945300F2D92C /* F-Script Anywhere.bundle in Resources */,
     
    631581                                258C27790A25A57200AC22BB /* FScript.framework in Resources */,
    632582                                E1FD011605B91232001DABE0 /* mach_error descriptions.strings in Resources */,
     583                                25D8A24C0CBD347A00EFA0BD /* Certificate.cer in Resources */,
    633584                        );
    634585                        runOnlyForDeploymentPostprocessing = 0;
     
    659610
    660611/* Begin PBXSourcesBuildPhase section */
    661                 25666BDE0A1DAA050006AC79 /* Sources */ = {
    662                         isa = PBXSourcesBuildPhase;
    663                         buildActionMask = 2147483647;
    664                         files = (
    665                                 25666BEC0A1DAA410006AC79 /* procmod.m in Sources */,
    666                         );
    667                         runOnlyForDeploymentPostprocessing = 0;
    668                 };
    669612                E1D651FE0575B3D50054F5D1 /* Sources */ = {
    670613                        isa = PBXSourcesBuildPhase;
     
    718661
    719662/* Begin PBXTargetDependency section */
    720                 25666BE60A1DAA120006AC79 /* PBXTargetDependency */ = {
    721                         isa = PBXTargetDependency;
    722                         target = 25666BE00A1DAA050006AC79 /* AddToProcMod */;
    723                         targetProxy = 25666BE50A1DAA120006AC79 /* PBXContainerItemProxy */;
    724                 };
    725663                E1D652BC057666690054F5D1 /* PBXTargetDependency */ = {
    726664                        isa = PBXTargetDependency;
     
    795733
    796734/* Begin XCBuildConfiguration section */
    797                 25666BEE0A1DAA410006AC79 /* Development */ = {
    798                         isa = XCBuildConfiguration;
    799                         buildSettings = {
    800                                 COPY_PHASE_STRIP = NO;
    801                                 FRAMEWORK_SEARCH_PATHS = (
    802                                         "$(FRAMEWORK_SEARCH_PATHS)",
    803                                         "$(SRCROOT)",
    804                                 );
    805                                 GCC_DYNAMIC_NO_PIC = NO;
    806                                 GCC_ENABLE_FIX_AND_CONTINUE = YES;
    807                                 GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
    808                                 GCC_MODEL_TUNING = G5;
    809                                 GCC_OPTIMIZATION_LEVEL = 0;
    810                                 INSTALL_PATH = "$(HOME)/bin";
    811                                 PREBINDING = NO;
    812                                 PRODUCT_NAME = AddToProcMod;
    813                                 ZERO_LINK = YES;
    814                         };
    815                         name = Development;
    816                 };
    817                 25666BEF0A1DAA410006AC79 /* Deployment */ = {
    818                         isa = XCBuildConfiguration;
    819                         buildSettings = {
    820                                 ARCHS = (
    821                                         ppc,
    822                                         i386,
    823                                 );
    824                                 COPY_PHASE_STRIP = YES;
    825                                 FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"";
    826                                 GCC_ENABLE_FIX_AND_CONTINUE = NO;
    827                                 GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
    828                                 GCC_MODEL_TUNING = G5;
    829                                 PREBINDING = NO;
    830                                 PRODUCT_NAME = AddToProcMod;
    831                                 ZERO_LINK = NO;
    832                         };
    833                         name = Deployment;
    834                 };
    835                 25666BF00A1DAA410006AC79 /* Default */ = {
    836                         isa = XCBuildConfiguration;
    837                         buildSettings = {
    838                                 FRAMEWORK_SEARCH_PATHS = (
    839                                         "$(FRAMEWORK_SEARCH_PATHS)",
    840                                         "$(SRCROOT)",
    841                                 );
    842                                 GCC_ENABLE_FIX_AND_CONTINUE = YES;
    843                                 GCC_MODEL_TUNING = G5;
    844                                 INSTALL_PATH = "$(HOME)/bin";
    845                                 PREBINDING = NO;
    846                                 PRODUCT_NAME = AddToProcMod;
    847                                 ZERO_LINK = YES;
    848                         };
    849                         name = Default;
    850                 };
    851735                25EAD8EC09CD1E3900BCD8E1 /* Development */ = {
    852736                        isa = XCBuildConfiguration;
     
    987871                                        suppress,
    988872                                        "-lstuff",
     873                                        "-weak_framework",
     874                                        FScript,
     875                                        "-sectcreate",
     876                                        __TEXT,
     877                                        __info_plist,
     878                                        "Info-Application.plist",
    989879                                );
    990880                                PREBINDING = YES;
     
    1029919                                        "-weak_framework",
    1030920                                        FScript,
     921                                        "-sectcreate",
     922                                        __TEXT,
     923                                        __info_plist,
     924                                        "Info-Application.plist",
    1031925                                );
    1032926                                PREBINDING = YES;
     
    1060954                                        suppress,
    1061955                                        "-lstuff",
     956                                        "-weak_framework",
     957                                        FScript,
     958                                        "-sectcreate",
     959                                        __TEXT,
     960                                        __info_plist,
     961                                        "Info-Application.plist",
    1062962                                );
    1063963                                PREBINDING = YES;
     
    1078978                        isa = XCBuildConfiguration;
    1079979                        buildSettings = {
     980                                MACOSX_DEPLOYMENT_TARGET = 10.1;
     981                                SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
    1080982                        };
    1081983                        name = Development;
     
    1084986                        isa = XCBuildConfiguration;
    1085987                        buildSettings = {
     988                                SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
    1086989                        };
    1087990                        name = Deployment;
     
    1090993                        isa = XCBuildConfiguration;
    1091994                        buildSettings = {
     995                                SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
    1092996                        };
    1093997                        name = Default;
     
    10961000
    10971001/* Begin XCConfigurationList section */
    1098                 25666BED0A1DAA410006AC79 /* Build configuration list for PBXNativeTarget "AddToProcMod" */ = {
    1099                         isa = XCConfigurationList;
    1100                         buildConfigurations = (
    1101                                 25666BEE0A1DAA410006AC79 /* Development */,
    1102                                 25666BEF0A1DAA410006AC79 /* Deployment */,
    1103                                 25666BF00A1DAA410006AC79 /* Default */,
    1104                         );
    1105                         defaultConfigurationIsVisible = 0;
    1106                         defaultConfigurationName = Default;
    1107                 };
    11081002                25EAD8EB09CD1E3900BCD8E1 /* Build configuration list for PBXNativeTarget "Bundle" */ = {
    11091003                        isa = XCConfigurationList;
  • trunk/Cocoa/F-Script Anywhere/Source/FSAApp.mm

    r231 r342  
    2727#import "FSAApp.h"
    2828#import "FSAnywhere.h"
    29 #import <DSCL/PathManager.h>
    3029#import <CoreFoundation/CoreFoundation.h>
    3130#import <ApplicationServices/ApplicationServices.h>
     
    4544    { 5, @"F-Script Anywhere must be installed in a Cocoa application running as the current user.\n\nYou may be attempting to install in a setuid application, which is not supported" },
    4645    { 11, @"F-Script Anywhere cannot be installed in itself.\n\nIf you wish to install F-Script Anywhere in itself, make a copy of the F-Script Anywhere application and install one copy into the other" },
    47     { smUnExBusErr, @"a bus error occurred.\n\nTry switching to the application first then using F-Script AnywhereÕs dock menu to install" },
     46    { smUnExBusErr, @"a bus error occurred.\n\nTry switching to the application first then using F-Script Anywhere's dock menu to install" },
    4847    { fnfErr, @"F-Script Anywhere was unable to locate its component to install in the application.  Please try reinstalling F-Script Anywhere" },
    4948    { cfragDupRegistrationErr, @"another running copy of F-Script Anywhere is already installed in the application"},
     
    222221}
    223222
    224 -(tDirStatus)authorizeAndAddToProcMod:(NSString *)username
    225 {
    226     OSStatus myStatus;
    227    
    228     if(![self createAuthorization])
    229         return eDSAuthFailed;
    230    
    231     NSString *myToolPath = [[NSBundle mainBundle] pathForResource:@"AddToProcMod" ofType:@""];
    232     char *myArguments[] = { (char *)[username UTF8String], NULL };
    233     FILE *myCommunicationsPipe = NULL;
    234     char myReadBuffer[128];
    235     myStatus = AuthorizationExecuteWithPrivileges(myAuthorizationRef, [myToolPath UTF8String],
    236                                                   myFlags, myArguments,
    237                                                   &myCommunicationsPipe);
    238    
    239     int didRead = 0;
    240     int lastRead;
    241     while((lastRead = read(fileno(myCommunicationsPipe), myReadBuffer, sizeof(myReadBuffer) - didRead - 1)) && (lastRead > 0))
    242         didRead += lastRead;
    243    
    244     myReadBuffer[didRead - 1] = 0;
    245    
    246     return (tDirStatus)strtol(myReadBuffer, NULL, 10);
    247 }
    248 
    249223- (void)finishLaunching
    250224{
    251225    mach_port_t     taskOfOurProcess = mach_task_self();
    252226    mach_port_t     machPortForProcess;
    253    
    254     if(task_for_pid(taskOfOurProcess, 1, &machPortForProcess) != KERN_SUCCESS){ // launchd should always be pid 1
    255         if(![[NSUserDefaults standardUserDefaults] objectForKey:@"doPathCheck"])
    256             [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"doPathCheck"];
    257        
    258         if([[NSUserDefaults standardUserDefaults] boolForKey:@"doPathCheck"]){
    259 top:
    260             PathManager *pm = [[PathManager alloc] initWithLocalNode];
    261             [pm backupStack];
    262             @try {
    263                 [pm cd:@"/Groups/procmod"];
    264             } @catch ( NSException *exception ) {
    265                 goto next;  // this means we must be on ppc 10.4 or less.
    266             }
    267             CFDictionaryRef sessionInfoDict = CGSessionCopyCurrentDictionary();
    268             if(sessionInfoDict){
    269                 CFStringRef shortUserName = (CFStringRef)CFDictionaryGetValue(sessionInfoDict, kCGSessionUserNameKey);
    270                 if(![[[pm lastObject] readArray:@"GroupMembership"] containsObject:(NSString *)shortUserName]){
    271                     switch([[NSAlert alertWithMessageText:[NSString stringWithFormat:@"User %@ not in the procmod group", shortUserName]
    272                                             defaultButton:@"Add me"
    273                                           alternateButton:@"Disable checking"
    274                                               otherButton:@"Ignore message"
    275                                 informativeTextWithFormat:@"F-Script Anywhere requires that you add yourself to the procmod "
    276                         "group in order for it to function properly. If you like, F-Script Anywhere can automatically add you "
    277                         "to the procmod group."] runModal]){
    278                         case NSAlertDefaultReturn:
    279                         {
    280                             tDirStatus status = [self authorizeAndAddToProcMod:(NSString *)shortUserName];
    281                             if(status != eDSNoErr){
    282                                 [[NSAlert alertWithMessageText:@"Error adding to procmod group"
    283                                                  defaultButton:nil
    284                                                alternateButton:nil
    285                                                    otherButton:nil
    286                                      informativeTextWithFormat:@"There was an error (%@) adding you to the procmod group. ", [[NSClassFromString(@"DSoStatus") sharedInstance] stringForStatus:status]] runModal];
    287                             } else {
    288                                 [[NSAlert alertWithMessageText:@"Adding user procmod group succeeded"
    289                                                  defaultButton:nil
    290                                                alternateButton:nil
    291                                                    otherButton:nil
    292                                      informativeTextWithFormat:@"You may have to wait a few minutes until the system updates its caches (or alternatively, reboot your machine) before things will work properly."] runModal];
    293                             }
    294                         }
    295                             [pm restoreStack];
    296                             [pm release];
    297                             goto top;
    298                         case NSAlertAlternateReturn:
    299                             [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"doPathCheck"];
    300                             break;
    301                         default:
    302                             break;
    303                     }           
    304                 }
    305             }
    306             [pm restoreStack];
    307             [pm release];
    308         }
     227    /* under new rules for task_for_pid, only processes with proper permissions can call task_for_pid successfullly */
     228    int ourPid = [[NSProcessInfo processInfo] processIdentifier];
     229    NSLog(@"our pid %d", ourPid);
     230    if(task_for_pid(taskOfOurProcess, ourPid, &machPortForProcess) == KERN_SUCCESS){ // launchd should always be pid 1
     231        mach_port_deallocate(taskOfOurProcess, machPortForProcess);
    309232    } else {
    310         mach_port_deallocate(taskOfOurProcess, machPortForProcess);
    311     }
    312 next:
     233        int result = NSRunInformationalAlertPanel(
     234                                                  NSLocalizedString(@"Certificate not trusted", "Framework not found alert title"),
     235                                                  NSLocalizedString(@"Due to new security features in Leopard, F-Script Anywhere requires you to to trust the signature on the current application. "
     236                                                                    "You have several options:\n"
     237                                                                    "1. You can add the signing certificate automatically to your keychain, in which case you should click \"OK\" in the next dialog box to add the certificate to your keychain, and then \"Always Trust.\"\n"
     238                                                                    "2. You can quit F-Script Anywhere, create a signing authority on your local machine, trust it, and then sign the application binary yourself.\n"
     239                                                                    @"Note that if you add the certificate properly and you still get an F-Script Anywhere error when injecting, you may need to restart your computer to clear the proper keychain caches.", @"no certificate warning message"),
     240                                                  NSLocalizedString(@"Add certificate", "'add certificate button title"),
     241                                                  NSLocalizedString(@"Quit", "Quit button title"),
     242                                                  NULL);
     243        switch (result) {
     244            case NSAlertDefaultReturn:
     245                NSString *certPath = [[NSBundle mainBundle] pathForResource:@"Certificate" ofType:@"cer"];
     246                [[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:certPath]];
     247                break;
     248            case NSAlertAlternateReturn:
     249                [self terminate: self];
     250                break;
     251            default:
     252                break;
     253        }       
     254    }
    313255    patchController = new FSAPatchController(self);
    314256    patchController->AddPatch((CFStringRef)PatchBundleIdentifier, CFSTR("Contents/Resources/"),
  • trunk/Cocoa/F-Script Anywhere/Source/FSAAppList.m

    r222 r342  
    320320        NSAssert1([cell isKindOfClass: [NJRLabeledImageCell class]], @"Cell is not what we expected, instead %@", cell);
    321321        [(NJRLabeledImageCell *)cell setImage: [app img]];
    322         [(NJRLabeledImageCell *)cell setImageCacheSource: app];
    323322    }
    324323}
  • trunk/Cocoa/F-Script Anywhere/Source/Info-Application.plist

    r222 r342  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    33<plist version="1.0">
    44<dict>
     
    2525        <string>FSAn</string>
    2626        <key>CFBundleVersion</key>
    27         <string>1.3</string>
     27        <string>1.3.1</string>
    2828        <key>NSMainNibFile</key>
    2929        <string>MainMenu</string>
    3030        <key>NSPrincipalClass</key>
    3131        <string>FSAApp</string>
     32        <key>SecTaskAccess</key>
     33        <string>allowed</string>
    3234</dict>
    3335</plist>
  • trunk/Cocoa/F-Script Anywhere/Source/NJRLabeledImageCell.h

    r7 r342  
    3131@private
    3232    NSImage *image;
    33     id imageCacheSource;
    3433}
    3534
     
    3837- (void)setImage:(NSImage *)anImage;
    3938- (NSImage *)image;
    40 - (void)setImageCacheSource:(id)aSource;
    4139
    4240- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
  • trunk/Cocoa/F-Script Anywhere/Source/NJRLabeledImageCell.m

    r19 r342  
    3838- (void)dealloc {
    3939    [image release];
    40     [imageCacheSource release];
    4140    image = nil;
    4241    [super dealloc];
     
    5857- (NSImage *)image {
    5958    return image;
    60 }
    61 
    62 - (void)setImageCacheSource:(id)aSource {
    63     if (aSource != imageCacheSource) {
    64         [imageCacheSource release];
    65         imageCacheSource = [aSource retain];
    66     }
    6759}
    6860
     
    10294        imageSize = NSMakeSize(cellFrame.size.height - 1, cellFrame.size.height - 1);
    10395
    104         preferredRep = [[[imageCacheSource cachedImage] representations] objectAtIndex: 0];
    105         if (preferredRep != nil && abs([preferredRep size].width - imageSize.width) < 1 && abs([preferredRep size].height != imageSize.height) < 1) {
    106             [self setImage: [imageCacheSource cachedImage]];
    107             // FSALog(@"%@ accepting cached image: %@", [self stringValue], preferredRep);
    108         } else {
    109             NSArray     *imageReps = [image representations];
    110             int         i, repCount = [imageReps count];
    111             NSSize      repSize;
    112            
    113             preferredRep = [imageReps objectAtIndex: 0];
    114             // FSALog(@"%@ rejecting cached image: %@", [self stringValue], preferredRep);
    115             for (i = 1 ; i < repCount ; i++) {
    116                 rep = [imageReps objectAtIndex: i];
    117                 repSize = [rep size];
    118                 if (repSize.width == imageSize.width && repSize.height == imageSize.height) {
    119                     preferredRep = rep;
    120                     break;
    121                 }
    122                 if (repSize.width >= imageSize.width || repSize.height >= imageSize.height) {
    123                     // pick the smallest of the larger representations
    124                     if (repSize.width <= [preferredRep size].width ||
    125                         repSize.height <= [preferredRep size].height) preferredRep = rep;
    126                 } else {
    127                     // or the largest of the smaller representations
    128                     if (repSize.width >= [preferredRep size].width ||
    129                         repSize.height >= [preferredRep size].height) preferredRep = rep;
    130                 }
    131             }
    132             /* // Working code as of OS X 10.0.4; this breaks in 10.1
    133                 for (i = repCount - 1 ; i >= 0 ; i--) {
    134                     rep = [imageReps objectAtIndex: i];
    135                     if (rep != preferredRep) {
    136                         [image removeRepresentation: rep];
    137                     }
    138                 }
    139             // End working code
    140             */
    141             // Begin workaround code for bug in OS X 10.1 (removeRepresentation: has no effect)
    142             if ([preferredRep size].width > imageSize.width || [preferredRep size].height > imageSize.height) {
    143                 NSImage *scaledImage = [[NSImage alloc] initWithSize: imageSize];
    144                 NSRect rect = { NSZeroPoint, imageSize };
    145                 FSALog(@"rescaling %@", [self stringValue]);
    146                 [scaledImage setFlipped: [controlView isFlipped]]; // XXX this works, but is correct?
    147                 [scaledImage lockFocus];
    148                 [preferredRep drawInRect: rect];
    149                 [scaledImage unlockFocus];
    150                 [image release];
    151                 image = scaledImage;
    152             } else if (repCount > 1) {
    153                 NSImage *sizedImage = [[NSImage alloc] initWithSize: [preferredRep size]];
    154                 [sizedImage addRepresentation: preferredRep];
    155                 [image release];
    156                 image = sizedImage;
    157             }
    158             // End workaround code
    159         }
     96                NSArray *imageReps = [image representations];
     97                int             i, repCount = [imageReps count];
     98                NSSize  repSize;
     99               
     100                preferredRep = [imageReps objectAtIndex: 0];
     101                // FSALog(@"%@ rejecting cached image: %@", [self stringValue], preferredRep);
     102                for (i = 1 ; i < repCount ; i++) {
     103                        rep = [imageReps objectAtIndex: i];
     104                        repSize = [rep size];
     105                        if (repSize.width == imageSize.width && repSize.height == imageSize.height) {
     106                                preferredRep = rep;
     107                                break;
     108                        }
     109                        if (repSize.width >= imageSize.width || repSize.height >= imageSize.height) {
     110                                // pick the smallest of the larger representations
     111                                if (repSize.width <= [preferredRep size].width ||
     112                                        repSize.height <= [preferredRep size].height) preferredRep = rep;
     113                        } else {
     114                                // or the largest of the smaller representations
     115                                if (repSize.width >= [preferredRep size].width ||
     116                                        repSize.height >= [preferredRep size].height) preferredRep = rep;
     117                        }
     118                }
     119                /* // Working code as of OS X 10.0.4; this breaks in 10.1
     120                 for (i = repCount - 1 ; i >= 0 ; i--) {
     121                 rep = [imageReps objectAtIndex: i];
     122                 if (rep != preferredRep) {
     123                 [image removeRepresentation: rep];
     124                 }
     125                 }
     126                 // End working code
     127                 */
     128                // Begin workaround code for bug in OS X 10.1 (removeRepresentation: has no effect)
     129                if ([preferredRep size].width > imageSize.width || [preferredRep size].height > imageSize.height) {
     130                        NSImage *scaledImage = [[NSImage alloc] initWithSize: imageSize];
     131                        NSRect rect = { NSZeroPoint, imageSize };
     132                        FSALog(@"rescaling %@", [self stringValue]);
     133                        [scaledImage setFlipped: [controlView isFlipped]]; // XXX this works, but is correct?
     134                        [scaledImage lockFocus];
     135                        [preferredRep drawInRect: rect];
     136                        [scaledImage unlockFocus];
     137                        [image release];
     138                        image = scaledImage;
     139                } else if (repCount > 1) {
     140                        NSImage *sizedImage = [[NSImage alloc] initWithSize: [preferredRep size]];
     141                        [sizedImage addRepresentation: preferredRep];
     142                        [image release];
     143                        image = sizedImage;
     144                }
     145                // End workaround code
    160146       
    161147        NSDivideRect(cellFrame, &imageFrame, &cellFrame,
     
    176162            fromRect: NSOffsetRect(imageFrame, -imageFrame.origin.x, -imageFrame.origin.y)
    177163            operation: NSCompositeSourceOver fraction: 1.0];
    178         [imageCacheSource setCachedImage: image];
    179164    }
    180165    [self setAttributedStringValue:
    181166        [[self stringValue] asAttributedStringTruncatedToWidth: cellFrame.size.width - 4]];
    182     [self setImageCacheSource: nil]; // without this, we crash (multiple cells get created!)
    183167    [super drawWithFrame: cellFrame inView: controlView];
    184168}
  • trunk/Cocoa/F-Script Anywhere/Source/SCPatch/Common/SCPatchMessenger.cp

    r153 r342  
    11#include <Carbon/Carbon.h>
     2#include <sys/time.h>
    23#include <syslog.h>
    34#include <unistd.h>
  • trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchLoader.c

    r217 r342  
    1111#undef USE_CFRUNLOOP
    1212#undef CHECK_SYMBOL_REFERENCES
    13 #define SCPL_DEBUG_LOG
     13#undef SCPL_DEBUG_LOG
    1414
    1515#ifdef SCPL_DEBUG_LOG
  • trunk/Cocoa/F-Script Anywhere/Source/mach_inject/mach_inject.h

    r217 r342  
    1919#ifndef         _mach_inject_
    2020#define         _mach_inject_
    21 
     21#define __DARWIN_UNIX03 0
    2222#include <sys/types.h>
    2323#include <mach/error.h>
  • trunk/Cocoa/F-Script Anywhere/Source/main.m

    r7 r342  
    11#import <Cocoa/Cocoa.h>
     2#import <Foundation/NSDebug.h>
    23
    34int main(int argc, const char *argv[])
    45{
     6        NSZombieEnabled = 1;
    57    return NSApplicationMain(argc, argv);
    68}
Note: See TracChangeset for help on using the changeset viewer.