Unique ID on Windows (all 32-bit versions)

Posted on 2006-05-04
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
    LVL 7

    Accepted Solution

    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.

    LVL 7

    Expert Comment

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

    Assisted Solution

    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.
    LVL 7

    Expert Comment

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

    Assisted Solution

    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. :)
    LVL 7

    Expert Comment

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    countEvens challenge 2 46
    fizzArray2 challenge 1 40
    Batch file output 20 71
    How to split this in C++ 4 46
    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    A short article about a problem I had getting the GPS LocationListener working.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now