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/registry.h" | 5 #include "base/win/registry.h" |
6 | 6 |
7 #include <shlwapi.h> | 7 #include <shlwapi.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return result; | 217 return result; |
218 } | 218 } |
219 | 219 |
220 LONG RegKey::ReadValues(const wchar_t* name, | 220 LONG RegKey::ReadValues(const wchar_t* name, |
221 std::vector<std::wstring>* values) { | 221 std::vector<std::wstring>* values) { |
222 base::ThreadRestrictions::AssertIOAllowed(); | 222 base::ThreadRestrictions::AssertIOAllowed(); |
223 values->clear(); | 223 values->clear(); |
224 | 224 |
225 DWORD type = REG_MULTI_SZ; | 225 DWORD type = REG_MULTI_SZ; |
226 DWORD size = 0; | 226 DWORD size = 0; |
227 LONG result = ReadValue(name, NULL, &size, NULL); | 227 LONG result = ReadValue(name, NULL, &size, &type); |
228 if (FAILED(result) || size == 0) | 228 if (FAILED(result) || size == 0) |
229 return result; | 229 return result; |
230 | 230 |
231 if (type != REG_MULTI_SZ) | 231 if (type != REG_MULTI_SZ) |
232 return ERROR_CANTREAD; | 232 return ERROR_CANTREAD; |
233 | 233 |
234 std::vector<wchar_t> buffer(size / sizeof(wchar_t)); | 234 std::vector<wchar_t> buffer(size / sizeof(wchar_t)); |
235 result = ReadValue(name, &buffer[0], &size, NULL); | 235 result = ReadValue(name, &buffer[0], &size, NULL); |
236 if (FAILED(result) || size == 0) | 236 if (FAILED(result) || size == 0) |
237 return result; | 237 return result; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 if (ERROR_SUCCESS == r) | 439 if (ERROR_SUCCESS == r) |
440 return true; | 440 return true; |
441 } | 441 } |
442 | 442 |
443 name_[0] = '\0'; | 443 name_[0] = '\0'; |
444 return false; | 444 return false; |
445 } | 445 } |
446 | 446 |
447 } // namespace win | 447 } // namespace win |
448 } // namespace base | 448 } // namespace base |
OLD | NEW |