summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-04 23:38:32 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-04 23:38:32 +0000
commit48d4387babfc1e9a78028bce546bdccddb2e542b (patch)
tree6283b88d67a92b63d1e6db74862dbdf58de23e7e /chrome/installer
parentaaa73ccc7ba5a44ce12160bfbb17a04743c2add5 (diff)
downloadchromium_src-48d4387babfc1e9a78028bce546bdccddb2e542b.zip
chromium_src-48d4387babfc1e9a78028bce546bdccddb2e542b.tar.gz
chromium_src-48d4387babfc1e9a78028bce546bdccddb2e542b.tar.bz2
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
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/util/install_util.cc22
-rwxr-xr-xchrome/installer/util/install_util.h7
2 files changed, 29 insertions, 0 deletions
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 <algorithm>
#include <shellapi.h>
+#include <shlobj.h>
#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<wchar_t>())) {
+ 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 <string>
+#include <tchar.h>
#include <windows.h>
#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);
};