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

Unified Diff: base/registry_store.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/registry_store.h ('k') | base/registry_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/registry_store.cc
diff --git a/base/registry_store.cc b/base/registry_store.cc
deleted file mode 100644
index ccfb6a30afc945256921f614e5ae00cc44c4c99b..0000000000000000000000000000000000000000
--- a/base/registry_store.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#include "omaha/base/registry_store.h"
-#include <vector>
-#include "omaha/base/debug.h"
-#include "omaha/base/reg_key.h"
-
-namespace omaha {
-
-bool RegistryStore::Open(const TCHAR* key_path) {
- key_path_ = key_path;
- return true;
-}
-
-bool RegistryStore::Close() {
- key_path_.Empty();
- return true;
-}
-
-bool RegistryStore::Clear() {
- if (RegKey::HasKey(key_path_)) {
- return SUCCEEDED(RegKey::DeleteKey(key_path_, false));
- } else {
- return true;
- }
-}
-
-bool RegistryStore::Read(const TCHAR* name, std::vector<byte>* data) const {
- ASSERT1(name);
- ASSERT1(data);
-
- byte* sdata = NULL;
- DWORD sdata_size = 0;
- HRESULT hr = RegKey::GetValue(key_path_, name, &sdata, &sdata_size);
- if (FAILED(hr) || !sdata || !sdata_size)
- return false;
-
- data->resize(sdata_size);
- memcpy(&data->front(), sdata, sdata_size);
-
- delete[] sdata;
-
- return true;
-}
-
-bool RegistryStore::Write(const TCHAR* name, byte* data, int data_size) {
- ASSERT1(name);
- ASSERT1(data);
- ASSERT1(data_size);
-
- return SUCCEEDED(RegKey::SetValue(key_path_, name, data, data_size));
-}
-
-bool RegistryStore::Exists(const TCHAR* name) {
- ASSERT1(name);
-
- return RegKey::HasValue(key_path_, name);
-}
-
-bool RegistryStore::Remove(const TCHAR* name) {
- ASSERT1(name);
-
- return SUCCEEDED(RegKey::DeleteValue(key_path_, name));
-}
-
-bool RegistryStore::GetValueCount(uint32* value_count) {
- ASSERT1(value_count);
-
- CString key_name(key_path_);
- HKEY h_key = RegKey::GetRootKeyInfo(&key_name);
-
- RegKey reg_key;
- if (FAILED(reg_key.Open(h_key, key_name.GetString(), KEY_READ)))
- return false;
-
- *value_count = reg_key.GetValueCount();
-
- reg_key.Close();
-
- return true;
-}
-
-bool RegistryStore::GetValueNameAt(int index, CString* value_name) {
- ASSERT1(index >= 0);
- ASSERT1(value_name);
-
- CString key_name(key_path_);
- HKEY h_key = RegKey::GetRootKeyInfo(&key_name);
-
- RegKey reg_key;
- if (FAILED(reg_key.Open(h_key, key_name.GetString(), KEY_READ)))
- return false;
-
- HRESULT hr = reg_key.GetValueNameAt(index, value_name, NULL);
-
- reg_key.Close();
-
- return SUCCEEDED(hr);
-}
-
-} // namespace omaha
-
« no previous file with comments | « base/registry_store.h ('k') | base/registry_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698