<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
< meta name = "generator" content = "Doxygen 1.9.3" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Theodosius: theo::decomp::decomp_t Class Reference< / title >
< link href = "../../tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../jquery.js" > < / script >
< script type = "text/javascript" src = "../../dynsections.js" > < / script >
< link href = "../../search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../search/searchdata.js" > < / script >
< script type = "text/javascript" src = "../../search/search.js" > < / script >
< link href = "../../doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr id = "projectrow" >
< td id = "projectlogo" > < img alt = "Logo" src = "../../icon.png" / > < / td >
< td id = "projectalign" >
< div id = "projectname" > Theodosius< span id = "projectnumber" >   v3.0< / span >
< / div >
< div id = "projectbrief" > Jit linker, symbol mapper, and obfuscator< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
<!-- Generated by Doxygen 1.9.3 -->
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
/* @license-end */
< / script >
< script type = "text/javascript" src = "../../menudata.js" > < / script >
< script type = "text/javascript" src = "../../menu.js" > < / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
< / script >
< div id = "main-nav" > < / div >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< iframe src = "javascript:void(0)" frameborder = "0"
name="MSearchResults" id="MSearchResults">
< / iframe >
< / div >
< div id = "nav-path" class = "navpath" >
< ul >
< li class = "navelem" > < a class = "el" href = "../../da/de6/namespacetheo.html" > theo< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../d9/dbd/namespacetheo_1_1decomp.html" > decomp< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html" > decomp_t< / a > < / li > < / ul >
< / div >
< / div > <!-- top -->
< div class = "header" >
< div class = "summary" >
< a href = "#pub-methods" > Public Member Functions< / a > < / div >
< div class = "headertitle" > < div class = "title" > theo::decomp::decomp_t Class Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< p > the main decomposition class which is responsible for breaking down lib file into coff files, and extracted used symbols from the coff files.
< a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#details" > More...< / a > < / p >
< p > < code > #include " < a class = "el" href = "../../d2/d96/decomp_8hpp_source.html" > decomp.hpp< / a > " < / code > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "pub-methods" name = "pub-methods" > < / a >
Public Member Functions< / h2 > < / td > < / tr >
< tr class = "memitem:a35cfac16bd918d576b29e04388690d68" > < td class = "memItemLeft" align = "right" valign = "top" >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a35cfac16bd918d576b29e04388690d68" > decomp_t< / a > (std::vector< std::uint8_t > & < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#aa728bde8ec1c5c28ec09f86adf427ae2" > lib< / a > , < a class = "el" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html" > recomp::symbol_table_t< / a > *< a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120" > syms< / a > )< / td > < / tr >
< tr class = "memdesc:a35cfac16bd918d576b29e04388690d68" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > the explicit constructor for < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html" title = "the main decomposition class which is responsible for breaking down lib file into coff files,..." > decomp_t< / a > < a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a35cfac16bd918d576b29e04388690d68" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a35cfac16bd918d576b29e04388690d68" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a79c965ec0a996a936faae7f54b0e055e" > < td class = "memItemLeft" align = "right" valign = "top" > std::vector< < a class = "el" href = "../../df/db4/classtheo_1_1decomp_1_1routine__t.html" > routine_t< / a > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a79c965ec0a996a936faae7f54b0e055e" > rtns< / a > ()< / td > < / tr >
< tr class = "memdesc:a79c965ec0a996a936faae7f54b0e055e" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > gets all of the routine objects. < a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a79c965ec0a996a936faae7f54b0e055e" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a79c965ec0a996a936faae7f54b0e055e" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:aa728bde8ec1c5c28ec09f86adf427ae2" > < td class = "memItemLeft" align = "right" valign = "top" > std::vector< std::uint8_t >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#aa728bde8ec1c5c28ec09f86adf427ae2" > lib< / a > ()< / td > < / tr >
< tr class = "memdesc:aa728bde8ec1c5c28ec09f86adf427ae2" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > gets a vector of bytes consisting of the lib file. < a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#aa728bde8ec1c5c28ec09f86adf427ae2" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:aa728bde8ec1c5c28ec09f86adf427ae2" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a81ae70b313a9ef24ea5d8f404699baef" > < td class = "memItemLeft" align = "right" valign = "top" > std::vector< std::vector< std::uint8_t > >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a81ae70b313a9ef24ea5d8f404699baef" > objs< / a > ()< / td > < / tr >
< tr class = "memdesc:a81ae70b313a9ef24ea5d8f404699baef" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > gets all the obj files as a vector of a vector of bytes. < a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a81ae70b313a9ef24ea5d8f404699baef" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a81ae70b313a9ef24ea5d8f404699baef" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a8630f2ee0f4fb9516f5b20014e4c6120" > < td class = "memItemLeft" align = "right" valign = "top" > < a class = "el" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html" > recomp::symbol_table_t< / a > *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120" > syms< / a > ()< / td > < / tr >
< tr class = "memdesc:a8630f2ee0f4fb9516f5b20014e4c6120" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > gets the symbol table. < a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a8630f2ee0f4fb9516f5b20014e4c6120" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a860dddc3a5d12231b685dbaa12a0db06" > < td class = "memItemLeft" align = "right" valign = "top" > std::map< coff::section_header_t *, std::size_t > &   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a860dddc3a5d12231b685dbaa12a0db06" > scn_hash_tbl< / a > ()< / td > < / tr >
< tr class = "memdesc:a860dddc3a5d12231b685dbaa12a0db06" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > gets the section hash table section header --> hash of the section header ptr. < a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a860dddc3a5d12231b685dbaa12a0db06" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a860dddc3a5d12231b685dbaa12a0db06" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ae23353a4293aa30969b6d3fa37359469" > < td class = "memItemLeft" align = "right" valign = "top" > std::optional< < a class = "el" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html" > recomp::symbol_table_t< / a > * >   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#ae23353a4293aa30969b6d3fa37359469" > decompose< / a > (std::string & entry_sym)< / td > < / tr >
< tr class = "memdesc:ae23353a4293aa30969b6d3fa37359469" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > decomposes (extracts) the symbols used. this function determines all used symbols given the entry point. < a href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#ae23353a4293aa30969b6d3fa37359469" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ae23353a4293aa30969b6d3fa37359469" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
< div class = "textblock" > < p > the main decomposition class which is responsible for breaking down lib file into coff files, and extracted used symbols from the coff files. < / p >
< p class = "definition" > Definition at line < a class = "el" href = "../../d2/d96/decomp_8hpp_source.html#l00061" > 61< / a > of file < a class = "el" href = "../../d2/d96/decomp_8hpp_source.html" > decomp.hpp< / a > .< / p >
< / div > < h2 class = "groupheader" > Constructor & Destructor Documentation< / h2 >
< a id = "a35cfac16bd918d576b29e04388690d68" name = "a35cfac16bd918d576b29e04388690d68" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a35cfac16bd918d576b29e04388690d68" > ◆ < / a > < / span > decomp_t()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "mlabels" >
< tr >
< td class = "mlabels-left" >
< table class = "memname" >
< tr >
< td class = "memname" > theo::decomp::decomp_t::decomp_t < / td >
< td > (< / td >
< td class = "paramtype" > std::vector< std::uint8_t > &   < / td >
< td class = "paramname" > < em > lib< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > < a class = "el" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html" > recomp::symbol_table_t< / a > *  < / td >
< td class = "paramname" > < em > syms< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / td >
< td class = "mlabels-right" >
< span class = "mlabels" > < span class = "mlabel" > explicit< / span > < / span > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > the explicit constructor for < a class = "el" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html" title = "the main decomposition class which is responsible for breaking down lib file into coff files,..." > decomp_t< / a > < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > lib< / td > < td > vector of bytes containing the lib file.< / td > < / tr >
< tr > < td class = "paramname" > syms< / td > < td > symbol table that gets populated and managed by this class.< / td > < / tr >
< / table >
< / dd >
< / dl >
< p class = "definition" > Definition at line < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00034" > 34< / a > of file < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > .< / p >
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 35< / span > : m_lib(< a class = "code hl_function" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#aa728bde8ec1c5c28ec09f86adf427ae2" title = "gets a vector of bytes consisting of the lib file." > lib< / a > ), m_syms(< a class = "code hl_function" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#a8630f2ee0f4fb9516f5b20014e4c6120" title = "gets the symbol table." > syms< / a > ) {}< / div >
< / div > <!-- fragment -->
< / div >
< / div >
< h2 class = "groupheader" > Member Function Documentation< / h2 >
< a id = "ae23353a4293aa30969b6d3fa37359469" name = "ae23353a4293aa30969b6d3fa37359469" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ae23353a4293aa30969b6d3fa37359469" > ◆ < / a > < / span > decompose()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > std::optional< < a class = "el" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html" > recomp::symbol_table_t< / a > * > theo::decomp::decomp_t::decompose < / td >
< td > (< / td >
< td class = "paramtype" > std::string &   < / td >
< td class = "paramname" > < em > entry_sym< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > decomposes (extracts) the symbols used. this function determines all used symbols given the entry point. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > entry_sym< / td > < td > the entry point symbol name.< / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > returns an optional pointer to the symbol table. no value in the optional object on failure.< / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00037" > 37< / a > of file < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > .< / p >
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 38< / span > {< / div >
< div class = "line" > < span class = "lineno" > 39< / span > < span class = "comment" > // extract obj files from the archive file...< / span > < / div >
< div class = "line" > < span class = "lineno" > 40< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 41< / span > ar::view< false> < a class = "code hl_function" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#aa728bde8ec1c5c28ec09f86adf427ae2" title = "gets a vector of bytes consisting of the lib file." > lib< / a > (m_lib.data(), m_lib.size());< / div >
< div class = "line" > < span class = "lineno" > 42< / span > std::for_each(< / div >
< div class = "line" > < span class = "lineno" > 43< / span > < a class = "code hl_function" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#aa728bde8ec1c5c28ec09f86adf427ae2" title = "gets a vector of bytes consisting of the lib file." > lib< / a > .begin(), < a class = "code hl_function" href = "../../d6/d0e/classtheo_1_1decomp_1_1decomp__t.html#aa728bde8ec1c5c28ec09f86adf427ae2" title = "gets a vector of bytes consisting of the lib file." > lib< / a > .end(),< / div >
< div class = "line" > < span class = "lineno" > 44< / span > [& ](std::pair< std::string_view, ar::entry_t& > itr) {< / div >
< div class = "line" > < span class = "lineno" > 45< / span > < span class = "comment" > // if the entry isnt the symbol table or the string table< / span > < / div >
< div class = "line" > < span class = "lineno" > 46< / span > < span class = "comment" > // then we know its an obj file...< / span > < / div >
< div class = "line" > < span class = "lineno" > 47< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 48< / span > if (!itr.second.is_symbol_table() & & !itr.second.is_string_table()) {< / div >
< div class = "line" > < span class = "lineno" > 49< / span > spdlog::info(< span class = "stringliteral" > " extracted obj from archive: {}" < / span > , itr.first);< / div >
< div class = "line" > < span class = "lineno" > 50< / span > std::vector< std::uint8_t> data(itr.second.begin(), itr.second.end());< / div >
< div class = "line" > < span class = "lineno" > 51< / span > m_objs.push_back(data);< / div >
< div class = "line" > < span class = "lineno" > 52< / span > }< / div >
< div class = "line" > < span class = "lineno" > 53< / span > });< / div >
< div class = "line" > < span class = "lineno" > 54< / span > < / div >
< div class = "line" > < span class = "lineno" > 55< / span > std::for_each(< / div >
< div class = "line" > < span class = "lineno" > 56< / span > m_objs.begin(), m_objs.end(), [& ](std::vector< std::uint8_t> & img_data) {< / div >
< div class = "line" > < span class = "lineno" > 57< / span > auto img = reinterpret_cast< coff::image_t*> (img_data.data());< / div >
< div class = "line" > < span class = "lineno" > 58< / span > for (auto idx = 0u; idx < img-> file_header.num_symbols; ++idx) {< / div >
< div class = "line" > < span class = "lineno" > 59< / span > auto sym = img-> get_symbol(idx);< / div >
< div class = "line" > < span class = "lineno" > 60< / span > if (sym-> section_index - 1 > img-> file_header.num_sections)< / div >
< div class = "line" > < span class = "lineno" > 61< / span > continue;< / div >
< div class = "line" > < span class = "lineno" > 62< / span > < / div >
< div class = "line" > < span class = "lineno" > 63< / span > auto sym_name = symbol_t::name(img, sym);< / div >
< div class = "line" > < span class = "lineno" > 64< / span > if (sym_name.length()) {< / div >
< div class = "line" > < span class = "lineno" > 65< / span > auto sym_hash = symbol_t::hash(sym_name.data());< / div >
< div class = "line" > < span class = "lineno" > 66< / span > auto sym_size =< / div >
< div class = "line" > < span class = "lineno" > 67< / span > sym-> has_section()< / div >
< div class = "line" > < span class = "lineno" > 68< / span > ? next_sym(img, img-> get_section(sym-> section_index - 1),< / div >
< div class = "line" > < span class = "lineno" > 69< / span > sym)< / div >
< div class = "line" > < span class = "lineno" > 70< / span > : 0u;< / div >
< div class = "line" > < span class = "lineno" > 71< / span > < / div >
< div class = "line" > < span class = "lineno" > 72< / span > m_lookup_tbl[sym_hash].emplace_back(img, sym, sym_size);< / div >
< div class = "line" > < span class = "lineno" > 73< / span > }< / div >
< div class = "line" > < span class = "lineno" > 74< / span > }< / div >
< div class = "line" > < span class = "lineno" > 75< / span > });< / div >
< div class = "line" > < span class = "lineno" > 76< / span > < / div >
< div class = "line" > < span class = "lineno" > 77< / span > < span class = "comment" > // extract used symbols from objs and create a nice little set of them so that< / span > < / div >
< div class = "line" > < span class = "lineno" > 78< / span > < span class = "comment" > // we can easily decompose them... no need deal with every single symbol...< / span > < / div >
< div class = "line" > < span class = "lineno" > 79< / span > spdlog::info(< span class = "stringliteral" > " extracted {} symbols being used..." < / span > ,< / div >
< div class = "line" > < span class = "lineno" > 80< / span > ext_used_syms(entry_sym.data()));< / div >
< div class = "line" > < span class = "lineno" > 81< / span > < / div >
< div class = "line" > < span class = "lineno" > 82< / span > < span class = "comment" > // generate symbols, populate section hash table, for each object file< / span > < / div >
< div class = "line" > < span class = "lineno" > 83< / span > < span class = "comment" > // extracted from the archive file...< / span > < / div >
< div class = "line" > < span class = "lineno" > 84< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 85< / span > std::for_each(m_used_syms.begin(), m_used_syms.end(), [& ](< a class = "code hl_typedef" href = "../../d9/dbd/namespacetheo_1_1decomp.html#abbf09e1f7eb9e42057ff9c9e8be41266" title = "meta symbol data. consists of the coff image which contains the coff symbol, the coff symbol itself,..." > sym_data_t< / a > < a class = "code hl_enumvalue" href = "../../d9/dbd/namespacetheo_1_1decomp.html#af96177687d0ad683c5897d8fa01135f9acdb885c0ea7f6b2874224487c69b8112" > data< / a > ) {< / div >
< div class = "line" > < span class = "lineno" > 86< / span > auto [img, sym, size] = data;< / div >
< div class = "line" > < span class = "lineno" > 87< / span > < / div >
< div class = "line" > < span class = "lineno" > 88< / span > < span class = "comment" > // populate section hash table with sections for the img of this< / span > < / div >
< div class = "line" > < span class = "lineno" > 89< / span > < span class = "comment" > // symbol... only populate the hash table if its not been populated for< / span > < / div >
< div class = "line" > < span class = "lineno" > 90< / span > < span class = "comment" > // this obj before...< / span > < / div >
< div class = "line" > < span class = "lineno" > 91< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 92< / span > if (m_processed_objs.emplace(img).second) {< / div >
< div class = "line" > < span class = "lineno" > 93< / span > for (auto idx = 0u; idx < img-> file_header.num_sections; ++idx) {< / div >
< div class = "line" > < span class = "lineno" > 94< / span > auto scn = img-> get_section(idx);< / div >
< div class = "line" > < span class = "lineno" > 95< / span > auto scn_sym_name =< / div >
< div class = "line" > < span class = "lineno" > 96< / span > std::string(scn-> name.to_string(img-> get_strings()))< / div >
< div class = "line" > < span class = "lineno" > 97< / span > .append(< span class = "stringliteral" > " #" < / span > )< / div >
< div class = "line" > < span class = "lineno" > 98< / span > .append(std::to_string(idx))< / div >
< div class = "line" > < span class = "lineno" > 99< / span > .append(< span class = "stringliteral" > " !" < / span > )< / div >
< div class = "line" > < span class = "lineno" > 100< / span > .append(std::to_string(img-> file_header.timedate_stamp));< / div >
< div class = "line" > < span class = "lineno" > 101< / span > < / div >
< div class = "line" > < span class = "lineno" > 102< / span > < span class = "comment" > // hash the name of the section + the index + the timestamp of the< / span > < / div >
< div class = "line" > < span class = "lineno" > 103< / span > < span class = "comment" > // obj file it is in...< / span > < / div >
< div class = "line" > < span class = "lineno" > 104< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 105< / span > m_scn_hash_tbl.insert({scn, decomp::symbol_t::hash(scn_sym_name)});< / div >
< div class = "line" > < span class = "lineno" > 106< / span > }< / div >
< div class = "line" > < span class = "lineno" > 107< / span > }< / div >
< div class = "line" > < span class = "lineno" > 108< / span > < / div >
< div class = "line" > < span class = "lineno" > 109< / span > < span class = "comment" > // if the symbol is a function then we are going to decompose it...< / span > < / div >
< div class = "line" > < span class = "lineno" > 110< / span > < span class = "comment" > // data symbols are handled after this...< / span > < / div >
< div class = "line" > < span class = "lineno" > 111< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 112< / span > if (sym-> has_section()) {< / div >
< div class = "line" > < span class = "lineno" > 113< / span > if (sym-> derived_type == coff::derived_type_id::function) {< / div >
< div class = "line" > < span class = "lineno" > 114< / span > auto scn = img-> get_section(sym-> section_index - 1);< / div >
< div class = "line" > < span class = "lineno" > 115< / span > auto dcmp_type =< / div >
< div class = "line" > < span class = "lineno" > 116< / span > scn-> name.to_string(img-> get_strings()) == INSTR_SPLIT_SECTION_NAME< / div >
< div class = "line" > < span class = "lineno" > 117< / span > ? decomp::sym_type_t::instruction< / div >
< div class = "line" > < span class = "lineno" > 118< / span > : decomp::sym_type_t::function;< / div >
< div class = "line" > < span class = "lineno" > 119< / span > < / div >
< div class = "line" > < span class = "lineno" > 120< / span > auto fn_size = next_sym(img, scn, sym);< / div >
< div class = "line" > < span class = "lineno" > 121< / span > auto fn_bgn = scn-> ptr_raw_data + reinterpret_cast< std::uint8_t*> (img) +< / div >
< div class = "line" > < span class = "lineno" > 122< / span > sym-> value;< / div >
< div class = "line" > < span class = "lineno" > 123< / span > < / div >
< div class = "line" > < span class = "lineno" > 124< / span > std::vector< std::uint8_t> fn(fn_bgn, fn_bgn + fn_size);< / div >
< div class = "line" > < span class = "lineno" > 125< / span > decomp::routine_t rtn(sym, img, scn, fn, dcmp_type);< / div >
< div class = "line" > < span class = "lineno" > 126< / span > < / div >
< div class = "line" > < span class = "lineno" > 127< / span > auto syms = rtn.decompose();< / div >
< div class = "line" > < span class = "lineno" > 128< / span > m_syms-> put_symbols(syms);< / div >
< div class = "line" > < span class = "lineno" > 129< / span > } < span class = "keywordflow" > else< / span > if (sym-> storage_class == coff::storage_class_id::public_symbol ||< / div >
< div class = "line" > < span class = "lineno" > 130< / span > sym-> storage_class == coff::storage_class_id::private_symbol) {< / div >
< div class = "line" > < span class = "lineno" > 131< / span > auto scn = img-> get_section(sym-> section_index - 1);< / div >
< div class = "line" > < span class = "lineno" > 132< / span > auto scn_sym = m_syms-> sym_from_hash(m_scn_hash_tbl[scn]);< / div >
< div class = "line" > < span class = "lineno" > 133< / span > < / div >
< div class = "line" > < span class = "lineno" > 134< / span > < span class = "comment" > // if the section doesnt have a symbol then make one and put it into< / span > < / div >
< div class = "line" > < span class = "lineno" > 135< / span > < span class = "comment" > // the symbol table...< / span > < / div >
< div class = "line" > < span class = "lineno" > 136< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 137< / span > if (!scn_sym.has_value()) {< / div >
< div class = "line" > < span class = "lineno" > 138< / span > auto scn_sym_name =< / div >
< div class = "line" > < span class = "lineno" > 139< / span > std::string(scn-> name.to_string(img-> get_strings()))< / div >
< div class = "line" > < span class = "lineno" > 140< / span > .append(< span class = "stringliteral" > " #" < / span > )< / div >
< div class = "line" > < span class = "lineno" > 141< / span > .append(std::to_string(sym-> section_index - 1))< / div >
< div class = "line" > < span class = "lineno" > 142< / span > .append(< span class = "stringliteral" > " !" < / span > )< / div >
< div class = "line" > < span class = "lineno" > 143< / span > .append(std::to_string(img-> file_header.timedate_stamp));< / div >
< div class = "line" > < span class = "lineno" > 144< / span > < / div >
< div class = "line" > < span class = "lineno" > 145< / span > std::vector< std::uint8_t> scn_data(scn-> size_raw_data);< / div >
< div class = "line" > < span class = "lineno" > 146< / span > if (scn-> characteristics.cnt_uninit_data) {< / div >
< div class = "line" > < span class = "lineno" > 147< / span > scn_data.insert(scn_data.begin(), scn-> size_raw_data, 0);< / div >
< div class = "line" > < span class = "lineno" > 148< / span > } else {< / div >
< div class = "line" > < span class = "lineno" > 149< / span > scn_data.insert(< / div >
< div class = "line" > < span class = "lineno" > 150< / span > scn_data.begin(),< / div >
< div class = "line" > < span class = "lineno" > 151< / span > reinterpret_cast< std::uint8_t*> (img) + scn-> ptr_raw_data,< / div >
< div class = "line" > < span class = "lineno" > 152< / span > reinterpret_cast< std::uint8_t*> (img) + scn-> ptr_raw_data +< / div >
< div class = "line" > < span class = "lineno" > 153< / span > scn-> size_raw_data);< / div >
< div class = "line" > < span class = "lineno" > 154< / span > }< / div >
< div class = "line" > < span class = "lineno" > 155< / span > < / div >
< div class = "line" > < span class = "lineno" > 156< / span > std::vector< recomp::reloc_t> relocs;< / div >
< div class = "line" > < span class = "lineno" > 157< / span > auto scn_relocs = reinterpret_cast< coff::reloc_t*> (< / div >
< div class = "line" > < span class = "lineno" > 158< / span > scn-> ptr_relocs + reinterpret_cast< std::uint8_t*> (img));< / div >
< div class = "line" > < span class = "lineno" > 159< / span > < / div >
< div class = "line" > < span class = "lineno" > 160< / span > for (auto idx = 0u; idx < scn-> num_relocs; ++idx) {< / div >
< div class = "line" > < span class = "lineno" > 161< / span > auto scn_reloc = & scn_relocs[idx];< / div >
< div class = "line" > < span class = "lineno" > 162< / span > auto sym_reloc = img-> get_symbol(scn_relocs[idx].symbol_index);< / div >
< div class = "line" > < span class = "lineno" > 163< / span > auto sym_name = symbol_t::name(img, sym_reloc);< / div >
< div class = "line" > < span class = "lineno" > 164< / span > auto sym_hash = decomp::symbol_t::hash(sym_name.data());< / div >
< div class = "line" > < span class = "lineno" > 165< / span > relocs.push_back(< / div >
< div class = "line" > < span class = "lineno" > 166< / span > recomp::reloc_t(scn_reloc-> virtual_address - sym-> value,< / div >
< div class = "line" > < span class = "lineno" > 167< / span > sym_hash, sym_name.data()));< / div >
< div class = "line" > < span class = "lineno" > 168< / span > }< / div >
< div class = "line" > < span class = "lineno" > 169< / span > < / div >
< div class = "line" > < span class = "lineno" > 170< / span > decomp::symbol_t new_scn_sym(img, scn_sym_name, 0, scn_data, scn, {},< / div >
< div class = "line" > < span class = "lineno" > 171< / span > relocs, sym_type_t::section);< / div >
< div class = "line" > < span class = "lineno" > 172< / span > < / div >
< div class = "line" > < span class = "lineno" > 173< / span > m_syms-> put_symbol(new_scn_sym);< / div >
< div class = "line" > < span class = "lineno" > 174< / span > }< / div >
< div class = "line" > < span class = "lineno" > 175< / span > < / div >
< div class = "line" > < span class = "lineno" > 176< / span > < span class = "comment" > // create a symbol for the data...< / span > < / div >
< div class = "line" > < span class = "lineno" > 177< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 178< / span > decomp::symbol_t new_sym(img, < a class = "code hl_function" href = "../../d9/dd5/classtheo_1_1decomp_1_1symbol__t.html#a7c6dee036291ded334aa10d89293fc2a" title = "gets the name of the symbol." > symbol_t::name< / a > (img, sym).< a class = "code hl_enumvalue" href = "../../d9/dbd/namespacetheo_1_1decomp.html#af96177687d0ad683c5897d8fa01135f9acdb885c0ea7f6b2874224487c69b8112" > data< / a > (),< / div >
< div class = "line" > < span class = "lineno" > 179< / span > sym-> value, {}, scn, sym, {},< / div >
< div class = "line" > < span class = "lineno" > 180< / span > < a class = "code hl_enumvalue" href = "../../d9/dbd/namespacetheo_1_1decomp.html#af96177687d0ad683c5897d8fa01135f9acdb885c0ea7f6b2874224487c69b8112" > sym_type_t::data< / a > );< / div >
< div class = "line" > < span class = "lineno" > 181< / span > < / div >
< div class = "line" > < span class = "lineno" > 182< / span > m_syms-> < a class = "code hl_function" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#af9caf2d4d97b2498aa624c3750a7a601" title = "add symbol to m_table" > put_symbol< / a > (new_sym);< / div >
< div class = "line" > < span class = "lineno" > 183< / span > }< / div >
< div class = "line" > < span class = "lineno" > 184< / span > } < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (sym-> storage_class ==< / div >
< div class = "line" > < span class = "lineno" > 185< / span > coff::storage_class_id::< / div >
< div class = "line" > < span class = "lineno" > 186< / span > external_definition) { < span class = "comment" > // else if the symbol has no< / span > < / div >
< div class = "line" > < span class = "lineno" > 187< / span > < span class = "comment" > // section... these symbols< / span > < / div >
< div class = "line" > < span class = "lineno" > 188< / span > < span class = "comment" > // require the linker to allocate< / span > < / div >
< div class = "line" > < span class = "lineno" > 189< / span > < span class = "comment" > // space for them...< / span > < / div >
< div class = "line" > < span class = "lineno" > 190< / span > < / div >
< div class = "line" > < span class = "lineno" > 191< / span > std::vector< std::uint8_t> data(sym-> value, 0);< / div >
< div class = "line" > < span class = "lineno" > 192< / span > decomp::symbol_t bss_sym(img, symbol_t::name(img, sym).data(), {}, < a class = "code hl_enumvalue" href = "../../d9/dbd/namespacetheo_1_1decomp.html#af96177687d0ad683c5897d8fa01135f9acdb885c0ea7f6b2874224487c69b8112" > data< / a > ,< / div >
< div class = "line" > < span class = "lineno" > 193< / span > {}, sym, {}, < a class = "code hl_enumvalue" href = "../../d9/dbd/namespacetheo_1_1decomp.html#af96177687d0ad683c5897d8fa01135f9acdb885c0ea7f6b2874224487c69b8112" > sym_type_t::data< / a > );< / div >
< div class = "line" > < span class = "lineno" > 194< / span > < / div >
< div class = "line" > < span class = "lineno" > 195< / span > m_syms-> < a class = "code hl_function" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html#af9caf2d4d97b2498aa624c3750a7a601" title = "add symbol to m_table" > put_symbol< / a > (bss_sym);< / div >
< div class = "line" > < span class = "lineno" > 196< / span > }< / div >
< div class = "line" > < span class = "lineno" > 197< / span > });< / div >
< div class = "line" > < span class = "lineno" > 198< / span > < / div >
< div class = "line" > < span class = "lineno" > 199< / span > < span class = "comment" > // return the extract symbols to the caller...< / span > < / div >
< div class = "line" > < span class = "lineno" > 200< / span > < span class = "comment" > //< / span > < / div >
< div class = "line" > < span class = "lineno" > 201< / span > < span class = "keywordflow" > return< / span > m_syms;< / div >
< div class = "line" > < span class = "lineno" > 202< / span > }< / div >
< / div > <!-- fragment -->
< p class = "reference" > References < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00285" > lib()< / a > .< / p >
< p class = "reference" > Referenced by < a class = "el" href = "../../d2/d26/theo_8cpp_source.html#l00045" > theo::theo_t::decompose()< / a > .< / p >
< / div >
< / div >
< a id = "aa728bde8ec1c5c28ec09f86adf427ae2" name = "aa728bde8ec1c5c28ec09f86adf427ae2" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#aa728bde8ec1c5c28ec09f86adf427ae2" > ◆ < / a > < / span > lib()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > std::vector< std::uint8_t > theo::decomp::decomp_t::lib < / td >
< td > (< / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > gets a vector of bytes consisting of the lib file. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > a vector of bytes consisting of the lib file.< / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00285" > 285< / a > of file < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > .< / p >
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 285< / span > {< / div >
< div class = "line" > < span class = "lineno" > 286< / span > < span class = "keywordflow" > return< / span > m_lib;< / div >
< div class = "line" > < span class = "lineno" > 287< / span > }< / div >
< / div > <!-- fragment -->
< p class = "reference" > Referenced by < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00037" > decompose()< / a > .< / p >
< / div >
< / div >
< a id = "a81ae70b313a9ef24ea5d8f404699baef" name = "a81ae70b313a9ef24ea5d8f404699baef" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a81ae70b313a9ef24ea5d8f404699baef" > ◆ < / a > < / span > objs()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > std::vector< std::vector< std::uint8_t > > theo::decomp::decomp_t::objs < / td >
< td > (< / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > gets all the obj files as a vector of a vector of bytes. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > all the obj files as a vector of a vector of bytes.< / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00289" > 289< / a > of file < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > .< / p >
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 289< / span > {< / div >
< div class = "line" > < span class = "lineno" > 290< / span > < span class = "keywordflow" > return< / span > m_objs;< / div >
< div class = "line" > < span class = "lineno" > 291< / span > }< / div >
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "a79c965ec0a996a936faae7f54b0e055e" name = "a79c965ec0a996a936faae7f54b0e055e" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a79c965ec0a996a936faae7f54b0e055e" > ◆ < / a > < / span > rtns()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > std::vector< < a class = "el" href = "../../df/db4/classtheo_1_1decomp_1_1routine__t.html" > routine_t< / a > > theo::decomp::decomp_t::rtns < / td >
< td > (< / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > gets all of the routine objects. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > vector of routine objects.< / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00281" > 281< / a > of file < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > .< / p >
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 281< / span > {< / div >
< div class = "line" > < span class = "lineno" > 282< / span > < span class = "keywordflow" > return< / span > m_rtns;< / div >
< div class = "line" > < span class = "lineno" > 283< / span > }< / div >
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "a860dddc3a5d12231b685dbaa12a0db06" name = "a860dddc3a5d12231b685dbaa12a0db06" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a860dddc3a5d12231b685dbaa12a0db06" > ◆ < / a > < / span > scn_hash_tbl()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > std::map< coff::section_header_t *, std::size_t > & theo::decomp::decomp_t::scn_hash_tbl < / td >
< td > (< / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > gets the section hash table section header --> hash of the section header ptr. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > the section hash table section header --> hash of the section header ptr.< / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00297" > 297< / a > of file < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > .< / p >
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 297< / span > {< / div >
< div class = "line" > < span class = "lineno" > 298< / span > < span class = "keywordflow" > return< / span > m_scn_hash_tbl;< / div >
< div class = "line" > < span class = "lineno" > 299< / span > }< / div >
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "a8630f2ee0f4fb9516f5b20014e4c6120" name = "a8630f2ee0f4fb9516f5b20014e4c6120" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a8630f2ee0f4fb9516f5b20014e4c6120" > ◆ < / a > < / span > syms()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > < a class = "el" href = "../../db/d77/classtheo_1_1recomp_1_1symbol__table__t.html" > recomp::symbol_table_t< / a > * theo::decomp::decomp_t::syms < / td >
< td > (< / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > gets the symbol table. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > the symbol table.< / dd > < / dl >
< p class = "definition" > Definition at line < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html#l00293" > 293< / a > of file < a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > .< / p >
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 293< / span > {< / div >
< div class = "line" > < span class = "lineno" > 294< / span > < span class = "keywordflow" > return< / span > m_syms;< / div >
< div class = "line" > < span class = "lineno" > 295< / span > }< / div >
< / div > <!-- fragment -->
< p class = "reference" > Referenced by < a class = "el" href = "../../db/d55/recomp_8cpp_source.html#l00040" > theo::recomp::recomp_t::allocate()< / a > .< / p >
< / div >
< / div >
< hr / > The documentation for this class was generated from the following files:< ul >
< li > include/decomp/< a class = "el" href = "../../d2/d96/decomp_8hpp_source.html" > decomp.hpp< / a > < / li >
< li > src/decomp/< a class = "el" href = "../../dc/d83/decomp_8cpp_source.html" > decomp.cpp< / a > < / li >
< / ul >
< / div > <!-- contents -->
<!-- start footer part -->
< hr class = "footer" / > < address class = "footer" > < small >
Generated by  < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "../../doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.9.3
< / small > < / address >
< / body >
< / html >