From 48d4387babfc1e9a78028bce546bdccddb2e542b Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Tue, 4 Nov 2008 23:38:32 +0000 Subject: This fixes the following bugs1. http://b/issue?id=1447957 For machine installs we need to use a different version of the Omaha updater.2. http://b/issue?id=1447951 For Vista we need to elevate while performing the update operation. This only applies to machine installs. Update checks also instantiate the same COM object. However it does not need elevation.Bug=1447957, 1447951R=finnur, kuchhal Review URL: http://codereview.chromium.org/8221 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4705 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/installer/util/install_util.cc | 22 ++++++++++++++++++++++ chrome/installer/util/install_util.h | 7 +++++++ 2 files changed, 29 insertions(+) (limited to 'chrome/installer/util') diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index a372070..bec4af8 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -7,12 +7,15 @@ #include "install_util.h" +#include #include +#include #include "base/logging.h" #include "base/registry.h" #include "base/string_util.h" #include "base/win_util.h" + #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/l10n_string_util.h" @@ -109,3 +112,22 @@ void InstallUtil::WriteInstallerResult(bool system_install, if (!install_list->Do()) LOG(ERROR) << "Failed to record installer error information in registry."; } + +bool InstallUtil::IsPerUserInstall(const wchar_t* const exe_path) { + std::wstring exe_path_copy = exe_path; + + wchar_t program_files_path[MAX_PATH] = {0}; + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, + SHGFP_TYPE_CURRENT, program_files_path))) { + std::wstring program_files_path_copy = program_files_path; + + if (std::equal(program_files_path_copy.begin(), + program_files_path_copy.end(), exe_path_copy.begin(), + CaseInsensitiveCompare())) { + return false; + } + } else { + NOTREACHED(); + } + return true; +} \ No newline at end of file diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h index 95c4bf9..ee6e2ff 100755 --- a/chrome/installer/util/install_util.h +++ b/chrome/installer/util/install_util.h @@ -10,6 +10,7 @@ #define CHROME_INSTALLER_UTIL_INSTALL_UTIL_H__ #include +#include #include #include "base/basictypes.h" @@ -46,6 +47,12 @@ class InstallUtil { installer_util::InstallStatus status, int string_resource_id, const std::wstring* const launch_cmd); + + // Returns true if this installation path is per user, otherwise returns + // false (per machine install, meaning: the exe_path contains path to + // Program Files). + static bool IsPerUserInstall(const wchar_t* const exe_path); + private: DISALLOW_EVIL_CONSTRUCTORS(InstallUtil); }; -- cgit v1.1