]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PeCoffGetEntryPointLib.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Library / PeCoffGetEntryPointLib.h
1 /** @file
2 Provides a service to retrieve the PE/COFF entry point from a PE/COFF image.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __PE_COFF_GET_ENTRY_POINT_LIB_H__
10 #define __PE_COFF_GET_ENTRY_POINT_LIB_H__
11
12 /**
13 Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
14 into system memory with the PE/COFF Loader Library functions.
15
16 Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry
17 point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then
18 return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS.
19 If Pe32Data is NULL, then ASSERT().
20 If EntryPoint is NULL, then ASSERT().
21
22 @param Pe32Data The pointer to the PE/COFF image that is loaded in system memory.
23 @param EntryPoint The pointer to entry point to the PE/COFF image to return.
24
25 @retval RETURN_SUCCESS EntryPoint was returned.
26 @retval RETURN_INVALID_PARAMETER The entry point could not be found in the PE/COFF image.
27
28 **/
29 RETURN_STATUS
30 EFIAPI
31 PeCoffLoaderGetEntryPoint (
32 IN VOID *Pe32Data,
33 OUT VOID **EntryPoint
34 );
35
36 /**
37 Returns the machine type of a PE/COFF image.
38
39 Returns the machine type from the PE/COFF image specified by Pe32Data.
40 If Pe32Data is NULL, then ASSERT().
41
42 @param Pe32Data The pointer to the PE/COFF image that is loaded in system
43 memory.
44
45 @return Machine type or zero if not a valid image.
46
47 **/
48 UINT16
49 EFIAPI
50 PeCoffLoaderGetMachineType (
51 IN VOID *Pe32Data
52 );
53
54 /**
55 Returns a pointer to the PDB file name for a PE/COFF image that has been
56 loaded into system memory with the PE/COFF Loader Library functions.
57
58 Returns the PDB file name for the PE/COFF image specified by Pe32Data. If
59 the PE/COFF image specified by Pe32Data is not a valid, then NULL is
60 returned. If the PE/COFF image specified by Pe32Data does not contain a
61 debug directory entry, then NULL is returned. If the debug directory entry
62 in the PE/COFF image specified by Pe32Data does not contain a PDB file name,
63 then NULL is returned.
64 If Pe32Data is NULL, then ASSERT().
65
66 @param Pe32Data The pointer to the PE/COFF image that is loaded in system
67 memory.
68
69 @return The PDB file name for the PE/COFF image specified by Pe32Data, or NULL
70 if it cannot be retrieved.
71
72 **/
73 VOID *
74 EFIAPI
75 PeCoffLoaderGetPdbPointer (
76 IN VOID *Pe32Data
77 );
78
79
80 /**
81 Returns the size of the PE/COFF headers
82
83 Returns the size of the PE/COFF header specified by Pe32Data.
84 If Pe32Data is NULL, then ASSERT().
85
86 @param Pe32Data The pointer to the PE/COFF image that is loaded in system
87 memory.
88
89 @return Size of PE/COFF header in bytes, or zero if not a valid image.
90
91 **/
92 UINT32
93 EFIAPI
94 PeCoffGetSizeOfHeaders (
95 IN VOID *Pe32Data
96 );
97
98 /**
99 Returns PE/COFF image base specified by the address in this PE/COFF image.
100
101 On DEBUG build, searches the PE/COFF image base forward the address in this
102 PE/COFF image and returns it.
103
104 @param Address Address located in one PE/COFF image.
105
106 @retval 0 RELEASE build or cannot find the PE/COFF image base.
107 @retval others PE/COFF image base found.
108
109 **/
110 UINTN
111 EFIAPI
112 PeCoffSearchImageBase (
113 IN UINTN Address
114 );
115
116 #endif