Sign in to follow this  
pDK

Machine ID

Recommended Posts

Quick and easy: What is the best way to derive a Machine ID (aka: System ID , Computer ID)? Looking for some API calls to get a few serial numbers and compile them into a 128bit ID. -Eric [edited for engrish] Also, I am not going to bother with the CPU serial number... becuase only PIII's support that :).

Share this post


Link to post
Share on other sites
MAC addresses are unigue. Assuming the machine has an ethernet card, it has a unigue identification right there. If it has more then one, just pick one. If it doesn't have any, there aren't any other machines to worry about anyway.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That is what I was thinking, but my NIC on my laptop has a programmable one...

I also looked into hard drive serials... but I forgot that API call...

The only other routes I can think of are dongles (which I'm never going to do) and registry/file (which is easy to edit).

I heard of some functions that also use the creation date of a folder (C:\windows or the program's ROOT folder)...

Share this post


Link to post
Share on other sites
Hi

You could use WMI - I think this is standard on w2k and newer windows OSes

VBScript example:

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM CIM_Chassis", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo objitem.SerialNumber
Next

Share this post


Link to post
Share on other sites
WMI... wow.. never heard of that... prob cause I'm not a systems admin :). Let me see if I can whip up a C++ port of that code and see what that brings me...

Looking on the MSDN site, it does not give me the full details as to what serial number this is pulling from. Does this return the individual physical elements' S/Ns (ie: sound cards... hard drives... cd roms... etc)? Or on the system as the whole?

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
That is what I was thinking, but my NIC on my laptop has a programmable one...

I seriously doubt it has a programmable MAC address. The entire point in MAC's is that they're static and unique.

Share this post


Link to post
Share on other sites
Quote:
Original post by Spoonbender
Quote:
Original post by Anonymous Poster
That is what I was thinking, but my NIC on my laptop has a programmable one...

I seriously doubt it has a programmable MAC address. The entire point in MAC's is that they're static and unique.

I don't wanna derail things here... So, quickly: both of the network routers that I've had recently can either clone or simply change their MAC addresses. I was always taught that MAC's were static/unique, but this little quirk always confused me [smile]

Cheers,
Jack

Share this post


Link to post
Share on other sites
You can alter the reported MAC address in software trivially.

Does CPUID include a unique CPU serial number? I can't remember. Hard drive and RAM serial numbers might be accessible too...maybe even mobo.

Share this post


Link to post
Share on other sites
CPUID returns 0 on anything BUT PIII's...

I know there is a function to find a hard drive serial number... but I can not recall it.

I never heard of RAM returning a S/N...

[edited]... looking more into the MAC address spoof.. it was more of a software thing (it edits the registry). So my initial thoughts were wrong :). I do not have access to my project from where I am at... so I can not verify if this "spoofing" will show up in any local MAC lookups.

Here is a program that will change your address for you:

http://students.washington.edu/natetrue/macshift/

Share this post


Link to post
Share on other sites
I have seen quite a few intergrated network cards (like nvidia ones), that you can configure what the mac address is in the cmos. They usually have a default value, but this can be modified. On a friends pc, we were playing what words we can spell using hex for his mac address. I think I came up with DECCAF C0FFEE (and yes decaf is spelled wrong, but hey its funny).

Share this post


Link to post
Share on other sites
Quote:
Original post by Spoonbender
I seriously doubt it has a programmable MAC address. The entire point in MAC's is that they're static and unique.


For instance for realtek cards, see here.
Document "RTL8139D(L) Specification" (Version 1.11) on page 10.
The configuration registers 0 to 5 contain the MAC address, which may be set to any value. The EEPROM of the card contains an identifier which should be unique for every card of that vendor.

Also think of virtual network cards like those that VMWare emulates. They can have any MAC address.



pDK, why do you need to have that Computer ID ?
For some kind of copy protection ?
Why not place a token on that computer, i.e. a hidden file somewhere, or a hidden registry entry.
Or you can copy some bytes of a system file or a hash of that file (e.g. from some standard windows file) to your executable during installation, then check those bytes at runtime. If the application is executed on another computer, those values should be different.

BTW it is not a good idea to use the serial number of the graphics card, ram, harddisk or something like that. Image the user upgrades the hardware, then the software should still run.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this