Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: chrome/installer/util/install_util.cc

Issue 8337006: base/win: small improvement to RegKey API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apply grt comments Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 368 }
369 369
370 // This method tries to delete a registry value and logs an error message 370 // This method tries to delete a registry value and logs an error message
371 // in case of failure. It returns true if deletion is successful, 371 // in case of failure. It returns true if deletion is successful,
372 // otherwise false. 372 // otherwise false.
373 bool InstallUtil::DeleteRegistryValue(HKEY reg_root, 373 bool InstallUtil::DeleteRegistryValue(HKEY reg_root,
374 const std::wstring& key_path, 374 const std::wstring& key_path,
375 const std::wstring& value_name) { 375 const std::wstring& value_name) {
376 RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS); 376 RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS);
377 VLOG(1) << "Deleting registry value " << value_name; 377 VLOG(1) << "Deleting registry value " << value_name;
378 if (key.ValueExists(value_name.c_str())) { 378 if (key.HasValue(value_name.c_str())) {
379 LONG result = key.DeleteValue(value_name.c_str()); 379 LONG result = key.DeleteValue(value_name.c_str());
380 if (result != ERROR_SUCCESS) { 380 if (result != ERROR_SUCCESS) {
381 LOG(ERROR) << "Failed to delete registry value: " << value_name 381 LOG(ERROR) << "Failed to delete registry value: " << value_name
382 << " error: " << result; 382 << " error: " << result;
383 return false; 383 return false;
384 } 384 }
385 } 385 }
386 return true; 386 return true;
387 } 387 }
388 388
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, 462 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat,
463 date_str, arraysize(date_str)); 463 date_str, arraysize(date_str));
464 if (len) { 464 if (len) {
465 --len; // Subtract terminating \0. 465 --len; // Subtract terminating \0.
466 } else { 466 } else {
467 PLOG(DFATAL) << "GetDateFormat"; 467 PLOG(DFATAL) << "GetDateFormat";
468 } 468 }
469 469
470 return std::wstring(date_str, len); 470 return std::wstring(date_str, len);
471 } 471 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_update_settings.cc ('k') | chrome/installer/util/install_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698