summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 19:34:45 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 19:34:45 +0000
commit5667f1bdc8d290f469f9c5eae7bb4ec7563f85ac (patch)
treeb3b4d32437596c5462b1907e6c68f2db2d15b8a0 /chrome/installer
parent186bf92abfcce5136acb040c301959ff6ca96028 (diff)
downloadchromium_src-5667f1bdc8d290f469f9c5eae7bb4ec7563f85ac.zip
chromium_src-5667f1bdc8d290f469f9c5eae7bb4ec7563f85ac.tar.gz
chromium_src-5667f1bdc8d290f469f9c5eae7bb4ec7563f85ac.tar.bz2
Revert 80819 due to failed tests
TBR=pkasting@chromium.org Review URL: http://codereview.chromium.org/6816024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/gcapi/gcapi.cc64
-rw-r--r--chrome/installer/setup/install_worker.cc3
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc12
-rw-r--r--chrome/installer/util/install_util.cc13
4 files changed, 47 insertions, 45 deletions
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc
index dc38bbe..5ba9251 100644
--- a/chrome/installer/gcapi/gcapi.cc
+++ b/chrome/installer/gcapi/gcapi.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,12 +8,10 @@
#include <atlcom.h>
#include <windows.h>
#include <sddl.h>
-#define STRSAFE_NO_DEPRECATE
+#include <stdlib.h>
#include <strsafe.h>
#include <tlhelp32.h>
-#include <cstdlib>
-
#include "google_update_idl.h"
namespace {
@@ -158,31 +156,31 @@ bool ReadValueFromRegistry(HKEY root_key, const wchar_t *sub_key,
bool IsChromeInstalled(HKEY root_key) {
wchar_t version[64];
size_t size = _countof(version);
- return ReadValueFromRegistry(root_key, kChromeRegClientsKey,
- kChromeRegVersion, version, &size);
+ if (ReadValueFromRegistry(root_key, kChromeRegClientsKey, kChromeRegVersion,
+ version, &size))
+ return true;
+ return false;
}
-enum WindowsVersion {
- VERSION_BELOW_XP_SP2,
- VERSION_XP_SP2_UP_TO_VISTA, // "but not including"
- VERSION_VISTA_OR_HIGHER,
-};
-WindowsVersion GetWindowsVersion() {
- OSVERSIONINFOEX version_info = { sizeof version_info };
- GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
-
- // Windows Vista is version 6.0.
- if (version_info.dwMajorVersion >= 6)
- return VERSION_VISTA_OR_HIGHER;
-
- // Windows XP is version 5.1. (5.2 is Windows Server 2003/XP Pro x64.)
- if ((version_info.dwMajorVersion < 5) || (version_info.dwMinorVersion < 1))
- return VERSION_BELOW_XP_SP2;
-
- // For XP itself, we only support SP2 and above.
- return ((version_info.dwMinorVersion > 1) ||
- (version_info.wServicePackMajor >= 2)) ?
- VERSION_XP_SP2_UP_TO_VISTA : VERSION_BELOW_XP_SP2;
+bool IsWinXPSp2OrLater(bool* is_vista_or_later) {
+ OSVERSIONINFOEX osviex = { sizeof(OSVERSIONINFOEX) };
+ int r = ::GetVersionEx((LPOSVERSIONINFO)&osviex);
+ // If this failed we're on Win9X or a pre NT4SP6 OS.
+ if (!r)
+ return false;
+
+ if (osviex.dwMajorVersion < 5)
+ return false;
+
+ if (osviex.dwMajorVersion > 5) {
+ *is_vista_or_later = true;
+ return true; // way beyond Windows XP;
+ }
+
+ if (osviex.dwMinorVersion >= 1 && osviex.wServicePackMajor >= 2)
+ return true; // Windows XP SP2 or better.
+
+ return false; // Windows 2000, WinXP no Service Pack.
}
// Note this function should not be called on old Windows versions where these
@@ -232,8 +230,9 @@ bool VerifyHKLMAccess(const wchar_t* sub_key) {
bool IsRunningElevated() {
// This method should be called only for Vista or later.
- if ((GetWindowsVersion() < VERSION_VISTA_OR_HIGHER) ||
- !VerifyAdminGroup())
+ bool is_vista_or_later = false;
+ IsWinXPSp2OrLater(&is_vista_or_later);
+ if (!is_vista_or_later || !VerifyAdminGroup())
return false;
HANDLE process_token;
@@ -288,9 +287,9 @@ DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
DWORD *reasons) {
DWORD local_reasons = 0;
- WindowsVersion windows_version = GetWindowsVersion();
+ bool is_vista_or_later = false;
// System requirements?
- if (windows_version == VERSION_BELOW_XP_SP2)
+ if (!IsWinXPSp2OrLater(&is_vista_or_later))
local_reasons |= GCCC_ERROR_OSNOTSUPPORTED;
if (IsChromeInstalled(HKEY_LOCAL_MACHINE))
@@ -301,8 +300,7 @@ DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
if (!VerifyHKLMAccess(kChromeRegClientsKey)) {
local_reasons |= GCCC_ERROR_ACCESSDENIED;
- } else if ((windows_version == VERSION_VISTA_OR_HIGHER) &&
- !VerifyAdminGroup()) {
+ } else if (is_vista_or_later && !VerifyAdminGroup()) {
// For Vista or later check for elevation since even for admin user we could
// be running in non-elevated mode. We require integrity level High.
local_reasons |= GCCC_ERROR_INTEGRITYLEVEL;
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index 7bdc9e5..8b11835 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -512,8 +512,7 @@ void AddInstallWorkItems(const InstallationState& original_state,
// Extra executable for 64 bit systems.
// NOTE: We check for "not disabled" so that if the API call fails, we play it
// safe and copy the executable anyway.
- if (base::win::OSInfo::GetInstance()->wow64_status() !=
- base::win::OSInfo::WOW64_DISABLED) {
+ if (base::win::GetWOW64Status() != base::win::WOW64_DISABLED) {
install_list->AddMoveTreeWorkItem(
src_path.Append(installer::kWowHelperExe).value(),
target_path.Append(installer::kWowHelperExe).value(),
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 89dd58a..c2ee5eb 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -326,10 +326,14 @@ void GoogleChromeDistribution::DoPostUninstallOperations(
// need to escape the string before using it in a URL.
const std::wstring kVersionParam = L"crversion";
const std::wstring kOSParam = L"os";
- base::win::OSInfo::VersionNumber version_number =
- base::win::OSInfo::GetInstance()->version_number();
- std::wstring os_version = StringPrintf(L"%d.%d.%d", version_number.major,
- version_number.minor, version_number.build);
+ std::wstring os_version = L"na";
+ OSVERSIONINFO version_info;
+ version_info.dwOSVersionInfoSize = sizeof(version_info);
+ if (GetVersionEx(&version_info)) {
+ os_version = StringPrintf(L"%d.%d.%d", version_info.dwMajorVersion,
+ version_info.dwMinorVersion,
+ version_info.dwBuildNumber);
+ }
FilePath iexplore;
if (!PathService::Get(base::DIR_PROGRAM_FILES, &iexplore))
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index d1110de..999d84a 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -19,7 +19,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/string_util.h"
-#include "base/sys_info.h"
#include "base/values.h"
#include "base/version.h"
#include "base/win/registry.h"
@@ -137,13 +136,15 @@ Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist,
}
bool InstallUtil::IsOSSupported() {
- // We do not support Win2K or older, or XP without service pack 2.
- VLOG(1) << base::SysInfo::OperatingSystemName() << ' '
- << base::SysInfo::OperatingSystemVersion();
+ int major, minor;
base::win::Version version = base::win::GetVersion();
+ base::win::GetServicePackLevel(&major, &minor);
+
+ // We do not support Win2K or older, or XP without service pack 2.
+ VLOG(1) << "Windows Version: " << version
+ << ", Service Pack: " << major << "." << minor;
return (version > base::win::VERSION_XP) ||
- ((version == base::win::VERSION_XP) &&
- (base::win::OSInfo::GetInstance()->service_pack().major >= 2));
+ (version == base::win::VERSION_XP && major >= 2);
}
void InstallUtil::WriteInstallerResult(bool system_install,