|
|
|
@ -187,17 +187,25 @@ int __cdecl main( int argc, const char *argv[] )
|
|
|
|
|
|
|
|
|
|
if ( parser.exists( "devirt" ) )
|
|
|
|
|
{
|
|
|
|
|
vtil::basic_block *rtn = nullptr;
|
|
|
|
|
vtil::basic_block *rtn = nullptr, *first = nullptr;
|
|
|
|
|
for ( auto [ code_block, code_block_num ] = std::tuple{ first_block, 0u };
|
|
|
|
|
code_block_num < file_header->code_block_count;
|
|
|
|
|
code_block = reinterpret_cast< vmp2::v3::code_block_t * >(
|
|
|
|
|
reinterpret_cast< std::uintptr_t >( code_block ) + code_block->next_block_offset ),
|
|
|
|
|
++code_block_num )
|
|
|
|
|
{
|
|
|
|
|
rtn = rtn ? rtn->fork(
|
|
|
|
|
ABS_TO_IMG( code_block->vip_begin, file_header->module_base, file_header->image_base ) )
|
|
|
|
|
: vtil::basic_block::begin(
|
|
|
|
|
if ( !rtn )
|
|
|
|
|
{
|
|
|
|
|
rtn = vtil::basic_block::begin(
|
|
|
|
|
ABS_TO_IMG( code_block->vip_begin, file_header->module_base, file_header->image_base ) );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
first = rtn;
|
|
|
|
|
|
|
|
|
|
rtn =
|
|
|
|
|
rtn->fork( ABS_TO_IMG( code_block->vip_begin, file_header->module_base, file_header->image_base ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( auto idx = 0u; idx < code_block->vinstr_count; ++idx )
|
|
|
|
|
{
|
|
|
|
@ -235,8 +243,8 @@ int __cdecl main( int argc, const char *argv[] )
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vtil::optimizer::apply_all( rtn );
|
|
|
|
|
vtil::debug::dump( rtn );
|
|
|
|
|
vtil::optimizer::apply_all( first );
|
|
|
|
|
vtil::debug::dump( first );
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|