| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 COURGETTE_IMAGE_INFO_H_ | 5 #ifndef COURGETTE_IMAGE_INFO_H_ |
| 6 #define COURGETTE_IMAGE_INFO_H_ | 6 #define COURGETTE_IMAGE_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 // Returns description of the RVA, e.g. ".text+0x1243". For debugging only. | 113 // Returns description of the RVA, e.g. ".text+0x1243". For debugging only. |
| 114 std::string DescribeRVA(RVA rva) const; | 114 std::string DescribeRVA(RVA rva) const; |
| 115 | 115 |
| 116 // Returns a pointer into the memory copy of the file format. | 116 // Returns a pointer into the memory copy of the file format. |
| 117 // FileOffsetToPointer(0) returns a pointer to the start of the file format. | 117 // FileOffsetToPointer(0) returns a pointer to the start of the file format. |
| 118 const uint8* FileOffsetToPointer(uint32 offset) const { | 118 const uint8* FileOffsetToPointer(uint32 offset) const { |
| 119 return start_ + offset; | 119 return start_ + offset; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Finds the first section at file_offset or above. | 122 // Finds the first section at file_offset or above. Does not return sections |
| 123 // that have no raw bytes in the file. |
| 123 const Section* FindNextSection(uint32 file_offset) const; | 124 const Section* FindNextSection(uint32 file_offset) const; |
| 124 // Returns Section containing the relative virtual address, or NULL if none. | 125 // Returns Section containing the relative virtual address, or NULL if none. |
| 125 const Section* RVAToSection(RVA rva) const; | 126 const Section* RVAToSection(RVA rva) const; |
| 126 | 127 |
| 127 // There are 2 'coordinate systems' for reasoning about executables. | 128 // There are 2 'coordinate systems' for reasoning about executables. |
| 128 // FileOffset - the the offset within a single .EXE or .DLL *file*. | 129 // FileOffset - the the offset within a single .EXE or .DLL *file*. |
| 129 // RVA - relative virtual address (offset within *loaded image*) | 130 // RVA - relative virtual address (offset within *loaded image*) |
| 130 // FileOffsetToRVA and RVAToFileOffset convert between these representations. | 131 // FileOffsetToRVA and RVAToFileOffset convert between these representations. |
| 131 | 132 |
| 132 RVA FileOffsetToRVA(uint32 offset) const; | 133 RVA FileOffsetToRVA(uint32 offset) const; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 191 |
| 191 private: | 192 private: |
| 192 bool ReadDataDirectory(int index, ImageDataDirectory* dir); | 193 bool ReadDataDirectory(int index, ImageDataDirectory* dir); |
| 193 bool Bad(const char *reason); | 194 bool Bad(const char *reason); |
| 194 | 195 |
| 195 DISALLOW_COPY_AND_ASSIGN(PEInfo); | 196 DISALLOW_COPY_AND_ASSIGN(PEInfo); |
| 196 }; | 197 }; |
| 197 | 198 |
| 198 } // namespace | 199 } // namespace |
| 199 #endif // COURGETTE_IMAGE_INFO_H_ | 200 #endif // COURGETTE_IMAGE_INFO_H_ |
| OLD | NEW |