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