user1571292
user1571292

Reputation: 129

Secure the installation of a software by prompting for a serial number

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

Answers (2)

Martin Prikryl
Martin Prikryl

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.

[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;

enter image description here


For a more advanced implementation, see CustomPage for Serial Number in Inno Setup.

Upvotes: 1

user1571292
user1571292

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

Related Questions