From e06f4d5c6bd7bad162c45784e39cd0114635eb42 Mon Sep 17 00:00:00 2001 From: "amit@chromium.org" Date: Wed, 19 Jan 2011 07:28:46 +0000 Subject: Regkey functions return error code instead of bool Change the Regkey helper to consistently use and return LONG instead of bool. Fix RegKey usage all over the code base and get rid of workarounds due to lack of return value. Reviewers: brettw: everything (skip parts for other reviewers if you wish) robertshield,grt: chrome_frame, installer siggi: ceee BUG=none TEST=covered by existing tests Review URL: http://codereview.chromium.org/6090006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71768 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/plugins/npapi/plugin_list_win.cc | 13 ++++++++----- webkit/plugins/npapi/webplugin_delegate_impl_win.cc | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'webkit/plugins') diff --git a/webkit/plugins/npapi/plugin_list_win.cc b/webkit/plugins/npapi/plugin_list_win.cc index d7f13ef..324dffb 100644 --- a/webkit/plugins/npapi/plugin_list_win.cc +++ b/webkit/plugins/npapi/plugin_list_win.cc @@ -73,7 +73,7 @@ bool GetInstalledPath(const char16* app, FilePath* out) { base::win::RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); std::wstring path; - if (key.ReadValue(kRegistryPath, &path)) { + if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) { *out = FilePath(path); return true; } @@ -95,7 +95,7 @@ void GetPluginsInRegistryDirectory( base::win::RegKey key(root_key, reg_path.c_str(), KEY_READ); std::wstring path; - if (key.ReadValue(kRegistryPath, &path)) + if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) plugin_dirs->insert(FilePath(path)); } } @@ -110,7 +110,7 @@ void GetFirefoxInstalledPaths(std::vector* out) { it.Name() + L"\\Main"; base::win::RegKey key(HKEY_LOCAL_MACHINE, full_path.c_str(), KEY_READ); std::wstring install_dir; - if (!key.ReadValue(L"Install Directory", &install_dir)) + if (key.ReadValue(L"Install Directory", &install_dir) != ERROR_SUCCESS) continue; out->push_back(FilePath(install_dir)); } @@ -190,8 +190,10 @@ void GetJavaDirectory(std::set* plugin_dirs) { // 2. Read the current Java version std::wstring java_version; - if (!java_key.ReadValue(kRegistryBrowserJavaVersion, &java_version)) + if (java_key.ReadValue(kRegistryBrowserJavaVersion, &java_version) != + ERROR_SUCCESS) { java_key.ReadValue(kRegistryCurrentJavaVersion, &java_version); + } if (!java_version.empty()) { java_key.OpenKey(java_version.c_str(), KEY_QUERY_VALUE); @@ -199,7 +201,8 @@ void GetJavaDirectory(std::set* plugin_dirs) { // 3. Install path of the JRE binaries is specified in "JavaHome" // value under the Java version key. std::wstring java_plugin_directory; - if (java_key.ReadValue(kRegistryJavaHome, &java_plugin_directory)) { + if (java_key.ReadValue(kRegistryJavaHome, &java_plugin_directory) == + ERROR_SUCCESS) { // 4. The new plugin resides under the 'bin/new_plugin' // subdirectory. DCHECK(!java_plugin_directory.empty()); diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc index e281720..12cd216 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc @@ -418,9 +418,9 @@ bool WebPluginDelegateImpl::PlatformInitialize() { // for the rest patch this function. if ((quirks_ & PLUGIN_QUIRK_PATCH_REGENUMKEYEXW) && base::win::GetVersion() == base::win::VERSION_XP && - !base::win::RegKey().Open(HKEY_LOCAL_MACHINE, + (base::win::RegKey().Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\MediaPlayer\\ShimInclusionList\\chrome.exe", - KEY_READ) && + KEY_READ) != ERROR_SUCCESS) && !g_iat_patch_reg_enum_key_ex_w.Pointer()->is_patched()) { g_iat_patch_reg_enum_key_ex_w.Pointer()->Patch( L"wmpdxm.dll", "advapi32.dll", "RegEnumKeyExW", -- cgit v1.1