- NSIS Discussion
- Any way to specify the lifetime of the installer
Archive: Any way to specify the lifetime of the installer
cybereka
20th March 2003 05:50 UTC
Any way to specify the lifetime of the installer
Hai all,
I am using NSIS to create the installer for my code. I am trying to make something like trial version. Is there any way to keep track of installation date and checking for expire date and to close the application once it reaches the expiry date. Can someone guid me..........please.
Many Thanks......
With Thanks.
deguix
20th March 2003 08:08 UTC
Current Date and Time Convertion to Seconds and Vice-Versa should do the trick (but is not to easy!). NSISdt dll required to work.
Use the first in your installation folder (DatetoSeconds Function), and save it to somewhere. To calculate if are passed 30 days:
Read the seconds that you're saved before
IntOp $0 $1 - $2 ;$1=the number detected now, $2=the number detected at first time.
IntCmp $0 2592000 0 End
The code
End:
An example:
;detect the current date&time in seconds - $1 = current time in seconds
ReadINIDWORD$2 HKLM "Software\Program Name" "30days"
>IntOp $0 $1 - $2
IntCmp$0 2592000 0 End
MessageBox MB_OK "The time to use this program is expired!"
>End:
cybereka
20th March 2003 11:53 UTC
But i couldn't open the page Current Date and Time Convertion to Seconds and Vice-Versa. So how can i take the date from nsis script is there any function available for that or i should do that with the help of someother code.
viper0179
20th March 2003 13:58 UTC
Whatever you do I wouldn't suggest putting the registry value inside of your program's key. That's the first place someone would look to bypass your trial period. Also, I would make a change in your program to ensure that if the key isn't there and your program hasn't been registered to quit your program immediately. Otherwise people would just delete the key to keep using it.
viper0179
20th March 2003 14:04 UTC
Here's the first part of the example.
viper0179
20th March 2003 14:05 UTC
And... here's the 2nd part.
viper0179
20th March 2003 14:07 UTC
Bah, it didn't let me attach it. Let's try that again.
deguix
21st March 2003 07:58 UTC
Originally posted by cybereka
But i couldn't open the page Current Date and Time Convertion to Seconds and Vice-Versa. So how can i take the date from nsis script is there any function available for that or i should do that with the help of someother code.
Use the link in my signature now.
Originally posted by viper0179
Whatever you do I wouldn't suggest putting the registry value inside of your program's key. That's the first place someone would look to bypass your trial period. Also, I would make a change in your program to ensure that if the key isn't there and your program hasn't been registered to quit your program immediately. Otherwise people would just delete the key to keep using it.
Is only a example, the registry is a grand explicity way to read from external of the program. The more safest way is to write in a file (not a INI file).
I've fixed the code that I posted:
;detect the current date&time in seconds - $1 = current time in seconds
>;Read the old time from somewhere - $2 = old time in seconds
IntOp$0 $1 - $2
IntCmp$0 2592000 0 0 End
MessageBox MB_OK "The time to use this program is expired!"
>;use a definitive code to disable the use of the program forever
End:
You can detect if the user changed the time to before the installation time and execute the program to get additional time (after the IntOp of the code above):
IntCmp$0 0 0 End 0
MessageBox MB_OK "You cannot use anymore this program!"
>;use a definitive code to disable the use of the program forever
End:
Ever use a definitive code to disable the code when is detected that passed the 30-days and this above. Because if the user change the time to between 30-days after expiring, don't run the installation again!
[EDIT]The file "part 1" is Current Date to Seconds function, "part 2" is Seconds to Date function.[/EDIT]
kichik
21st March 2003 11:46 UTC
deguix, the two last links in your signature don't work.
Almost all of your pages are so large that for some reason they are truncated. Could you please trim them down a bit so everything will show until we figure out what's wrong and how to fix it?
deguix
22nd March 2003 18:13 UTC
Fixed... one thing that I did wrong is deleting accidentally the basic example of the Current Time & Date Convertion To Seconds and Vice-Versa page! (And I don't have it in my computer because the hard disk is ever full, so I'd deleted!)
Joel
22nd March 2003 20:54 UTC
good arhives deguix :up: . They simplify many task
deguix
22nd March 2003 21:12 UTC
And more one: Advanced Search in String!
Joel
22nd March 2003 21:19 UTC
wao !
Think about this: Nsis as another Language app to create Win32 app,
and not only to create Installers.
Nsis has many instructions to do that...
Cool idea, doesn't? :up:
deguix
22nd March 2003 21:23 UTC
I agree! I made two or three programs with NSIS! A great utility, isn't it?
Joel
22nd March 2003 21:26 UTC
yeah, and no need Runtime :D! What kind of apps did you make? I'm make an app to insert in
every folder the instruction to call the command prompt(MS-DOS box)
and begin from that folder.
deguix
22nd March 2003 21:34 UTC
An editor that can edit players, tribes, AIs, and other little things for a estrategy game called Civ Evolution (you can see this at forums, the editor is called Registry Changer 2). A terrain changer (that isn't published). And a files updater from the game site files page (that isn't published).