Activate() return code seems wrong for invalid product key

Hello, it seems that when I call the Activate() function with an invalid product key, I get TA_E_PDETS, when I would expect to get TA_E_PKEY.

This is on Windows 7.

Aside from that, everything is working properly (activation does succeed with a valid key, etc.).

Any ideas?

Actually, sorry. I just realized that it's a different problem.

CheckAndSavePKey() is what's failing for an invalid product key. I guess that's expected. But does TA_FAIL mean *only* that the product key is invalid? Or could it mean something else? I'm trying to create error messages to display to the user based on the return codes.

Hey Eric,

does TA_FAIL mean *only* that the product key is invalid?

Yes.

Ok, thanks. But how does CheckAndSavePKey() know whether or not the key is valid, without connecting to the internet?

The product key is formed using a mathematical algorithm. Thus it can be verified using math (thus no internet connection is needed).

I see. So the internet connection for Activate() is only required to update the database?

No, it's more complicated than that. A good overview of how online activation works is here: How hardware-locked licensing works.

Tell me if that helps.

Thanks, that makes sense.

One other thing about CheckAndSavePKey(): if the product key is too long, meaning there's an extra character in it or more, TA_E_PKEY is returned, which is not one of the return codes that the header file says the function can return. However, if the product key is too short, or if it's the right length but invalid, TA_FAIL is returned.

Is this expected?

I would assume that either TA_E_PKEY would be returned in both cases, and should be added to the header file, or that TA_FAIL would be returned in both cases.

Sorry, you're absolutely right -- it should return TA_FAIL in all cases (for CheckAndSavePkey() at least), not TA_E_PKEY. We're fixing this for the next version.