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