diff options
Diffstat (limited to 'tools/shared')
-rw-r--r-- | tools/shared/windows/registry.cpp | 6 | ||||
-rw-r--r-- | tools/shared/windows/registry_p.h | 8 |
2 files changed, 11 insertions, 3 deletions
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 |