diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-07 19:34:45 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-07 19:34:45 +0000 |
commit | 5667f1bdc8d290f469f9c5eae7bb4ec7563f85ac (patch) | |
tree | b3b4d32437596c5462b1907e6c68f2db2d15b8a0 | |
parent | 186bf92abfcce5136acb040c301959ff6ca96028 (diff) | |
download | chromium_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
32 files changed, 335 insertions, 287 deletions
diff --git a/base/file_version_info_win.cc b/base/file_version_info_win.cc index 8c6820e..953caa9 100644 --- a/base/file_version_info_win.cc +++ b/base/file_version_info_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -12,6 +12,9 @@ #include "base/path_service.h" #include "base/threading/thread_restrictions.h" +// This has to be last. +#include <strsafe.h> + FileVersionInfoWin::FileVersionInfoWin(void* data, int language, int code_page) : language_(language), code_page_(code_page) { base::ThreadRestrictions::AssertIOAllowed(); diff --git a/base/process_util_win.cc b/base/process_util_win.cc index a49b78c..8ade06e 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -17,7 +17,6 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" -#include "base/sys_info.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" @@ -555,11 +554,12 @@ bool CleanupProcesses(const std::wstring& executable_name, /////////////////////////////////////////////////////////////////////////////// // ProcesMetrics -ProcessMetrics::ProcessMetrics(ProcessHandle process) - : process_(process), - processor_count_(base::SysInfo::NumberOfProcessors()), - last_time_(0), - last_system_time_(0) { +ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process), + last_time_(0), + last_system_time_(0) { + SYSTEM_INFO system_info; + GetSystemInfo(&system_info); + processor_count_ = system_info.dwNumberOfProcessors; } // static diff --git a/base/sys_info.h b/base/sys_info.h index 863e068..1d2939e 100644 --- a/base/sys_info.h +++ b/base/sys_info.h @@ -41,9 +41,9 @@ class BASE_API SysInfo { // Retrieves detailed numeric values for the OS version. // TODO(port): Implement a Linux version of this method and enable the // corresponding unit test. - static void OperatingSystemVersionNumbers(int32* major_version, - int32* minor_version, - int32* bugfix_version); + static void OperatingSystemVersionNumbers(int32 *major_version, + int32 *minor_version, + int32 *bugfix_version); // Returns the CPU architecture of the system. Exact return value may differ // across platforms. @@ -73,9 +73,9 @@ class BASE_API SysInfo { // Parses /etc/lsb-release to get version information for Google Chrome OS. // Declared here so it can be exposed for unit testing. static void ParseLsbRelease(const std::string& lsb_release, - int32* major_version, - int32* minor_version, - int32* bugfix_version); + int32 *major_version, + int32 *minor_version, + int32 *bugfix_version); #endif }; diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc index cd17c18..b15d71b 100644 --- a/base/sys_info_chromeos.cc +++ b/base/sys_info_chromeos.cc @@ -43,9 +43,9 @@ static base::LazyInstance<ChromeOSVersionNumbers> g_chrome_os_version_numbers(base::LINKER_INITIALIZED); // static -void SysInfo::OperatingSystemVersionNumbers(int32* major_version, - int32* minor_version, - int32* bugfix_version) { +void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, + int32 *minor_version, + int32 *bugfix_version) { if (!g_chrome_os_version_numbers.Get().parsed) { // The other implementations of SysInfo don't block on the disk. // See http://code.google.com/p/chromium/issues/detail?id=60394 @@ -75,9 +75,9 @@ std::string SysInfo::GetLinuxStandardBaseVersionKey() { // static void SysInfo::ParseLsbRelease(const std::string& lsb_release, - int32* major_version, - int32* minor_version, - int32* bugfix_version) { + int32 *major_version, + int32 *minor_version, + int32 *bugfix_version) { size_t version_key_index = std::string::npos; for (int i = 0; kLinuxStandardBaseVersionKeys[i] != NULL; ++i) { version_key_index = lsb_release.find(kLinuxStandardBaseVersionKeys[i]); diff --git a/base/sys_info_mac.cc b/base/sys_info_mac.cc index e668421..79caf55 100644 --- a/base/sys_info_mac.cc +++ b/base/sys_info_mac.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. @@ -14,9 +14,9 @@ namespace base { // static -void SysInfo::OperatingSystemVersionNumbers(int32* major_version, - int32* minor_version, - int32* bugfix_version) { +void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, + int32 *minor_version, + int32 *bugfix_version) { Gestalt(gestaltSystemVersionMajor, reinterpret_cast<SInt32*>(major_version)); Gestalt(gestaltSystemVersionMinor, diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc index 045d516..ce8376a 100644 --- a/base/sys_info_win.cc +++ b/base/sys_info_win.cc @@ -10,13 +10,14 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/stringprintf.h" -#include "base/win/windows_version.h" namespace base { // static int SysInfo::NumberOfProcessors() { - return win::OSInfo::GetInstance()->processors(); + SYSTEM_INFO info; + GetSystemInfo(&info); + return static_cast<int>(info.dwNumberOfProcessors); } // static @@ -53,17 +54,12 @@ std::string SysInfo::OperatingSystemName() { // static std::string SysInfo::OperatingSystemVersion() { - win::OSInfo* os_info = win::OSInfo::GetInstance(); - win::OSInfo::VersionNumber version_number = os_info->version_number(); - std::string version(StringPrintf("%d.%d", version_number.major, - version_number.minor)); - win::OSInfo::ServicePack service_pack = os_info->service_pack(); - if (service_pack.major != 0) { - version += StringPrintf(" SP%d", service_pack.major); - if (service_pack.minor != 0) - version += StringPrintf(".%d", service_pack.minor); - } - return version; + OSVERSIONINFO info = {0}; + info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&info); + + return base::StringPrintf("%lu.%lu", + info.dwMajorVersion, info.dwMinorVersion); } // TODO: Implement OperatingSystemVersionComplete, which would include @@ -92,16 +88,21 @@ int SysInfo::DisplayCount() { // static size_t SysInfo::VMAllocationGranularity() { - return win::OSInfo::GetInstance()->allocation_granularity(); + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + + return sysinfo.dwAllocationGranularity; } // static -void SysInfo::OperatingSystemVersionNumbers(int32* major_version, - int32* minor_version, - int32* bugfix_version) { - win::OSInfo* os_info = win::OSInfo::GetInstance(); - *major_version = os_info->version_number().major; - *minor_version = os_info->version_number().minor; +void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, + int32 *minor_version, + int32 *bugfix_version) { + OSVERSIONINFO info = {0}; + info.dwOSVersionInfoSize = sizeof(info); + GetVersionEx(&info); + *major_version = info.dwMajorVersion; + *minor_version = info.dwMinorVersion; *bugfix_version = 0; } diff --git a/base/win/windows_version.cc b/base/win/windows_version.cc index 8dc2d93..d53148d 100644 --- a/base/win/windows_version.cc +++ b/base/win/windows_version.cc @@ -11,49 +11,81 @@ namespace base { namespace win { -// static -OSInfo* OSInfo::GetInstance() { - return Singleton<OSInfo>::get(); +Version GetVersion() { + static bool checked_version = false; + static Version win_version = VERSION_PRE_2000; + if (!checked_version) { + OSVERSIONINFOEX version_info; + version_info.dwOSVersionInfoSize = sizeof version_info; + GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info)); + if (version_info.dwMajorVersion == 5) { + switch (version_info.dwMinorVersion) { + case 0: + win_version = VERSION_2000; + break; + case 1: + win_version = VERSION_XP; + break; + case 2: + default: + win_version = VERSION_SERVER_2003; + break; + } + } else if (version_info.dwMajorVersion == 6) { + if (version_info.wProductType != VER_NT_WORKSTATION) { + // 2008 is 6.0, and 2008 R2 is 6.1. + win_version = VERSION_2008; + } else { + if (version_info.dwMinorVersion == 0) { + win_version = VERSION_VISTA; + } else { + win_version = VERSION_WIN7; + } + } + } else if (version_info.dwMajorVersion > 6) { + win_version = VERSION_WIN7; + } + checked_version = true; + } + return win_version; } -OSInfo::OSInfo() - : version_(VERSION_PRE_XP), - architecture_(OTHER_ARCHITECTURE), - wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) { - OSVERSIONINFOEX version_info = { sizeof version_info }; - GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info)); - version_number_.major = version_info.dwMajorVersion; - version_number_.minor = version_info.dwMinorVersion; - version_number_.build = version_info.dwBuildNumber; - if ((version_number_.major == 5) && (version_number_.minor > 0)) { - version_ = (version_number_.minor == 1) ? VERSION_XP : VERSION_SERVER_2003; - } else if (version_number_.major == 6) { - if (version_info.wProductType == VER_NT_WORKSTATION) - version_ = (version_number_.minor == 0) ? VERSION_VISTA : VERSION_WIN7; - else - version_ = VERSION_SERVER_2008; - } else if (version_number_.major > 6) { - version_ = VERSION_WIN7; +void GetServicePackLevel(int* major, int* minor) { + DCHECK(major && minor); + static bool checked_version = false; + static int service_pack_major = -1; + static int service_pack_minor = -1; + if (!checked_version) { + OSVERSIONINFOEX version_info = {0}; + version_info.dwOSVersionInfoSize = sizeof(version_info); + GetVersionEx(reinterpret_cast<OSVERSIONINFOW*>(&version_info)); + service_pack_major = version_info.wServicePackMajor; + service_pack_minor = version_info.wServicePackMinor; + checked_version = true; } - service_pack_.major = version_info.wServicePackMajor; - service_pack_.minor = version_info.wServicePackMinor; - SYSTEM_INFO system_info = { 0 }; + *major = service_pack_major; + *minor = service_pack_minor; +} + +WindowsArchitecture GetWindowsArchitecture() { + SYSTEM_INFO system_info; GetNativeSystemInfo(&system_info); switch (system_info.wProcessorArchitecture) { - case PROCESSOR_ARCHITECTURE_INTEL: architecture_ = X86_ARCHITECTURE; break; - case PROCESSOR_ARCHITECTURE_AMD64: architecture_ = X64_ARCHITECTURE; break; - case PROCESSOR_ARCHITECTURE_IA64: architecture_ = IA64_ARCHITECTURE; break; + case PROCESSOR_ARCHITECTURE_INTEL: return X86_ARCHITECTURE; + case PROCESSOR_ARCHITECTURE_AMD64: return X64_ARCHITECTURE; + case PROCESSOR_ARCHITECTURE_IA64: return IA64_ARCHITECTURE; + default: return OTHER_ARCHITECTURE; } - processors_ = system_info.dwNumberOfProcessors; - allocation_granularity_ = system_info.dwAllocationGranularity; } -OSInfo::~OSInfo() { +WOW64Status GetWOW64Status() { + static WOW64Status wow64_status = + GetWOW64StatusForProcess(GetCurrentProcess()); + return wow64_status; } -// static -OSInfo::WOW64Status OSInfo::GetWOW64StatusForProcess(HANDLE process_handle) { +WOW64Status GetWOW64StatusForProcess(HANDLE process_handle) { typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL); IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>( GetProcAddress(GetModuleHandle(L"kernel32.dll"), "IsWow64Process")); @@ -65,9 +97,5 @@ OSInfo::WOW64Status OSInfo::GetWOW64StatusForProcess(HANDLE process_handle) { return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; } -Version GetVersion() { - return OSInfo::GetInstance()->version(); -} - } // namespace win } // namespace base diff --git a/base/win/windows_version.h b/base/win/windows_version.h index 96f3792..1d4b9bf 100644 --- a/base/win/windows_version.h +++ b/base/win/windows_version.h @@ -7,98 +7,61 @@ #pragma once #include "base/base_api.h" -#include "base/memory/singleton.h" typedef void* HANDLE; namespace base { namespace win { -// The running version of Windows. This is declared outside OSInfo for -// syntactic sugar reasons; see the declaration of GetVersion() below. // NOTE: Keep these in order so callers can do things like -// "if (base::win::GetVersion() >= base::win::VERSION_VISTA) ...". +// "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, +// though. enum Version { - VERSION_PRE_XP = 0, // Not supported. - VERSION_XP, - VERSION_SERVER_2003, // Also includes Windows XP Professional x64. - VERSION_VISTA, - VERSION_SERVER_2008, - VERSION_WIN7, + VERSION_PRE_2000 = 0, // Not supported + VERSION_2000 = 1, // Not supported + VERSION_XP = 2, + VERSION_SERVER_2003 = 3, // Also includes Windows XP Professional x64 edition + VERSION_VISTA = 4, + VERSION_2008 = 5, + VERSION_WIN7 = 6, }; -// A Singleton that can be used to query various pieces of information about the -// OS and process state. -class BASE_API OSInfo { - public: - struct VersionNumber { - int major; - int minor; - int build; - }; - - struct ServicePack { - int major; - int minor; - }; - - // The processor architecture this copy of Windows natively uses. For - // example, given an x64-capable processor, we have three possibilities: - // 32-bit Chrome running on 32-bit Windows: X86_ARCHITECTURE - // 32-bit Chrome running on 64-bit Windows via WOW64: X64_ARCHITECTURE - // 64-bit Chrome running on 64-bit Windows: X64_ARCHITECTURE - enum WindowsArchitecture { - X86_ARCHITECTURE, - X64_ARCHITECTURE, - IA64_ARCHITECTURE, - OTHER_ARCHITECTURE, - }; - - // Whether a process is running under WOW64 (the wrapper that allows 32-bit - // processes to run on 64-bit versions of Windows). This will return - // WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit - // Chrome on 64-bit Windows". WOW64_UNKNOWN means "an error occurred", e.g. - // the process does not have sufficient access rights to determine this. - enum WOW64Status { - WOW64_DISABLED, - WOW64_ENABLED, - WOW64_UNKNOWN, - }; - - static OSInfo* GetInstance(); - - Version version() const { return version_; } - // The next two functions return arrays of values, [major, minor(, build)]. - VersionNumber version_number() const { return version_number_; } - ServicePack service_pack() const { return service_pack_; } - WindowsArchitecture architecture() const { return architecture_; } - int processors() const { return processors_; } - size_t allocation_granularity() const { return allocation_granularity_; } - WOW64Status wow64_status() const { return wow64_status_; } - - // Like wow64_status(), but for the supplied handle instead of the current - // process. This doesn't touch member state, so you can bypass the singleton. - static WOW64Status GetWOW64StatusForProcess(HANDLE process_handle); +// Returns the running version of Windows. +BASE_API Version GetVersion(); - private: - OSInfo(); - ~OSInfo(); +// Returns the major and minor version of the service pack installed. +BASE_API void GetServicePackLevel(int* major, int* minor); - Version version_; - VersionNumber version_number_; - ServicePack service_pack_; - WindowsArchitecture architecture_; - int processors_; - size_t allocation_granularity_; - WOW64Status wow64_status_; +enum WindowsArchitecture { + X86_ARCHITECTURE, + X64_ARCHITECTURE, + IA64_ARCHITECTURE, + OTHER_ARCHITECTURE, +}; - friend struct DefaultSingletonTraits<OSInfo>; - DISALLOW_COPY_AND_ASSIGN(OSInfo); +// Returns the processor architecture this copy of Windows natively uses. +// For example, given an x64-capable processor, we have three possibilities: +// 32-bit Chrome running on 32-bit Windows: X86_ARCHITECTURE +// 32-bit Chrome running on 64-bit Windows via WOW64: X64_ARCHITECTURE +// 64-bit Chrome running on 64-bit Windows: X64_ARCHITECTURE +BASE_API WindowsArchitecture GetWindowsArchitecture(); + +enum WOW64Status { + WOW64_DISABLED, + WOW64_ENABLED, + WOW64_UNKNOWN, }; -// Because this is by far the most commonly-requested value from the above -// singleton, we add a global-scope accessor here as syntactic sugar. -BASE_API Version GetVersion(); +// Returns whether this process is running under WOW64 (the wrapper that allows +// 32-bit processes to run on 64-bit versions of Windows). This will return +// WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit Chrome +// on 64-bit Windows". WOW64_UNKNOWN means "an error occurred", e.g. the +// process does not have sufficient access rights to determine this. +BASE_API WOW64Status GetWOW64Status(); + +// Like GetWOW64Status(), but for the supplied handle instead of the current +// process. +BASE_API WOW64Status GetWOW64StatusForProcess(HANDLE process_handle); } // namespace win } // namespace base diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc index ebb8e24..8ba0e2c 100644 --- a/chrome/browser/bug_report_util.cc +++ b/chrome/browser/bug_report_util.cc @@ -13,7 +13,6 @@ #include "base/memory/singleton.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "base/win/windows_version.h" #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/safe_browsing/safe_browsing_util.h" @@ -136,19 +135,19 @@ void BugReportUtil::PostCleanup::OnURLFetchComplete( // Process the error for debug output if (response_code == kHttpPostFailNoConnection) { - error_stream << "No connection to server."; + error_stream << "No connection to server."; } else if ((response_code > kHttpPostFailClientError) && - (response_code < kHttpPostFailServerError)) { - error_stream << "Client error: HTTP response code " << response_code; + (response_code < kHttpPostFailServerError)) { + error_stream << "Client error: HTTP response code " << response_code; } else if (response_code > kHttpPostFailServerError) { - error_stream << "Server error: HTTP response code " << response_code; + error_stream << "Server error: HTTP response code " << response_code; } else { - error_stream << "Unknown error: HTTP response code " << response_code; + error_stream << "Unknown error: HTTP response code " << response_code; } } - LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << url - << ") status: " << error_stream.str(); + LOG(WARNING) << "FEEDBACK: Submission to feedback server (" << url << + ") status: " << error_stream.str() << std::endl; // Delete the URLFetcher. delete source; @@ -157,15 +156,21 @@ void BugReportUtil::PostCleanup::OnURLFetchComplete( } // static -void BugReportUtil::SetOSVersion(std::string* os_version) { +void BugReportUtil::SetOSVersion(std::string *os_version) { #if defined(OS_WIN) - base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); - base::win::OSInfo::VersionNumber version_number = os_info->version_number(); - *os_version = StringPrintf("%d.%d.%d", version_number.major, - version_number.minor, version_number.build); - int service_pack = os_info->service_pack().major; - if (service_pack > 0) - os_version->append(StringPrintf("Service Pack %d", service_pack)); + OSVERSIONINFO osvi; + ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + if (GetVersionEx(&osvi)) { + *os_version = StringPrintf("%d.%d.%d %S", + osvi.dwMajorVersion, + osvi.dwMinorVersion, + osvi.dwBuildNumber, + osvi.szCSDVersion); + } else { + *os_version = "unknown"; + } #elif defined(OS_MACOSX) int32 major; int32 minor; diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 4ff348e..86666f6 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -47,20 +47,27 @@ class OperatingSystemTest : public DiagnosticTest { virtual int GetId() { return 0; } virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { + int version = 0; + int major = 0; + int minor = 0; #if defined(OS_WIN) - base::win::Version version = base::win::GetVersion(); - if ((version < base::win::VERSION_XP) || - ((version == base::win::VERSION_XP) && - (base::win::OSInfo::GetInstance()->service_pack().major < 2))) { - RecordFailure(ASCIIToUTF16("Must have Windows XP SP2 or later")); + version = base::win::GetVersion(); + if (version < base::win::VERSION_XP) { + RecordFailure(ASCIIToUTF16("Windows 2000 or earlier")); + return false; + } + base::win::GetServicePackLevel(&major, &minor); + if ((version == base::win::VERSION_XP) && (major < 2)) { + RecordFailure(ASCIIToUTF16("XP Service Pack 1 or earlier")); return false; } #else // TODO(port): define the OS criteria for Linux and Mac. #endif // defined(OS_WIN) - RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s", + RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])", base::SysInfo::OperatingSystemName().c_str(), - base::SysInfo::OperatingSystemVersion().c_str()))); + base::SysInfo::OperatingSystemVersion().c_str(), + version, major, minor))); return true; } diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index 9fe3e12..b0ac166 100644 --- a/chrome/browser/importer/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -205,7 +205,7 @@ class TestObserver : public ProfileWriter, EXPECT_EQ(arraysize(kIEBookmarks), bookmark_count_); EXPECT_EQ(1, history_count_); #if 0 // This part of the test is disabled. See bug #2466 - if (base::win::GetVersion() >= base::win::VERSION_VISTA) + if (base::win::GetVersion() < base::win::VERSION_VISTA) EXPECT_EQ(0, password_count_); else EXPECT_EQ(1, password_count_); diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index 576c74c..c954a8e 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -72,8 +72,8 @@ void MemoryDetails::CollectProcessData( for (unsigned int index = 0; index < process_data_.size(); index++) process_data_[index].processes.clear(); - base::win::OSInfo::WindowsArchitecture windows_architecture = - base::win::OSInfo::GetInstance()->architecture(); + base::win::WindowsArchitecture windows_architecture = + base::win::GetWindowsArchitecture(); base::win::ScopedHandle snapshot( ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); @@ -93,10 +93,10 @@ void MemoryDetails::CollectProcessData( if (!process_handle.Get()) continue; bool is_64bit_process = - ((windows_architecture == base::win::OSInfo::X64_ARCHITECTURE) || - (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE)) && - (base::win::OSInfo::GetWOW64StatusForProcess(process_handle) == - base::win::OSInfo::WOW64_DISABLED); + ((windows_architecture == base::win::X64_ARCHITECTURE) || + (windows_architecture == base::win::IA64_ARCHITECTURE)) && + (base::win::GetWOW64StatusForProcess(process_handle) == + base::win::WOW64_DISABLED); for (unsigned int index2 = 0; index2 < process_data_.size(); index2++) { if (_wcsicmp(process_data_[index2].process_name.c_str(), process_entry.szExeFile) != 0) diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index d23b51c..528e380 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -56,8 +56,7 @@ NaClProcessHost::NaClProcessHost(const std::wstring& url) running_on_wow64_(false) { set_name(url); #if defined(OS_WIN) - running_on_wow64_ = (base::win::OSInfo::GetInstance()->wow64_status() == - base::win::OSInfo::WOW64_ENABLED); + running_on_wow64_ = (base::win::GetWOW64Status() == base::win::WOW64_ENABLED); #endif } diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index 93faa2a..70505fb 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -532,8 +532,10 @@ void AboutChromeView::ViewHierarchyChanged(bool is_add, // on-demand updates. Silent updates (in the background) should still // work as before - enabling UAC or installing the latest service pack // for Vista is another option. + int service_pack_major = 0, service_pack_minor = 0; + base::win::GetServicePackLevel(&service_pack_major, &service_pack_minor); if (!(base::win::GetVersion() == base::win::VERSION_VISTA && - (base::win::OSInfo::GetInstance()->service_pack().major == 0) && + (service_pack_major == 0) && !base::win::UserAccountControlIsEnabled())) { UpdateStatus(UPGRADE_CHECK_STARTED, GOOGLE_UPDATE_NO_ERROR); // CheckForUpdate(false, ...) means don't upgrade yet. 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, diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 84a7ff8..3e40ea3 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -43,7 +43,9 @@ #include "native_client/src/trusted/plugin/nacl_entry_points.h" #endif -#if defined(OS_LINUX) +#if defined(OS_WIN) +#include <strsafe.h> // note: per msdn docs, this must *follow* other includes +#elif defined(OS_LINUX) #include "content/renderer/renderer_sandbox_support_linux.h" #endif diff --git a/chrome/test/out_of_proc_test_runner.cc b/chrome/test/out_of_proc_test_runner.cc index 5d23954..6e4bc3b 100644 --- a/chrome/test/out_of_proc_test_runner.cc +++ b/chrome/test/out_of_proc_test_runner.cc @@ -579,18 +579,6 @@ int main(int argc, char** argv) { return ChromeTestSuite(argc, argv).Run(); } - // The exit manager is in charge of calling the dtors of singleton objects. - // On Windows, the call to ChromeMain() below will construct one for the - // chrome.dll module, but that global is not shared with this module, so if - // chrome.dll calls back out to this module and the called code uses a - // singleton, we'll need this. On other platforms, ChromeMain() isn't called - // at all below, so this is the lone exit manager for any code after this - // point. - // NOTE: We can't init this atop main() because ChromeTestSuite, as a subclass - // of TestSuite, creates one. So we wait until after the Run() call above to - // create the manager for the code path that _doesn't_ use ChromeTestSuite. - base::AtExitManager exit_manager; - #if defined(OS_WIN) if (command_line->HasSwitch(switches::kProcessType)) { // This is a child process, call ChromeMain. diff --git a/media/tools/mfplayer/mf_playback_main.cc b/media/tools/mfplayer/mf_playback_main.cc index 3ce897c..3ae8164 100644 --- a/media/tools/mfplayer/mf_playback_main.cc +++ b/media/tools/mfplayer/mf_playback_main.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -6,9 +6,7 @@ #include "media/tools/mfplayer/mfplayer.h" #include <mfapi.h> -#define STRSAFE_NO_DEPRECATE #include <strsafe.h> - #include <cassert> namespace mfplayer { diff --git a/media/tools/mfplayer/mfplayer.cc b/media/tools/mfplayer/mfplayer.cc index 7ef51e1..79894ee 100644 --- a/media/tools/mfplayer/mfplayer.cc +++ b/media/tools/mfplayer/mfplayer.cc @@ -7,9 +7,9 @@ #include <mfapi.h> #include <mferror.h> #include <shlwapi.h> +#include <strsafe.h> #include <cassert> -#include <cstdio> template <class T> static void SafeRelease(T** pptr) { diff --git a/sandbox/src/Wow64.cc b/sandbox/src/Wow64.cc index 60c63fd..9284fe8 100644 --- a/sandbox/src/Wow64.cc +++ b/sandbox/src/Wow64.cc @@ -88,8 +88,7 @@ Wow64::~Wow64() { // bit version of ntdll is loaded, we'll remove the interception and return to // our caller. bool Wow64::WaitForNtdll() { - if (base::win::OSInfo::GetInstance()->wow64_status() != - base::win::OSInfo::WOW64_ENABLED) + if (base::win::GetWOW64Status() != base::win::WOW64_ENABLED) return true; const size_t page_size = 4096; diff --git a/sandbox/src/dep_test.cc b/sandbox/src/dep_test.cc index 91d4e67..7d57c6e 100644 --- a/sandbox/src/dep_test.cc +++ b/sandbox/src/dep_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -12,6 +12,32 @@ namespace sandbox { namespace { +class DepTest : public testing::Test { + public: + static bool IsTestCaseDisabled() { + OSVERSIONINFOEX version_info; + version_info.dwOSVersionInfoSize = sizeof version_info; + GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info)); + + // Windows 2000 doesn't support DEP at all. + if (version_info.dwMajorVersion == 5 && version_info.dwMinorVersion == 0) + return true; + + // Windows XP Service Pack 0 and 1 don't support DEP at all. + if (version_info.dwMajorVersion == 5 && version_info.dwMinorVersion == 1 + && version_info.wServicePackMajor < 2) + return true; + + // Bug 1212371 Vista SP0 DEP support is half-baked. Nobody seem to have + // noticed! + if (version_info.dwMajorVersion == 6 && + version_info.wServicePackMajor == 0) + return true; + + return false; + } +}; + BYTE kReturnCode[] = { // ret 0xC3, @@ -141,7 +167,7 @@ SBOX_TESTS_COMMAND int CheckDepLevel(int argc, wchar_t **argv) { } // namespace // This test is disabled. See bug 1275842 -TEST(DepTest, DISABLED_TestDepDisable) { +TEST_F(DepTest, DISABLED_TestDepDisable) { TestRunner runner(JOB_UNPROTECTED, USER_INTERACTIVE, USER_INTERACTIVE); runner.SetTimeout(INFINITE); diff --git a/sandbox/src/integrity_level_test.cc b/sandbox/src/integrity_level_test.cc index c6e0b64..cdc8da7 100644 --- a/sandbox/src/integrity_level_test.cc +++ b/sandbox/src/integrity_level_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -45,7 +45,7 @@ SBOX_TESTS_COMMAND int CheckIntegrityLevel(int argc, wchar_t **argv) { } TEST(IntegrityLevelTest, TestLowILReal) { - if (base::win::GetVersion() != base::win::VERSION_VISTA) + if (base::win::VERSION_VISTA != base::win::GetVersion()) return; TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); @@ -61,7 +61,7 @@ TEST(IntegrityLevelTest, TestLowILReal) { } TEST(DelayedIntegrityLevelTest, TestLowILDelayed) { - if (base::win::GetVersion() != base::win::VERSION_VISTA) + if (base::win::VERSION_VISTA != base::win::GetVersion()) return; TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); @@ -77,7 +77,7 @@ TEST(DelayedIntegrityLevelTest, TestLowILDelayed) { } TEST(IntegrityLevelTest, TestNoILChange) { - if (base::win::GetVersion() != base::win::VERSION_VISTA) + if (base::win::VERSION_VISTA != base::win::GetVersion()) return; TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); diff --git a/sandbox/src/interception.cc b/sandbox/src/interception.cc index b66fddd..577d079 100644 --- a/sandbox/src/interception.cc +++ b/sandbox/src/interception.cc @@ -438,8 +438,7 @@ bool InterceptionManager::PatchClientFunctions(DllInterceptionData* thunks, #endif ServiceResolverThunk* thunk; - if (base::win::OSInfo::GetInstance()->wow64_status() == - base::win::OSInfo::WOW64_ENABLED) + if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED) thunk = new Wow64ResolverThunk(child_->Process(), relaxed_); else if (!IsXPSP2OrLater()) thunk = new Win2kResolverThunk(child_->Process(), relaxed_); diff --git a/sandbox/src/job.cc b/sandbox/src/job.cc index 8ed3a77..e0dca68 100644 --- a/sandbox/src/job.cc +++ b/sandbox/src/job.cc @@ -1,10 +1,8 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. #include "sandbox/src/job.h" - -#include "base/win/windows_version.h" #include "sandbox/src/restricted_token.h" namespace sandbox { @@ -51,11 +49,17 @@ DWORD Job::Init(JobLevel security_level, wchar_t *job_name, jbur.UIRestrictionsClass |= JOB_OBJECT_UILIMIT_EXITWINDOWS; } case JOB_UNPROTECTED: { + OSVERSIONINFO version_info = {0}; + version_info.dwOSVersionInfoSize = sizeof(version_info); + GetVersionEx(&version_info); + // The JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag is not supported on // Windows 2000. We need a mechanism on Windows 2000 to ensure // that processes in the job are terminated when the job is closed - if (base::win::GetVersion() == base::win::VERSION_PRE_XP) + if ((5 == version_info.dwMajorVersion) && + (0 == version_info.dwMinorVersion)) { break; + } jeli.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; diff --git a/sandbox/src/sandbox_utils.cc b/sandbox/src/sandbox_utils.cc index b93434c..9554514 100644 --- a/sandbox/src/sandbox_utils.cc +++ b/sandbox/src/sandbox_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. @@ -7,7 +7,6 @@ #include <windows.h> #include "base/logging.h" -#include "base/win/windows_version.h" #include "sandbox/src/internal_types.h" #include "sandbox/src/nt_internals.h" @@ -57,10 +56,33 @@ bool GetModuleHandleHelper(DWORD flags, const wchar_t* module_name, } bool IsXPSP2OrLater() { - base::win::Version version = base::win::GetVersion(); - return (version > base::win::VERSION_XP) || - ((version == base::win::VERSION_XP) && - (base::win::OSInfo::GetInstance()->service_pack().major >= 2)); + OSVERSIONINFOEX version = {0}; + version.dwOSVersionInfoSize = sizeof(version); + if (!::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version))) { + NOTREACHED(); + return false; + } + + // Vista or later + if (version.dwMajorVersion > 5) + return true; + + // 2k, xp or 2003 + if (version.dwMajorVersion == 5) { + // 2003 + if (version.dwMinorVersion > 1) + return true; + + // 2000 + if (version.dwMinorVersion == 0) + return false; + + // Windows Xp Sp2 or later + if (version.wServicePackMajor >= 2) + return true; + } + + return false; } void InitObjectAttribs(const std::wstring& name, ULONG attributes, HANDLE root, diff --git a/sandbox/src/service_resolver_unittest.cc b/sandbox/src/service_resolver_unittest.cc index 36ad1d0f..f5e29f3 100644 --- a/sandbox/src/service_resolver_unittest.cc +++ b/sandbox/src/service_resolver_unittest.cc @@ -120,8 +120,7 @@ NTSTATUS PatchNtdllWithResolver(const char* function, bool relaxed, } sandbox::ServiceResolverThunk* GetTestResolver(bool relaxed) { - if (base::win::OSInfo::GetInstance()->wow64_status() == - base::win::OSInfo::WOW64_ENABLED) + if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED) return new Wow64ResolverTest(relaxed); if (!sandbox::IsXPSP2OrLater()) return new Win2kResolverTest(relaxed); diff --git a/sandbox/tests/common/controller.cc b/sandbox/tests/common/controller.cc index b618069..7efd374 100644 --- a/sandbox/tests/common/controller.cc +++ b/sandbox/tests/common/controller.cc @@ -55,10 +55,9 @@ std::wstring MakePathToSysWow64(const wchar_t* name, bool is_obj_man_path) { namespace sandbox { std::wstring MakePathToSys(const wchar_t* name, bool is_obj_man_path) { - return (base::win::OSInfo::GetInstance()->wow64_status() == - base::win::OSInfo::WOW64_ENABLED) ? - MakePathToSysWow64(name, is_obj_man_path) : - MakePathToSys32(name, is_obj_man_path); + if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED) + return MakePathToSysWow64(name, is_obj_man_path); + return MakePathToSys32(name, is_obj_man_path); } BrokerServices* GetBroker() { @@ -139,8 +138,7 @@ bool TestRunner::AddRuleSys32(TargetPolicy::Semantics semantics, if (!AddRule(TargetPolicy::SUBSYS_FILES, semantics, win32_path.c_str())) return false; - if (base::win::OSInfo::GetInstance()->wow64_status() != - base::win::OSInfo::WOW64_ENABLED) + if (base::win::GetWOW64Status() != base::win::WOW64_ENABLED) return true; win32_path = MakePathToSysWow64(pattern, false); diff --git a/webkit/glue/user_agent.cc b/webkit/glue/user_agent.cc index f92bc9a..c8d8b24 100644 --- a/webkit/glue/user_agent.cc +++ b/webkit/glue/user_agent.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -64,15 +64,14 @@ std::string BuildOSCpuInfo() { #if defined(OS_WIN) std::string architecture_token; - base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); - if (os_info->wow64_status() == base::win::OSInfo::WOW64_ENABLED) { + if (base::win::GetWOW64Status() == base::win::WOW64_ENABLED) { architecture_token = "; WOW64"; } else { - base::win::OSInfo::WindowsArchitecture windows_architecture = - os_info->architecture(); - if (windows_architecture == base::win::OSInfo::X64_ARCHITECTURE) + base::win::WindowsArchitecture windows_architecture = + base::win::GetWindowsArchitecture(); + if (windows_architecture == base::win::X64_ARCHITECTURE) architecture_token = "; Win64; x64"; - else if (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE) + else if (windows_architecture == base::win::IA64_ARCHITECTURE) architecture_token = "; Win64; IA64"; } #endif diff --git a/webkit/plugins/npapi/test/plugin_npobject_proxy_test.cc b/webkit/plugins/npapi/test/plugin_npobject_proxy_test.cc index 2c28089..c9cd27f 100644 --- a/webkit/plugins/npapi/test/plugin_npobject_proxy_test.cc +++ b/webkit/plugins/npapi/test/plugin_npobject_proxy_test.cc @@ -1,10 +1,14 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. #include "base/basictypes.h" #include "base/compiler_specific.h" +#if defined(OS_WIN) +#define STRSAFE_NO_DEPRECATE +#include <strsafe.h> +#endif #include "webkit/plugins/npapi/test/plugin_npobject_proxy_test.h" namespace NPAPIClient { |