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

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

Issue 2365523004: Component updater: report the Windows OS and Service Pack separately. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « base/win/windows_version.h ('k') | components/update_client/utils.cc » ('j') | 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) 2012 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 <memory> 9 #include <memory>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) { 109 wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) {
110 OSVERSIONINFOEX version_info = { sizeof version_info }; 110 OSVERSIONINFOEX version_info = { sizeof version_info };
111 ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info)); 111 ::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
112 version_number_.major = version_info.dwMajorVersion; 112 version_number_.major = version_info.dwMajorVersion;
113 version_number_.minor = version_info.dwMinorVersion; 113 version_number_.minor = version_info.dwMinorVersion;
114 version_number_.build = version_info.dwBuildNumber; 114 version_number_.build = version_info.dwBuildNumber;
115 version_ = MajorMinorBuildToVersion( 115 version_ = MajorMinorBuildToVersion(
116 version_number_.major, version_number_.minor, version_number_.build); 116 version_number_.major, version_number_.minor, version_number_.build);
117 service_pack_.major = version_info.wServicePackMajor; 117 service_pack_.major = version_info.wServicePackMajor;
118 service_pack_.minor = version_info.wServicePackMinor; 118 service_pack_.minor = version_info.wServicePackMinor;
119 service_pack_str_ = base::WideToUTF8(version_info.szCSDVersion);
119 120
120 SYSTEM_INFO system_info = {}; 121 SYSTEM_INFO system_info = {};
121 ::GetNativeSystemInfo(&system_info); 122 ::GetNativeSystemInfo(&system_info);
122 switch (system_info.wProcessorArchitecture) { 123 switch (system_info.wProcessorArchitecture) {
123 case PROCESSOR_ARCHITECTURE_INTEL: architecture_ = X86_ARCHITECTURE; break; 124 case PROCESSOR_ARCHITECTURE_INTEL: architecture_ = X86_ARCHITECTURE; break;
124 case PROCESSOR_ARCHITECTURE_AMD64: architecture_ = X64_ARCHITECTURE; break; 125 case PROCESSOR_ARCHITECTURE_AMD64: architecture_ = X64_ARCHITECTURE; break;
125 case PROCESSOR_ARCHITECTURE_IA64: architecture_ = IA64_ARCHITECTURE; break; 126 case PROCESSOR_ARCHITECTURE_IA64: architecture_ = IA64_ARCHITECTURE; break;
126 } 127 }
127 processors_ = system_info.dwNumberOfProcessors; 128 processors_ = system_info.dwNumberOfProcessors;
128 allocation_granularity_ = system_info.dwAllocationGranularity; 129 allocation_granularity_ = system_info.dwAllocationGranularity;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 case PRODUCT_STARTER: 163 case PRODUCT_STARTER:
163 default: 164 default:
164 version_type_ = SUITE_HOME; 165 version_type_ = SUITE_HOME;
165 break; 166 break;
166 } 167 }
167 } else if (version_info.dwMajorVersion == 5 && 168 } else if (version_info.dwMajorVersion == 5 &&
168 version_info.dwMinorVersion == 2) { 169 version_info.dwMinorVersion == 2) {
169 if (version_info.wProductType == VER_NT_WORKSTATION && 170 if (version_info.wProductType == VER_NT_WORKSTATION &&
170 system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { 171 system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
171 version_type_ = SUITE_PROFESSIONAL; 172 version_type_ = SUITE_PROFESSIONAL;
172 } else if (version_info.wSuiteMask & VER_SUITE_WH_SERVER ) { 173 } else if (version_info.wSuiteMask & VER_SUITE_WH_SERVER) {
173 version_type_ = SUITE_HOME; 174 version_type_ = SUITE_HOME;
174 } else { 175 } else {
175 version_type_ = SUITE_SERVER; 176 version_type_ = SUITE_SERVER;
176 } 177 }
177 } else if (version_info.dwMajorVersion == 5 && 178 } else if (version_info.dwMajorVersion == 5 &&
178 version_info.dwMinorVersion == 1) { 179 version_info.dwMinorVersion == 1) {
179 if(version_info.wSuiteMask & VER_SUITE_PERSONAL) 180 if (version_info.wSuiteMask & VER_SUITE_PERSONAL)
180 version_type_ = SUITE_HOME; 181 version_type_ = SUITE_HOME;
181 else 182 else
182 version_type_ = SUITE_PROFESSIONAL; 183 version_type_ = SUITE_PROFESSIONAL;
183 } else { 184 } else {
184 // Windows is pre XP so we don't care but pick a safe default. 185 // Windows is pre XP so we don't care but pick a safe default.
185 version_type_ = SUITE_HOME; 186 version_type_ = SUITE_HOME;
186 } 187 }
187 } 188 }
188 189
189 OSInfo::~OSInfo() { 190 OSInfo::~OSInfo() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return WOW64_UNKNOWN; 222 return WOW64_UNKNOWN;
222 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; 223 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED;
223 } 224 }
224 225
225 Version GetVersion() { 226 Version GetVersion() {
226 return OSInfo::GetInstance()->version(); 227 return OSInfo::GetInstance()->version();
227 } 228 }
228 229
229 } // namespace win 230 } // namespace win
230 } // namespace base 231 } // namespace base
OLDNEW
« no previous file with comments | « base/win/windows_version.h ('k') | components/update_client/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698