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

Unified Diff: sandbox/src/sandbox_utils.cc

Issue 6713107: Make the windows_version.h functions threadsafe by using a singleton. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « sandbox/src/job.cc ('k') | sandbox/src/service_resolver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/src/sandbox_utils.cc
===================================================================
--- sandbox/src/sandbox_utils.cc (revision 80667)
+++ sandbox/src/sandbox_utils.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,6 +7,7 @@
#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"
@@ -56,33 +57,10 @@
}
bool IsXPSP2OrLater() {
- 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;
+ 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));
}
void InitObjectAttribs(const std::wstring& name, ULONG attributes, HANDLE root,
« no previous file with comments | « sandbox/src/job.cc ('k') | sandbox/src/service_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698