diff options
author | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-13 17:37:13 +0000 |
---|---|---|
committer | gab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-13 17:37:13 +0000 |
commit | a049b24a30811754b47b6f81dbd4e35b54617b70 (patch) | |
tree | 2bc751eaae3f58011c2431e22b556dea3f5fa74e /webkit/plugins | |
parent | 9d9b996395a714500eb55da225c16bdc48786bce (diff) | |
download | chromium_src-a049b24a30811754b47b6f81dbd4e35b54617b70.zip chromium_src-a049b24a30811754b47b6f81dbd4e35b54617b70.tar.gz chromium_src-a049b24a30811754b47b6f81dbd4e35b54617b70.tar.bz2 |
Fix all hardcoded Windows registry lookups.
Some of our registry lookups were wrong based on how the "new" (Win7+) Windows operates.
BUG=None
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10535057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/npapi/plugin_list_win.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/webkit/plugins/npapi/plugin_list_win.cc index c93e2ff..88e6374 100644 --- a/webkit/plugins/npapi/plugin_list_win.cc +++ b/webkit/plugins/npapi/plugin_list_win.cc @@ -20,6 +20,7 @@ #include "base/win/pe_image.h" #include "base/win/registry.h" #include "base/win/scoped_handle.h" +#include "base/win/windows_version.h" #include "webkit/plugins/npapi/plugin_constants_win.h" #include "webkit/plugins/npapi/plugin_lib.h" #include "webkit/plugins/plugin_switches.h" @@ -78,11 +79,19 @@ bool GetInstalledPath(const char16* app, FilePath* out) { reg_path.append(L"\\"); reg_path.append(app); - base::win::RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); + base::win::RegKey hkcu_key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); std::wstring path; - if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { + // As of Win7 AppPaths can also be registered in HKCU: http://goo.gl/UgFOf. + if (base::win::GetVersion() >= base::win::VERSION_WIN7 && + hkcu_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { *out = FilePath(path); return true; + } else { + base::win::RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); + if (hklm_key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { + *out = FilePath(path); + return true; + } } return false; |