6#include "../dumper/dumper.h"
7#include "../linker/segment_manager.h"
8#include "../linker/section.h"
11namespace SeychellDOS32
40 AdamFormat(format_type format = FORMAT_UNSPECIFIED, output_type output = OUTPUT_EXE)
41 : format(format), output(output)
43 if(output == OUTPUT_EXE)
55 std::array<char, 4> signature;
56 std::array<uint8_t, 2> minimum_dos_version;
57 std::array<uint8_t, 2> dlink_version;
59 uint32_t image_size = 0;
61 uint32_t header_size = 0;
63 uint32_t program_size = 0;
65 uint32_t memory_size = 0;
67 uint32_t contents_size = 0;
69 uint32_t selector_relocation_count = 0;
71 uint32_t offset_relocations_size = 0;
74 std::vector<uint32_t> selector_relocations;
75 std::vector<uint32_t> offset_relocations;
77 std::map<uint32_t, relocation_type> relocations_map;
80 std::shared_ptr<Linker::Contents> image;
84 FLAG_COMPRESSED = 0x0001,
85 FLAG_DISPLAY_LOGO = 0x0002,
86 FLAG_4MB_HEAP_LIMIT = 0x0004,
89 constexpr bool IsV35()
const {
return (dlink_version[1] > 0x03) || (dlink_version[1] == 0x03 && dlink_version[0] >= 0x50); }
90 constexpr bool IsDLL()
const {
return signature[0] ==
'D'; }
92 void MakeApplication();
96 static uint32_t GetRelocationSize(uint32_t displacement, relocation_type type);
109 uint32_t stack_size = 0;
123 { OUTPUT_EXE,
"executable" },
124 { OUTPUT_DLL,
"shared library" },
133 AdamOptionCollector()
135 InitializeFields(stub, output, stack);
141 unsigned FormatAdditionalSectionFlags(std::string section_name)
const override;
143 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
145 void SetOptions(std::map<std::string, std::string>& options)
override;
147 void OnNewSegment(std::shared_ptr<Linker::Segment> segment)
override;
179 uint32_t header_size = 0;
180 uint32_t binary_size = 0;
181 uint32_t extra_size = 0;
183 uint32_t stack_top = 0;
217 : AdamFormat(AdamFormat::FORMAT_LV_FLAT, OUTPUT_EXE)
222 void SetSignature(format_type type);
242 InitializeFields(stub, stack);
246 std::shared_ptr<Linker::OptionCollector>
GetOptions()
override;
248 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