Is there any way to get MachineGuid using win32 API call (not reading it maually from registry)?
Asked
Active
Viewed 3,099 times
3
-
There's a registry entry for this under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid you can read the registry using the Windows API. Look at this other post about [Reading from Registry](http://stackoverflow.com/questions/34065/how-to-read-a-value-from-the-windows-registry) – Simon Bosley Feb 25 '14 at 12:07
-
The question was if there is an API call to get its value directly (because you cant be sure if that Registry Key existed on Windows XP SP1 and still exists on current Windows 8.1 and future ms products, can you?) – DuckQueen Feb 25 '14 at 12:46
-
It's stored in the registry, so any other API would need to get it from there as well (stored during Windows setup). What do you need it for? Maybe there is something else you could use such as the MAC Address for uniquely identifying your user. – Simon Bosley Feb 25 '14 at 13:01
-
You are asking for teleportation. Reading from the registry requires winapi calls, they are not fundamentally different from some other winapi call you hope is available. WMI is another way to get it, unlikely you'll enjoy that much in C++. Getting an id that globally unique to identify a machine is never difficult, just make your own. Save it in a file. – Hans Passant Feb 25 '14 at 13:35
1 Answers
1
You should be able to get the GUID using the WMI Win32_ComputerSystemProduct class.

rrirower
- 4,338
- 4
- 27
- 45
-
1Looks grate, could you provide minimalistic example of how to use this in C++ programm? – DuckQueen Feb 25 '14 at 16:20
-
[MSDN](http://msdn.microsoft.com/en-us/library/aa390418(v=vs.85).aspx) provides plenty of examples. – rrirower Feb 25 '14 at 16:26