Click to See Complete Forum and Search --> : Need information about the PC time


valica
January 31st, 2005, 04:20 PM
Hello all,

I need to know if it exists an incremental time available through a Windows API. I want to mean a data that is always incremented each time the PC is booted up. This data mustn't be possible to decrease even if the PC or BIOS time is changed to the past. Surely, I'll use this API to protect a software (something like FlexLm does). I hope that's clearly enough to be able to help me. Anyway, please let me know if more information required.

Kind regards,

Vlad

cilu
January 31st, 2005, 04:38 PM
I don't know anything like that. But you can use a registry key that you can decrement each time. Hoever this key should not be easy to spot or linked to your app. You can create a GUID for that.

valica
February 1st, 2005, 01:21 AM
I don't know anything like that. But you can use a registry key that you can decrement each time. Hoever this key should not be easy to spot or linked to your app. You can create a GUID for that.
Yes, I thought about this buthow to decrement it? I decrement with respect of something. I'll give an exampl: you have just 3 days left until the license expires. When you start the application today you'll know that you have only three days of using before expiration. Then, you quit the software and two days later (you have only one day left) you change the PC (wondows or bios) time and you start again the application. If you use a registry key that you have to decrement I don't have a reference to decrease it with respect of.
Do you have any idea about how to do that?

Kind regards,

Vlad

Kheun
February 1st, 2005, 01:34 AM
How about storing the number of seconds required for 3 days, i.e. 3 * 24 * 60 * 60, in the registry. When your program starts up, it start its counter from 0 sec. When it is terminated, your program has captured the elapsed that it is being run. Then you can update the total available time by substracting with the elapsed time. If the total available becomes zero, your program will not run.

valica
February 2nd, 2005, 01:07 AM
How about storing the number of seconds required for 3 days, i.e. 3 * 24 * 60 * 60, in the registry. When your program starts up, it start its counter from 0 sec. When it is terminated, your program has captured the elapsed that it is being run. Then you can update the total available time by substracting with the elapsed time. If the total available becomes zero, your program will not run.
Indeed, this permits to count the usage time of the application. But usually we have an expiration date that invalidates the application start-up even if the application was used or not.
I need to compare the value stored (and updated) in registry with something else that can't be reversed (as the date). I heard about a counter of the CPU that is always incrementing. Do you know something about such a countero or any other idea?

Regards,

Vlad

Kheun
February 2nd, 2005, 02:05 AM
I don't know if there is any such counter available. If not, you can probably write one yourself. Not sure if this is appropriate, you can write an NT Service that starts up automatically whenever the PC boots up. By periodically, substracting the time as well as monitoring the time and date, you should be unable to detect date change and thus avoid falling for the trick.

kasracer
February 2nd, 2005, 05:06 AM
Instead of using the registry, you should encrypt the data and append it to your executable. That way it's much more difficult to foil the protection scheme because they have to break the encryption and hex edit the binary file where as the registry example is just finding a key and changing it or even deleting it.

HighCommander4
February 3rd, 2005, 12:36 PM
Instead of using the registry, you should encrypt the data and append it to your executable. That way it's much more difficult to foil the protection scheme because they have to break the encryption and hex edit the binary file where as the registry example is just finding a key and changing it or even deleting it.

Just out of curiosity, how do you append something to your exe file?

kasracer
February 3rd, 2005, 08:47 PM
Just out of curiosity, how do you append something to your exe file?
I know it's possible and I've heard of others doing that, however; I do not know how myself