Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uniquely identify PC based on software/hardware

For a requirement to generate per-PC license keys, I need some code which will return a stable and (near) unique key on any PC. It doesn't have to be guaranteed unique, but close. It does need to be reasonably stable though, so that a given PC always generates the same result unless the hardware is substantially changed.

This is for a Windows application, using wxWidgets but a Win32 or other option is fine.

I was thinking about MAC address but what about laptops which can routinely disable the network card in power-saving mode? I came across GetCurrentHwProfile but it doesn't quite look like what I want?

like image 529
Mr. Boy Avatar asked Sep 03 '10 13:09

Mr. Boy


People also ask

What uniquely identifies you to a computer system?

A unique identifier (UID) is a numeric or alphanumeric string that is associated with a single entity within a given system. UIDs make it possible to address that entity, so that it can be accessed and interacted with.

Is device ID unique for PC?

Each device in Windows has it's own unique identifier known as the Hardware ID. The Device ID is the identifier of the PC itself.

What is the unique ID of laptop?

On a desktop computer, this sticker is usually on the side or back of the computer. Laptop computers often have this sticker on the bottom of the computer. If you still cannot find the product number and your computer came with Microsoft Windows, contact your computer manufacturer to purchase a new number.

How can you identify a computer?

Click Start, right-click Computer, and then click Properties. The computer name appears under Computer name, domain, and workgroup settings.


3 Answers

One idea I had a while back for this is to use CryptProtectData as a way to identify a machine. Behind-the-scenes in that API, Microsoft has done what you're looking for. I never tested it though and I'm curious if it's actually viable.

Basically you would encode a constant magic value with CryptProtectData with CRYPTPROTECT_LOCAL_MACHINE, and the result is your machine ID.

like image 82
tenfour Avatar answered Oct 27 '22 17:10

tenfour


I think there no really easy and unique method so far discovered here.

  1. GetVolumeInformation retrieves not even close to unique ID.....
  2. To use any hardware serial is problematic because manufactures are not committed to supported it always and especially to keep it globally unique
  3. GetCurrentHwProfile retrieves GUID but it's value affected by minor! hardware changes...
  4. Using Product Key ... will bring U to deal with the stolen software - there lot of pirate installations over the globe.
  5. Creation of own GUID and preserving it under registry (in any place) will not prevent duplication by cloning of image ....
    etc... From my perspective of view the best way is combine: Volume ID + MAC's list + Machine SID + Machine Name. And obviously manage license policy on the server side ;0)

Regards Mickel.

like image 43
Mickel Avatar answered Oct 27 '22 17:10

Mickel


For a pretty brain dead test I am using the ProductID code of the OS and the computer name - both extracted from the registry. Not really secure, but its all pretend security anyway.

edit

To answer John's question about what keys I am reading:

SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductID

SYSTEM\CurrentControlset\Control\ComputerName\ComputerName\ComputerName

like image 26
Peter M Avatar answered Oct 27 '22 17:10

Peter M