Getting "Already Activated" when not activated (TurboActivate)Answered

Any suggestions on how to diagnose this?

A customer appears to have been playing activate/deactivate for no good reason. Eventually he hit the deactivation limit and that was his first support request. I fixed that by removing the limit and deactivating him online, but now he's getting an “already activated” (TA_E_ALREADY_ACTIVATED) error from the call to TA_Activate(). I've checked online and it shows his product key is not activated.

I can think of two possibilities. First is that “you have to wait X hours” thing. I told him to wait 5 hours and try again. He claims he did.  Second is that it's possible that at some point he tried a different product key, maybe from a trial.

Is this correct?  Are you aware of other possibilities?

Is there maybe a tool that can give more diagnostics when this kind of thing happens?  Is there a tool that can zap all activations of our product on a particular PC?

I can't be exactly sure what TA version he's using. It will be the current (4.3.3.0) or previous release of TurboActivate, depending on how recently he got the app from us. I can get him to check the DLL version if this matters.

, edited
Answer

For starters, use the latest version.

Then, the error is telling you exactly what is wrong. They’re already activated, so there’s no need for them to enter the product key again.

Yes, you’ve deactivated them online, but that doesn’t change the fact they’re still activated on the machine (for the time being).

He's using 4.3.3.0 now confirmed.

With respect, I believe the error message is NOT telling what's wrong, it's only telling half of the story.  I would get this same "already activated" error even if it was previously activated with an expired trial isn't that correct?

My code wouldn't be calling TA_Activate() unless the TA_IsGenuineEx() call had already failed (my code is based on your sample at the time I first included TurboActivate).  So it's not genuine but it's refusing to activate with a genuine product key.

My question was, how do I diagnose the details of this condition, or better yet, how do I make this problem go away?  In an ideal world I could find out what other product key is conflicting, or simply zap all activations on this PC.

Answer

TA_Activate() Doesn’t return TA_E_ALREADY_ACTIVATED. CheckAndSavePKey does. See the docs.

use The latest version (4.4.2) and show your code, including params, return codes, etc so we can tell you exactly where things failed.

Quite right, “Activate_Now” is the name of my own function. Your function was TA_CheckAndSavePKey(), so you have correctly identified where the problem is: we have a product key that has been assigned to this user, but for some reason TA_CheckAndSavePKey() refuses to accept it, returning TA_E_ALREADY_ACTIVATED (and this form's insistance on replacing my text with italics every time I type underscore is VERY annoying).

The code follows. USER_DATA is a structure of my own that recovers data stored in the registry by a previous dialog. The exact structure is not important, but it includes the product key assigned to this user.

The problem is that TA_CheckAndSavePKey() returns TA_E_ALREADY_ACTIVATED, and then I believe TA_Deactivate() returns a fail (I'll get the client to confirm that it still happens: I'm having two conversations here).  My question remains: how do I diagnose this condition with certainty (e.g. by naming the conflicting product key) or, how do I zap all activations of our product on this PC.

BOOL
Activate_Now(void)
{
  HRESULT hr;
  PUSER_DATA pud = UserData_Get();
  if (!taHandle) {
     SetDatFilePath();
     taHandle = TA_GetHandle(Tx_GUID);
  }
_check_again:
  hr = TA_CheckAndSavePKey(taHandle,pud->product_key, TA_USER); // we use the TA_USER flag so we don't need elevated permissions.
  if (hr == TA_OK) {
     // Message("Product key saved successfully.");
     // try to activate
     hr = TA_Activate(taHandle,NULL);
     if (hr == TA_OK) {
        Message("Activate was successful!");
        bActivated = TestTimeLimit();
     } else {
        Error("Activation failed!", hr);
        return FALSE;
     }
  } else if (hr==TA_E_ALREADY_ACTIVATED) {
     if (MessageBox(GetFocus(),"Strange. Activation is failing because the server says that "szAppName" is already activated on this PC.\nWould you like to force deactivation and try again?","Activation Error",MB_ICONINFORMATION|MB_YESNO)==IDYES) {
        hr = TA_Deactivate(taHandle,1);
        if (hr==TA_OK) {
           MessageBox(GetFocus(),"Done. This PC should now be deactivated. Click \"OK\" to attempt activation again.","Activation Progress",MB_ICONINFORMATION|MB_OK);
           goto _check_again;
        } else {
           Error("Deactivation did not work. I'm going to have to bail here.", hr);
           return FALSE;
        }
     }
  } else {
     Error("Software error: Could not write product key.", hr);
     return FALSE;
  }
  return TRUE;
}
, edited

but for some reason TA_CheckAndSavePKey() refuses to accept it, returning TA_E_ALREADY_ACTIVATED

The reason is described in the error. It will never accept any product key if they're already activated. That's by design. If they want to deactivate, they need to do that first.

(and this form's insistance on replacing my text with italics every time I type underscore is VERY annoying).

It is. We'll fix it soon.

My question remains: how do I diagnose this condition with certainty (e.g. by naming the conflicting product key) or, how do I zap all activations of our product on this PC.

TA_GetPKey() to get the product key. But don't bother getting the product key to then save it again (because it will again return TA_ALREADY_ACTIVATED).

The way to diagnose problems:

  1. Record error codes.
  2. Record which function is returning the error code.
  3. Record params used.

Don't teach granny how to suck eggs.  I know how to record an error code, that's how I was able to report it in the first post here. Since you seem to be unable to give a solution to this problem (how to zap all activations on a given PC) I think we're done here.

I'm not trying to be rude. You're asking questions that are self-evident (or documented extensively).

(how to zap all activations on a given PC)

Again, the answer is self-evident (TA_Deactivate).

I think the source of the problems is that you're recording what you think the activation state is separately, and when that cached information is incorrect you get odd behavior. Which is to be expected. Don't do that. TurboActivate provides all the API functions you need to get the activation state, and all the error codes and parameters to handle odd end-user-behavior.