Implementing Serial Number Validation at Run Time

InstallShield 2012 Spring Express Edition

As part of your installation, you can require end users to enter a valid serial number. You can do this through a custom action .dll file and the Customer Information run-time dialog.

To implement serial number validation for your product:

1. In the View List under Customize the Setup Appearance, click Dialogs.
2. In the Dialogs explorer, click Customer Information.
3. Set the value of the Show Serial Number field to Yes.
4. In the Serial Number Template field, specify the format for your product's serial number. For example, type the following:

??????-####-??????????

Note the following guidelines for this field:

Type a question mark (?) to represent each alphanumeric character.
Type a number sign (#) to represent each number.
Type a dash (-) between each group of characters. The dash indicates a break in the serial number, where one group of characters ends and another begins.
5. In the Serial Number Validation DLL field, enter the location of the .dll file that you use for serial number validation. Alternately, click the browse (...) button to locate the .dll file.

Tip: Sample code for a serial number validation .dll file is available in the InstallShield Program Files Folder\Samples\WindowsInstaller\ValidateSerialNumber directory. For more information, see Using a Custom Action for Serial Number Validation.

6. In the Validate Function field, enter the name of the .dll file function that performs the validation.
7. Set the Success Return Value field to a number other than 0.
8. In the Retry Limit field, specify the number of times that you want to allow an end user to attempt to enter the serial number.
9. Configure the Show All Users Option field as appropriate.

When an end user enters a serial number in the Customer Information dialog, it is passed to your .dll file for verification. If the serial number is successfully verified, the installation can continue. If the serial number is invalid, the installation will end, depending on how many retries you allow in the Retry Limit field.

Note: InstallShield sequences the serial number .dll file custom action after any user-defined custom actions. Thus, if you add your own custom action and schedule it after the Customer Information dialog, the installation launches this custom action before the serial number .dll file custom action.

See Also