]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - wimboot/wimboot-2.7.3/src/peloader.h
5 * Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
37 /** Bytes on last page of file */
43 /** Size of header in paragraphs */
45 /** Minimum extra paragraphs needed */
47 /** Maximum extra paragraphs needed */
49 /** Initial (relative) SS value */
51 /** Initial SP value */
55 /** Initial IP value */
57 /** Initial (relative) CS value */
59 /** File address of relocation table */
65 /** OEM identifier (for oeminfo) */
67 /** OEM information; oemid specific */
71 /** File address of new exe header */
73 } __attribute__ (( packed
));
75 /** MZ header magic */
76 #define MZ_HEADER_MAGIC 0x5a4d
78 /** COFF file header */
82 /** Number of sections */
83 uint16_t num_sections
;
84 /** Timestamp (seconds since the Epoch) */
86 /** Offset to symbol table */
88 /** Number of symbol table entries */
90 /** Length of optional header */
94 } __attribute__ (( packed
));
100 /** Physical address or virtual length */
102 /** Physical address */
104 /** Virtual length */
105 uint32_t virtual_len
;
107 /** Virtual address */
109 /** Length of raw data */
111 /** Offset to raw data */
113 /** Offset to relocations */
114 uint32_t relocations
;
115 /** Offset to line numbers */
116 uint32_t line_numbers
;
117 /** Number of relocations */
118 uint16_t num_relocations
;
119 /** Number of line numbers */
120 uint16_t num_line_numbers
;
123 } __attribute__ (( packed
));
125 /** PE file header */
130 struct coff_header coff
;
131 } __attribute__ (( packed
));
133 /** PE header magic */
134 #define PE_HEADER_MAGIC 0x00004550
136 /** PE optional header */
137 struct pe_optional_header
{
140 /** Major linker version */
141 uint8_t linker_major
;
142 /** Minor linker version */
143 uint8_t linker_minor
;
144 /** Length of code */
146 /** Length of initialised data */
148 /** Length of uninitialised data */
156 /** Image base address */
158 /** Section alignment */
159 uint32_t section_align
;
160 /** File alignment */
162 /** Major operating system version */
164 /** Minor operating system version */
166 /** Major image version */
167 uint16_t image_major
;
168 /** Minor image version */
169 uint16_t image_minor
;
170 /** Major subsystem version */
171 uint16_t subsystem_major
;
172 /** Minor subsystem version */
173 uint16_t subsystem_minor
;
175 uint32_t win32_version
;
178 /** Size of headers */
180 /* Plus extra fields that we don't care about */
181 } __attribute__ (( packed
));
183 /** A loaded PE image */
190 void ( * entry
) ( struct bootapp_descriptor
*bootapp
);
193 extern int load_pe ( const void *data
, size_t len
, struct loaded_pe
*pe
);
195 #endif /* _PELOADER_H */