]> code.delx.au - refind/blob - include/PeImage2.h
New files to support Secure Boot & MOK verification of binaries.
[refind] / include / PeImage2.h
1 /** @file
2 EFI image format for PE32, PE32+ and TE. Please note some data structures are
3 different for PE32 and PE32+. EFI_IMAGE_NT_HEADERS32 is for PE32 and
4 EFI_IMAGE_NT_HEADERS64 is for PE32+.
5
6 This file is coded to the Visual Studio, Microsoft Portable Executable and
7 Common Object File Format Specification, Revision 8.0 - May 16, 2006.
8 This file also includes some definitions in PI Specification, Revision 1.0.
9
10 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
11 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
12 This program and the accompanying materials
13 are licensed and made available under the terms and conditions of the BSD License
14 which accompanies this distribution. The full text of the license may be found at
15 http://opensource.org/licenses/bsd-license.php.
16
17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19
20 **/
21
22 /*
23 * Stripped down because the original file was flaking out on me and I just
24 * needed the one definition....
25 *
26 */
27
28 #ifndef _PEIMAGE2_H_
29 #define _PEIMAGE2_H_
30
31
32 typedef struct _GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT {
33 UINT64 ImageAddress;
34 UINT64 ImageSize;
35 UINT64 EntryPoint;
36 UINTN SizeOfHeaders;
37 UINT16 ImageType;
38 UINT16 NumberOfSections;
39 EFI_IMAGE_SECTION_HEADER *FirstSection;
40 EFI_IMAGE_DATA_DIRECTORY *RelocDir;
41 EFI_IMAGE_DATA_DIRECTORY *SecDir;
42 UINT64 NumberOfRvaAndSizes;
43 EFI_IMAGE_OPTIONAL_HEADER_UNION *PEHdr;
44 } GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT;
45
46
47
48 //
49 // Return status codes from the PE/COFF Loader services
50 //
51 #define IMAGE_ERROR_SUCCESS 0
52 #define IMAGE_ERROR_IMAGE_READ 1
53 #define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE 2
54 #define IMAGE_ERROR_INVALID_MACHINE_TYPE 3
55 #define IMAGE_ERROR_INVALID_SUBSYSTEM 4
56 #define IMAGE_ERROR_INVALID_IMAGE_ADDRESS 5
57 #define IMAGE_ERROR_INVALID_IMAGE_SIZE 6
58 #define IMAGE_ERROR_INVALID_SECTION_ALIGNMENT 7
59 #define IMAGE_ERROR_SECTION_NOT_LOADED 8
60 #define IMAGE_ERROR_FAILED_RELOCATION 9
61 #define IMAGE_ERROR_FAILED_ICACHE_FLUSH 10
62
63 #ifdef __MAKEWITH_GNUEFI
64 #define RETURN_STATUS EFI_STATUS
65 typedef UINT64 PHYSICAL_ADDRESS;
66 #endif
67
68 #endif