Unique ID on Windows (all 32-bit versions)

Posted on 2006-05-04
Medium Priority
Last Modified: 2011-02-21
I'm looking for a way to retrieve a unique ID (truly unique) from any Windows version (98 through XP).

Any help would be appreciated.  FYI...I've used unique id's from hardware before, but if we put the app on 2 PCs with the same hard-drive (from the same manufacturer), the IDs are sometimes the same...which would obviously be a problem.
Question by:jsopher
  • 4

Accepted Solution

wnross earned 272 total points
ID: 16608439
Well, it depends on how picky you want to get
HD ~ relatively unique
Network MAC address ~ unique, but changeable
Proceesor ID ~ unique, but usually turned off in most systems and you need a P4 or greater to have one.  AMD Does not have a processor id

So take the Microsoft activation approach and hash together all three.
HD + MAC + (PROC ID Exists ? PROCID : 0) to come up with a uniqe value.

The only issue is if the hardware changes what do you want to do: Force the user to reauthorize? Ignore the change?

Still, for a simple "deter the honest guy", this would be sufficient.


Expert Comment

ID: 16608445
Oh, you could look at Host SID, but they are only avaliable on Windows NT and Higher, not 95/98/Me

Assisted Solution

Prambo earned 264 total points
ID: 16608636
The only function that you would need to call if you want to do this programatically is  the Win32 CoCreateGuid() call. Used for creation of globally unique 128-bit integers, usually for COM implementations but works fine with anything.

If you don't want to do this programmatically you can use the uuidgen tool provided by Microsoft. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/generating_interface_uuids.asp
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 16608799
That would get you a unique ID, but *not* one associated to a machine.
LVL 25

Assisted Solution

SStory earned 264 total points
ID: 16608868
I beg to differ...

GUID's are unique to a machine... Just you'd have no idea knowing which machine.  They do give you a UNIQUE ID, that even the machine can't produce again by calling the same method.  CoCreateGUID uses date and time stamps, NIC card and other things to come up with a unique number.

IF it wasn't unique COM would be failing all of the time.  Worse than ever. :)

Expert Comment

ID: 16608908
Thats exactly what I said: You now have a unique value not assosciated to any machine.  jsopher needs to *retrieve* a unique value from any
given windows instance (unless I misread the question).  I'm very aware of the relative uniqueness of UUID generation.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Loops Section Overview

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question