6#include "../dumper/dumper.h"
7#include "../linker/segment_manager.h"
8#include "../linker/section.h"
12namespace SeychellDOS32
41 AdamFormat(format_type format = FORMAT_UNSPECIFIED, output_type output = OUTPUT_EXE)
42 : format(format), output(output)
44 if(output == OUTPUT_EXE)
56 std::array<char, 4> signature;
57 std::array<uint8_t, 2> minimum_dos_version;
58 std::array<uint8_t, 2> dlink_version;
60 uint32_t image_size = 0;
62 uint32_t header_size = 0;
64 uint32_t program_size = 0;
66 uint32_t memory_size = 0;
68 uint32_t contents_size = 0;
70 uint32_t selector_relocation_count = 0;
72 uint32_t offset_relocations_size = 0;
75 std::vector<uint32_t> selector_relocations;
76 std::vector<uint32_t> offset_relocations;
78 std::map<uint32_t, relocation_type> relocations_map;
81 std::shared_ptr<Linker::Contents> image;
85 FLAG_COMPRESSED = 0x0001,
86 FLAG_DISPLAY_LOGO = 0x0002,
87 FLAG_4MB_HEAP_LIMIT = 0x0004,
90 constexpr bool IsV35()
const {
return (dlink_version[1] > 0x03) || (dlink_version[1] == 0x03 && dlink_version[0] >= 0x50); }
91 constexpr bool IsDLL()
const {
return signature[0] ==
'D'; }
93 void MakeApplication();
97 static uint32_t GetRelocationSize(uint32_t displacement, relocation_type type);
110 uint32_t stack_size = 0;
124 { OUTPUT_EXE,
"executable" },
125 { OUTPUT_DLL,
"shared library" },
134 AdamOptionCollector()
136 InitializeFields(stub, output, stack);
142 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
144 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
146 void SetOptions(std::map<std::string, std::string>& options)
override;
148 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
191 : AdamFormat(AdamFormat::FORMAT_LV_FLAT, OUTPUT_EXE)
196 void SetSignature(format_type type);
216 InitializeFields(stub, stack);
220 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
222 void SetOptions(std::map<std::string, std::string>& options)
override;
236 uint32_t header_size = 0;
237 uint32_t binary_size = 0;
238 uint32_t extra_size = 0;
240 uint32_t stack_top = 0;
266 InitializeFields(stub);
272 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
274 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
276 void SetOptions(std::map<std::string, std::string>& options)
override;
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:773
A representation of an enumeration with associated string representations for each value.
Definition options.h:15
std::map< value_type, std::string > descriptions
An empty dictionary that explains the value types in detail.
Definition options.h:20
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:24
Helper class that contains the options interpreted by the format.
Definition options.h:474
Documents and handles command line options.
Definition options.h:306
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:20
A helper class to collect sections into segments.
Definition segment_manager.h:32
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15