OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/safe_browsing/incident_reporting/environment_data_colle
ction_win.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/environment_data_colle
ction_win.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 // Look for a match between LSPs and loaded dlls. | 228 // Look for a match between LSPs and loaded dlls. |
229 for (int i = 0; i < process->dll_size(); ++i) { | 229 for (int i = 0; i < process->dll_size(); ++i) { |
230 if (lsp_paths.count(base::UTF8ToWide(process->dll(i).path()))) { | 230 if (lsp_paths.count(base::UTF8ToWide(process->dll(i).path()))) { |
231 process->mutable_dll(i) | 231 process->mutable_dll(i) |
232 ->add_feature(ClientIncidentReport_EnvironmentData_Process_Dll::LSP); | 232 ->add_feature(ClientIncidentReport_EnvironmentData_Process_Dll::LSP); |
233 } | 233 } |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 void CollectDllBlacklistData( | |
238 ClientIncidentReport_EnvironmentData_Process* process) { | |
239 PathSanitizer path_sanitizer; | |
240 base::win::RegistryValueIterator iter(HKEY_CURRENT_USER, | |
241 blacklist::kRegistryFinchListPath); | |
242 for (; iter.Valid(); ++iter) { | |
243 base::FilePath dll_name(iter.Value()); | |
244 path_sanitizer.StripHomeDirectory(&dll_name); | |
245 process->add_blacklisted_dll(dll_name.AsUTF8Unsafe()); | |
246 } | |
247 } | |
248 | |
249 void CollectModuleVerificationData( | 237 void CollectModuleVerificationData( |
250 const wchar_t* const modules_to_verify[], | 238 const wchar_t* const modules_to_verify[], |
251 size_t num_modules_to_verify, | 239 size_t num_modules_to_verify, |
252 ClientIncidentReport_EnvironmentData_Process* process) { | 240 ClientIncidentReport_EnvironmentData_Process* process) { |
253 #if !defined(_WIN64) | 241 #if !defined(_WIN64) |
254 using ModuleState = ClientIncidentReport_EnvironmentData_Process_ModuleState; | 242 using ModuleState = ClientIncidentReport_EnvironmentData_Process_ModuleState; |
255 | 243 |
256 for (size_t i = 0; i < num_modules_to_verify; ++i) { | 244 for (size_t i = 0; i < num_modules_to_verify; ++i) { |
257 std::unique_ptr<ModuleState> module_state(new ModuleState()); | 245 std::unique_ptr<ModuleState> module_state(new ModuleState()); |
258 | 246 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 292 |
305 void CollectDomainEnrollmentData( | 293 void CollectDomainEnrollmentData( |
306 ClientIncidentReport_EnvironmentData_OS* os_data) { | 294 ClientIncidentReport_EnvironmentData_OS* os_data) { |
307 os_data->set_is_enrolled_to_domain(base::win::IsEnrolledToDomain()); | 295 os_data->set_is_enrolled_to_domain(base::win::IsEnrolledToDomain()); |
308 } | 296 } |
309 | 297 |
310 void CollectPlatformProcessData( | 298 void CollectPlatformProcessData( |
311 ClientIncidentReport_EnvironmentData_Process* process) { | 299 ClientIncidentReport_EnvironmentData_Process* process) { |
312 CollectDlls(process); | 300 CollectDlls(process); |
313 RecordLspFeature(process); | 301 RecordLspFeature(process); |
314 CollectDllBlacklistData(process); | |
315 CollectModuleVerificationData( | 302 CollectModuleVerificationData( |
316 kModulesToVerify, arraysize(kModulesToVerify), process); | 303 kModulesToVerify, arraysize(kModulesToVerify), process); |
317 } | 304 } |
318 | 305 |
319 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) { | 306 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) { |
320 const std::string reg_data_param_value = variations::GetVariationParamValue( | 307 const std::string reg_data_param_value = variations::GetVariationParamValue( |
321 "SafeBrowsingIncidentReportingService", "collect_reg_data"); | 308 "SafeBrowsingIncidentReportingService", "collect_reg_data"); |
322 if (reg_data_param_value == "true") { | 309 if (reg_data_param_value == "true") { |
323 CollectRegistryData(kRegKeysToCollect, arraysize(kRegKeysToCollect), | 310 CollectRegistryData(kRegKeysToCollect, arraysize(kRegKeysToCollect), |
324 os_data->mutable_registry_key()); | 311 os_data->mutable_registry_key()); |
325 } | 312 } |
326 CollectDomainEnrollmentData(os_data); | 313 CollectDomainEnrollmentData(os_data); |
327 } | 314 } |
328 } // namespace safe_browsing | 315 } // namespace safe_browsing |
OLD | NEW |