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/module_integrity_verifier_win.h" | 5 #include "chrome/browser/safe_browsing/module_integrity_verifier_win.h" |
6 | 6 |
7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/scoped_native_library.h" | 11 #include "base/scoped_native_library.h" |
12 #include "base/win/pe_image.h" | 12 #include "base/win/pe_image.h" |
13 | 13 |
14 namespace safe_browsing { | 14 namespace safe_browsing { |
15 | 15 |
| 16 const wchar_t* modules_to_verify[kModulesToVerifyMaxCount] = { |
| 17 L"chrome.dll", |
| 18 L"chrome_elf.dll", |
| 19 L"ntdll.dll", |
| 20 NULL, |
| 21 }; |
| 22 |
| 23 int ModulesToVerifyCount() { |
| 24 int i = 0; |
| 25 while (modules_to_verify[i] != NULL) |
| 26 ++i; |
| 27 return i; |
| 28 } |
| 29 |
16 struct ModuleVerificationState { | 30 struct ModuleVerificationState { |
17 explicit ModuleVerificationState(HMODULE hModule); | 31 explicit ModuleVerificationState(HMODULE hModule); |
18 ~ModuleVerificationState(); | 32 ~ModuleVerificationState(); |
19 | 33 |
20 base::win::PEImageAsData disk_peimage; | 34 base::win::PEImageAsData disk_peimage; |
21 | 35 |
22 // The module's preferred base address minus the base address it actually | 36 // The module's preferred base address minus the base address it actually |
23 // loaded at. | 37 // loaded at. |
24 intptr_t image_base_delta; | 38 intptr_t image_base_delta; |
25 | 39 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 mem_code_addr, | 303 mem_code_addr, |
290 code_size, | 304 code_size, |
291 exports, | 305 exports, |
292 &state, | 306 &state, |
293 modified_exports); | 307 modified_exports); |
294 | 308 |
295 return num_bytes_different ? MODULE_STATE_MODIFIED : MODULE_STATE_UNMODIFIED; | 309 return num_bytes_different ? MODULE_STATE_MODIFIED : MODULE_STATE_UNMODIFIED; |
296 } | 310 } |
297 | 311 |
298 } // namespace safe_browsing | 312 } // namespace safe_browsing |
OLD | NEW |