Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is one way to make it really difficult for them to use it after expiry. The main theme of this trick is to make your expiration date independent of system time and make it depend on hours passed, irrespective of whatever the system time may be. </p> <p>you will have to create a separate thread to perform this task.</p> <p>Suppose you want the application to expire after they use it 70 hours. </p> <p>Create a binary file called "record", and store any number in it, which should be hard to guess (I will tell you latter why you have to put this number in binary file).</p> <p>When your application starts, it checks if that number is present there if yes, your application should get the current time, and store it in that file along with hour=1 (replacing the already present number), and the thread you created should keep on checking if hour in system time has changed or not, when it changes store current time in that file along with hour=2. A time will come when hour=70.</p> <p>Add this code at two places inside that thread and on the start of your applicaiton </p> <pre><code>/*the purpose of storing current time is to find out later if hour has changed or not*/ /*read hour from file.*/ if(hour==70) { cout&lt;&lt;"Your trial period has expired"&lt;&lt;endl; return EXIT_SUCESS; } </code></pre> <p>now when ever hour=70 application will not work.</p> <p>Earlier I told you to keep any number in your binary file, when ever they will run your application, binary file will be read and if that number is found there your application will replace it with current time and hour=1, now suppose they use your application for 5 hours and close it and run it after some time, now when your application will be run it will check that binary file if that number has been replaced with time stored previously and hour=5 it means now you will have to store current time along with hour=stored hour in file +1; . In this even if they change time or do anything else it will not effect your expiration period. Because now your expiration checking is not based on system time any more, it is now based on hours passed, irrespective whatever the time may be. </p> <p>The absence of that number indicates file is not being accessed for first time and currently present hour in file should be incremented, and use binary file so that client can't see that number. </p> <p>One last thing Your binary file's format should be like this</p> <pre><code>current time, hour="any number", another_secret_number </code></pre> <p>another_secret_number will be placed so that even if they any how change your binary they will not be able to put that another_secret_number there because they don't know it. It means while reading your binary file you will have to make sure that, the end of any entry in your binary file contains "another_secret_number" at end.</p> <p>For checking purposes both hidden numbers will also be hard coded in your code, which surely they can't see, and they can't read the binary also, so there is no way they can know them.</p> <p>I hope it will help you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload