\hypertarget{recomp_8hpp_source}{}\doxysection{recomp.\+hpp} \label{recomp_8hpp_source}\index{include/recomp/recomp.hpp@{include/recomp/recomp.hpp}} \mbox{\hyperlink{recomp_8hpp}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00001}00001 \textcolor{comment}{// Copyright (c) 2022, \_xeroxz}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00002}00002 \textcolor{comment}{// All rights reserved.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00003}00003 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00004}00004 \textcolor{comment}{// Redistribution and use in source and binary forms, with or without}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00005}00005 \textcolor{comment}{// modification, are permitted provided that the following conditions are met:}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00006}00006 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00007}00007 \textcolor{comment}{// 1. Redistributions of source code must retain the above copyright notice,}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00008}00008 \textcolor{comment}{// this list of conditions and the following disclaimer.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00009}00009 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00010}00010 \textcolor{comment}{// 2. Redistributions in binary form must reproduce the above copyright notice,}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00011}00011 \textcolor{comment}{// this list of conditions and the following disclaimer in the documentation}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00012}00012 \textcolor{comment}{// and/or other materials provided with the distribution.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00013}00013 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00014}00014 \textcolor{comment}{// 3. Neither the name of the copyright holder nor the names of its}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00015}00015 \textcolor{comment}{// contributors may be used to endorse or promote products derived from}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00016}00016 \textcolor{comment}{// this software without specific prior written permission.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00017}00017 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00018}00018 \textcolor{comment}{// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "{}AS IS"{}}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00019}00019 \textcolor{comment}{// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00020}00020 \textcolor{comment}{// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00021}00021 \textcolor{comment}{// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00022}00022 \textcolor{comment}{// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00023}00023 \textcolor{comment}{// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00024}00024 \textcolor{comment}{// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00025}00025 \textcolor{comment}{// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00026}00026 \textcolor{comment}{// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00027}00027 \textcolor{comment}{// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00028}00028 \textcolor{comment}{// POSSIBILITY OF SUCH DAMAGE.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00029}00029 \textcolor{comment}{//}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00030}00030 } \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00031}00031 \textcolor{preprocessor}{\#pragma once}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00032}00032 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{decomp_8hpp}{decomp/decomp.hpp}}>}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00033}00033 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{engine_8hpp}{obf/engine.hpp}}>}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00034}00034 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{symbol__table_8hpp}{recomp/symbol\_table.hpp}}>}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00035}00035 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00036}00036 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00037}00037 \textcolor{comment}{/// this namespace encompasses all recomposition related code.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00038}00038 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00039}\mbox{\hyperlink{namespacetheo_1_1recomp}{00039}} \textcolor{comment}{}\textcolor{keyword}{namespace }\mbox{\hyperlink{namespacetheo_1_1recomp}{theo::recomp}} \{} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00040}00040 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00041}00041 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00042}00042 \textcolor{comment}{/// a function which is called by recomp\_t to resolve external symbols}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00043}00043 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00044}\mbox{\hyperlink{namespacetheo_1_1recomp_a7364f8c94855a2a871a9d6e1057989f3}{00044}} \textcolor{comment}{}\textcolor{keyword}{using} \mbox{\hyperlink{namespacetheo_1_1recomp_a7364f8c94855a2a871a9d6e1057989f3}{resolver\_t}} = \mbox{\hyperlink{namespacetheo_1_1decomp_af96177687d0ad683c5897d8fa01135f9acf6baee49c2ddb7e89724231bbd75d4a}{std::function}};} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00045}00045 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00046}00046 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00047}00047 \textcolor{comment}{/// a function which is called by recomp\_t to copy symbols into memory.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00048}00048 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00049}\mbox{\hyperlink{namespacetheo_1_1recomp_a604e81450773453df676c3b573651adc}{00049}} \textcolor{comment}{}\textcolor{keyword}{using} \mbox{\hyperlink{namespacetheo_1_1recomp_a604e81450773453df676c3b573651adc}{copier\_t}} = \mbox{\hyperlink{namespacetheo_1_1decomp_af96177687d0ad683c5897d8fa01135f9acf6baee49c2ddb7e89724231bbd75d4a}{std::function}};} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00050}00050 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00051}00051 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00052}00052 \textcolor{comment}{/// a function which is called to allocate space for a symbol.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00053}00053 \textcolor{comment}{///}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00054}00054 \textcolor{comment}{/// the first param is the size of the symbol, the second param is the}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00055}00055 \textcolor{comment}{/// characteristics of the section which the symbol is allocated in.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00056}00056 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00057}\mbox{\hyperlink{namespacetheo_1_1recomp_a96995cb0c5291dce945760c3d8f55241}{00057}} \textcolor{comment}{}\textcolor{keyword}{using} \mbox{\hyperlink{namespacetheo_1_1recomp_a96995cb0c5291dce945760c3d8f55241}{allocator\_t}} =} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00058}00058 \mbox{\hyperlink{namespacetheo_1_1decomp_af96177687d0ad683c5897d8fa01135f9acf6baee49c2ddb7e89724231bbd75d4a}{std::function}};} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00060}00060 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00061}00061 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00062}00062 \textcolor{comment}{/// the main class responsible for recomposition}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00063}00063 \textcolor{comment}{/// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00064}\mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t}{00064}} \textcolor{comment}{}\textcolor{keyword}{class }\mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t}{recomp\_t}} \{} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00065}00065 \textcolor{keyword}{public}:\textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00066}00066 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00067}00067 \textcolor{comment}{ /// the explicit constructor for the recomp\_t class.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00068}00068 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00069}00069 \textcolor{comment}{ /// pointer to a decomp\_t class.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00070}00070 \textcolor{comment}{ /// lambda function which is used to allocate memory for}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00071}00071 \textcolor{comment}{ /// symbols. lambda function used to copy bytes}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00072}00072 \textcolor{comment}{ /// into allocations. lambda function used to}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00073}00073 \textcolor{comment}{ /// resolve external symbols.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00074}00074 \textcolor{comment}{} \textcolor{keyword}{explicit} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_ac5f04297153c2e445330e5cc103e8589}{recomp\_t}}(\mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t}{decomp::decomp\_t}}* dcmp,} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00075}00075 \mbox{\hyperlink{namespacetheo_1_1recomp_a96995cb0c5291dce945760c3d8f55241}{allocator\_t}} alloc,} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00076}00076 \mbox{\hyperlink{namespacetheo_1_1recomp_a604e81450773453df676c3b573651adc}{copier\_t}} copy,} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00077}00077 \mbox{\hyperlink{namespacetheo_1_1recomp_a7364f8c94855a2a871a9d6e1057989f3}{resolver\_t}} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a299fbede378f04991df2e39293307094}{resolve}});} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00078}00078 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00079}00079 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00080}00080 \textcolor{comment}{ /// when called, this function allocates space for every symbol.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00081}00081 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00082}00082 \textcolor{comment}{} \textcolor{keywordtype}{void} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a78502665e218d3addca9b1e5e3875f39}{allocate}}();} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00083}00083 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00084}00084 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00085}00085 \textcolor{comment}{ /// when called, this function resolves all relocations in every symbol.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00086}00086 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00087}00087 \textcolor{comment}{} \textcolor{keywordtype}{void} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a299fbede378f04991df2e39293307094}{resolve}}();} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00088}00088 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00089}00089 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00090}00090 \textcolor{comment}{ /// when called, this function copies symbols into allocations.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00091}00091 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00092}00092 \textcolor{comment}{} \textcolor{keywordtype}{void} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a080d88f122d12faf2e328c9bdd10be6e}{copy\_syms}}();} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00093}00093 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00094}00094 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00095}00095 \textcolor{comment}{ /// setter for the allocater lambda function.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00096}00096 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00097}00097 \textcolor{comment}{ /// lambda function which allocates memory for}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00098}00098 \textcolor{comment}{ /// symbols.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00099}00099 \textcolor{comment}{} \textcolor{keywordtype}{void} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a0da9a904b0057c14190218592aff0f07}{allocator}}(\mbox{\hyperlink{namespacetheo_1_1recomp_a96995cb0c5291dce945760c3d8f55241}{allocator\_t}} alloc);} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00100}00100 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00101}00101 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00102}00102 \textcolor{comment}{ /// setter for the copier lambda function.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00103}00103 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00104}00104 \textcolor{comment}{ /// copier lambda function used to copy bytes into}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00105}00105 \textcolor{comment}{ /// allocations made by the allocator.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00106}00106 \textcolor{comment}{} \textcolor{keywordtype}{void} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_aa6fecf752d4c5bc211e164d8496724b1}{copier}}(\mbox{\hyperlink{namespacetheo_1_1recomp_a604e81450773453df676c3b573651adc}{copier\_t}} copy);} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00107}00107 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00108}00108 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00109}00109 \textcolor{comment}{ /// setter for the resolve lambda function.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00110}00110 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00111}00111 \textcolor{comment}{ /// lambda function to resolve external symbols.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00112}00112 \textcolor{comment}{} \textcolor{keywordtype}{void} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a1be6d0cdb57565c31b138248c8b2d470}{resolver}}(\mbox{\hyperlink{namespacetheo_1_1recomp_a7364f8c94855a2a871a9d6e1057989f3}{resolver\_t}} \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a299fbede378f04991df2e39293307094}{resolve}});} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00113}00113 \textcolor{comment}{}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00114}00114 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00115}00115 \textcolor{comment}{ /// resolves the address of a function given its name.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00116}00116 \textcolor{comment}{ /// }} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00117}00117 \textcolor{comment}{ /// the name of the symbol to resolve the location}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00118}00118 \textcolor{comment}{ /// of. the address of the symbol.}} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00119}00119 \textcolor{comment}{} std::uintptr\_t \mbox{\hyperlink{classtheo_1_1recomp_1_1recomp__t_a299fbede378f04991df2e39293307094}{resolve}}(\textcolor{keyword}{const} std::string\&\& sym);} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00120}00120 } \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00121}00121 \textcolor{keyword}{private}:} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00122}00122 \mbox{\hyperlink{classtheo_1_1decomp_1_1decomp__t}{decomp::decomp\_t}}* m\_dcmp;} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00123}00123 \mbox{\hyperlink{namespacetheo_1_1recomp_a7364f8c94855a2a871a9d6e1057989f3}{resolver\_t}} m\_resolver;} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00124}00124 \mbox{\hyperlink{namespacetheo_1_1recomp_a604e81450773453df676c3b573651adc}{copier\_t}} m\_copier;} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00125}00125 \mbox{\hyperlink{namespacetheo_1_1recomp_a96995cb0c5291dce945760c3d8f55241}{allocator\_t}} m\_allocator;} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00126}00126 \};} \DoxyCodeLine{\Hypertarget{recomp_8hpp_source_l00127}00127 \} \textcolor{comment}{// namespace theo::recomp}} \end{DoxyCode}