OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ |
| 7 |
| 8 #include <windows.h> |
| 9 #include <psapi.h> |
| 10 |
| 11 #include "base/files/file_path.h" |
| 12 #include "base/files/memory_mapped_file.h" |
| 13 #include "base/scoped_native_library.h" |
| 14 #include "base/win/pe_image.h" |
| 15 |
| 16 namespace safe_browsing { |
| 17 |
| 18 // This enum defines the possible module states VerifyModule can return. |
| 19 enum ModuleState { |
| 20 MODULE_STATE_UNKNOWN, |
| 21 MODULE_STATE_UNMODIFIED, |
| 22 MODULE_STATE_MODIFIED, |
| 23 }; |
| 24 |
| 25 // Helper to grab the addresses and size of the code section of a PEImage. |
| 26 // Returns two addresses: one for the dll loaded as a library, the other for the |
| 27 // dll loaded as data. |
| 28 bool GetCodeAddrsAndSize(const base::win::PEImage& mem_peimage, |
| 29 const base::win::PEImageAsData& disk_peimage, |
| 30 BYTE** mem_code_addr, |
| 31 BYTE** disk_code_addr, |
| 32 SIZE_T* code_size); |
| 33 |
| 34 // Helper to count the number of bytes differing between two pointers. |
| 35 int CountBytesDiffInPtr(intptr_t num_a, intptr_t num_b); |
| 36 |
| 37 // Examines the code section of the given module in memory and on disk, looking |
| 38 // for unexpected differences. |
| 39 ModuleState VerifyModule(const wchar_t* module_name); |
| 40 |
| 41 } // namespace safe_browsing |
| 42 |
| 43 #endif // CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_H_ |
OLD | NEW |