Chromium Code Reviews| 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> | |
|
grt (UTC plus 2)
2014/07/29 19:32:23
both of these are no longer needed if you switch a
krstnmnlsn
2014/07/30 14:34:35
Great!
| |
| 9 #include <psapi.h> | |
| 10 | |
| 11 #include "base/files/file_path.h" | |
|
grt (UTC plus 2)
2014/07/29 19:32:23
remove
krstnmnlsn
2014/07/30 14:34:35
Done.
| |
| 12 #include "base/files/memory_mapped_file.h" | |
|
grt (UTC plus 2)
2014/07/29 19:32:23
remove
krstnmnlsn
2014/07/30 14:34:36
Done.
| |
| 13 #include "base/scoped_native_library.h" | |
|
grt (UTC plus 2)
2014/07/29 19:32:23
remove
krstnmnlsn
2014/07/30 14:34:35
Had meant to remove these!
| |
| 14 #include "base/win/pe_image.h" | |
|
grt (UTC plus 2)
2014/07/29 19:32:23
forward-declare PEImage and PEImageAsData rather t
krstnmnlsn
2014/07/30 14:34:35
Done.
| |
| 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, | |
|
grt (UTC plus 2)
2014/07/29 19:32:22
is there any reason not to use const uint8_t* in p
krstnmnlsn
2014/07/30 14:34:35
Nope, done.
| |
| 31 BYTE** disk_code_addr, | |
| 32 SIZE_T* code_size); | |
|
grt (UTC plus 2)
2014/07/29 19:32:23
uint32_t (VirtualSize is always a 32-bit unsigned
krstnmnlsn
2014/07/30 14:34:35
Done.
| |
| 33 | |
| 34 // Helper to count the number of bytes differing between two pointers. | |
| 35 int CountBytesDiffInPtr(intptr_t num_a, intptr_t num_b); | |
|
grt (UTC plus 2)
2014/07/29 19:32:23
uintptr_t
krstnmnlsn
2014/07/30 14:34:35
Done.
| |
| 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 |