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 | 11 |
12 namespace base { | 12 namespace base { |
13 namespace win { | 13 namespace win { |
14 class PEImage; | 14 class PEImage; |
15 class PEImageAsData; | 15 class PEImageAsData; |
16 } // namespace win | 16 } // namespace win |
17 } // namespace base | 17 } // namespace base |
18 | 18 |
19 namespace safe_browsing { | 19 namespace safe_browsing { |
20 | 20 |
21 // The max number of test dlls in |test_dll_names|. | |
csharp
2014/08/05 15:46:33
Lines 21->33 seem to be just for tests, can they b
grt (UTC plus 2)
2014/08/05 16:04:54
yes, please move as much of this as possible into
krstnmnlsn
2014/08/05 23:07:25
Okay cool. _util made.
| |
22 const int kTestDllsMaxCount = 5; | |
grt (UTC plus 2)
2014/08/05 16:04:54
i think this can be safely removed. there are ways
krstnmnlsn
2014/08/05 23:07:25
Done.
| |
23 | |
24 // The test dlls used by module_integrity_verifier_win_unittest.cc and | |
25 // environment_data_collection_win_unittest.cc. The tests assume there exists | |
26 // at least one entry. | |
27 const wchar_t* test_dll_names[]; | |
28 | |
29 // Returns the number of names in |test_dll_names|. | |
30 int TestDllsCount(); | |
31 | |
32 // A function exported by the test dlls in |test_dll_names|. | |
33 const char kTestExportName[] = "DummyExport"; | |
34 | |
35 // The max number of modules in |modules_to_verify|. | |
36 const int kModulesToVerifyMaxCount = 5; | |
37 | |
38 // The modules on which we will run VerifyModule. | |
39 const wchar_t* modules_to_verify[]; | |
40 | |
41 // Returns the number of names in |modules_to_verify|. | |
42 int ModulesToVerifyCount(); | |
43 | |
21 // This enum defines the possible module states VerifyModule can return. | 44 // This enum defines the possible module states VerifyModule can return. |
22 enum ModuleState { | 45 enum ModuleState { |
23 MODULE_STATE_UNKNOWN, | 46 MODULE_STATE_UNKNOWN, |
24 MODULE_STATE_UNMODIFIED, | 47 MODULE_STATE_UNMODIFIED, |
25 MODULE_STATE_MODIFIED, | 48 MODULE_STATE_MODIFIED, |
26 }; | 49 }; |
27 | 50 |
28 // Helper to grab the addresses and size of the code section of a PEImage. | 51 // Helper to grab the addresses and size of the code section of a PEImage. |
29 // Returns two addresses: one for the dll loaded as a library, the other for the | 52 // Returns two addresses: one for the dll loaded as a library, the other for the |
30 // dll loaded as data. | 53 // dll loaded as data. |
31 bool GetCodeAddrsAndSize(const base::win::PEImage& mem_peimage, | 54 bool GetCodeAddrsAndSize(const base::win::PEImage& mem_peimage, |
32 const base::win::PEImageAsData& disk_peimage, | 55 const base::win::PEImageAsData& disk_peimage, |
33 uint8_t** mem_code_addr, | 56 uint8_t** mem_code_addr, |
34 uint8_t** disk_code_addr, | 57 uint8_t** disk_code_addr, |
35 uint32_t* code_size); | 58 uint32_t* code_size); |
36 | 59 |
37 // Examines the code section of the given module in memory and on disk, looking | 60 // Examines the code section of the given module in memory and on disk, looking |
38 // for unexpected differences. Returns a ModuleState and and a set of the | 61 // for unexpected differences. Returns a ModuleState and and a set of the |
39 // possibly modified exports. | 62 // possibly modified exports. |
40 ModuleState VerifyModule(const wchar_t* module_name, | 63 ModuleState VerifyModule(const wchar_t* module_name, |
41 std::set<std::string>* modified_exports); | 64 std::set<std::string>* modified_exports); |
42 | 65 |
43 } // namespace safe_browsing | 66 } // namespace safe_browsing |
44 | 67 |
45 #endif // CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ | 68 #endif // CHROME_BROWSER_SAFE_BROWSING_MODULE_INTEGRITY_VERIFIER_WIN_H_ |
OLD | NEW |