From 166162d8305404e8fc820de91ef9f6d733b4657a Mon Sep 17 00:00:00 2001 From: Roland Rossgotterer Date: Mon, 7 Jan 2019 14:49:28 +0100 Subject: 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 --- src/corelib/global/qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) == ERROR_SUCCESS) { wchar_t buffer[UuidStringLen + 1]; DWORD size = sizeof(buffer); -- cgit v1.2.3