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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/memory_mapped_file.h" | 10 #include "base/files/memory_mapped_file.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/scoped_native_library.h" | 12 #include "base/scoped_native_library.h" |
13 #include "base/win/pe_image.h" | 13 #include "base/win/pe_image.h" |
14 | 14 |
15 namespace safe_browsing { | 15 namespace safe_browsing { |
16 | 16 |
17 const wchar_t* test_dll_names[kTestDllsMaxCount] = { | |
csharp
2014/08/05 15:46:33
Same comment about test data (lines 17->28)
krstnmnlsn
2014/08/05 23:07:25
Done.
| |
18 L"verifier_test_dll_1.dll", | |
19 L"verifier_test_dll_2.dll", | |
20 NULL, | |
21 }; | |
22 | |
23 int TestDllsCount() { | |
24 int i = 0; | |
25 while (test_dll_names[i] != NULL) | |
26 ++i; | |
27 return i; | |
28 } | |
29 | |
30 const wchar_t* modules_to_verify[kModulesToVerifyMaxCount] = { | |
31 L"chrome.dll", | |
32 L"chrome_elf.dll", | |
33 L"ntdll.dll", | |
34 NULL, | |
35 }; | |
36 | |
37 int ModulesToVerifyCount() { | |
38 int i = 0; | |
39 while (modules_to_verify[i] != NULL) | |
40 ++i; | |
41 return i; | |
42 } | |
43 | |
17 struct ModuleVerificationState { | 44 struct ModuleVerificationState { |
18 explicit ModuleVerificationState(HMODULE hModule); | 45 explicit ModuleVerificationState(HMODULE hModule); |
19 ~ModuleVerificationState(); | 46 ~ModuleVerificationState(); |
20 | 47 |
21 base::win::PEImageAsData disk_peimage; | 48 base::win::PEImageAsData disk_peimage; |
22 | 49 |
23 // The module's preferred base address minus the base address it actually | 50 // The module's preferred base address minus the base address it actually |
24 // loaded at. | 51 // loaded at. |
25 uintptr_t image_base_delta; | 52 uintptr_t image_base_delta; |
26 | 53 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 exports, | 314 exports, |
288 &state, | 315 &state, |
289 modified_exports); | 316 modified_exports); |
290 | 317 |
291 if (num_bytes_different == 0) | 318 if (num_bytes_different == 0) |
292 return MODULE_STATE_UNMODIFIED; | 319 return MODULE_STATE_UNMODIFIED; |
293 return MODULE_STATE_MODIFIED; | 320 return MODULE_STATE_MODIFIED; |
294 } | 321 } |
295 | 322 |
296 } // namespace safe_browsing | 323 } // namespace safe_browsing |
OLD | NEW |