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

Side by Side Diff: base/win/windows_version.cc

Issue 10408084: Lump client and server versions of Windows together. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/windows_version.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/windows_version.h" 5 #include "base/win/windows_version.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace base { 11 namespace base {
(...skipping 20 matching lines...) Expand all
32 architecture_(OTHER_ARCHITECTURE), 32 architecture_(OTHER_ARCHITECTURE),
33 wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) { 33 wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) {
34 OSVERSIONINFOEX version_info = { sizeof version_info }; 34 OSVERSIONINFOEX version_info = { sizeof version_info };
35 GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info)); 35 GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
36 version_number_.major = version_info.dwMajorVersion; 36 version_number_.major = version_info.dwMajorVersion;
37 version_number_.minor = version_info.dwMinorVersion; 37 version_number_.minor = version_info.dwMinorVersion;
38 version_number_.build = version_info.dwBuildNumber; 38 version_number_.build = version_info.dwBuildNumber;
39 if ((version_number_.major == 5) && (version_number_.minor > 0)) { 39 if ((version_number_.major == 5) && (version_number_.minor > 0)) {
40 version_ = (version_number_.minor == 1) ? VERSION_XP : VERSION_SERVER_2003; 40 version_ = (version_number_.minor == 1) ? VERSION_XP : VERSION_SERVER_2003;
41 } else if (version_number_.major == 6) { 41 } else if (version_number_.major == 6) {
42 if (version_info.wProductType == VER_NT_WORKSTATION) { 42 switch (version_number_.minor) {
43 switch (version_number_.minor) { 43 case 0:
44 case 0: 44 version_ = (version_info.wProductType == VER_NT_WORKSTATION) ?
45 version_ = VERSION_VISTA; 45 VERSION_VISTA : VERSION_SERVER_2008;
46 break; 46 break;
cpu_(ooo_6.6-7.5) 2012/05/23 18:21:08 is server 2008 also vista? I mean, if we are foldi
grt (UTC plus 2) 2012/05/23 21:43:49 Sure, why not. Is it reasonable to lump all of th
47 case 1: 47 case 1:
48 version_ = VERSION_WIN7; 48 // Treat Windows Server 2008 R2 the same as Windows 7.
49 break; 49 version_ = VERSION_WIN7;
50 default: // case 2 appears to be win8. 50 break;
51 version_ = VERSION_WIN8; 51 default: // case 2 appears to be win8.
52 } 52 DCHECK_EQ(version_number_.minor, 2);
cpu_(ooo_6.6-7.5) 2012/05/23 18:21:08 I rather have case 2: and a dcheck on the default:
grt (UTC plus 2) 2012/05/23 21:43:49 But then when Windows 9 comes out, version_ will b
53 } else { 53 // Treat Windows Server 2012 the same as Windows 8.
54 version_ = VERSION_SERVER_2008; 54 version_ = VERSION_WIN8;
55 break;
55 } 56 }
56 } else if (version_number_.major > 6) { 57 } else if (version_number_.major > 6) {
57 NOTREACHED(); 58 NOTREACHED();
58 version_ = VERSION_WIN_LAST; 59 version_ = VERSION_WIN_LAST;
59 } 60 }
60 service_pack_.major = version_info.wServicePackMajor; 61 service_pack_.major = version_info.wServicePackMajor;
61 service_pack_.minor = version_info.wServicePackMinor; 62 service_pack_.minor = version_info.wServicePackMinor;
62 63
63 SYSTEM_INFO system_info = { 0 }; 64 SYSTEM_INFO system_info = { 0 };
64 GetNativeSystemInfo(&system_info); 65 GetNativeSystemInfo(&system_info);
(...skipping 21 matching lines...) Expand all
86 return WOW64_UNKNOWN; 87 return WOW64_UNKNOWN;
87 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; 88 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED;
88 } 89 }
89 90
90 Version GetVersion() { 91 Version GetVersion() {
91 return OSInfo::GetInstance()->version(); 92 return OSInfo::GetInstance()->version();
92 } 93 }
93 94
94 } // namespace win 95 } // namespace win
95 } // namespace base 96 } // namespace base
OLDNEW
« no previous file with comments | « base/win/windows_version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698