Banning Licenses

<< Click to Display Table of Contents >>

Navigation:  WinLicense > Licensing with WinLicense >

Banning Licenses

Sometimes it's necessary to set a license as stolen, leaked, etc. so you can disable that license from being used in your current or new versions of your application.

 

Disabling licenses before protection

 

With WinLicense it's easy to disable a license for a new protected version of your application. Basically, you set the licenses to disable before the protection stage, in your project settings. The protected application won't accept those licenses and will generate the event MSG_ID_LICENSE_STOLEN (Customized Dialogs panel) in runtime.

 

Before protecting your application, you can disable specific licenses from the Advanced Options panel in WinLicense:

 

For common File/Registry licenses:

 

Insert an entry in the Advanced Options panel with the number of licenses that you want to ban. Example:

 

OPTION_STOLEN_LICENSES_NUMBER_NAMED_LICENSES=2

 

For each license that you want to ban, insert 3 entries in the Advanced Options panel with the User/Company/Custom Data of the license to ban. Example:

 

OPTION_STOLEN_LICENSES_USER_NAME_AT_0=Alexander

OPTION_STOLEN_LICENSES_COMPANY_NAME_AT_0=ax1@alex.co.com

OPTION_STOLEN_LICENSES_CUSTOM_DATA_AT_0=Alex's custom data

 

OPTION_STOLEN_LICENSES_USER_NAME_AT_1=Manuel Sanchez

OPTION_STOLEN_LICENSES_COMPANY_NAME_AT_1=msanchez@msanch.co.com

OPTION_STOLEN_LICENSES_CUSTOM_DATA_AT_1=Another custom Data\nNew Line

 

For SmartKeys:

 

Insert an entry in the Advanced Options panel with the number of licenses that you want to ban. Example:

 

OPTION_STOLEN_LICENSES_NUMBER_SMARTKEY_LICENSES=2

 

For each license that you want to ban, insert 4 entries in the Advanced Options panel with the User/Company/Custom Data of the license to ban. Example:

 

OPTION_STOLEN_LICENSES_USER_NAME_AT_0=Alexander

OPTION_STOLEN_LICENSES_COMPANY_NAME_AT_0=ax1@alex.co.com

OPTION_STOLEN_LICENSES_CUSTOM_DATA_AT_0=Alex's custom data

OPTION_STOLEN_LICENSES_SMARTKEY_AT_0=AABB-1821-A45B-81C4-........

 

OPTION_STOLEN_LICENSES_USER_NAME_AT_1=Manuel Sanchez

OPTION_STOLEN_LICENSES_COMPANY_NAME_AT_1=msanchez@msanch.co.com

OPTION_STOLEN_LICENSES_CUSTOM_DATA_AT_1=Another custom Data\nNew Line

OPTION_STOLEN_LICENSES_SMARTKEY_AT_1=1829-8D1A-45C3........

 

In case that you are using the Custom Data with several lines, you have to can put "\n" to specify a new line.

 

The above process can be quite time consuming if you are going to insert multiple licenses to be set as banned/stolen. You can create an external configuration file with the above entries, so you can auto generate the external configuration file with a simple application. If you are going to use an external configuration file, you have to insert an entry in the Advanced Options panel to point to the location of your configuration file. Example:

 

OPTION_ADVANCED_EXTERNAL_PROJECT_OPTIONS=Path\YourConfigurationFile.txt

 

Notice that you can use the special path constants to work with relative paths.

 

There is a special advanced option in case that you want to ignore the custom data field from the license that you want to ban. For example, you deliver several licenses to a specific customer with different Custom Data information. Now you decide to ban that customer but you don't want to create multiple entries for each specific Custom Data that you generated for that specific customer, just create a single entry for that customer. To achieve that, just insert the following entry in the Advanced Options panel:

 

OPTION_STOLEN_LICENSES_IGNORE_CUSTOM_DATA=YES

 

Now you just set the license user name and company name to ban, without inserting an entry for the custom data information. Example:

 

OPTION_STOLEN_LICENSES_USER_NAME_AT_0=Alexander

OPTION_STOLEN_LICENSES_COMPANY_NAME_AT_0=ax1@alex.co.com

 

OPTION_STOLEN_LICENSES_USER_NAME_AT_1=Manuel Sanchez

OPTION_STOLEN_LICENSES_COMPANY_NAME_AT_1=msanchez@msanch.co.com

 

NOTE: In case that you use an external configuration file, you have to save it as Unicode (UTF-16). For example, in Windows Notepad save with encoding "UNICODE".

 

Disabling a license in runtime

 

You can also disable a license in runtime in the current protected application. In order to achieve this, you have to call the WinLicense SDK from your protected application. The function WLRegDisableCurrentKey will disable the current license from being used in your current application (and also in your new protected versions of your application where you keep the same "License Hash")

 

There are some cases, where the function WLRegDisableCurrentKey might be too strict for your specific scenario. Suppose that you want to ban a license for a specific customer but only for the current version of your application, but you want that the license can still be used in older or newer versions of your application. In that case, you should call instead the function WLRegDisableKeyCurrentInstance to achieve that goal.