From 8fbab00264861b95a99a8232ba75e0994c46c185 Mon Sep 17 00:00:00 2001 From: "finnur@google.com" Date: Wed, 10 Sep 2008 19:30:35 +0000 Subject: The About box was needlessly blocking Chrome on Vista SP1 (with UAC disabled) from performing an On-demand update. Google Update has worked around the issue - for SP1 and up that is - so we can relax the restriction a bit. Review URL: http://codereview.chromium.org/1708 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2003 0039d316-1c4b-4281-b951-d872f2087c98 --- base/win_util.cc | 18 ++++++++++++++++++ base/win_util.h | 3 +++ 2 files changed, 21 insertions(+) (limited to 'base') diff --git a/base/win_util.cc b/base/win_util.cc index d8f8b4e..6f193cc 100644 --- a/base/win_util.cc +++ b/base/win_util.cc @@ -60,6 +60,24 @@ WinVersion GetWinVersion() { return win_version; } +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(&version_info)); + service_pack_major = version_info.wServicePackMajor; + service_pack_minor = version_info.wServicePackMinor; + checked_version = true; + } + + *major = service_pack_major; + *minor = service_pack_minor; +} + bool AddAccessToKernelObject(HANDLE handle, WELL_KNOWN_SID_TYPE known_sid, ACCESS_MASK access) { PSECURITY_DESCRIPTOR descriptor = NULL; diff --git a/base/win_util.h b/base/win_util.h index 54f5e4a..d3728c1 100644 --- a/base/win_util.h +++ b/base/win_util.h @@ -28,6 +28,9 @@ void GetNonClientMetrics(NONCLIENTMETRICS* metrics); // Returns the running version of Windows. WinVersion GetWinVersion(); +// Returns the major and minor version of the service pack installed. +void GetServicePackLevel(int* major, int* minor); + // Adds an ACE in the DACL of the object referenced by handle. The ACE is // granting |access| to the user |known_sid|. // If |known_sid| is WinSelfSid, the sid of the current user will be added to -- cgit v1.1