diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-12-05 19:09:15 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@theqtcompany.com> | 2015-12-08 06:37:57 +0000 |
commit | cbb2ce0f918c471a7306a2e6a91730aad6a01f7b (patch) | |
tree | 99f63b4aa010fe40c14d0ec292218370dcb0b8d9 /tools | |
parent | 3304ea8f0e915b6562d9d89621c42a46bf92dafa (diff) |
Remove Wow6432Node versions of Visual Studio registry keys
The Visual Studio registry keys are stored in the 32 bit view.
Extend qt_readRegistryKey with an option that enables the caller to
choose the 32 bit or 64 bit registry view.
We now read the Visual Studio registry keys from the 32 bit registry
view even in a 64 bit build.
Adding the next Visual Studio version will become a bit easier.
Change-Id: I7300b992be6058f30a422e3f1fe0bafade6eea54
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/configure/environment.cpp | 9 | ||||
-rw-r--r-- | tools/shared/windows/registry.cpp | 6 | ||||
-rw-r--r-- | tools/shared/windows/registry_p.h | 8 |
3 files changed, 13 insertions, 10 deletions
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 11064a757d..5e28fda11d 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -69,17 +69,11 @@ struct CompilerInfo{ {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"}, {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe {CC_MSVC2005, "Microsoft (R) Visual Studio 2005 C/C++ Compiler (8.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe - {CC_MSVC2005, "Microsoft (R) Visual Studio 2005 C/C++ Compiler (8.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe {CC_MSVC2008, "Microsoft (R) Visual Studio 2008 C/C++ Compiler (9.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe - {CC_MSVC2008, "Microsoft (R) Visual Studio 2008 C/C++ Compiler (9.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe {CC_MSVC2010, "Microsoft (R) Visual Studio 2010 C/C++ Compiler (10.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe - {CC_MSVC2010, "Microsoft (R) Visual Studio 2010 C/C++ Compiler (10.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe {CC_MSVC2012, "Microsoft (R) Visual Studio 2012 C/C++ Compiler (11.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\11.0", "cl.exe"}, // link.exe, lib.exe - {CC_MSVC2012, "Microsoft (R) Visual Studio 2012 C/C++ Compiler (11.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\11.0", "cl.exe"}, // link.exe, lib.exe {CC_MSVC2013, "Microsoft (R) Visual Studio 2013 C/C++ Compiler (12.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe - {CC_MSVC2013, "Microsoft (R) Visual Studio 2013 C/C++ Compiler (12.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe // Microsoft skipped version 13 - {CC_MSVC2015, "Microsoft (R) Visual Studio 2015 C/C++ Compiler (14.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VS7\\14.0", "cl.exe"}, // link.exe, lib.exe {CC_MSVC2015, "Microsoft (R) Visual Studio 2015 C/C++ Compiler (14.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\14.0", "cl.exe"}, // link.exe, lib.exe {CC_UNKNOWN, "Unknown", 0, 0}, }; @@ -196,7 +190,8 @@ Compiler Environment::detectCompiler() QString paths = qgetenv("PATH"); QStringList pathlist = paths.toLower().split(";"); for(int i = 0; compiler_info[i].compiler; ++i) { - QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower(); + QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey, + KEY_WOW64_32KEY).toLower(); if (productPath.length()) { QStringList::iterator it; for(it = pathlist.begin(); it != pathlist.end(); ++it) { diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp index c989ae279b..432c707e28 100644 --- a/tools/shared/windows/registry.cpp +++ b/tools/shared/windows/registry.cpp @@ -74,7 +74,7 @@ static QString keyName(const QString &rKey) } #endif -QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey) +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, unsigned long options) { QString result; @@ -83,7 +83,8 @@ QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey) QString rSubkeyPath = keyPath(rSubkey); HKEY handle = 0; - LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, + KEY_READ | options, &handle); if (res != ERROR_SUCCESS) return QString(); @@ -152,6 +153,7 @@ QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey) #else Q_UNUSED(parentHandle); Q_UNUSED(rSubkey) + Q_UNUSED(options); #endif return result; diff --git a/tools/shared/windows/registry_p.h b/tools/shared/windows/registry_p.h index e13f9e6f46..4fa2d6aa9f 100644 --- a/tools/shared/windows/registry_p.h +++ b/tools/shared/windows/registry_p.h @@ -63,8 +63,14 @@ QT_BEGIN_NAMESPACE * If the key is not found, or the registry cannot be accessed (for example * if this code is compiled for a platform other than Windows), a null * string is returned. + * + * 32-bit code reads from the registry's 32 bit view (Wow6432Node), + * 64 bit code reads from the 64 bit view. + * Pass KEY_WOW64_32KEY to access the 32 bit view regardless of the + * application's architecture, KEY_WOW64_64KEY respectively. */ -QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey); +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, + unsigned long options = 0); QT_END_NAMESPACE |