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/registry.h" | 5 #include "base/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 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 DWORD count = 0; | 125 DWORD count = 0; |
126 HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, &count, NULL, NULL, | 126 HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, &count, NULL, NULL, |
127 NULL, NULL, NULL, NULL, NULL); | 127 NULL, NULL, NULL, NULL, NULL); |
128 | 128 |
129 if (result != ERROR_SUCCESS) | 129 if (result != ERROR_SUCCESS) |
130 return 0; | 130 return 0; |
131 | 131 |
132 return count; | 132 return count; |
133 } | 133 } |
134 | 134 |
| 135 RegKey::RegKey() |
| 136 : key_(NULL), |
| 137 watch_event_(0) { |
| 138 } |
| 139 |
135 RegKey::RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access) | 140 RegKey::RegKey(HKEY rootkey, const wchar_t* subkey, REGSAM access) |
136 : key_(NULL), | 141 : key_(NULL), |
137 watch_event_(0) { | 142 watch_event_(0) { |
138 if (rootkey) { | 143 if (rootkey) { |
139 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) | 144 if (access & (KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_CREATE_LINK)) |
140 Create(rootkey, subkey, access); | 145 Create(rootkey, subkey, access); |
141 else | 146 else |
142 Open(rootkey, subkey, access); | 147 Open(rootkey, subkey, access); |
143 } else { | 148 } else { |
144 DCHECK(!subkey); | 149 DCHECK(!subkey); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 372 |
368 bool RegKey::HasChanged() { | 373 bool RegKey::HasChanged() { |
369 if (watch_event_) { | 374 if (watch_event_) { |
370 if (WaitForSingleObject(watch_event_, 0) == WAIT_OBJECT_0) { | 375 if (WaitForSingleObject(watch_event_, 0) == WAIT_OBJECT_0) { |
371 StartWatching(); | 376 StartWatching(); |
372 return true; | 377 return true; |
373 } | 378 } |
374 } | 379 } |
375 return false; | 380 return false; |
376 } | 381 } |
OLD | NEW |