Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __thiscall VM_x_setFLAG_sub_66A696(_vm_x *this, unsigned int FLAGa2)
- {
- this->_OF = (FLAGa2 >> 11) & 1;
- this->_CF = FLAGa2 & 1;
- this->_PF = ((unsigned __int8)FLAGa2 >> 2) & 1;
- this->_SF = ((unsigned __int8)FLAGa2 >> 7) & 1;
- this->_ZF = ((unsigned __int8)FLAGa2 >> 6) & 1;
- this->_DF = (FLAGa2 >> 10) & 1;
- }
- ------------------
- void __thiscall VM_x_VM_RUN_sub_66A6D7(_vm_x *this)
- {
- unsigned int v2; // eax@1
- signed int opcount_v3; // ecx@1
- _OPCODE *_map_op_v4; // ecx@2
- int _PPv5; // edi@2
- int eip_v6; // eax@2
- unsigned int v7; // eax@2
- unsigned int v8; // eax@6
- char v9; // dl@6
- unsigned int iv10; // eax@10
- char *v11; // eax@11
- int *v11_v12; // ecx@14
- unsigned int v13; // edx@14
- int v14; // eax@16
- int v15; // eax@17
- int v16; // ebx@30
- bool v17; // dl@35
- unsigned int v18; // edx@46
- bool v19; // bl@47
- int v20; // ecx@55
- int v21; // ST08_4@60
- unsigned int _END_EIP_opcount_v23; // [sp+8h] [bp-14h]@1
- int v23; // [sp+Ch] [bp-10h]@45
- int v15_v25; // [sp+10h] [bp-Ch]@6
- int *v11_v26; // [sp+14h] [bp-8h]@6
- char v26; // [sp+1Ah] [bp-2h]@1
- unsigned __int8 OPidxv28; // [sp+1Bh] [bp-1h]@2
- VM_x_setFLAG_sub_66A696(this, (unsigned __int16)FLAGS_word_7D77A0);
- memcpy_0(this->_args_field_54, &ARG_eax_dword_7D77A4, 0x20u);
- LeaveCriticalSection(&VM_crit_stru_7D77C8);
- construct_opcode_ar_sub_66A9D2();
- VM_oo_12_end_dword_7D779C = 0;
- v2 = sub_66A485();
- this->_HM_field_48 = v2;
- this->_bfield_74 = 0;
- v26 = ~(unsigned __int8)(v2 >> 4) & 1;
- opcount_v3 = this->_map_op_array_field_8->_mapop_field_268.endfield_4
- - (unsigned int)this->_map_op_array_field_8->_mapop_field_268.beginfield_0;
- this->_EIP1_field_4C = 0;
- this->_EIP2_field_50 = 0;
- _END_EIP_opcount_v23 = opcount_v3 >> 4;
- if ( opcount_v3 >> 4 )
- {
- while ( 1 )
- {
- _map_op_v4 = this->_map_op_array_field_8;
- _PPv5 = (int)&_map_op_v4->_mapop_field_268.beginfield_0[4 * this->_EIP1_field_4C];
- eip_v6 = this->_EIP1_field_4C + 1;
- ++this->_EIP2_field_50;
- this->_EIP1_field_4C = eip_v6;
- v7 = *(_DWORD *)_PPv5;
- OPidxv28 = LOBYTE(_map_op_v4->_ar67_1_field_10C[(*(_DWORD *)_PPv5 >> 4) & 0x7F]);
- if ( OPidxv28 == 0x1B )
- break;
- if ( OPidxv28 == 0x1D )
- {
- if ( VM_x_FLAG_cmp_sub_66A238(this, ((v7 >> 25) & 7) + ((v7 & 0x30000000) != 0 ? 8 : 0)) )
- break;
- }
- else
- {
- v11_v26 = 0;
- v15_v25 = 0;
- v8 = *(_DWORD *)_PPv5;
- v9 = (*(_DWORD *)_PPv5 >> 12) & 1;
- if ( OPidxv28 == 0x2A || OPidxv28 == 0x2B )
- v9 = 0;
- if ( BYTE1(v8) & 0x40 )
- {
- iv10 = LOBYTE(_map_op_v4->_ar8_1_field_238[(v8 >> 15) & 7]);
- if ( v9 )
- v11 = VM_x_get_Args_sub_66A1EF(this, iv10);
- else
- v11 = (char *)&this->_args_field_54[iv10];
- }
- else
- {
- v11 = 0;
- }
- v11_v12 = (int *)v11;
- v11_v26 = (int *)v11;
- v13 = *(_DWORD *)_PPv5;
- if ( v13 & 0x40000 )
- {
- v15 = 0;
- if ( v13 & 0x80000 )
- v15 = this->_args_field_54[(v13 >> 22) & 7];
- if ( v13 & 0x200000 )
- {
- v11_v12 = v11_v26;
- v15 += this->_args_field_54[(v13 >> 25) & 7] << ((v13 >> 28) & 3);
- }
- if ( v13 & 0x100000 )
- v15 += *(_DWORD *)(_PPv5 + 8);
- }
- else if ( v13 & 0x80000 )
- {
- v14 = (v13 >> 22) & 7;
- if ( (v13 >> 12) & 1 )
- {
- v15 = (int)VM_x_get_Args_sub_66A1EF(this, v14);
- v11_v12 = v11_v26;
- }
- else
- {
- v15 = (int)&this->_args_field_54[v14];
- }
- }
- else
- {
- v15 = 0;
- }
- v15_v25 = v15;
- if ( *(_DWORD *)_PPv5 & 0x80000000 && *(_DWORD *)_PPv5 & 0x40000000 )
- {
- v15 = *(_DWORD *)(_PPv5 + 4);
- v15_v25 = *(_DWORD *)(_PPv5 + 4);
- }
- if ( *(_BYTE *)(_PPv5 + 1) & 8 )
- {
- v16 = (int)v11_v12;
- v11_v12 = (int *)v15;
- v15 = v16;
- v11_v26 = v11_v12;
- v15_v25 = v16;
- }
- if ( *(_DWORD *)_PPv5 & 0x80000000 && !(*(_DWORD *)_PPv5 & 0x40000000) )
- {
- v17 = v15 && v11_v12;
- if ( v15 && !v11_v12 )
- {
- v11_v12 = (int *)v15;
- v11_v26 = (int *)v15;
- }
- if ( !v17 )
- {
- v15 = _PPv5 + 4;
- v15_v25 = _PPv5 + 4;
- }
- }
- if ( v15 && !v11_v12 )
- {
- v11_v12 = (int *)v15;
- v11_v26 = (int *)v15;
- }
- v23 = *(_DWORD *)_PPv5 & 0x1000;
- v19 = 0;
- if ( !v23 )
- {
- v18 = *(_DWORD *)_PPv5;
- if ( !(BYTE1(v18) & 0x20) )
- v19 = 1;
- }
- if ( OPidxv28 || !v19 )
- {
- if ( !v26 )
- goto _OP_CALL_loc_66A998;
- if ( OPidxv28 == 0x17 )
- {
- if ( v19 )
- {
- v20 = *v11_v12 - *(_DWORD *)v15;
- this->_CF = (((unsigned __int64)v20 >> 32) & 1) != 0;
- VM_x_FLAGS_sub_66A212(this, v20);
- }
- else
- {
- if ( !v23 )
- goto _OP_CALL_loc_66A998;
- v21 = *(_BYTE *)v11_v12 - *(_BYTE *)v15;
- this->_CF = BYTE1(v21) & 1;
- VM_x_FLAGS_sub_66A212(this, v21);
- }
- this->_OF = 0;
- }
- else
- {
- if ( OPidxv28 != 0x14 || !v23 )
- {
- _OP_CALL_loc_66A998:
- (**(void (__fastcall ***)(int, int **, int *, _vm_x *, int))OPcode_array_dword_7D7798[OPidxv28])(
- OPcode_array_dword_7D7798[OPidxv28],
- &v11_v26,
- &v15_v25,
- this,
- _PPv5);
- goto LABEL_63;
- }
- *(_BYTE *)v11_v12 ^= *(_BYTE *)v15;
- VM_x_FLAGS_sub_66A212(this, *(_BYTE *)v11_v26);
- this->_OF = 0;
- this->_CF = 0;
- }
- }
- else
- {
- *v11_v12 = *(_DWORD *)v15;
- }
- }
- LABEL_63:
- if ( this->_EIP1_field_4C >= _END_EIP_opcount_v23 )
- goto LABEL_64;
- }
- VM_x_hand_jmp_sub_66A37E(this, *(_DWORD *)(_PPv5 + 4), _PPv5);
- goto LABEL_63;
- }
- LABEL_64:
- VM_x_exit_stop_sub_66A3D3(this->_map_op_array_field_8->_stopEIP_field_264);
- }
- ---------------------------
- void __thiscall VM_x_hand_jmp_sub_66A37E(_vm_x *this, unsigned int toa2, int a3)
- {
- int v4; // eax@1
- int v5; // eax@5
- v4 = *(_DWORD *)(a3 + 12);
- if ( v4 == -1 )
- {
- v5 = OPCODE_find_sub_66AC5D(this->_map_op_array_field_8, toa2);
- if ( v5 == -1 )
- {
- *(_DWORD *)(a3 + 12) = -2;
- }
- else
- {
- *(_DWORD *)(a3 + 12) = v5;
- this->_EIP1_field_4C = v5;
- }
- }
- else if ( v4 != -2 )
- {
- this->_EIP1_field_4C = v4;
- return;
- }
- if ( *(_DWORD *)(a3 + 12) == -2 )
- VM_x_exit_stop_sub_66A3D3(toa2);
- }
- -----------------------
- signed int __thiscall OPCODE_find_sub_66AC5D(_OPCODE *this, unsigned int a2)
- {
- int v2; // edi@3
- signed int res; // eax@3
- signed int endv4; // edx@3
- int iv5; // esi@4
- unsigned int v6; // ebx@6
- if ( a2 >= this->_startEIP_field_260
- && a2 < this->_stopEIP_field_264
- && (v2 = this->_startEIP_field_260,
- res = 0,
- (endv4 = (signed int)(this->_mapop_field_268.endfield_4 - (unsigned int)this->_mapop_field_268.beginfield_0) >> 4) != 0) )
- {
- iv5 = 0;
- while ( v2 != a2 )
- {
- v6 = this->_mapop_field_268.beginfield_0[iv5];
- iv5 += 4;
- v2 += v6 & 0xF;
- ++res;
- if ( res >= (unsigned int)endv4 )
- goto LABEL_7;
- }
- }
- else
- {
- LABEL_7:
- res = -1;
- }
- return res;
- }
- -------------------------------
- char __thiscall VM_x_FLAG_cmp_sub_66A238(_vm_x *this, char a2)
- {
- char res; // al@2
- bool v4; // zf@10
- bool v5; // zf@12
- switch ( a2 )
- {
- case 0:
- return this->_OF;
- case 1:
- return this->_OF == 0;
- case 2:
- return this->_CF;
- case 3:
- return this->_CF == 0;
- case 4:
- return this->_ZF;
- case 5:
- return this->_ZF == 0;
- case 6:
- if ( this->_CF )
- goto LABEL_26;
- v4 = this->_ZF == 0;
- goto LABEL_21;
- case 7:
- if ( this->_CF )
- goto LABEL_22;
- v5 = this->_ZF == 0;
- goto LABEL_25;
- case 8:
- return this->_SF;
- case 9:
- return this->_SF == 0;
- case 0xA:
- return this->_PF;
- case 0xB:
- return this->_PF == 0;
- case 0xC:
- return this->_SF != this->_OF;
- case 0xD:
- return this->_SF == this->_OF;
- case 0xE:
- if ( !this->_ZF )
- {
- v4 = this->_SF == this->_OF;
- LABEL_21:
- if ( v4 )
- goto LABEL_22;
- }
- goto LABEL_26;
- case 0xF:
- if ( this->_ZF )
- goto LABEL_22;
- v5 = this->_SF == this->_OF;
- LABEL_25:
- if ( !v5 )
- LABEL_22:
- res = 0;
- else
- LABEL_26:
- res = 1;
- break;
- default:
- res = 0;
- break;
- }
- return res;
- }
- -----------------------------
- void __thiscall OPCODE_Init_sub_66AA63(_OPCODE *this)
- {
- unsigned int v2; // eax@1
- _OPCODE *v3; // ecx@1
- unsigned int v4; // eax@3
- int *v5; // ecx@3
- unsigned int v6; // eax@5
- int *v7; // ecx@5
- int *v8; // ecx@7
- unsigned int v9; // eax@7
- std_map_clear_sub_66ACED(
- (int)&this->_mapop_field_268,
- this->_mapop_field_268.beginfield_0,
- this->_mapop_field_268.endfield_4);
- this->_initbfield_258 = 0;
- this->_opcount_field_25C = 0;
- v2 = 0;
- v3 = this;
- do
- {
- v3->_ar67_0_field_0[0] = v2++;
- v3 = (_OPCODE *)((char *)v3 + 4);
- }
- while ( v2 < 67 );
- v4 = 0;
- v5 = this->_ar67_1_field_10C;
- do
- {
- *v5 = v4++;
- ++v5;
- }
- while ( v4 < 67 );
- v6 = 0;
- v7 = this->_ar8_0_field_218;
- do
- {
- *v7 = v6++;
- ++v7;
- }
- while ( v6 < 8 );
- v8 = this->_ar8_1_field_238;
- v9 = 0;
- do
- {
- *v8 = v9++;
- ++v8;
- }
- while ( v9 < 8 );
- }
- --------------------
- void __thiscall OPCODE_Add_sub_66ABC4(_OPCODE *this, int pa2, int a3)
- {
- int v4; // ebx@1
- int v5; // esi@1
- int endv6; // edx@1
- unsigned int v7; // ecx@3
- unsigned int *v8; // eax@3
- unsigned int v9; // ebx@4
- char v10; // [sp+Ch] [bp-14h]@1
- int v11; // [sp+1Ch] [bp-4h]@2
- int iv12; // [sp+28h] [bp+8h]@2
- this->_startEIP_field_260 = *(_DWORD *)pa2;
- v4 = *(_DWORD *)(pa2 + 4);
- v5 = pa2 + 8;
- std_map_sub_66AD22((int)&this->_mapop_field_268, *(_DWORD *)(pa2 + 4), (int)&v10);
- endv6 = this->_startEIP_field_260;
- if ( v4 )
- {
- iv12 = 0;
- v11 = v4;
- do
- {
- v7 = *(_DWORD *)v5;
- v8 = &this->_mapop_field_268.beginfield_0[iv12];
- v5 += 4;
- *v8 = v7;
- if ( v7 & 0x100000 )
- {
- v9 = *(_DWORD *)v5;
- v5 += 4;
- v8[2] = v9;
- }
- if ( v7 & 0x80000000 )
- {
- v8[1] = -*(_DWORD *)v5;
- v5 += 4;
- }
- v8[3] = -1;
- iv12 += 4;
- endv6 += v7 & 0xF;
- --v11;
- }
- while ( v11 );
- }
- this->_stopEIP_field_264 = endv6;
- OPCODE_unpack_sub_66AAD0(this, 0);
- }
- --------------------
- void __thiscall OPCODE_unpack_sub_66AAD0(_OPCODE *this, char a2)
- {
- signed int sizev3; // edi@1
- char *v4; // ebx@2
- unsigned int iv5; // eax@2
- _OPCODE *v6; // ecx@2
- int v7; // edx@3
- unsigned int iv8; // eax@4
- int v9; // ecx@5
- int iv10; // ebx@8
- unsigned int *v11; // ecx@9
- unsigned int v12; // edx@9
- unsigned int v13; // eax@9
- int randv14; // [sp+8h] [bp-4h]@2
- sizev3 = (signed int)(this->_mapop_field_268.endfield_4 - (unsigned int)this->_mapop_field_268.beginfield_0) >> 4;
- if ( !this->_initbfield_258 )
- {
- this->_initbfield_258 = 1;
- randv14 = rand();
- srand(sizev3);
- this->_opcount_field_25C = sizev3;
- shuffle_randoml_sub_5BC5BA(this->_ar67_0_field_0, this->_ar67_1_field_10C);
- v4 = (char *)this->_ar8_0_field_218;
- shuffle_randoml_sub_5BC5BA(this->_ar8_0_field_218, this->_ar8_1_field_238);
- iv5 = 0;
- v6 = this;
- do
- {
- v7 = v6->_ar67_0_field_0[0];
- v6 = (_OPCODE *)((char *)v6 + 4);
- this->_ar67_1_field_10C[v7] = iv5++;
- }
- while ( iv5 < 67 );
- iv8 = 0;
- do
- {
- v9 = *(_DWORD *)v4;
- v4 += 4;
- this->_ar8_1_field_238[v9] = iv8++;
- }
- while ( iv8 < 8 );
- if ( a2 && sizev3 )
- {
- iv10 = 0;
- do
- {
- v11 = &this->_mapop_field_268.beginfield_0[iv10];
- v12 = *v11;
- LOWORD(v12) = *v11 & 0xF80F;
- v13 = v12 | 16 * (this->_ar67_0_field_0[(*v11 >> 4) & 0x7F] & 0x7F);
- *v11 = v13;
- if ( BYTE1(v13) & 0x40 )
- *v11 = v13 & 0xFFFC7FFF | ((this->_ar8_0_field_218[(v13 >> 15) & 7] & 7) << 15);
- iv10 += 4;
- --sizev3;
- }
- while ( sizev3 );
- }
- srand(randv14);
- }
- }
- ---------------
- _vm_x *__cdecl alloc_ctx_vm_ret_0x78_sub_66A00E(int tbla1)
- {
- int v1; // esi@2
- int iv2; // eax@4
- int _flag_v3; // ecx@4
- _vm_x *v4; // ecx@7
- _vm_x *res; // eax@8
- int iv6; // esi@9
- _vm_x *v7; // ecx@9
- _vm_x *rv8; // esi@11
- EnterCriticalSection(&VM_crit_stru_7D77C8);
- if ( !vm_ctx_array[0]._ptr0x78_field_0 )
- {
- v1 = (int)&vm_ctx_array[0]._ptr0xFE0_field_4;
- do
- {
- *(_DWORD *)(v1 - 4) = operator new(0x78u);
- *(_DWORD *)v1 = operator new(0xFE0u);
- *(_BYTE *)(v1 + 4) = 1;
- v1 += 12;
- }
- while ( v1 < (unsigned int)&VM_oo_12_end_dword_7D779C );
- }
- iv2 = 0;
- _flag_v3 = (int)&vm_ctx_array[0]._flag_field_8;
- while ( !*(_BYTE *)_flag_v3 )
- {
- _flag_v3 += 12;
- ++iv2;
- if ( _flag_v3 >= (unsigned int)&FLAGS_word_7D77A0 )
- {
- LeaveCriticalSection(&VM_crit_stru_7D77C8);
- v4 = (_vm_x *)operator new(0x78u);
- if ( v4 )
- res = vm_x_ctor_0x78_sub_66A18E(v4, tbla1, 0);
- else
- res = 0;
- return res;
- }
- }
- iv6 = iv2;
- vm_ctx_array[iv2]._flag_field_8 = 0;
- v7 = vm_ctx_array[iv2]._ptr0x78_field_0;
- if ( v7 )
- vm_x_ctor_0x78_sub_66A18E(v7, tbla1, vm_ctx_array[iv6]._ptr0xFE0_field_4);
- rv8 = vm_ctx_array[iv6]._ptr0x78_field_0;
- LeaveCriticalSection(&VM_crit_stru_7D77C8);
- return rv8;
- }
- -----------------
- void __cdecl free_ctx_vm_sub_66A103(_vm_x *pa1)
- {
- int iv1; // eax@1
- _vm_ctx *vmv2; // ecx@1
- int v3; // edi@7
- EnterCriticalSection(&VM_crit_stru_7D77C8);
- iv1 = 0;
- vmv2 = vm_ctx_array;
- do
- {
- if ( vmv2->_ptr0x78_field_0 == pa1 )
- {
- v3 = iv1;
- dtor_0x78_sub_66A1D6(vm_ctx_array[iv1]._ptr0x78_field_0);
- vm_ctx_array[v3]._flag_field_8 = 1;
- LeaveCriticalSection(&VM_crit_stru_7D77C8);
- return;
- }
- ++vmv2;
- ++iv1;
- }
- while ( (unsigned int)vmv2 < (unsigned int)&OPcode_array_dword_7D7798 );
- LeaveCriticalSection(&VM_crit_stru_7D77C8);
- if ( pa1 )
- {
- dtor_0x78_sub_66A1D6(pa1);
- free_sub_65A591(pa1);
- }
- }
- ---------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement