summaryrefslogtreecommitdiff
path: root/le/le_fixup_record_table.hpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-06-27 01:33:02 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-06-27 15:23:06 +0200
commitb80a82fcc9edc73057796005cede4eea8380e193 (patch)
tree2da5e7cddef0bc39b449410c9826680a3dd6ca9d /le/le_fixup_record_table.hpp
parenta7bcede17b4c10e172c7877fc2ce89862dc454af (diff)
downloadopenwar-b80a82fcc9edc73057796005cede4eea8380e193.tar.gz
openwar-b80a82fcc9edc73057796005cede4eea8380e193.tar.bz2
openwar-b80a82fcc9edc73057796005cede4eea8380e193.zip
Parses the fixup page and fixup record table.
Diffstat (limited to 'le/le_fixup_record_table.hpp')
-rw-r--r--le/le_fixup_record_table.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/le/le_fixup_record_table.hpp b/le/le_fixup_record_table.hpp
new file mode 100644
index 0000000..6a07da5
--- /dev/null
+++ b/le/le_fixup_record_table.hpp
@@ -0,0 +1,56 @@
+#pragma once
+
+#include "le_fixup_page_table.hpp"
+#include "types.hpp"
+#include "variant_output_helper.hpp" //include this before <boost/variant>
+
+#include <boost/variant.hpp>
+#include <boost/optional.hpp>
+#include <boost/optional/optional_io.hpp>
+
+#include <vector>
+#include <map>
+
+namespace le {
+
+using namespace binparse;
+
+struct FixupRecordTable
+{
+ struct Entry {
+ struct Internal {
+ boost::variant<Value8,Value16> object_number;
+ boost::variant<Offset16, Offset32> target_offset;
+ };
+
+ struct ImportedOrdinal {
+ boost::variant<Value8, Value16> ordinal_number;
+ };
+
+ struct ImportedName {
+ boost::variant<Value8, Value16> ordinal_number;
+ boost::variant<Offset16, Offset32> procedure_name_offset;
+ };
+
+ struct InternalEntry {
+ boost::variant<Value8, Value16> entry_number;
+ };
+
+ Value8 source_flags;
+ Value8 target_flags;
+ boost::variant<Offset16, Value8> source_offset_or_source_list_count;
+ boost::variant<Internal, ImportedOrdinal, ImportedName, InternalEntry> data;
+ boost::optional<boost::variant<boost::variant<Offset16, Offset32>, std::vector<boost::variant<Offset16, Offset32>>>> additive;
+ boost::optional<std::vector<Value16>> sources;
+ };
+
+ std::map<Value32, std::vector<Entry>> entries;
+
+};
+
+FixupRecordTable::Entry parse(std::istream& is);
+FixupRecordTable parse_fixup_record_table(std::istream& is, Offset32 offset, FixupPageTable fixups);
+
+std::ostream& operator<<(std::ostream& os, FixupRecordTable const& table);
+
+} \ No newline at end of file