40 using reserved_t = std::array<uint16_t, 4>;
41 using reserved2_t = std::array<uint16_t, 10>;
43 static constexpr uint16_t MAGIC = 0x5a4d;
45 DosHeader(
const details::pe_dos_header& header);
59 uint16_t used_bytes_in_last_page()
const {
60 return used_bytes_in_last_page_;
63 uint16_t file_size_in_pages()
const {
64 return file_sz_in_pages_;
67 uint16_t numberof_relocation()
const {
68 return nb_relocations_;
71 uint16_t header_size_in_paragraphs()
const {
72 return header_sz_in_paragraphs_;
75 uint16_t minimum_extra_paragraphs()
const {
76 return min_extra_paragraphs_;
79 uint16_t maximum_extra_paragraphs()
const {
80 return max_extra_paragraphs_;
83 uint16_t initial_relative_ss()
const {
84 return init_relative_ss_;
87 uint16_t initial_sp()
const {
91 uint16_t checksum()
const {
95 uint16_t initial_ip()
const {
99 uint16_t initial_relative_cs()
const {
103 uint16_t addressof_relocation_table()
const {
104 return addr_reloc_table_;
107 uint16_t overlay_number()
const {
108 return overlay_number_;
111 const reserved_t& reserved()
const {
115 uint16_t oem_id()
const {
119 uint16_t oem_info()
const {
123 const reserved2_t& reserved2()
const {
129 return addr_new_exe_header_;
132 void magic(uint16_t magic) {
136 void used_bytes_in_last_page(uint16_t value) {
137 used_bytes_in_last_page_ = value;
140 void file_size_in_pages(uint16_t value) {
141 file_sz_in_pages_ = value;
144 void numberof_relocation(uint16_t value) {
145 nb_relocations_ = value;
148 void header_size_in_paragraphs(uint16_t value) {
149 header_sz_in_paragraphs_ = value;
152 void minimum_extra_paragraphs(uint16_t value) {
153 min_extra_paragraphs_ = value;
156 void maximum_extra_paragraphs(uint16_t value) {
157 max_extra_paragraphs_ = value;
160 void initial_relative_ss(uint16_t value) {
161 init_relative_ss_ = value;
164 void initial_sp(uint16_t value) {
168 void checksum(uint16_t value) {
172 void initial_ip(uint16_t value) {
176 void initial_relative_cs(uint16_t value) {
177 init_rel_cs_ = value;
180 void addressof_relocation_table(uint16_t value) {
181 addr_reloc_table_ = value;
184 void overlay_number(uint16_t value) {
185 overlay_number_ = value;
188 void reserved(
const reserved_t& reserved) {
189 reserved_ = reserved;
192 void oem_id(uint16_t value) {
196 void oem_info(uint16_t value) {
200 void reserved2(
const reserved2_t& reserved2) {
201 reserved2_ = reserved2;
204 void addressof_new_exeheader(uint32_t value) {
205 addr_new_exe_header_ = value;
208 void accept(Visitor& visitor)
const override;
210 LIEF_API
friend std::ostream& operator<<(std::ostream& os,
const DosHeader& entry);
212 static DosHeader create(PE_TYPE type);
218 uint16_t used_bytes_in_last_page_ = 0;
219 uint16_t file_sz_in_pages_ = 0;
220 uint16_t nb_relocations_ = 0;
221 uint16_t header_sz_in_paragraphs_ = 0;
222 uint16_t min_extra_paragraphs_ = 0;
223 uint16_t max_extra_paragraphs_ = 0;
224 uint16_t init_relative_ss_ = 0;
225 uint16_t init_sp_ = 0;
226 uint16_t checksum_ = 0;
227 uint16_t init_ip_ = 0;
228 uint16_t init_rel_cs_ = 0;
229 uint16_t addr_reloc_table_ = 0;
230 uint16_t overlay_number_ = 0;
231 reserved_t reserved_;
232 uint16_t oem_id_ = 0;
233 uint16_t oem_info_ = 0;
234 reserved2_t reserved2_;
235 uint32_t addr_new_exe_header_ = 0;