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 #ifndef CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 namespace win { | 14 namespace win { |
15 class PEImage; | 15 class PEImage; |
16 class PEImageAsData; | 16 class PEImageAsData; |
17 } // namespace win | 17 } // namespace win |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace safe_browsing { | 20 namespace safe_browsing { |
21 | 21 |
22 // The max number of modules in |modules_to_verify|. | |
23 const int kModulesToVerifyMaxCount = 5; | |
grt (UTC plus 2)
2014/08/06 01:28:10
remove
krstnmnlsn
2014/08/06 21:55:12
Done.
| |
24 | |
25 // The modules on which we will run VerifyModule. | |
26 const wchar_t* modules_to_verify[]; | |
grt (UTC plus 2)
2014/08/06 01:28:11
move this to the unnamed namespace of environment_
krstnmnlsn
2014/08/06 21:55:12
Done.
| |
27 | |
28 // Returns the number of names in |modules_to_verify|. | |
29 int ModulesToVerifyCount(); | |
grt (UTC plus 2)
2014/08/06 01:28:10
remove
krstnmnlsn
2014/08/06 21:55:12
Done.
| |
30 | |
22 // This enum defines the possible module states VerifyModule can return. | 31 // This enum defines the possible module states VerifyModule can return. |
23 enum ModuleState { | 32 enum ModuleState { |
24 MODULE_STATE_UNKNOWN, | 33 MODULE_STATE_UNKNOWN, |
25 MODULE_STATE_UNMODIFIED, | 34 MODULE_STATE_UNMODIFIED, |
26 MODULE_STATE_MODIFIED, | 35 MODULE_STATE_MODIFIED, |
27 }; | 36 }; |
28 | 37 |
29 // Helper to grab the addresses and size of the code section of a PEImage. | 38 // Helper to grab the addresses and size of the code section of a PEImage. |
30 // Returns two addresses: one for the dll loaded as a library, the other for the | 39 // Returns two addresses: one for the dll loaded as a library, the other for the |
31 // dll loaded as data. | 40 // dll loaded as data. |
32 bool GetCodeAddrsAndSize(const base::win::PEImage& mem_peimage, | 41 bool GetCodeAddrsAndSize(const base::win::PEImage& mem_peimage, |
33 const base::win::PEImageAsData& disk_peimage, | 42 const base::win::PEImageAsData& disk_peimage, |
34 uint8_t** mem_code_addr, | 43 uint8_t** mem_code_addr, |
35 uint8_t** disk_code_addr, | 44 uint8_t** disk_code_addr, |
36 uint32_t* code_size); | 45 uint32_t* code_size); |
37 | 46 |
38 // Examines the code section of the given module in memory and on disk, looking | 47 // Examines the code section of the given module in memory and on disk, looking |
39 // for unexpected differences. Returns a ModuleState and and a set of the | 48 // for unexpected differences. Returns a ModuleState and and a set of the |
40 // possibly modified exports. | 49 // possibly modified exports. |
41 ModuleState VerifyModule(const wchar_t* module_name, | 50 ModuleState VerifyModule(const wchar_t* module_name, |
42 std::set<std::string>* modified_exports); | 51 std::set<std::string>* modified_exports); |
43 | 52 |
44 } // namespace safe_browsing | 53 } // namespace safe_browsing |
45 | 54 |
46 #endif // CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ | 55 #endif // CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ |
OLD | NEW |