I want to make a c++ install deployed windows application that would check hardware fingerprint (to verify that the user will use the application only on his computer). After some net research I decided that WMI is my tool. I started with a simple MFC application and for start I wanted to print out the MotherBoard SerialNumber. And just at this point the whole thing crashed. I checked on XP and Win7 and this property is not returned. And this got me thinking - what if there are some classes/properties that won't work on certain windows versions? Or some hardware configurations? I sincerely don't like that. My instant idea for the fingerprint was the MAC address (my application is strictly network driven so if the machine does not have a net connection it is no use at all). However, some machines can have several MAC devices. And some of MACs may be a virtual one's that can vanish from the system after uninstalling (i.e. VPN client). I think that MAC address can be easily changed but if I hashcode the number the user may not figure out that use it. So I ask for your advice - is WMI a good tool for Hardware fingerprint? If it is - which classes/properties would you suggest to use? They should work on all machines and systems and also be safe/unchangeable at the same time (ok we cannot do much if the user changes the whole hardware..) If WMI is not a good solution, than what other C++ framework would you suggest? And following - which HD properties to use then.
Asked
Active
Viewed 2,768 times
2
-
1possible duplicate of [Generating a Hardware-ID on Windows](http://stackoverflow.com/questions/910619/generating-a-hardware-id-on-windows) – David Webb Dec 12 '11 at 14:22
-
Save your self an ongoing maintenance and support nightmare and use hardware dongle. – Tony Hopkinson Dec 12 '11 at 14:33
2 Answers
5
Yes, the WMI is a very good option to do this task, the key is choose the right classes and properties to use or even better you can access the SMBIOS tables to get information about the system and generate a unique identifier. some time ago I blogged about both subjects, the code is in delphi but can be easily translatable to C++
-
Thanks RRUZ. Choosing the right components is in fact crucial. But In your post you also use MotherBoard properties and SerialNumber is among them. This doesn't work for me, as posted above (and the documentation is silent about this kind of issues). Here is also a good topic about it that I have now found: http://stackoverflow.com/questions/8072414/best-way-to-generate-a-machine-fingerprint – srd.pl Dec 12 '11 at 14:51
-
If you uses the SMBIOS you can retrieve this info (the motherboard SerialNumber) without problems (because is read directly from the BIOS Hardware), Also use a mix of properties and classes not just one, example Processor info + BIOS info (version, release date, model) + motherboard info. – RRUZ Dec 12 '11 at 15:21
-
I will definitely need more than 1 property as I now see that lots of them provide different results depending on the platform (and I am only testing 3 computer: 1 win7 and 2 winXP). Even the Bios serial number is not always displayed. So I now know that I won't be able to come up with one single parameter. I think I will now take another look to the SMBIOS from your post as it may provide more stable results. Thanks again RRUZ. I any one has other suggestion please post. – srd.pl Dec 12 '11 at 19:06
-1
From my experience, No. WMI seems to be slow and sometime inaccurate. It would be better to use lower level methods and to query the hardware directly using Win32 API.

Michael Haephrati
- 3,660
- 1
- 33
- 56
-
2Michael, your answer might be more helpful if you could provide some more concrete examples of which Win32 functions you used, and which hardware properties you queried. As for the fact the WMI is typically slow - that shouldn't be a problem for the occasional fingerprinting routing.. Don't you think? – Mike Dinescu Sep 28 '12 at 16:01