0

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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
user1571292
  • 129
  • 1
  • 9

2 Answers2

1

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.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
0

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");
user1571292
  • 129
  • 1
  • 9