| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_version_info_win.h" | 5 #include "base/file_version_info_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return GetStringValue(L"LastChange"); | 142 return GetStringValue(L"LastChange"); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool FileVersionInfoWin::is_official_build() { | 145 bool FileVersionInfoWin::is_official_build() { |
| 146 return (GetStringValue(L"Official Build").compare(L"1") == 0); | 146 return (GetStringValue(L"Official Build").compare(L"1") == 0); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool FileVersionInfoWin::GetValue(const wchar_t* name, | 149 bool FileVersionInfoWin::GetValue(const wchar_t* name, |
| 150 std::wstring* value_str) { | 150 std::wstring* value_str) { |
| 151 WORD lang_codepage[8]; | 151 WORD lang_codepage[8]; |
| 152 int i = 0; | 152 size_t i = 0; |
| 153 // Use the language and codepage from the DLL. | 153 // Use the language and codepage from the DLL. |
| 154 lang_codepage[i++] = language_; | 154 lang_codepage[i++] = language_; |
| 155 lang_codepage[i++] = code_page_; | 155 lang_codepage[i++] = code_page_; |
| 156 // Use the default language and codepage from the DLL. | 156 // Use the default language and codepage from the DLL. |
| 157 lang_codepage[i++] = ::GetUserDefaultLangID(); | 157 lang_codepage[i++] = ::GetUserDefaultLangID(); |
| 158 lang_codepage[i++] = code_page_; | 158 lang_codepage[i++] = code_page_; |
| 159 // Use the language from the DLL and Latin codepage (most common). | 159 // Use the language from the DLL and Latin codepage (most common). |
| 160 lang_codepage[i++] = language_; | 160 lang_codepage[i++] = language_; |
| 161 lang_codepage[i++] = 1252; | 161 lang_codepage[i++] = 1252; |
| 162 // Use the default language and Latin codepage (most common). | 162 // Use the default language and Latin codepage (most common). |
| (...skipping 18 matching lines...) Expand all Loading... |
| 181 return false; | 181 return false; |
| 182 } | 182 } |
| 183 | 183 |
| 184 std::wstring FileVersionInfoWin::GetStringValue(const wchar_t* name) { | 184 std::wstring FileVersionInfoWin::GetStringValue(const wchar_t* name) { |
| 185 std::wstring str; | 185 std::wstring str; |
| 186 if (GetValue(name, &str)) | 186 if (GetValue(name, &str)) |
| 187 return str; | 187 return str; |
| 188 else | 188 else |
| 189 return L""; | 189 return L""; |
| 190 } | 190 } |
| OLD | NEW |