| 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 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 OSInfo::OSInfo() | 30 OSInfo::OSInfo() |
| 31 : version_(VERSION_PRE_XP), | 31 : version_(VERSION_PRE_XP), |
| 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 // Treat XP Pro x64, Server 2003, Home Server, and Server 2003 R2 as XP. | 40 // Treat XP Pro x64, Home Server, and Server 2003 R2 as Server 2003. |
| 41 version_ = VERSION_XP; | 41 version_ = (version_number_.minor == 1) ? VERSION_XP : VERSION_SERVER_2003; |
| 42 } else if (version_number_.major == 6) { | 42 } else if (version_number_.major == 6) { |
| 43 switch (version_number_.minor) { | 43 switch (version_number_.minor) { |
| 44 case 0: | 44 case 0: |
| 45 // Treat Windows Server 2008 the same as Windows Vista. | 45 // Treat Windows Server 2008 the same as Windows Vista. |
| 46 version_ = VERSION_VISTA; | 46 version_ = VERSION_VISTA; |
| 47 break; | 47 break; |
| 48 case 1: | 48 case 1: |
| 49 // Treat Windows Server 2008 R2 the same as Windows 7. | 49 // Treat Windows Server 2008 R2 the same as Windows 7. |
| 50 version_ = VERSION_WIN7; | 50 version_ = VERSION_WIN7; |
| 51 break; | 51 break; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return WOW64_UNKNOWN; | 88 return WOW64_UNKNOWN; |
| 89 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; | 89 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; |
| 90 } | 90 } |
| 91 | 91 |
| 92 Version GetVersion() { | 92 Version GetVersion() { |
| 93 return OSInfo::GetInstance()->version(); | 93 return OSInfo::GetInstance()->version(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace win | 96 } // namespace win |
| 97 } // namespace base | 97 } // namespace base |
| OLD | NEW |