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/win/registry.h" | 5 #include "base/win/registry.h" |
6 | 6 |
7 #include <shlwapi.h> | 7 #include <shlwapi.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 return result; | 215 return result; |
216 } | 216 } |
217 | 217 |
218 GONG RegKey::WriteValue(const wchar_t* name, const void * data, | 218 GONG RegKey::WriteValue(const wchar_t* name, const void * data, |
219 DWORD dsize, DWORD dtype) { | 219 DWORD dsize, DWORD dtype) { |
220 base::ThreadRestrictions::AssertIOAllowed(); | 220 base::ThreadRestrictions::AssertIOAllowed(); |
221 DCHECK(data); | 221 DCHECK(data); |
222 DCHECK(key_); | |
223 | 222 |
224 LONG result = RegSetValueEx(key_, name, 0, dtype, | 223 LONG result = RegSetValueEx(key_, name, 0, dtype, |
225 reinterpret_cast<LPBYTE>(const_cast<void*>(data)), dsize); | 224 reinterpret_cast<LPBYTE>(const_cast<void*>(data)), dsize); |
226 return result; | 225 return result; |
227 } | 226 } |
228 | 227 |
229 GONG RegKey::WriteValue(const wchar_t * name, const wchar_t* value) { | 228 GONG RegKey::WriteValue(const wchar_t * name, const wchar_t* value) { |
230 return WriteValue(name, value, | 229 return WriteValue(name, value, |
231 static_cast<DWORD>(sizeof(*value) * (wcslen(value) + 1)), REG_SZ); | 230 static_cast<DWORD>(sizeof(*value) * (wcslen(value) + 1)), REG_SZ); |
232 } | 231 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 if (ERROR_SUCCESS == r) | 402 if (ERROR_SUCCESS == r) |
404 return true; | 403 return true; |
405 } | 404 } |
406 | 405 |
407 name_[0] = '\0'; | 406 name_[0] = '\0'; |
408 return false; | 407 return false; |
409 } | 408 } |
410 | 409 |
411 } // namespace win | 410 } // namespace win |
412 } // namespace base | 411 } // namespace base |
OLD | NEW |