path: root/src/corelib/global/qglobal.cpp
diff options
authorRoland Rossgotterer <>2019-01-07 14:49:28 +0100
committerRoland Rossgotterer <>2019-01-09 08:42:10 +0000
commit166162d8305404e8fc820de91ef9f6d733b4657a (patch)
treef8af722ab73060ee13428089dc36f3e753abc7b6 /src/corelib/global/qglobal.cpp
parent2780f80fae58ecd986c0695f9bc61cfb5b099dc0 (diff)
Always access the 64-bit registry key to read MachineGuid
When running a 32bit application on a 64bit Windows, the call to open the key "HKLM/Software/Microsoft/Cryptography/MachineGuid" will by default be redirect to "HKLM/Software/WOW6432Node/Microsoft/Cryptography/MachineGuid" which does not exist. Instead access the 64bit key from either a 32bit or 64bit application. KEY_WOW64_64KEY has no effect on 32bit Windows. Change-Id: Ic5e13f99d08aef2658d58a52cffe66dbab0510b8 Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 88d4877be5..0109bb3568 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2933,7 +2933,7 @@ QByteArray QSysInfo::machineUniqueId()
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// Let's poke at the registry
HKEY key = NULL;
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ, &key)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ | KEY_WOW64_64KEY, &key)
wchar_t buffer[UuidStringLen + 1];
DWORD size = sizeof(buffer);