preparing for vmemu re-write

merge-requests/6/head
_xeroxz 3 years ago
parent 4bc35659f1
commit fd3e44fb9d

@ -15,5 +15,6 @@ namespace vm
private: private:
uc_engine *uc_ctx; uc_engine *uc_ctx;
vm::ctx_t *vm_ctx;
}; };
} // namespace vm } // namespace vm

@ -31,13 +31,13 @@ int __cdecl main( int argc, const char *argv[] )
auto umtils = xtils::um_t::get_instance(); auto umtils = xtils::um_t::get_instance();
if ( !parser.exists( "unpack" ) ) if ( !parser.exists( "unpack" ) && parser.exists( "vmentry" ) && parser.exists( "bin" ) )
{ {
const auto module_base = reinterpret_cast< std::uintptr_t >( const auto module_base = reinterpret_cast< std::uintptr_t >(
LoadLibraryExA( parser.get< std::string >( "bin" ).c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES ) ); LoadLibraryExA( parser.get< std::string >( "bin" ).c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES ) );
const auto vm_entry_rva = std::strtoull( parser.get< std::string >( "vmentry" ).c_str(), nullptr, 16 ); const auto vm_entry_rva = std::strtoull( parser.get< std::string >( "vmentry" ).c_str(), nullptr, 16 );
const auto image_base = umtils->image_base( parser.get< std::string >( "vmpbin" ).c_str() ); const auto image_base = umtils->image_base( parser.get< std::string >( "bin" ).c_str() );
const auto image_size = NT_HEADER( module_base )->OptionalHeader.SizeOfImage; const auto image_size = NT_HEADER( module_base )->OptionalHeader.SizeOfImage;
std::printf( "> image base = %p, image size = %p, module base = %p\n", image_base, image_size, module_base ); std::printf( "> image base = %p, image size = %p, module base = %p\n", image_base, image_size, module_base );

@ -2,12 +2,14 @@
namespace vm namespace vm
{ {
emu_t::emu_t( vm::ctx_t *vmctx ) emu_t::emu_t( vm::ctx_t *vm_ctx ) : vm_ctx( vm_ctx ), uc_ctx( nullptr )
{ {
} }
emu_t::~emu_t() emu_t::~emu_t()
{ {
if ( uc_ctx )
uc_close( uc_ctx );
} }
bool emu_t::init() bool emu_t::init()

Loading…
Cancel
Save