1

I am currently developing a first-person-shooter.

I would like to know if there is a way to generate a GUID that will always return the same value for the same machine, but will be different on another machine.

I need to do this generation to effectively ban troublesome users.

I want it to work on both Microsoft Visual C++ and g++.

Victor
  • 743
  • 1
  • 5
  • 16
  • 2
    Wouldn't that by definition, not be a GUID? – Daryl Nov 01 '11 at 03:42
  • Don't start from assuming GUID is the answer (it's not, and although early implementations encoded unique machine info you might extract, those generation approaches were generally scrapped for privacy reasons). Start a search just on how to uniquely identify a machine: http://stackoverflow.com/questions/7440763/how-can-i-uniquely-identify-a-machine-in-c – HostileFork says dont trust SE Nov 01 '11 at 03:43
  • there's no foolproof way of doing it. you can spoof anything these days.. – JosephH Nov 01 '11 at 03:47
  • @Victor: see http://stackoverflow.com/questions/3636115/uniquely-identify-pc-based-on-software-hardware/3636137#3636137 – tenfour Nov 01 '11 at 10:11
  • I know there is no foolproof way of doing this. But lazy people probably won't know how to spoof it. – Victor Nov 01 '11 at 23:32

4 Answers4

1

I would second the vote on the MAC address, because every MAC address is unique when manufactured, but then you run the issue of spoofing. I recommend you base it on multiple values such as the volume serial number, CPU model/stepping, MAC Address, and the disk manufacturer just as an example. It's up to you, but try to avoid relying on just a single value as that could always change, but then again, the GUID would change if any of your identifying factors changed, so you would need to pick some kind of persistent value between machines. Something like the product key, or product id rather might be a better choice, but im not sure if thats easily accessible if at all.

Marc DiMillo
  • 513
  • 5
  • 17
  • 1
    Quite a few computers have multiple MAC's nowadays: Ethernet, WiFi, Bluetooth, possibly VPN. – MSalters Nov 01 '11 at 09:05
  • Thats actually a great point, but we can't always rely on that. If theres multiple MAC's it also makes it easier to spoof, but if we rely on both MAC's and someone changes their network card, your GUID is invalid. – Marc DiMillo Nov 01 '11 at 19:30
1

You could read the MachineGuid key at the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography registry key.

That would work on Windows, but you'd need an alternate method for other OS's.

Colen
  • 13,428
  • 21
  • 78
  • 107
0

You could use the MAC address.

A way to do it is described here.

Community
  • 1
  • 1
Joshua Clark
  • 1,346
  • 3
  • 14
  • 24
0

There's also the TMID in HKEY_CLASSES_ROOT. Windows only though.

rushman
  • 532
  • 2
  • 8