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 // See the corresponding header file for description of the functions in this | 5 // See the corresponding header file for description of the functions in this |
6 // file. | 6 // file. |
7 | 7 |
8 #include "chrome/installer/util/install_util.h" | 8 #include "chrome/installer/util/install_util.h" |
9 | 9 |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 196 } |
197 | 197 |
198 // This method tries to delete a registry key and logs an error message | 198 // This method tries to delete a registry key and logs an error message |
199 // in case of failure. It returns true if deletion is successful, | 199 // in case of failure. It returns true if deletion is successful, |
200 // otherwise false. | 200 // otherwise false. |
201 bool InstallUtil::DeleteRegistryKey(RegKey& root_key, | 201 bool InstallUtil::DeleteRegistryKey(RegKey& root_key, |
202 const std::wstring& key_path) { | 202 const std::wstring& key_path) { |
203 VLOG(1) << "Deleting registry key " << key_path; | 203 VLOG(1) << "Deleting registry key " << key_path; |
204 LONG result = root_key.DeleteKey(key_path.c_str()); | 204 LONG result = root_key.DeleteKey(key_path.c_str()); |
205 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { | 205 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { |
206 PLOG(ERROR) << "Failed to delete registry key: " << key_path | 206 LOG(ERROR) << "Failed to delete registry key: " << key_path |
207 << " error: " << result; | 207 << " error: " << result; |
208 return false; | 208 return false; |
209 } | 209 } |
210 return true; | 210 return true; |
211 } | 211 } |
212 | 212 |
213 // This method tries to delete a registry value and logs an error message | 213 // This method tries to delete a registry value and logs an error message |
214 // in case of failure. It returns true if deletion is successful, | 214 // in case of failure. It returns true if deletion is successful, |
215 // otherwise false. | 215 // otherwise false. |
216 bool InstallUtil::DeleteRegistryValue(HKEY reg_root, | 216 bool InstallUtil::DeleteRegistryValue(HKEY reg_root, |
217 const std::wstring& key_path, | 217 const std::wstring& key_path, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, | 270 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, |
271 date_str, arraysize(date_str)); | 271 date_str, arraysize(date_str)); |
272 if (len) { | 272 if (len) { |
273 --len; // Subtract terminating \0. | 273 --len; // Subtract terminating \0. |
274 } else { | 274 } else { |
275 PLOG(DFATAL) << "GetDateFormat"; | 275 PLOG(DFATAL) << "GetDateFormat"; |
276 } | 276 } |
277 | 277 |
278 return std::wstring(date_str, len); | 278 return std::wstring(date_str, len); |
279 } | 279 } |
OLD | NEW |