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

Side by Side Diff: base/win_util.cc

Issue 21274: Add code to be able to detect windows7 in GetWinVersion. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/win_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/win_util.h" 5 #include "base/win_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <sddl.h> 8 #include <sddl.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 21 matching lines...) Expand all
32 const bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 32 const bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
33 SIZEOF_NONCLIENTMETRICS, metrics, 33 SIZEOF_NONCLIENTMETRICS, metrics,
34 0); 34 0);
35 DCHECK(success); 35 DCHECK(success);
36 } 36 }
37 37
38 WinVersion GetWinVersion() { 38 WinVersion GetWinVersion() {
39 static bool checked_version = false; 39 static bool checked_version = false;
40 static WinVersion win_version = WINVERSION_PRE_2000; 40 static WinVersion win_version = WINVERSION_PRE_2000;
41 if (!checked_version) { 41 if (!checked_version) {
42 OSVERSIONINFO version_info; 42 OSVERSIONINFOEX version_info;
43 version_info.dwOSVersionInfoSize = sizeof version_info; 43 version_info.dwOSVersionInfoSize = sizeof version_info;
44 GetVersionEx(&version_info); 44 GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
45 if (version_info.dwMajorVersion == 5) { 45 if (version_info.dwMajorVersion == 5) {
46 switch (version_info.dwMinorVersion) { 46 switch (version_info.dwMinorVersion) {
47 case 0: 47 case 0:
48 win_version = WINVERSION_2000; 48 win_version = WINVERSION_2000;
49 break; 49 break;
50 case 1: 50 case 1:
51 win_version = WINVERSION_XP; 51 win_version = WINVERSION_XP;
52 break; 52 break;
53 case 2: 53 case 2:
54 default: 54 default:
55 win_version = WINVERSION_SERVER_2003; 55 win_version = WINVERSION_SERVER_2003;
56 break; 56 break;
57 } 57 }
58 } else if (version_info.dwMajorVersion >= 6) { 58 } else if (version_info.dwMajorVersion == 6) {
59 win_version = WINVERSION_VISTA; 59 if (version_info.wProductType != VER_NT_WORKSTATION) {
60 // 2008 is 6.0, and 2008 R2 is 6.1.
61 win_version = WINVERSION_2008;
62 } else {
63 if (version_info.dwMinorVersion == 0) {
64 win_version = WINVERSION_VISTA;
65 } else {
66 win_version = WINVERSION_WIN7;
67 }
68 }
69 } else if (version_info.dwMajorVersion > 6) {
70 win_version = WINVERSION_WIN7;
60 } 71 }
61 checked_version = true; 72 checked_version = true;
62 } 73 }
63 return win_version; 74 return win_version;
64 } 75 }
65 76
66 void GetServicePackLevel(int* major, int* minor) { 77 void GetServicePackLevel(int* major, int* minor) {
67 DCHECK(major && minor); 78 DCHECK(major && minor);
68 static bool checked_version = false; 79 static bool checked_version = false;
69 static int service_pack_major = -1; 80 static int service_pack_major = -1;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 451
441 #ifndef COPY_FILE_COPY_SYMLINK 452 #ifndef COPY_FILE_COPY_SYMLINK
442 #error You must install the Windows 2008 or Vista Software Development Kit and \ 453 #error You must install the Windows 2008 or Vista Software Development Kit and \
443 set it as your default include path to build this library. You can grab it by \ 454 set it as your default include path to build this library. You can grab it by \
444 searching for "download windows sdk 2008" in your favorite web search engine. \ 455 searching for "download windows sdk 2008" in your favorite web search engine. \
445 Also make sure you register the SDK with Visual Studio, by selecting \ 456 Also make sure you register the SDK with Visual Studio, by selecting \
446 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ 457 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \
447 menu (see Start - All Programs - Microsoft Windows SDK - \ 458 menu (see Start - All Programs - Microsoft Windows SDK - \
448 Visual Studio Registration). 459 Visual Studio Registration).
449 #endif 460 #endif
OLDNEW
« no previous file with comments | « base/win_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698