| OLD | NEW |
| 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 "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 break; | 57 break; |
| 58 case 2: | 58 case 2: |
| 59 // Treat Windows Server 2012 the same as Windows 8. | 59 // Treat Windows Server 2012 the same as Windows 8. |
| 60 version_ = VERSION_WIN8; | 60 version_ = VERSION_WIN8; |
| 61 break; | 61 break; |
| 62 default: | 62 default: |
| 63 DCHECK_EQ(version_number_.minor, 3); | 63 DCHECK_EQ(version_number_.minor, 3); |
| 64 version_ = VERSION_WIN8_1; | 64 version_ = VERSION_WIN8_1; |
| 65 break; | 65 break; |
| 66 } | 66 } |
| 67 } else if (version_number_.major == 10) { |
| 68 version_ = VERSION_WIN10; |
| 67 } else if (version_number_.major > 6) { | 69 } else if (version_number_.major > 6) { |
| 68 NOTREACHED(); | 70 NOTREACHED(); |
| 69 version_ = VERSION_WIN_LAST; | 71 version_ = VERSION_WIN_LAST; |
| 70 } | 72 } |
| 71 service_pack_.major = version_info.wServicePackMajor; | 73 service_pack_.major = version_info.wServicePackMajor; |
| 72 service_pack_.minor = version_info.wServicePackMinor; | 74 service_pack_.minor = version_info.wServicePackMinor; |
| 73 | 75 |
| 74 SYSTEM_INFO system_info = { 0 }; | 76 SYSTEM_INFO system_info = { 0 }; |
| 75 ::GetNativeSystemInfo(&system_info); | 77 ::GetNativeSystemInfo(&system_info); |
| 76 switch (system_info.wProcessorArchitecture) { | 78 switch (system_info.wProcessorArchitecture) { |
| 77 case PROCESSOR_ARCHITECTURE_INTEL: architecture_ = X86_ARCHITECTURE; break; | 79 case PROCESSOR_ARCHITECTURE_INTEL: architecture_ = X86_ARCHITECTURE; break; |
| 78 case PROCESSOR_ARCHITECTURE_AMD64: architecture_ = X64_ARCHITECTURE; break; | 80 case PROCESSOR_ARCHITECTURE_AMD64: architecture_ = X64_ARCHITECTURE; break; |
| 79 case PROCESSOR_ARCHITECTURE_IA64: architecture_ = IA64_ARCHITECTURE; break; | 81 case PROCESSOR_ARCHITECTURE_IA64: architecture_ = IA64_ARCHITECTURE; break; |
| 80 } | 82 } |
| 81 processors_ = system_info.dwNumberOfProcessors; | 83 processors_ = system_info.dwNumberOfProcessors; |
| 82 allocation_granularity_ = system_info.dwAllocationGranularity; | 84 allocation_granularity_ = system_info.dwAllocationGranularity; |
| 83 | 85 |
| 84 GetProductInfoPtr get_product_info; | 86 GetProductInfoPtr get_product_info; |
| 85 DWORD os_type; | 87 DWORD os_type; |
| 86 | 88 |
| 87 if (version_info.dwMajorVersion == 6) { | 89 if (version_info.dwMajorVersion == 6 || version_info.dwMajorVersion == 10) { |
| 88 // Only present on Vista+. | 90 // Only present on Vista+. |
| 89 get_product_info = reinterpret_cast<GetProductInfoPtr>( | 91 get_product_info = reinterpret_cast<GetProductInfoPtr>( |
| 90 ::GetProcAddress(::GetModuleHandle(L"kernel32.dll"), "GetProductInfo")); | 92 ::GetProcAddress(::GetModuleHandle(L"kernel32.dll"), "GetProductInfo")); |
| 91 | 93 |
| 92 get_product_info(version_info.dwMajorVersion, version_info.dwMinorVersion, | 94 get_product_info(version_info.dwMajorVersion, version_info.dwMinorVersion, |
| 93 0, 0, &os_type); | 95 0, 0, &os_type); |
| 94 switch (os_type) { | 96 switch (os_type) { |
| 95 case PRODUCT_CLUSTER_SERVER: | 97 case PRODUCT_CLUSTER_SERVER: |
| 96 case PRODUCT_DATACENTER_SERVER: | 98 case PRODUCT_DATACENTER_SERVER: |
| 97 case PRODUCT_DATACENTER_SERVER_CORE: | 99 case PRODUCT_DATACENTER_SERVER_CORE: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return WOW64_UNKNOWN; | 169 return WOW64_UNKNOWN; |
| 168 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; | 170 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; |
| 169 } | 171 } |
| 170 | 172 |
| 171 Version GetVersion() { | 173 Version GetVersion() { |
| 172 return OSInfo::GetInstance()->version(); | 174 return OSInfo::GetInstance()->version(); |
| 173 } | 175 } |
| 174 | 176 |
| 175 } // namespace win | 177 } // namespace win |
| 176 } // namespace base | 178 } // namespace base |
| OLD | NEW |