|
|
|
#pragma once
|
|
|
|
#include <spdlog/spdlog.h>
|
|
|
|
#include <decomp/decomp.hpp>
|
|
|
|
#include <obf/engine.hpp>
|
|
|
|
#include <recomp/recomp.hpp>
|
|
|
|
#include <recomp/symbol_table.hpp>
|
|
|
|
|
|
|
|
#include <obf/passes/jcc_rewrite_pass.hpp>
|
|
|
|
#include <obf/passes/next_inst_pass.hpp>
|
|
|
|
#include <obf/passes/reloc_transform_pass.hpp>
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
#include <tuple>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#define XED_ENCODER
|
|
|
|
extern "C" {
|
|
|
|
#include <xed-decode.h>
|
|
|
|
#include <xed-interface.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace theo {
|
|
|
|
using lnk_fns_t =
|
|
|
|
std::tuple<recomp::allocator_t, recomp::copier_t, recomp::resolver_t>;
|
|
|
|
|
|
|
|
class theo_t {
|
|
|
|
public:
|
|
|
|
explicit theo_t(std::vector<std::uint8_t>& lib, lnk_fns_t lnkr_fns);
|
|
|
|
|
|
|
|
std::optional<std::uint32_t> decompose();
|
|
|
|
std::uintptr_t compose(const std::string&& entry_sym);
|
|
|
|
std::uintptr_t resolve(const std::string&& sym);
|
|
|
|
|
|
|
|
private:
|
|
|
|
decomp::decomp_t m_dcmp;
|
|
|
|
recomp::recomp_t m_recmp;
|
|
|
|
recomp::symbol_table_t m_sym_tbl;
|
|
|
|
};
|
|
|
|
} // namespace theo
|