Click here to Skip to main content
16,015,900 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Do not speak English well. I try to write as much as possible.

I ask for a way to manage system time or program time with certainty.

I am creating a specific program evaluation version.

I created a class library to generate a license file and check the license expiration time. And I am comparing the current time with the license expiration time in a specific module through the class library.


License validation can be controlled using the current time and license time using Datetime.Compare. However, if an arbitrary user intentionally adjusts the system time, the program can be used indefinitely. This is because if you keep only the middle time (?) Between the license expiration time and the current time, you can continue to use it.

What I have tried:

This is the idea I tried to try.

1. I can not compare time with time.windows.com because it is not a network environment.

2. Environment.TickCount has a time limit of 24.9 days.

3. Microsoft.Win32.SystemEvents.TimeChanged Assuming you use it, you do not know if the time has changed in advance before you start the program.

4. I considered how to use Microsoft.Win32.SystemEvents.TimeChanged together with the license file access time. However, unlimited use is possible. Because you can set it to the middle time.

5. I also considered the registry count.
The disadvantage is that if you continue to run arbitrarily, you will not be able to run it sometime.
Posted
Updated 12-Mar-19 21:23pm

1 solution

If you have no access to external time sources, then you can't limit to a date as you are solely dependant on the system clock, which the user can change at will.

There is no way round that.

You could say "this date, or N hours of use" and keep a record of how much they have used so far. But ... that can be got round as well, particularly if they run your app in a VM and reset the VM each time.

Basically, restricting an app to a "trial version" without internet access is never going to be infallible, and there is a very good chance of you putting in more effort than you would save in lost sales if you work on it too hard ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900