From 22231518b9c2c0b7f73c72a6ca834df659c63c7f Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Wed, 22 Jun 2016 00:15:08 +0200 Subject: Reduces the amount of boilerplate neccesary to parse the binary format. --- le/le_object_table_entry.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 le/le_object_table_entry.hpp (limited to 'le/le_object_table_entry.hpp') diff --git a/le/le_object_table_entry.hpp b/le/le_object_table_entry.hpp new file mode 100644 index 0000000..7b97873 --- /dev/null +++ b/le/le_object_table_entry.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include "types.hpp" + +namespace le { + +using binparse::Value32; +using binparse::Offset32; + +enum class ObjectFlags { + readable = 0x1, + writable = 0x2, + executable = 0x4, + resource = 0x8, + discardable = 0x10, + shared = 0x20, + has_preload_pages = 0x40, + has_invalid_pages = 0x80, + has_zero_filled_pages = 0x100, + is_resident = 0x200, + is_resident_and_contiguous = 0x300, + is_resident_and_long_lockable = 0x400, + alias_16_16_required = 0x1000, + big_bit_setting = 0x2000, + is_conforming_for_code = 0x4000, + IO_privilege_level = 0x8000, +}; + +struct ObjectTableEntry { + Value32 virtual_size; + Offset32 reloc_base_address; + Value32 ojbect_flags; + Value32 page_table_index; + Value32 nr_page_table_entries; + Value32 reserved; +}; + +ObjectTableEntry parse_object_table_entry(std::istream& is); + +std::ostream& operator<<(std::ostream& os, ObjectTableEntry const& entry); + +} -- cgit v1.2.3-70-g09d2