RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
dosexe.h
1#ifndef DOSEXE_H
2#define DOSEXE_H
3
4#include "../common.h"
5#include "../dumper/dumper.h"
6#include "../linker/segment_manager.h"
7#include "../linker/section.h"
8#include "mzexe.h"
9
10namespace SeychellDOS32
11{
15 class AdamFormat : public virtual Linker::Format, public virtual Linker::OutputFormat
16 {
17 public:
18 bool is_v35; /* based on Michael Tippach's research */
19
20 AdamFormat(bool is_v35 = false)
21 : is_v35(is_v35)
22 {
23 if(is_v35)
24 {
25 Linker::FatalError("Fatal error: 3.5 format unimplemented");
26 }
27 }
28
29 bool is_dll = false;
30 uint16_t minimum_dos_version = 0;
31 uint16_t dlink_version = 0;
32 uint32_t image_size = 0;
33 uint32_t header_size = 0;
34 uint32_t extra_memory_size = 0;
35 uint32_t eip = 0;
36 uint32_t esp = 0;
37 std::set<uint32_t> relocations;
38 uint32_t flags = 0;
39 uint32_t relocation_start = 0;
41 uint32_t last_header_field = 0;
42
43 std::shared_ptr<Linker::Image> image;
44
45 enum
46 {
47 FLAG_COMPRESSED = 0x0001,
48 FLAG_DISPLAY_LOGO = 0x0002,
49 };
50
51 void CalculateValues() override;
52
53 void ReadFile(Linker::Reader& rd) override;
54
56 offset_t WriteFile(Linker::Writer& wr) const override;
57 void Dump(Dumper::Dumper& dump) const override;
58 };
59};
60
61namespace BrocaD3X
62{
66 class D3X1Format : public virtual Linker::Format
67 {
68 public:
69 uint32_t header_size = 0;
70 uint32_t binary_size = 0;
71 uint32_t extra_size = 0;
72 uint32_t entry = 0;
73 uint32_t stack_top = 0;
74
76 : header_size(24)
77 {
78 }
79
80 void ReadFile(Linker::Reader& rd) override;
81
83 offset_t WriteFile(Linker::Writer& wr) const override;
84 void Dump(Dumper::Dumper& dump) const override;
85 };
86};
87
88namespace DX64
89{
93 class LVFormat : public virtual Linker::Format
94 {
95 public:
96 enum format_type
97 {
98 FORMAT_FLAT,
99 FORMAT_LV,
100 };
101
102 char signature[4];
103 uint32_t eip = 0;
104 uint32_t esp = 0;
105 uint32_t extra_memory_size = 0;
106 std::shared_ptr<Linker::Image> image;
107
108 explicit LVFormat()
109 {
110 }
111
112 LVFormat(format_type type)
113 {
114 SetSignature(type);
115 }
116
117 void SetSignature(format_type type);
118
119 void ReadFile(Linker::Reader& rd) override;
120
122 offset_t WriteFile(Linker::Writer& wr) const override;
123 void Dump(Dumper::Dumper& dump) const override;
124 };
125}
126
127/* TODO: other formats? */
128
129#endif /* DOSEXE_H */
Daniel Broca's D3X executable format.
Definition dosexe.h:67
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition dosexe.cc:155
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition dosexe.cc:143
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition dosexe.cc:168
CandyMan's DX64 "Flat" and "LV" executable formats.
Definition dosexe.h:94
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition dosexe.cc:222
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition dosexe.cc:194
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition dosexe.cc:210
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:586
A class to encode a general file format.
Definition format.h:26
offset_t WriteFile(Writer &wr) const override=0
Stores data in memory to file.
A class that provides a general interface to setting up generation for a format.
Definition format.h:61
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Adam Seychell's DOS32 "Adam" executable format.
Definition dosexe.h:16
uint32_t last_header_field
Unknown field for version 3.5.
Definition dosexe.h:41
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition dosexe.cc:6
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition dosexe.cc:132
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition dosexe.cc:84
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition dosexe.cc:22