Where does CheckAndSavePKey() save license file to? Location of file?

Hi There,

I've started to implement this to see if it's viable for us our project. For our product, we support both OSX and Windows, so we are using our own GUI to activate. I'm at the point where I just want to see if the CheckAndSavePKey() actually works. My question is where that function saves the license file to. I couldn't find that in the reference documents. If you can point me to some documentation about that I am happy to review it.

For now, I'm developing on OSX, so where would I find the license file that CheckAndSavePKey() generates in its filesystem?

Thanks,Arie

Where it saves the files depends on the operating system, the version of the operating system, the type of user account, and whether TA_SYSTEM or TA_USER is used. And the "license files" for the product key is just basically the product key written to a file (in a binary format TurboActivate can read quickly). So, nothing special in there.

If there something you're trying to test?

Hey Wyatt,

Thanks for the response. Here's some code I've got in my app's "activation" method. I basically copied and pasted the if statement from Example.c

printf("\nThe result from the UI is %s", result.c_str()); hr = CheckAndSavePKey(_T(result.c_str()), TA_USER); if (hr == TA_OK) { printf("\nProduct key saved successfully.\n"); // try to activate hr = Activate(); if (hr == TA_OK) printf("\nActivated successfully\n"); else printf("\nActivation failed: hr = %d\n", hr); } else printf("\nProduct key failed to save: hr = %i\n", hr);

I'm always seeing "Product key failed to save: hr = 8" in my console. Do you know what 8 refers to here? I know that TurboActivate.h has the error codes for type HRESULT. My thought is the issue could be one of two (from the header file):

The version GUID doesn't match that of the product details file.The product details file "TurboActivate.dat" failed to load.

Is it either one of those?

Thanks,Arie

Okay so it was definitely the TurboActivate.dat file that wasn't loading properly. So, after reading the documentation, I did this:

STRCTYPE datFileHRESULT hr

datFile = "/path/to/the/TurboActivate/file.dat"hr = PDetsFromPath(datFile);hr = CheckAndSavePKey("serial-code-generated-by-limelm", TA_USER)

And I'm happy to report that Activate() now works!

Here's the issue though. I'm building a bundle that acts as a plugin for another app, so it would be great if I could somehow NOT require the user to install the TurboActivate.dat file in the same directory of their archive. Is there any way I can include the .dat file into the built bundle and then refer to it from there?

Thanks,Arie

Well, yes, you could find your plugin's location then call PDetsFromPath() with the TurboActivate.dat file path that's relative to your plugin's location.

Any ideas on how to do this with C++ in XCode? Pointers to references?Thanks!

Well, you'd need to do a few things:

  1. Get the loaded process: http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe
  2. Get the dynamic libraries in the loaded process, and find yourself among those libraries: http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe
  3. Find the relative path to TurboActivate.dat.

Or you could just hardcode the location of the TurboActivate.dat files specific to your product.

Thank you for those links. I'll take a closer look at them. I thought to store the .dat file within the bundle's Resources directory, then use something like the following to find the path to that file.

http://stackoverflow.com/questions/8768217/how-can-i-find-the-path-to-a-file-in-an-application-bundle-nsbundle-using-chttp://stackoverflow.com/questions/24165681/accessing-files-in-resources-folder-in-mac-osx-app-bundle

I've tried both methods there and I get an EXC_BAD_ACCESS crash. So I'm troubleshooting it.

This is making me think it's probably better to just have an installer so it's explicitly determined where the .dat file should existand copied to. But, since the app is already one file, it would have been nice to just include the .dat file.

Thanks again for the help,Arie