How to check current time for demonstration product

  • Thread starter Thread starter Mark Ingram
  • Start date Start date
M

Mark Ingram

Hi, I'd like to know the best way of checking the current time during a
demonstration product. At the minute i store the first run date, then
compare that to the system time, but obviously a user can just change
their clock back a month and continue using the product.

I heard it is best to check the access time on a system dll? I had a
quick look at the user32.dll file and realised the access time was the
time my machine booted up, but when i check in .net (via
File.GetLastAccessedTime or FileInfo.LastAccessedTime) it is different
to the time windows displays in the properties sheet.

So does anyone have any suggestions?

(BTW: This isn't meant as fool-proof hacker protection, it's just to
deter the most basic attempts at getting around the demonstration period)

Cheers,
 
Hi, I'd like to know the best way of checking the current time during a
demonstration product. At the minute i store the first run date, then
compare that to the system time, but obviously a user can just change
their clock back a month and continue using the product.

I heard it is best to check the access time on a system dll? I had a
quick look at the user32.dll file and realised the access time was the
time my machine booted up, but when i check in .net (via
File.GetLastAccessedTime or FileInfo.LastAccessedTime) it is different
to the time windows displays in the properties sheet.

So does anyone have any suggestions?

(BTW: This isn't meant as fool-proof hacker protection, it's just to
deter the most basic attempts at getting around the demonstration period)

Check the 'created' or 'last modified' date on your executable, and compare
this with the current timestamp.
changing the current time back and forth gets very annoying, so it is
unlikely that users will do it continuously. you have to be admin as well to
do that.

Or store the first run date in the registry, possibly encrypted. hide it
amongs a dozen similar reg keys, and make it so your program stops working if
not all of the kyes are there. your installer then has to create those keys
during installation.

But there is NO fool proof to do this. Using FileMon or ProcessMonitor will
quickly show what your app is doing to protect itself.
And a user could always re-install the demo app.
 
Bruno said:
But there is NO fool proof to do this. Using FileMon or ProcessMonitor will
quickly show what your app is doing to protect itself.
And a user could always re-install the demo app.

Hi, thanks for the prompt reply. One of our requirements is that the
application can be run without an installer and the demo should start
from the first run (not the install date).

Currently I write the demo period and the start time out to a file, read
that in and compare against the current date / time.

I didn't realise you needed to be an admin to change the date / time though

Cheers,
 
Mark Ingram said:
Hi, thanks for the prompt reply. One of our requirements is that the
application can be run without an installer and the demo should start from
the first run (not the install date).

Currently I write the demo period and the start time out to a file, read
that in and compare against the current date / time.

You can also store the most recent run date along with the first run date,
and check for time going backwards. If you catch time going backwards,
refuse to run unless you can access a reliable (i.e. cryptographically
signed) network time source.
 
Back
Top