Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides a service to retrieve the PE/COFF entry point from a PE/COFF image.\r |
fb3df220 | 3 | \r |
412e9dea | 4 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r |
af2dc6a7 | 5 | This program and the accompanying materials are licensed and made available under \r |
6 | the terms and conditions of the BSD License that accompanies this distribution. \r | |
7 | The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php. \r | |
fb3df220 | 9 | \r |
50a64e5b | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
fb3df220 | 12 | \r |
fb3df220 | 13 | **/\r |
14 | \r | |
15 | #ifndef __PE_COFF_GET_ENTRY_POINT_LIB_H__\r | |
16 | #define __PE_COFF_GET_ENTRY_POINT_LIB_H__\r | |
17 | \r | |
18 | /**\r | |
19 | Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded\r | |
20 | into system memory with the PE/COFF Loader Library functions.\r | |
21 | \r | |
22 | Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry\r | |
23 | point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then\r | |
24 | return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS.\r | |
25 | If Pe32Data is NULL, then ASSERT().\r | |
26 | If EntryPoint is NULL, then ASSERT().\r | |
27 | \r | |
af2dc6a7 | 28 | @param Pe32Data The pointer to the PE/COFF image that is loaded in system memory.\r |
29 | @param EntryPoint The pointer to entry point to the PE/COFF image to return.\r | |
fb3df220 | 30 | \r |
31 | @retval RETURN_SUCCESS EntryPoint was returned.\r | |
32 | @retval RETURN_INVALID_PARAMETER The entry point could not be found in the PE/COFF image.\r | |
33 | \r | |
34 | **/\r | |
35 | RETURN_STATUS\r | |
36 | EFIAPI\r | |
37 | PeCoffLoaderGetEntryPoint (\r | |
38 | IN VOID *Pe32Data,\r | |
39 | OUT VOID **EntryPoint\r | |
40 | );\r | |
41 | \r | |
42 | /**\r | |
43 | Returns the machine type of a PE/COFF image.\r | |
44 | \r | |
45 | Returns the machine type from the PE/COFF image specified by Pe32Data.\r | |
46 | If Pe32Data is NULL, then ASSERT().\r | |
47 | \r | |
af2dc6a7 | 48 | @param Pe32Data The pointer to the PE/COFF image that is loaded in system\r |
fb3df220 | 49 | memory.\r |
50 | \r | |
cb6cb44c | 51 | @return Machine type or zero if not a valid image.\r |
fb3df220 | 52 | \r |
53 | **/\r | |
54 | UINT16\r | |
55 | EFIAPI\r | |
56 | PeCoffLoaderGetMachineType (\r | |
57 | IN VOID *Pe32Data\r | |
58 | );\r | |
59 | \r | |
60 | /**\r | |
61 | Returns a pointer to the PDB file name for a PE/COFF image that has been\r | |
62 | loaded into system memory with the PE/COFF Loader Library functions. \r | |
63 | \r | |
64 | Returns the PDB file name for the PE/COFF image specified by Pe32Data. If\r | |
65 | the PE/COFF image specified by Pe32Data is not a valid, then NULL is\r | |
66 | returned. If the PE/COFF image specified by Pe32Data does not contain a\r | |
67 | debug directory entry, then NULL is returned. If the debug directory entry\r | |
68 | in the PE/COFF image specified by Pe32Data does not contain a PDB file name,\r | |
69 | then NULL is returned.\r | |
70 | If Pe32Data is NULL, then ASSERT().\r | |
71 | \r | |
af2dc6a7 | 72 | @param Pe32Data The pointer to the PE/COFF image that is loaded in system\r |
fb3df220 | 73 | memory.\r |
74 | \r | |
af2dc6a7 | 75 | @return The PDB file name for the PE/COFF image specified by Pe32Data, or NULL\r |
fb3df220 | 76 | if it cannot be retrieved.\r |
77 | \r | |
78 | **/\r | |
79 | VOID *\r | |
80 | EFIAPI\r | |
81 | PeCoffLoaderGetPdbPointer (\r | |
82 | IN VOID *Pe32Data\r | |
83 | );\r | |
84 | \r | |
225290eb A |
85 | \r |
86 | /**\r | |
87 | Returns the size of the PE/COFF headers\r | |
88 | \r | |
89 | Returns the size of the PE/COFF header specified by Pe32Data.\r | |
90 | If Pe32Data is NULL, then ASSERT().\r | |
91 | \r | |
af2dc6a7 | 92 | @param Pe32Data The pointer to the PE/COFF image that is loaded in system\r |
225290eb A |
93 | memory.\r |
94 | \r | |
af2dc6a7 | 95 | @return Size of PE/COFF header in bytes, or zero if not a valid image.\r |
225290eb A |
96 | \r |
97 | **/\r | |
cb6cb44c | 98 | UINT32\r |
99 | EFIAPI\r | |
100 | PeCoffGetSizeOfHeaders (\r | |
101 | IN VOID *Pe32Data\r | |
102 | );\r | |
225290eb | 103 | \r |
412e9dea JF |
104 | /**\r |
105 | Returns PE/COFF image base specified by the address in this PE/COFF image.\r | |
106 | \r | |
107 | On DEBUG build, searches the PE/COFF image base forward the address in this\r | |
108 | PE/COFF image and returns it.\r | |
109 | \r | |
110 | @param Address Address located in one PE/COFF image.\r | |
111 | \r | |
112 | @retval 0 RELEASE build or cannot find the PE/COFF image base.\r | |
113 | @retval others PE/COFF image base found.\r | |
114 | \r | |
115 | **/\r | |
116 | UINTN\r | |
117 | EFIAPI\r | |
9e981317 | 118 | PeCoffSearchImageBase (\r |
412e9dea JF |
119 | IN UINTN Address\r |
120 | );\r | |
121 | \r | |
fb3df220 | 122 | #endif\r |