From 5f082e2c9dbbc642d6a0daed439b15536dc36770 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Mon, 9 Nov 2020 11:35:35 +0000 Subject: [PATCH] Add an extra option when querying Windows registry keys (this option will be needed when 32-bit Ardour is running in 64-bit Windows) --- libs/pbd/windows_special_dirs.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/pbd/windows_special_dirs.cc b/libs/pbd/windows_special_dirs.cc index 388dc7a67d..1ec516e00f 100644 --- a/libs/pbd/windows_special_dirs.cc +++ b/libs/pbd/windows_special_dirs.cc @@ -71,5 +71,18 @@ PBD::windows_query_registry (const char *regkey, const char *regval, std::string return true; } +#ifndef _WIN64 + // If this is a 32-bit build (but we're running in Win64) the above + // code will only search Win32 registry keys. So if we got this far + // without finding anything, force Windows to search Win64 keys too + if ( (ERROR_SUCCESS == RegOpenKeyExA (root, regkey, 0, KEY_READ | KEY_WOW64_64KEY, &key)) + && (ERROR_SUCCESS == RegQueryValueExA (key, regval, 0, NULL, reinterpret_cast(tmp), &size)) + ) + { + rv = Glib::locale_to_utf8 (tmp); + return true; + } +#endif + return false; }