fixed bugs...

merge-requests/5/merge
_xeroxz 3 years ago
parent ca4e7bc7a9
commit 6932883ec6

@ -1 +1 @@
Subproject commit 0cbc83be3fb0f4293146def0c3735f39608f646b Subproject commit c2319117a07d95794f54db970aa7f72e8726349a

@ -143,7 +143,7 @@
color:rgb(153,153,153);</string> color:rgb(153,153,153);</string>
</property> </property>
<property name="text"> <property name="text">
<string>VMProtect 2 - Virtual Instruction Inspector (v1.7 BETA)</string> <string>VMProtect 2 - Virtual Instruction Inspector (v1.8 BETA)</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>

@ -202,38 +202,41 @@ void qvminspector_t::add_branch_children( qtree_widget_item_t *item, std::uintpt
var.setValue( virt_instr ); var.setValue( virt_instr );
virt_instr_entry->setData( 3, Qt::UserRole, var ); virt_instr_entry->setData( 3, Qt::UserRole, var );
if ( virt_instr->mnemonic_t == vm::handler::JMP && code_block->jcc.has_jcc ) if ( virt_instr->mnemonic_t == vm::handler::JMP )
{ {
virt_instr_entry->setText( 3, QString( "; { %1, %2 }" ) if ( code_block->jcc.type == vm::instrs::jcc_type::branching )
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) {
.arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) ); virt_instr_entry->setText( 3, QString( "; { %1, %2 }" )
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 )
auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t(); .arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) );
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
const auto block2_addr = code_block->jcc.block_addr[ 1 ]; auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t();
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) ); const auto block2_addr = code_block->jcc.block_addr[ 1 ];
branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) );
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) ); branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) );
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] ); branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] );
virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } ); add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
// if its a JMP with branches we want to insert the next code block
// instructions into the child widget entries... virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } );
item->addChild( virt_instr_entry ); // if its a JMP with branches we want to insert the next code block
return; // instructions into the child widget entries...
} item->addChild( virt_instr_entry );
else if ( virt_instr->mnemonic_t == vm::handler::JMP ) return;
{ }
virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) ); else
{
// else if this jmp doesnt have two branches add the next code block to it... virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) );
item->addChild( virt_instr_entry );
add_branch_children( item, code_block->jcc.block_addr[ 0 ] ); // else if this jmp doesnt have two branches add the next code block to it...
item->addChild( virt_instr_entry );
add_branch_children( item, code_block->jcc.block_addr[ 0 ] );
}
} }
item->addChild( virt_instr_entry ); item->addChild( virt_instr_entry );
} }
@ -343,34 +346,36 @@ void qvminspector_t::update_ui()
var.setValue( virt_instr ); var.setValue( virt_instr );
virt_instr_entry->setData( 3, Qt::UserRole, var ); virt_instr_entry->setData( 3, Qt::UserRole, var );
if ( virt_instr->mnemonic_t == vm::handler::JMP && code_block->jcc.has_jcc ) if ( virt_instr->mnemonic_t == vm::handler::JMP )
{ {
virt_instr_entry->setText( 3, QString( "; { %1, %2 }" ) if ( code_block->jcc.type == vm::instrs::jcc_type::branching )
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) {
.arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) ); virt_instr_entry->setText( 3, QString( "; { %1, %2 }" )
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 )
auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t(); .arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) );
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
const auto block2_addr = code_block->jcc.block_addr[ 1 ]; auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t();
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) ); const auto block2_addr = code_block->jcc.block_addr[ 1 ];
branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) );
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) ); branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) );
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] ); branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] );
virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } ); add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
// if its a JMP with branches we want to insert the next code block
// instructions into the child widget entries... virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } );
ui.virt_instrs->addTopLevelItem( virt_instr_entry ); // if its a JMP with branches we want to insert the next code block
goto finish; // bad code... // instructions into the child widget entries...
ui.virt_instrs->addTopLevelItem( virt_instr_entry );
goto finish; // bad code...
}
else if ( code_block->jcc.type == vm::instrs::jcc_type::absolute )
virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) );
} }
else if ( virt_instr->mnemonic_t == vm::handler::JMP )
virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) );
ui.virt_instrs->addTopLevelItem( virt_instr_entry ); ui.virt_instrs->addTopLevelItem( virt_instr_entry );
} }
} }

Loading…
Cancel
Save