| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sys_info.h" | 5 #include "base/sys_info.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (!GetDiskFreeSpaceExW(path.value().c_str(), &available, &total, &free)) { | 41 if (!GetDiskFreeSpaceExW(path.value().c_str(), &available, &total, &free)) { |
| 42 return -1; | 42 return -1; |
| 43 } | 43 } |
| 44 int64 rv = static_cast<int64>(available.QuadPart); | 44 int64 rv = static_cast<int64>(available.QuadPart); |
| 45 if (rv < 0) | 45 if (rv < 0) |
| 46 rv = kint64max; | 46 rv = kint64max; |
| 47 return rv; | 47 return rv; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 std::wstring SysInfo::GetEnvVar(const wchar_t* var) { | |
| 52 DWORD value_length = GetEnvironmentVariable(var, NULL, 0); | |
| 53 if (value_length == 0) { | |
| 54 return L""; | |
| 55 } | |
| 56 scoped_array<wchar_t> value(new wchar_t[value_length]); | |
| 57 GetEnvironmentVariable(var, value.get(), value_length); | |
| 58 return std::wstring(value.get()); | |
| 59 } | |
| 60 | |
| 61 // static | |
| 62 std::string SysInfo::OperatingSystemName() { | 51 std::string SysInfo::OperatingSystemName() { |
| 63 return "Windows NT"; | 52 return "Windows NT"; |
| 64 } | 53 } |
| 65 | 54 |
| 66 // static | 55 // static |
| 67 std::string SysInfo::OperatingSystemVersion() { | 56 std::string SysInfo::OperatingSystemVersion() { |
| 68 OSVERSIONINFO info = {0}; | 57 OSVERSIONINFO info = {0}; |
| 69 info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); | 58 info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
| 70 GetVersionEx(&info); | 59 GetVersionEx(&info); |
| 71 | 60 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 int32 *bugfix_version) { | 99 int32 *bugfix_version) { |
| 111 OSVERSIONINFO info = {0}; | 100 OSVERSIONINFO info = {0}; |
| 112 info.dwOSVersionInfoSize = sizeof(info); | 101 info.dwOSVersionInfoSize = sizeof(info); |
| 113 GetVersionEx(&info); | 102 GetVersionEx(&info); |
| 114 *major_version = info.dwMajorVersion; | 103 *major_version = info.dwMajorVersion; |
| 115 *minor_version = info.dwMinorVersion; | 104 *minor_version = info.dwMinorVersion; |
| 116 *bugfix_version = 0; | 105 *bugfix_version = 0; |
| 117 } | 106 } |
| 118 | 107 |
| 119 } // namespace base | 108 } // namespace base |
| OLD | NEW |