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.
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MODULE_INTEGRITY_VERIFIER_WIN_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MODULE_INTEGRITY_VERIFIER_WIN_H_
13 #include "chrome/common/safe_browsing/csd.pb.h"
22 namespace safe_browsing
{
24 // This enum defines the possible module states VerifyModule can return.
27 MODULE_STATE_UNMODIFIED
,
28 MODULE_STATE_MODIFIED
,
31 struct VerificationResult
{
33 // The number of bytes with different values on disk and in memory.
34 int num_bytes_different
;
35 // True if the relocations were ordered and the verification was fully
37 bool verification_completed
;
40 // Helper to grab the addresses and size of the code section of a PEImage.
41 // Returns two addresses: one for the dll loaded as a library, the other for the
42 // dll loaded as data.
43 bool GetCodeAddrsAndSize(const base::win::PEImage
& mem_peimage
,
44 const base::win::PEImageAsData
& disk_peimage
,
45 uint8_t** mem_code_addr
,
46 uint8_t** disk_code_addr
,
49 // Examines the code section of the given module in memory and on disk, looking
50 // for unexpected differences. Returns a ModuleState and and a set of the
51 // possibly modified exports.
52 ModuleState
VerifyModule(const wchar_t* module_name
,
53 std::set
<std::string
>* modified_exports
,
54 int* num_bytes_different
);
56 // Examines the code section of the given module in memory and on disk, looking
57 // for unexpected differences and populating |module_state| in the process.
58 VerificationResult
NewVerifyModule(
59 const wchar_t* module_name
,
60 ClientIncidentReport_EnvironmentData_Process_ModuleState
* module_state
);
62 } // namespace safe_browsing
64 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_MODULE_INTEGRITY_VERIFIER_WIN_H_