What is the best way to generate a unique hardware ID on Microsoft Windows with C++ that is not easily spoofable (with for example changing the MAC Address)?
+6
A:
Windows stores a unique Guid per machine in the registry at:
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\MachineGuid
AgileJon
2009-05-26 13:24:08
You could use this with the name of your program as the key to an HMAC hash function in CAPI.
Jeff Moser
2009-05-26 13:28:59
Is that standard on ALL Versions of Windows? What about Mobile Windows?
JoshBerke
2009-05-26 13:35:30
The question would be "how easy is that to spoof...?"
jesup
2009-05-26 14:04:13
Hint for all 64-bit users: Pass KEY_WOW64_64KEY as samDesired to RegOpenKeyEx(), since Windows only creates a 64-bit key which is mapped into an own key.
Patrick Daryll Glandien
2009-05-26 16:03:07
I am not sure that this MachineGuid is *really* hardware driven. For example, if I reformat the hard disk and install a new copy of windows, will this id remain same?
Hemant
2009-06-22 05:35:38
I'm really not sure what the MachineGuid is based on. If it's truly a Guid then it may just be generated at install time (ie: it may stay the same)... rather than something like a hash of your hardware S/Ns.
AgileJon
2009-06-22 11:01:02
A:
There are various IDs assigned to hardware that can be read and combined to form a machine key. For example, you could get the ID of the hard drive where the software is stored, the proc ID, etc. Some of these can be set more easily than others, but part of the strength is in combining multiple pieces together that are not necessarily strong enough by themselves.
GalacticCowboy
2009-05-26 14:26:40