<< Click to Display Table of Contents >> Navigation: WinLicense > Protecting an application > Hardware Lock |
The Hardware Lock panel is designed to prevent the use of a single registration key with different computers. Even if a registration key is leaked or stolen, that key will not work on other computers. In this panel you can select the different parameters that WinLicense will use to lock machine dependent keys to a computer.
NOTE: To get the Machine ID of your customers, you will have to send them a special application that retrieves their Hardware ID. This Machine ID will be set in a specific field (HardwareId field) in the generated license key. You could also customized all this processing by making a special server that communicates with your application in order to retrieve your customer's Machine ID transparently. The function WLHardwareGetId allows you to retrieve the current hardware ID in a specific machine.
PC Hardware
The Machine ID for a specific computer can be taken from several hardware items. WinLicense allows you to select which hardware items will be included to create the final Machine ID for a specific computer. The following hardware items can be included to create the final Machine ID for a specific computer:
•CPU: This option uses the CPU features for the current computer. Note that the CPU features are the same for all computers with the same CPU. It is not a good idea to use only this option to generate the final Machine ID.
•BIOS: This option uses the BIOS serial number for the current computer.
•MAC Address: This option uses the MAC address for the current computer. MAC address should be unique among computers. Be careful including this option if your customers usually change their network cards.
•HDD Serial: This option uses the primary hard drive serial number for the current computer.
When a machine dependent license key is going to be registered in the system, the Machine ID in the license key must match the current Machine ID. Once the license is validated and registered, hardware changes will be possible. To allow your customers to change their hardware components, you can select how many hardware changes are allowed for each hardware item. Each time a user replaces a hardware item, its internal counter is decreased by one. When one of these counters reach zero and a new hardware change happens, WinLicense will display the Customized Dialog MSG_ID_LICENSE_NO_MORE_HW_CHANGES to indicate that no more hardware changes are allowed.
Hardware Lock Engine
The option Hardware Lock Engine allows you to select a different version of the code that retrieves the PC Hardware ID. In order to keep compatibility with previous WinLicense versions (version <= 2.x) you should select "VERSION_1_0". If you are protecting a new application that you have not generated locked licenses for it yet, you might want to select "VERSION_2_0". Notice that hardware ID retrieved with VERSION_1_0 is different from the one obtained with VERSION_2_0.
USB Hardware
WinLicense can also lock licenses to a specific USB drive. When a license is locked to a USB drive, WinLicense requires that the USB drive is present when the protected application is launched. If the customer wants to move to a new or different computer, he just needs to plug the USB drive into the new computer. In order to lock a license to a USB drive, you first need to get the USB drive ID from your customer's PC. These are the basic steps to accomplish this task:
1.From within your application, call the function WLHardwareGetNumberUsbDrives to get the number of available USB drives connected to a computer
2.Collect all the USB drives names and IDs and display them to your customer. Call WLHardwareGetIdAt and WLHardwareGetNameAt to retrieve the name and ID of a specific USB drive
3.From the list that you display to your customer, your customer can recognize (by the USB drive name) the specific USB drive that he wants to use for the hardware locking. He sends you the USB drive ID and you generate a license by filling the "Hardware ID" field with the given USB ID
The option Get any USB device will scan for not only USB drives, but any USB device connected to the computer. Notice that not all USB devices contain a serial number or the serial number could be the same for different USB devices.
The option Detect Unplug periodically checks (about once each 30 seconds) if the USB drive is connected. If it's disconnected, WinLicense will signal the event (message) MSG_ID_USB_LOCKING_UNPLUGGED (from the Customized Dialogs panel).
NOTE: Some old/cheap USB drives do not have an embedded serial number on it. In that case WinLicense will report the ID "0000-0000-0000-0000-0000-0000-0000-FFFF" for those USB drives. You should not lock any license to that hardware ID ("0000-0000-0000-0000-0000-0000-0000-FFFF")