OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file was adapted from GreenBorder's Code. | 5 // This file was adapted from GreenBorder's Code. |
6 // To understand what this class is about (for other than well known functions | 6 // To understand what this class is about (for other than well known functions |
7 // as GetProcAddress), a good starting point is "An In-Depth Look into the | 7 // as GetProcAddress), a good starting point is "An In-Depth Look into the |
8 // Win32 Portable Executable File Format" by Matt Pietrek: | 8 // Win32 Portable Executable File Format" by Matt Pietrek: |
9 // http://msdn.microsoft.com/msdnmag/issues/02/02/PE/default.aspx | 9 // http://msdn.microsoft.com/msdnmag/issues/02/02/PE/default.aspx |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Post: 'e' is a pointer to the export directory entry | 139 // Post: 'e' is a pointer to the export directory entry |
140 // that contains 'f's export RVA, or NULL if 'f' | 140 // that contains 'f's export RVA, or NULL if 'f' |
141 // is not exported from this image | 141 // is not exported from this image |
142 PDWORD GetExportEntry(LPCSTR name) const; | 142 PDWORD GetExportEntry(LPCSTR name) const; |
143 | 143 |
144 // Returns the address for a given exported symbol. | 144 // Returns the address for a given exported symbol. |
145 // Use: p = image.GetProcAddress(f); | 145 // Use: p = image.GetProcAddress(f); |
146 // Pre: 'f' is either a zero terminated string or ordinal. | 146 // Pre: 'f' is either a zero terminated string or ordinal. |
147 // Post: if 'f' is a non-forwarded export from image, 'p' is | 147 // Post: if 'f' is a non-forwarded export from image, 'p' is |
148 // the exported function. If 'f' is a forwarded export | 148 // the exported function. If 'f' is a forwarded export |
149 // then p is the special value 0xFFFFFFFF. In this case | 149 // then p is the special value -1. In this case |
150 // RVAToAddr(*GetExportEntry) can be used to resolve | 150 // RVAToAddr(*GetExportEntry) can be used to resolve |
151 // the string that describes the forward. | 151 // the string that describes the forward. |
152 FARPROC GetProcAddress(LPCSTR function_name) const; | 152 FARPROC GetProcAddress(LPCSTR function_name) const; |
153 | 153 |
154 // Retrieves the ordinal for a given exported symbol. | 154 // Retrieves the ordinal for a given exported symbol. |
155 // Returns true if the symbol was found. | 155 // Returns true if the symbol was found. |
156 bool GetProcOrdinal(LPCSTR function_name, WORD *ordinal) const; | 156 bool GetProcOrdinal(LPCSTR function_name, WORD *ordinal) const; |
157 | 157 |
158 // Enumerates PE sections. | 158 // Enumerates PE sections. |
159 // cookie is a generic cookie to pass to the callback. | 159 // cookie is a generic cookie to pass to the callback. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 inline PIMAGE_EXPORT_DIRECTORY PEImage::GetExportDirectory() const { | 257 inline PIMAGE_EXPORT_DIRECTORY PEImage::GetExportDirectory() const { |
258 return reinterpret_cast<PIMAGE_EXPORT_DIRECTORY>( | 258 return reinterpret_cast<PIMAGE_EXPORT_DIRECTORY>( |
259 GetImageDirectoryEntryAddr(IMAGE_DIRECTORY_ENTRY_EXPORT)); | 259 GetImageDirectoryEntryAddr(IMAGE_DIRECTORY_ENTRY_EXPORT)); |
260 } | 260 } |
261 | 261 |
262 } // namespace win | 262 } // namespace win |
263 } // namespace base | 263 } // namespace base |
264 | 264 |
265 #endif // BASE_WIN_PE_IMAGE_H_ | 265 #endif // BASE_WIN_PE_IMAGE_H_ |
OLD | NEW |