What are the different ways to lock a license to a specific device?

<< Click to Display Table of Contents >>

Navigation:  WinLicense > FAQ > Hardware Lock >

What are the different ways to lock a license to a specific device?

WinLicense has 3 ways to lock a license to a specific machine ID:

 

PC Hardware: You have to set this option in the Hardware Lock panel. After that, you can retrieve the PC Hardware ID by calling the function WLHardwareGetId. Once that you have the hardware ID, just add it to the license when you generate it.

 

USB drive: You have to set this option in the Hardware Lock panel. Now you have to get the ID of the specific USB drive that your customer wants to use to lock the license to it. As the user might have several USB drives connected to his machine, you should display the ID of all different USB drives that are found on his machine.

 

You have iterate over all USB drives and display their names and IDs, so the customer can recognize the specific USB drive that he plans to use for hardware locking. To accomplish that, WinLicense offers 3 functions WLHardwareGetNumberUsbDrives, WLHardwareGetUsbNameAt, WLHardwareGetUsbIdAt.

 

The following C code shows how you can use the above 3 functions in order to display the ID of all found USB drives on a system:

 

  int number_usb_drives = WLHardwareGetNumberUsbDrives();

 

  for (int i = 0; i < number_usb_drives; i++)

   {

      char usb_name[256];

      char usb_id[256];

 

      WLHardwareGetUsbNameAt(i, usb_name);

      WLHardwareGetUsbIdAt(i, usb_id);

 

      printf('%s: %s', usb_name, usb_id);

   }

 

The above code will output something like:

 

SandDisk Cruzer Edge USB Device = 4A32-8016-A611-43A1-9644-AAA4-7CB1-F22B

Thosiba USB Device = 5A32-E835-B14C-2E5A-B6FA-B21C-6A12-A31C

 

Now the user will recognize which USB he will use for hardware locking and he will send you the specific USB ID. After that, you create a license locked to that specific ID

 

Custom ID: You can compute your own hardware ID and put in a WinLicense license via the Plugins Manager, specifically, using the callback SecureEngineProcessHardwareId