How can I lock a license to my customer's USB pendrive?

<< Click to Display Table of Contents >>

Navigation:  WinLicense > FAQ > Hardware Lock >

How can I lock a license to my customer's USB pendrive?

In order to lock a license to a USB drive, please, follow the next steps:

 

1) In the Hardware Lock panel, check the option "Activate USB (drives)"

 

2) Protect your application

 

3) Retrieve the USB hardware ID of your customer's pendrive. To do so, you can create a separate tool to retrieve the USB IDs or adding that functionality somewhere in your application.

 

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 his USB pendrive from the list and he will send you the specific ID.

 

4) After receiving the USB ID from your customer, just create a license locked to that specific ID and send the license to your customer.