Reputation: 129
I am working on a project (Java project) and using Inno Setup 5 to create an installer. How can I secure the use of the install.exe and ask a serial number during the installation?
Thanks for the help.
Upvotes: 0
Views: 995
Reputation: 202474
Inno Setup has a built-in functionality prompting for a serial number on the optional "User Information" page and verifying the entered number.
UserInfoPage
directive to yes
;CheckSerial
event function to make the Inno Setup prompt the user for the serial number and to verify it;{userinfoserial}
constant in the [Registry]
section to save the entered and verified number to registry.[Setup]
UserInfoPage=yes
[Registry]
Root: HKLM; Subkey: "Software\My Company"; ValueType: string; ValueName: "SerialNumber"; \
ValueData: "{userinfoserial}"
[Code]
function CheckSerial(Serial: String): Boolean;
begin
Result := (Serial = '123');
end;
For a more advanced implementation, see CustomPage for Serial Number in Inno Setup.
Upvotes: 1
Reputation: 129
I works. I recommand to add in the InnoSetup script :
Flags: uninsdeletekey
When the program is uninstalled, delete the entire key.
[Registry]
Root: HKLM; Subkey: "Software\MySoft"; ValueType: string; ValueName: "AppInfo"; ValueData: "value" ; Flags: uninsdeletekey
I used this link to recover the key in my soft.
value = WinRegistry.readString (
WinRegistry.HKEY_LOCAL_MACHINE,
"SOFTWARE\\MySoft",
"AppInfo");
Upvotes: 0