OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ | 5 #ifndef CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ |
6 #define CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ | 6 #define CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 | 9 |
10 // Represents and facilitates operations on the address range corresponding to a | 10 // Represents and facilitates operations on the address range corresponding to a |
11 // loaded module. | 11 // loaded module. |
12 struct ModuleInfo { | 12 struct ModuleInfo { |
13 ModuleInfo() : base_address(0), size(0) { | 13 ModuleInfo() : base_address(0), size(0) { |
14 } | 14 } |
15 | 15 |
16 ModuleInfo(const base::char16* const module_name, | 16 ModuleInfo(const base::char16* const module_name, |
17 uintptr_t module_base_address, | 17 uintptr_t module_base_address, |
18 uint32_t module_size) | 18 uint32_t module_size) |
19 : base_address(module_base_address), | 19 : name(module_name), |
20 size(module_size), | 20 base_address(module_base_address), |
21 name(module_name) { | 21 size(module_size) {} |
22 } | |
23 | 22 |
24 // Sorts modules by their base address. | 23 // Sorts modules by their base address. |
25 bool operator< (const ModuleInfo& compare) const { | 24 bool operator< (const ModuleInfo& compare) const { |
26 return base_address < compare.base_address; | 25 return base_address < compare.base_address; |
27 } | 26 } |
28 | 27 |
29 // Identifies if an address is within a module. | 28 // Identifies if an address is within a module. |
30 bool ContainsAddress(uintptr_t address) const { | 29 bool ContainsAddress(uintptr_t address) const { |
31 return address >= base_address && address < base_address + size; | 30 return address >= base_address && address < base_address + size; |
32 } | 31 } |
33 | 32 |
34 base::string16 name; | 33 base::string16 name; |
35 uintptr_t base_address; | 34 uintptr_t base_address; |
36 uint32_t size; | 35 uint32_t size; |
37 }; | 36 }; |
38 | 37 |
39 #endif // CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ | 38 #endif // CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_INFO_H_ |
OLD | NEW |