| OLD | NEW |
| 1 // Copyright 2015 Google Inc. All Rights Reserved. | 1 // Copyright 2015 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 size_t max_versions) | 52 size_t max_versions) |
| 53 : max_days_in_registry_(max_days_in_registry), | 53 : max_days_in_registry_(max_days_in_registry), |
| 54 max_entries_per_version_(max_entries_per_version), | 54 max_entries_per_version_(max_entries_per_version), |
| 55 max_modules_(max_modules), | 55 max_modules_(max_modules), |
| 56 max_versions_(max_versions), | 56 max_versions_(max_versions), |
| 57 registry_cache_key_(kRegistryBaseKey), | 57 registry_cache_key_(kRegistryBaseKey), |
| 58 is_init_(false) { | 58 is_init_(false) { |
| 59 registry_cache_key_.append(registry_name); | 59 registry_cache_key_.append(registry_name); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // static |
| 63 bool RegistryCache::RegistryAvailable() { |
| 64 base::win::RegKey test_key(kRegistryRootKey, L"SYSTEM", KEY_ALL_ACCESS); |
| 65 if (!test_key.Valid()) |
| 66 return false; |
| 67 test_key.Close(); |
| 68 return true; |
| 69 } |
| 70 |
| 62 bool RegistryCache::Init() { | 71 bool RegistryCache::Init() { |
| 72 DCHECK(RegistryAvailable()); |
| 73 |
| 63 // Always start by cleaning up the values, to limit the size of entries in | 74 // Always start by cleaning up the values, to limit the size of entries in |
| 64 // the registry. | 75 // the registry. |
| 65 CleanUp(); | 76 CleanUp(); |
| 66 // We can fail if we are not able to initialize the module information. | 77 // We can fail if we are not able to initialize the module information. |
| 67 is_init_ = InitModuleInfo(); | 78 is_init_ = InitModuleInfo(); |
| 68 if (!is_init_) | 79 if (!is_init_) |
| 69 return false; | 80 return false; |
| 70 LoadEntries(); | 81 LoadEntries(); |
| 71 return true; | 82 return true; |
| 72 } | 83 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 for (RegValueIter iter(kRegistryRootKey, module_key_name_.c_str()); | 289 for (RegValueIter iter(kRegistryRootKey, module_key_name_.c_str()); |
| 279 iter.Valid(); ++iter) { | 290 iter.Valid(); ++iter) { |
| 280 DCHECK_EQ(sizeof(StackId), iter.ValueSize()); | 291 DCHECK_EQ(sizeof(StackId), iter.ValueSize()); |
| 281 const StackId* ptr_value = reinterpret_cast<const StackId*>(iter.Value()); | 292 const StackId* ptr_value = reinterpret_cast<const StackId*>(iter.Value()); |
| 282 entries_.insert(*ptr_value); | 293 entries_.insert(*ptr_value); |
| 283 } | 294 } |
| 284 } | 295 } |
| 285 | 296 |
| 286 } // namespace asan | 297 } // namespace asan |
| 287 } // namespace agent | 298 } // namespace agent |
| OLD | NEW |