Updater License Check

License check

You can set up the updater to check the license of the user trying to call the auto-update function. For this you must do three things:

  1. Develop a script that does the license validation and host it on your server.
  2. Open the updates configuration project and add the URL of your validation script in "Advanced" page after checking the Verify license before applying updates option. At run-time you can overwrite the validation script URL using the -licensecheckurl command line switch.
  3. When you check for updates (using the /checknow or /silent options) specify the license ID directly in command line using -licenseid command line switch.

The command could be something like: "updater.exe /silent -licenseid abcdef".

The updater will do a POST with a string in the following format:

licenseid=%s&languageid=%u

The %s value represents the license ID (i.e. "abcdef") passed through command line and the %u an unsigned value representing the language identifier of the user's Windows operating system. The language identifier is useful if you want the script to return a localized message.

The script must give an answer, so the updater can choose the following course of action. The answer must be in the form:

AnswerCode\nMessage

"Message" is an explanatory message, "\n" is the new line character and "AnswerCode" can be one of:

  • 601 - License is OK. The updater will go on and download the updates.
  • 602 - License is not valid, but the update can be downloaded. The updater will display the message and download the updates.
  • 603 - License is not valid and the update is not to be downloaded. The updater will display the message and stop.

Note If your license ID is written into a registry value on local machine, then you can replace the -licenseid switch with the path of your registry value containing the license.

For instance, you can use a command line like "updater.exe /silent HKLM\Software\MyEditor\LicenseValue". The Updater will search for and get the license from the specified registry value. The registry value can be usually of string (REG_SZ) type. Any other type (REG_DWORD, REG_BINARY etc.) will be converted to a hexadecimal string.

License expiration check

A user may have a license that is valid for the product version installed on his machine but not valid for the newer versions. The updater can check this and show a message to warn the user. After this, the user can decide whether to continue the installation of the update. For this:

  1. Add two parameters for -licenseid command line switch:
    1. the first is the license ID as explained above
    2. the second is the license expiration date, in the form DD/MM/YYYY, where DD = the day, MM = the month and YYYY = the year.
  2. Set the Updates Release Date in your updates configuration project.

If the expiration date is prior to the release date then a warning is displayed.

NoteThese parameters must be specified last in the updater's command line.

A valid command could be something like: "updater.exe /checknow -licenseid abcdef 01/01/2014".