当前位置: 首页>>代码示例>>C++>>正文


C++ VirtualMachine::create_function_head方法代码示例

本文整理汇总了C++中VirtualMachine::create_function_head方法的典型用法代码示例。如果您正苦于以下问题:C++ VirtualMachine::create_function_head方法的具体用法?C++ VirtualMachine::create_function_head怎么用?C++ VirtualMachine::create_function_head使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VirtualMachine的用法示例。


在下文中一共展示了VirtualMachine::create_function_head方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BuildPCode

  /*
pCodeBufferInfo BuildVMCode::BuildPCode(
                                        VirtualMachineManage *vmmanage,
                                        pCodeBufferInfo pinfo,
                                        VMAddressTable * address_table
                                          )
{
  Analysis analysis;
  std::vector<CodePiece> code_piece_list;
  analysis.disasm(pinfo,code_piece_list);
  VirtualMachine *vm = vmmanage->rand_virtual_machine();
  vector <VMCodeBufferManage*>vcodebufs;
  long first_pcode_addr = alloc_address(vm,address_table,&analysis,&vcodebufs);
  
   SeniorVMHandle *sfirst = &vcodebufs[ 0 ]->get_generator(  );
   //sfirst->upset_register_array(sfirst->pcode->register_store_in);
   //sfirst->start();
  
  long key = vcodebufs[ 0 ]->code.get_original_key(  );

  VTable t_v;

  memset(&t_v,0,sizeof(t_v));
  bool t_sign = address_table->get_sign();
  address_table->set_sign(true);
  //printf("1111%d\n",address_table->get_size());
  //__asm__ ("int3");
  long head_address = address_table->assign_address(0x70);
  address_table->set_sign(t_sign);

#ifdef DEBUG
  printf("vm入口地址:%x\r\n",head_address);
#endif
  ppcode_block_info info =  vm->create_function_head(head_address,first_pcode_addr,sfirst->pcode,pinfo->addr + pinfo->size,123456,key); //pcode位置有问题

  address_table->copy(head_address,info->buf,info->size);
  

  for (int i = 0; i < analysis.block_count; ++i)
  {
    ud_t ud;
    pAssemblerTree nowtree = analysis.get_tree(i);
    SeniorVMHandle *senior = &(vcodebufs)[i]->get_generator();
    vcodebufs[ i ]->code.set_key( nowtree->key ); //设置key
    senior->save_vm_context();
      bool b_j = false;    
    for (std::vector<ud_t>::iterator iter = nowtree->asmpiece.begin();
         iter != nowtree->asmpiece.end(); ++iter)
    {
      ud = *iter;
      if (nowtree->LeftChild)
      ud.vm_jcc_addr1 = nowtree->LeftChild->reloc_address;
      switch ( ud.mnemonic)
      {
      case UD_Ijnz:
        b_j = true;
        ud.vm_jcc_addr2 = nowtree->RightChild->reloc_address;//nowtree->jcc_addr;
        asm_to_vm( &vcodebufs[ i ]->get_generator(  ),&ud );        
        break;
      case UD_Ijz:
        b_j = true;
        ud.vm_jcc_addr2 = nowtree->jcc_addr;
        asm_to_vm( &vcodebufs[ i ]->get_generator(  ),&ud );        
        break;
      default:
        asm_to_vm( &vcodebufs[ i ]->get_generator(  ),&ud );
      }
    }
    printf("当前key:%x\r\n",nowtree->key);
    if (i+1 < analysis.block_count    )
    {
      senior->recover_vm_context();
      if (!b_j) 
        senior->push(nowtree->LeftChild->reloc_address);
      else
        senior->push(T_JCC_REGISTER);
      //senior->set_key(vcodebufs[i]->code.get_original_key());
      senior->set_key(nowtree->key); //handle设置key
    }
        
    //senior->recover_vm_context();      
  }
  address_table->copy();
  
  for (vector <VMCodeBufferManage*>::iterator iter = vcodebufs.begin(); iter != vcodebufs.end(); ++iter)
  {
    delete *iter;
  }
  pinfo->addr = head_address;
  return pinfo;
}*/
pCodeBufferInfo BuildVMCode::BuildPCode(
                                        VirtualMachineManage *vmmanage,
                                        pCodeBufferInfo pinfo,
                                        VMAddressTable * address_table
                                          )
{
  Analysis analysis;
  analysis.disasm(pinfo);
  VirtualMachine *vm = vmmanage->rand_virtual_machine();
//.........这里部分代码省略.........
开发者ID:Kernal-GH,项目名称:WProtect-1,代码行数:101,代码来源:BuildVMCode.cpp


注:本文中的VirtualMachine::create_function_head方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。