Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1868)

Unified Diff: chrome/installer/gcapi/gcapi.cc

Issue 1943943002: GoogleChromeCompatibilityCheck in gcapi return false for Windows XP and Vista (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/gcapi/gcapi.cc
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc
index f00ec0d757807c6b719c65d398f7920babad81e5..1617dd2f541fb7e221c0b4756804063a702463ba 100644
--- a/chrome/installer/gcapi/gcapi.cc
+++ b/chrome/installer/gcapi/gcapi.cc
@@ -227,27 +227,16 @@ bool IsC1FSent() {
RegKeyHasC1F(HKEY_LOCAL_MACHINE, kC1FPendingKey);
}
-enum WindowsVersion {
- VERSION_BELOW_XP_SP2,
- VERSION_XP_SP2_UP_TO_VISTA, // "but not including"
- VERSION_VISTA_OR_HIGHER,
-};
-WindowsVersion GetWindowsVersion() {
+bool IsWindowsVersionSupported() {
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;
+ // Windows 7 is version 6.1.
+ if (version_info.dwMajorVersion > 6 ||
+ (version_info.dwMajorVersion == 6 && version_info.dwMinorVersion > 0))
+ return true;
- // 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;
+ return false;
}
// Note this function should not be called on old Windows versions where these
@@ -297,8 +286,7 @@ bool VerifyHKLMAccess() {
bool IsRunningElevated() {
// This method should be called only for Vista or later.
- if ((GetWindowsVersion() < VERSION_VISTA_OR_HIGHER) ||
- !VerifyAdminGroup())
+ if (!IsWindowsVersionSupported() || !VerifyAdminGroup())
return false;
HANDLE process_token;
@@ -406,9 +394,9 @@ BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
DWORD* reasons) {
DWORD local_reasons = 0;
- WindowsVersion windows_version = GetWindowsVersion();
+ bool is_windows_version_supported = IsWindowsVersionSupported();
// System requirements?
- if (windows_version == VERSION_BELOW_XP_SP2)
+ if (!is_windows_version_supported)
local_reasons |= GCCC_ERROR_OSNOTSUPPORTED;
if (IsChromeInstalled(HKEY_LOCAL_MACHINE))
@@ -422,11 +410,10 @@ BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
// GCAPI is being invoked from an elevated shell, or in admin mode
if (!VerifyHKLMAccess()) {
local_reasons |= GCCC_ERROR_ACCESSDENIED;
- } else if ((windows_version == VERSION_VISTA_OR_HIGHER) &&
- !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;
+ } else if (is_windows_version_supported && !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;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698