IsGenuineEx does not return TA_INET right

While TurboActivate 4.0 is still not out, we wanted to implement a functionality that counts the days without internet.It depends on what result is returned from IsGenuineEx(), however while debugging we observed some strange behavior.

Scenario 1 (used only for debug purposes)1. Unplug the internet cable2. Set GENUINE_OPTIONS to check on 0 days ( which in our practice seems to check with servers on every call)3. Call IsGenuineEx and TA_OK is returned the first time, after that TA_INET_DELAYED is returned.

Why is this behavior. How do we make IsGenuineEx return TA_INET whenever no internet is presented.

Scenario 2 (used in common practice)1.Unplug the cable 2. Set GENUINE_OPTIONS to check every 4 days.3. Still on first call TA_OK is returned3. We change the system date some days ahead( more or equal to 4), which have to make IsGenuineEx to check with the servers again, but still on the firs call TA_OK is returned.

How do we solve this issue?We depend on TA_OK, because we reset the grace period count every time we get this code.

Why is this behavior. How do we make IsGenuineEx return TA_INET whenever no internet is presented.

It is. That's what TA_E_INET_DELAYED is. This is all described in very clear detail in the TurboActivate.h file:

/*   Checks whether the computer is genuinely activated by verifying with the LimeLM servers   after a certain number of days you specify.


   This is meant as a replacement of both TA_IsActivated() and TA_IsGenuine(). Call this at the   top of your program and let TA_IsGenuineEx() handle all the details.


   This differs with TA_IsGenuine() in 3 major ways:


        1. You can specify how often to verify with the LimeLM servers and it handles           all the date tracking behind the scenes.




        2. TA_IsGenuineEx() prevents your app from hammering the end-user's network after           and TA_E_INET error return code by not checking with the LimeLM servers until           at least 5 hours has passed. If you call TA_IsGenuineEx() after a TA_E_INET return           and before 5 hours has elapsed then this function will return TA_E_INET_DELAYED.


           (If you give the user the option to recheck with LimeLM, e.g. via a button           like "Retry now" then call TA_IsGenuine() to immediately retry without waiting 5 hours).




        3. If a TA_E_INET error is being returned, and the grace period has expired,           then TA_IsGenuineEx() will return TA_FAIL. TA_IsGenuineEx() will continue to try           contacting the LimeLM servers on subsequent calls (5 hours apart), but you           should treat the TA_FAIL as a hard failure.




   Returns: TA_OK or TA_E_FEATURES_CHANGED on success. Handle TA_E_INET and TA_E_INET_DELAYED as warnings that            you should let the end user know about.


            Handle all other return codes as failures.


   Possible return codes: TA_OK, TA_FAIL, TA_E_ACTIVATE, TA_E_INET, TA_E_INVALID_HANDLE,                          TA_E_COM, TA_E_EXPIRED, TA_E_REVOKED, TA_E_INVALID_ARGS,                          TA_E_INVALID_FLAGS, TA_E_IN_VM, TA_E_INET_DELAYED,                          TA_E_FEATURES_CHANGED, TA_E_ANDROID_NOT_INIT,                          TA_E_ENABLE_NETWORK_ADAPTERS*/TURBOACTIVATE_API HRESULT TA_CC TA_IsGenuineEx(uint32_t handle, PGENUINE_OPTIONS options);

And:

/* MessageId: TA_E_INET_DELAYED Message code (in Hex): 0x15 Message code (in Decimal): 21


 MessageText:


 TA_IsGenuineEx() previously had a TA_E_INET error, and instead of hammering the end-user's network, TA_IsGenuineEx() is waiting 5 hours before rechecking on the network.*/#define TA_E_INET_DELAYED         ((HRESULT)0x00000015L)
3. We change the system date some days ahead( more or equal to 4), which have to make IsGenuineEx to check with the servers again, but still on the firs call TA_OK is returned.

We can't reproduce that. Show me your code.

Here you are:

CheckActivation( BOOL bForceCheck/*= FALSE*/ ){ m_GenuineOptions.nLength = sizeof(GENUINE_OPTIONS);

m_GenuineOptions.nDaysBetweenChecks = 4; // if set to 0, TA_OK is still returned // when no internet is presented on the first call

m_GenuineOptions.nGraceDaysOnInetErr = 30;

m_GenuineOptions.flags = TA_SKIP_OFFLINE; HRESULT hr;

if( bForceCheck ) { // Sometimes we need to force contact with the server hr = IsGenuine( /* TA_GUID_HERE */ ); }

else { hr = IsGenuineEx( /* TA_GUID_HERE */, &m_GenuineOptions ); }

bool bActivated = false;

if( hr == TA_OK ) { bActivated = true;

ResetGracePeriod( ); }

if( hr == TA_E_FEATURES_CHANGED || hr == TA_E_INET || hr == TA_E_INET_DELAYED ) { if( hr == TA_E_INET_DELAYED ) { // This is kind of workarround because we almost never get TA_INET from IsGenuineEx // so we have to check twice hr = IsGenuine( /* TA_GUID_HERE */ ); }

if( hr == TA_E_INET ) { m_LicenseNotification.uType = eNO_INTERNET_CONNECTION; // show internet connection error

m_LicenseNotification.nGraceDaysRemainig = CalculateGraceDaysRemaining( ); }

bActivated = IsActivated( /* TA_GUID_HERE */ ) == TA_OK ; }

return bActivated;}

We can't reproduce this. Don't mess around with the date/time settings. And if you're still having problems send us a small program that can reproduce what you're seeing.

Well we will test a couple of days with nDaysBetweenChecks = 1, but after that we will search of a workaround.Is it too ugly and dangerous to call IsGenunieEx() two consecutive times.

There's absolutely no reason to call IsGenuineEx() twice in a row. And there's absolutely no reason to set a low value for nDaysBetweenChecks.

But like I said:

if you're still having problems send us a small program that can reproduce what you're seeing.

On which email should i send my example program then?

You can send it to support@wyday.com

I have sent you a sample program. Have you received it ?

Everything is working fine here. If youve activated online, and youre not messing with the date/time/timezone settings of the computer, and your app cannot successfully connect to the activations servers then IsGenuineEx() will return either TA_E_INET or TA_E_INET_DELAYED.

Calling it multiple times wont help. And dont call IsGenuine() on TA_E_INET_DELAYED *unless* the customer has made an action to actually re-try (like clicking a retry button).

Dont hammer the customers network.