Rolling back the clock

Hello,

I've created a license number with a custom date value and filled in with the following information 03/20/2013 20:14:00and I'm using the following code:

if IsDateValid(PWideChar(FeatureValue), TA_HAS_NOT_EXPIRED) = 0 then { not expired code}else { expired code }

Ok, today it's returning <> 0, but I roll back the clock let's say, 03/10/2013 and it returns 0, what's wrong?I'm inside a VM, I don't know if it counts, but of course I've allowed it to run inside a VM.

Thank you.

Is this Delphi code? If so, then use booleans not ints.

Hello,

It's Delphi, and I'm using this function as defined in your source code:function IsDateValid(date_time: LPCWSTR; flags: LongWord):LongInt; cdecl; external 'TurboActivate.dll';

As a matter of fact, the function is working well, it returns 0 when the date is ok and different value when the date parameter is less than system date. The problem arises when I roll back the clock, it returns zero again.

Note that I'm not using trial mode in any way. I'm only trying to limit the activation period to one month using feature values.

You shouldn't actually use that function. If you open the example project you see we made a whole TurboActivate class that has pre-written functions that handle all the hairy details of making the native function calls.

Regarding the behavior of IsDateValid() -- we have some fraud protection but it's not perfect. It's being improved every version.

The problem arises when I roll back the clock, it returns zero again.

If you're rolling the clock back to the actual date, then IsDateValid is correct in returning 0.

Hello, thank you for your prompt reply.I'm aware of the class but I don't want to use exceptions and the class forces me to do that.But returning to the problem, this function does not work as I've expected, could you recommend a way to implement this behavior?I want the program to expire at month's end and do not want my user roll back the clock 30 days for using it again, I want the users renew their licenses in a monthy basis.

For starters you're not passing in the date correctly (this is why we're telling you to use our pre-written class -- we took the time to make sure everything works correctly).

Try calling our function in the class and see if it works. It should. Also, if you don't want exceptions then just catch them and ignore them.

Ok, I've changed the functions to use TurboActivate.pas, now I set my calendar to 2013-03-19 and execute the following:

IsGenuine := TurboActivate.IsGenuine(30, 10);Returns: Genuine

FeatureValue := TurboActivate.GetFeatureValue(PWideChar(WideString('vencimento')));Returns: '2013-03-20 20:14:00'

TurboActivate.IsDateValid(FeatureValue, TA_HAS_NOT_EXPIRED)Returns: true

What should I do now? Do I need to check something before calling IsDateValid?

PS: I've tried with 2013-03-18 but IsDateValid still returning true. If I change the data back to 2013-03-10 then IsGenuine returns NotGenuine. The last one makes sense because I've activated the license 2013-03-11.

PS2: I think there is a memory leak in GetFeatureValue, it does not free the pointer allocated if result is successful.

I've discovered that if I restart my computer and change back the clock, IsGenuine returns an error, but if I change first the clock and then restart my computer it does not detect the clock rolled back and IsDateValid returns always true.

Checking dates locally limits your ability for fraud detection (no matter what technique we use). We are improving our date change fraud detection.

If you want to be sure a date is always real then check it with your servers.

Thank you. I suspect that using files or registry are not a solution because the user could rewrite the file to previous state.I have no internet servers but I think that I could use an internet time server.Maybe in the future you could consider this or similar solution in your fraud detection algorithms. Having this functionality integrated in LimeLM is useful especially in times where SAAS model is being used not only in internet but in desktop programs too. In the hospitality segment where I am, 90% of the players in the market are adopting a montly leasing mechanism.

Best Regards,Ernesto