Revert "Use kernel32 version for OS deprecation infobar"
This reverts commit 251f13a00be12e784c8908e3396b291ff90fa18e.
Reason for revert: This seems to cause racey DCHECK failures on
tip of tree, because Kernel32Version() is not meant to be called
on the UI thread (as it includes a ScopedBlockingCall).
This is racey because it only happens if the infobar code is the
first caller to Kernel32Version(), which is how it slipped by.
The reland should call Kernel32Version() on a separate thread.
DCHECK call stack:
```
base.dll!logging::LogMessage::~LogMessage() Line 712
base.dll!logging::CheckError::~CheckError() Line 197
base.dll!base::internal::AssertBlockingAllowed() Line 109
base.dll!base::ScopedBlockingCall::ScopedBlockingCall(const base::Location & from_here, base::BlockingType blocking_type) Line 45
base.dll!FileVersionInfoWin::CreateFileVersionInfoWin(const base::FilePath & file_path) Line 79
base.dll!base::win::OSInfo::Kernel32BaseVersion::<lambda_1>::operator()() Line 241
base.dll!base::win::OSInfo::Kernel32BaseVersion() Line 240
base.dll!base::win::OSInfo::Kernel32Version() Line 219
chrome.dll!`anonymous namespace'::GetRealOSVersion() Line 22
chrome.dll!`anonymous namespace'::IsObsoleteOsVersion() Line 26
chrome.dll!ObsoleteSystem::IsObsoleteNowOrSoon() Line 33
chrome.dll!AddInfoBarsIfNecessary(Browser * browser, Profile * profile, const base::CommandLine & startup_command_line, chrome::startup::IsFirstRun is_first_run, bool is_web_app) Line 131
chrome.dll!StartupBrowserCreatorImpl::DetermineURLsAndLaunch(chrome::startup::IsProcessStartup process_startup) Line 460
```
Original change's description:
> Use kernel32 version for OS deprecation infobar
>
> This change makes the code to detect obsolete Windows versions get the
> OS version from `Kernel32Version()` instead of `GetVersion()`.
>
> If Chrome is run in App Compatibility mode [1], `GetVersion()` will
> return the compatibility-mode version rather than the true system
> version. This may be done by Windows automatically in certain cases, or
> by system administrators, anti-virus software, etc.
>
> The code to detect obsolete Windows versions is used to display warnings
> that the OS is no longer supported (e.g., the Windows 7/8 deprecation
> infobar recently added [2]). This means the current code shows warnings
> to users in compatibility mode for unsupported versions even if their
> actual OS is Windows 10, which can confuse users [3].
>
> `Kernel32Version()` returns the correct OS version by checking the
> version of kernel32.dll, and is used in e.g., Crashpad to ensure the
> right version is recorded.
>
> This change was tested by looking for the Windows 7/8 deprecation
> infobar on the following systems:
> * Windows 10 (not shown)
> * Windows 10 in compatibility mode for Windows 8 (not shown)
> * Windows 7 (shown)
> * Windows 8.1 (shown)
> * Windows 8.1 in compatibility mode for Windows 7
> (shown, infobar correctly says the OS version is Windows 8.1)
>
> [1] done by:
> 1. right-clicking a taskbar icon
> 2. navigating to Properties > Compatibility
> 3. checking the box "Run this program in compatibility mode for"
> 4. choosing the desired Windows version in the dropdown menu
> 5. clicking OK
> 6. launching Chrome via the taskbar icon
> [2] crrev.com/c/4004000
> [3] example support thread from the Win XP/Vista deprecation:
> https://support.google.com/chrome/thread/99522885/chrome-thinks-i-m-using-xp-but-i-m-using-windows-10?hl=en
>
> Bug: 1377525
> Change-Id: Ifd413d7efd941e7bb6c7d278ae2414e360147fab
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4031572
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> Reviewed-by: Will Harris <wfh@chromium.org>
> Commit-Queue: Jesse McKenna <jessemckenna@google.com>
> Cr-Commit-Position: refs/heads/main@{#1073035}
Bug: 1377525
Change-Id: I556abe74b956c3fd80a32d5e3c199bbb3e761bed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4038682
Commit-Queue: Jesse McKenna <jessemckenna@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1073629}
diff --git a/chrome/browser/obsolete_system/obsolete_system_win.cc b/chrome/browser/obsolete_system/obsolete_system_win.cc
index a599a80..b97bf74 100644
--- a/chrome/browser/obsolete_system/obsolete_system_win.cc
+++ b/chrome/browser/obsolete_system/obsolete_system_win.cc
@@ -14,16 +14,8 @@
namespace {
-// Obsolete-system checks get the system version from kernel32.dll's version, to
-// avoid getting an incorrect version reported by App Compatibility mode. This
-// prevents obsolete-system warnings from appearing when Chrome is run in
-// compatibility mode on modern versions of Windows.
-base::win::Version GetRealOSVersion() {
- return base::win::OSInfo::GetInstance()->Kernel32Version();
-}
-
bool IsObsoleteOsVersion() {
- return GetRealOSVersion() < base::win::Version::WIN10;
+ return base::win::GetVersion() < base::win::Version::WIN10;
}
} // namespace
@@ -35,7 +27,7 @@
// static
std::u16string ObsoleteSystem::LocalizedObsoleteString() {
- const auto version = GetRealOSVersion();
+ const auto version = base::win::GetVersion();
if (version == base::win::Version::WIN7)
return l10n_util::GetStringUTF16(IDS_WIN_7_OBSOLETE);
if (version == base::win::Version::WIN8)
@@ -52,7 +44,7 @@
// static
const char* ObsoleteSystem::GetLinkURL() {
- const auto version = GetRealOSVersion();
+ const auto version = base::win::GetVersion();
if (version < base::win::Version::WIN7)
return chrome::kWindowsXPVistaDeprecationURL;
return chrome::kWindows78DeprecationURL;