| 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 L"ntdll.dll", | 34 L"ntdll.dll", |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // Helper function for expanding all environment variables in |path|. | 37 // Helper function for expanding all environment variables in |path|. |
| 38 std::wstring ExpandEnvironmentVariables(const std::wstring& path) { | 38 std::wstring ExpandEnvironmentVariables(const std::wstring& path) { |
| 39 static const DWORD kMaxBuffer = 32 * 1024; // Max according to MSDN. | 39 static const DWORD kMaxBuffer = 32 * 1024; // Max according to MSDN. |
| 40 std::wstring path_expanded; | 40 std::wstring path_expanded; |
| 41 DWORD path_len = MAX_PATH; | 41 DWORD path_len = MAX_PATH; |
| 42 do { | 42 do { |
| 43 DWORD result = ExpandEnvironmentStrings( | 43 DWORD result = ExpandEnvironmentStrings( |
| 44 path.c_str(), WriteInto(&path_expanded, path_len), path_len); | 44 path.c_str(), base::WriteInto(&path_expanded, path_len), path_len); |
| 45 if (!result) { | 45 if (!result) { |
| 46 // Failed to expand variables. Return the original string. | 46 // Failed to expand variables. Return the original string. |
| 47 DPLOG(ERROR) << path; | 47 DPLOG(ERROR) << path; |
| 48 break; | 48 break; |
| 49 } | 49 } |
| 50 if (result <= path_len) | 50 if (result <= path_len) |
| 51 return path_expanded.substr(0, result - 1); | 51 return path_expanded.substr(0, result - 1); |
| 52 path_len = result; | 52 path_len = result; |
| 53 } while (path_len < kMaxBuffer); | 53 } while (path_len < kMaxBuffer); |
| 54 | 54 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 void CollectPlatformProcessData( | 163 void CollectPlatformProcessData( |
| 164 ClientIncidentReport_EnvironmentData_Process* process) { | 164 ClientIncidentReport_EnvironmentData_Process* process) { |
| 165 CollectDlls(process); | 165 CollectDlls(process); |
| 166 RecordLspFeature(process); | 166 RecordLspFeature(process); |
| 167 CollectDllBlacklistData(process); | 167 CollectDllBlacklistData(process); |
| 168 CollectModuleVerificationData( | 168 CollectModuleVerificationData( |
| 169 kModulesToVerify, arraysize(kModulesToVerify), process); | 169 kModulesToVerify, arraysize(kModulesToVerify), process); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace safe_browsing | 172 } // namespace safe_browsing |
| OLD | NEW |