| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/install_verification/win/imported_module_verification.h
" | 5 #include "chrome/browser/install_verification/win/imported_module_verification.h
" |
| 6 | 6 |
| 7 #include <Windows.h> | 7 #include <Windows.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "chrome/browser/install_verification/win/module_info.h" | 15 #include "chrome/browser/install_verification/win/module_info.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 #if !defined(_WIN64) |
| 19 // We must make sure not to include modules here that are likely to get unloaded | 20 // We must make sure not to include modules here that are likely to get unloaded |
| 20 // because the scanning of the module is not done within a loader lock, so is | 21 // because the scanning of the module is not done within a loader lock, so is |
| 21 // not resilient to changes made to the modules list. | 22 // not resilient to changes made to the modules list. |
| 22 const wchar_t* const kModulesToScan[] = { | 23 const wchar_t* const kModulesToScan[] = { |
| 23 L"chrome.dll", | 24 L"chrome.dll", |
| 24 L"kernel32.dll", | 25 L"kernel32.dll", |
| 25 L"user32.dll" | 26 L"user32.dll" |
| 26 }; | 27 }; |
| 28 #endif // !defined(_WIN64) |
| 27 | 29 |
| 28 bool AddressBeyondRange(const ModuleInfo& module, uintptr_t address) { | 30 bool AddressBeyondRange(const ModuleInfo& module, uintptr_t address) { |
| 29 return module.base_address + module.size < address; | 31 return module.base_address + module.size < address; |
| 30 } | 32 } |
| 31 | 33 |
| 32 void ScanImportAddressTable( | 34 void ScanImportAddressTable( |
| 33 HMODULE module_handle, | 35 HMODULE module_handle, |
| 34 const std::set<ModuleInfo>& loaded_modules, | 36 const std::set<ModuleInfo>& loaded_modules, |
| 35 std::set<base::string16>* imported_modules) { | 37 std::set<base::string16>* imported_modules) { |
| 36 DCHECK(module_handle); | 38 DCHECK(module_handle); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 93 } |
| 92 | 94 |
| 93 std::vector<std::string> module_name_digests; | 95 std::vector<std::string> module_name_digests; |
| 94 std::transform(imported_module_names.begin(), | 96 std::transform(imported_module_names.begin(), |
| 95 imported_module_names.end(), | 97 imported_module_names.end(), |
| 96 std::back_inserter(module_name_digests), | 98 std::back_inserter(module_name_digests), |
| 97 &CalculateModuleNameDigest); | 99 &CalculateModuleNameDigest); |
| 98 ReportModuleMatches(module_name_digests, module_ids, delegate); | 100 ReportModuleMatches(module_name_digests, module_ids, delegate); |
| 99 #endif | 101 #endif |
| 100 } | 102 } |
| OLD | NEW |