Aquatic Prime - Validation Issues

133 Views Asked by At

I am trying to get this to work using the Core Foundation library on OSX.

However i am seeing really inconsistent license validation, sometimes it validates fine, then other times not, using exactly the same file.

Here is the code i am using at the moment:

   - (void)checkApexProcess{

    CFMutableStringRef key = CFStringCreateMutable(NULL, 0);
CFStringAppend(key, CFSTR("0xB57B7D0E180"));
CFStringAppend(key, CFSTR("E"));
CFStringAppend(key, CFSTR("E"));
CFStringAppend(key, CFSTR("C4FD9AAAFC389F8"));
CFStringAppend(key, CFSTR("438903BC20D0"));
CFStringAppend(key, CFSTR("E"));
CFStringAppend(key, CFSTR("E"));
CFStringAppend(key, CFSTR("1F02C25010F8F47C"));
CFStringAppend(key, CFSTR("86"));
CFStringAppend(key, CFSTR("C"));
CFStringAppend(key, CFSTR("C"));
CFStringAppend(key, CFSTR("4FABF44A4376945C6F8F92292B"));
CFStringAppend(key, CFSTR("D45043012F6959BD6D3E1D246D1C1B"));
CFStringAppend(key, CFSTR("6F4A53FA1C023B4A91BC4578504B1D"));
CFStringAppend(key, CFSTR("9BEA69A53FAE91FD36ACA165CA57"));
CFStringAppend(key, CFSTR("B"));
CFStringAppend(key, CFSTR("B"));
CFStringAppend(key, CFSTR(""));
CFStringAppend(key, CFSTR("B"));
CFStringAppend(key, CFSTR("4"));
CFStringAppend(key, CFSTR("4"));
CFStringAppend(key, CFSTR("C30A925FAFBB1CA595D5011DA0E"));
CFStringAppend(key, CFSTR("BF819BC6A909861DE8C5121FCA06AF"));
CFStringAppend(key, CFSTR("FB3290875E3ED23D1F"));

APSetKey(key);

NSURL* filePath;
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:NO];
CFURLRef filePathUrl;
bool Valid;
//CFDictionaryRef cfUserLicenseInfo;
NSDictionary* apexDict;

if ( [openDlg runModal] == NSOKButton )
{
    for( NSURL* URL in [openDlg URLs] )
    {

        filePath = URL;
        NSString* filePathString = [URL path];
        filePathUrl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef) filePathString, kCFURLPOSIXPathStyle, FALSE);

        //CFDictionaryRef cfUserLicenseInfo = APCreateDictionaryForLicenseFile(filePathUrl);

        Valid = APVerifyLicenseFile(filePathUrl);
        //Valid = APVerifyLicenseData(cfUserLicenseInfo);
        DDLogCVerbose( @"%@", filePath );
        DDLogCVerbose( @"%@", filePathUrl );
        DDLogCVerbose( @"%@", [URL path] );

        //apexDict = [NSDictionary dictionaryWithContentsOfFile:(filePathString)];
    }

//Valid = testValidLicenseFile2(filePathUrl);
if(Valid == true){
    //[self storeLicenseFile:filePath];
    [self enableApexButtons];
} else {
    [self displayApexAlertInvalid];
    [self removeApexFile];
}
}

  }

I am really stuck as to what is going on here, i don't really understand how it can validate sometimes, and not others?

Anyone got any ideas?

Thanks

Gareth

Edit 1

Weirdly if i comment out the lines:

CFDictionaryRef cfUserLicenseInfo;
NSDictionary* apexDict;

Then the validation passes, if not then it fails, it's super weird, anyone got any ideas?

0

There are 0 best solutions below