421 lines
13 KiB
C
421 lines
13 KiB
C
/* Agent_Release_x64.exe sha256 6f2be7b8eb799ba51b359d1958720aac5baee5b7ee0d1d36684d3cbd72d45469
|
|
* Ghidra 12.1.2 decompiler output for 0x1400a83b0 FUN_1400a83b0
|
|
* Pseudocode, not original source. */
|
|
|
|
void FUN_1400a83b0(undefined ***param_1,longlong *param_2,uint *param_3,undefined8 param_4)
|
|
|
|
{
|
|
undefined **ppuVar1;
|
|
longlong lVar2;
|
|
undefined8 *puVar3;
|
|
uint uVar4;
|
|
uint uVar5;
|
|
undefined8 uVar6;
|
|
ulonglong uVar7;
|
|
uint *puVar8;
|
|
longlong *plVar9;
|
|
undefined **ppuVar10;
|
|
undefined ***pppuVar11;
|
|
void *pvVar12;
|
|
longlong **pplVar13;
|
|
int iVar14;
|
|
void *pvVar15;
|
|
uint uVar16;
|
|
undefined8 uVar17;
|
|
SIZE_T SVar18;
|
|
IMAGE_DOS_HEADER *pIVar19;
|
|
void *_Dst;
|
|
undefined ***pppuVar20;
|
|
uint uVar21;
|
|
uint uVar22;
|
|
undefined **local_res18;
|
|
uint local_res20 [2];
|
|
undefined **local_128;
|
|
longlong *local_120;
|
|
undefined4 local_118;
|
|
undefined4 local_114;
|
|
undefined2 *local_110;
|
|
void *local_108;
|
|
undefined8 local_100;
|
|
longlong *local_f8;
|
|
undefined8 local_f0;
|
|
undefined4 local_e4;
|
|
undefined4 local_e0 [2];
|
|
int local_d8 [2];
|
|
undefined *local_d0;
|
|
void *local_c8;
|
|
uint local_c0;
|
|
int local_bc;
|
|
undefined1 local_b0 [48];
|
|
undefined **local_80;
|
|
undefined8 local_78;
|
|
byte local_70 [24];
|
|
undefined ***local_58;
|
|
byte local_50;
|
|
longlong local_48;
|
|
undefined2 **local_40;
|
|
byte local_38 [16];
|
|
|
|
local_38[0] = 0xfe;
|
|
local_38[1] = 0xff;
|
|
local_38[2] = 0xff;
|
|
local_38[3] = 0xff;
|
|
local_38[4] = 0xff;
|
|
local_38[5] = 0xff;
|
|
local_38[6] = 0xff;
|
|
local_38[7] = 0xff;
|
|
if (param_3[10] != 1) {
|
|
return;
|
|
}
|
|
puVar8 = param_3;
|
|
(**(code **)(param_1[0x21][0xf] + 0x10))();
|
|
uVar6 = FUN_140081090(param_3,local_res20,puVar8,param_4);
|
|
if ((char)uVar6 == '\0') {
|
|
return;
|
|
}
|
|
uVar17 = 4;
|
|
uVar6 = FUN_140080600(param_3,(undefined8 *)local_e0,4);
|
|
if ((char)uVar6 == '\0') {
|
|
return;
|
|
}
|
|
uVar7 = FUN_140080ca0(param_3,(undefined8 *)(local_b0 + 0x28),uVar17,param_4);
|
|
if ((char)uVar7 == '\0') {
|
|
return;
|
|
}
|
|
if ((int)local_b0._40_4_ < 0) {
|
|
return;
|
|
}
|
|
if (DAT_140155140 <= (int)local_b0._40_4_) {
|
|
return;
|
|
}
|
|
FUN_1400806d0(local_d8);
|
|
uVar6 = FUN_140080930(param_3,local_d8,local_b0._40_4_,param_4);
|
|
if ((char)uVar6 == '\0') {
|
|
local_res18 = &local_d0;
|
|
FUN_140095270((longlong *)&local_d0);
|
|
if (local_c8 == (void *)0x0) {
|
|
return;
|
|
}
|
|
if (-1 < local_bc) {
|
|
return;
|
|
}
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f590();
|
|
}
|
|
SVar18 = (SIZE_T)local_res20[0];
|
|
pplVar13 = &local_120;
|
|
FUN_140070860((longlong *)param_1[0x21],(longlong *)pplVar13,local_res20[0]);
|
|
if ((((local_120 == (longlong *)0x0) || (lVar2 = *local_120, lVar2 == 0)) ||
|
|
(*(char *)(lVar2 + 0x684) != '\0')) || (*(char *)(lVar2 + 0x650) != '\0')) goto LAB_1400a89b9;
|
|
ppuVar10 = param_1[0x21] + 0x11;
|
|
local_f0 = (**(code **)(*ppuVar10 + 0x18))();
|
|
pvVar15 = (void *)0x0;
|
|
uVar21 = 0;
|
|
local_100 = 0;
|
|
local_108 = (void *)0x0;
|
|
local_110 = (undefined2 *)0x0;
|
|
local_f8 = (longlong *)0x0;
|
|
uVar22 = 0;
|
|
local_e4 = 0;
|
|
local_118 = 1;
|
|
local_114 = local_e0[0];
|
|
local_110 = FUN_1400952b0(ppuVar10,pplVar13,SVar18);
|
|
*(undefined8 *)(local_110 + 0x14) = 1;
|
|
if (local_d0 == (undefined *)0x0) {
|
|
uVar4 = local_c0;
|
|
if (local_c8 == (void *)0x0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_140095370(ppuVar10,0,SVar18,param_4);
|
|
}
|
|
}
|
|
else {
|
|
uVar4 = *(uint *)(local_d0 + 0x18);
|
|
}
|
|
if ((int)uVar4 < 0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f590();
|
|
}
|
|
if (local_108 == (void *)0x0) {
|
|
if ((int)uVar4 < 1) {
|
|
if (local_110 == (undefined2 *)0x0) goto LAB_1400a85c5;
|
|
uVar4 = 0;
|
|
}
|
|
else if (local_110 == (undefined2 *)0x0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_140095370((ulonglong)uVar4,local_c8,SVar18,0);
|
|
}
|
|
FUN_14001bc70((longlong)local_110,uVar4,SVar18);
|
|
}
|
|
else {
|
|
if (local_100._4_4_ < (int)uVar4) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f590();
|
|
}
|
|
local_100 = CONCAT44(local_100._4_4_,uVar4);
|
|
}
|
|
LAB_1400a85c5:
|
|
if (local_d0 == (undefined *)0x0) {
|
|
if (local_c8 == (void *)0x0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_140095370(local_110,0,SVar18,local_108);
|
|
}
|
|
}
|
|
else {
|
|
local_c0 = *(uint *)(local_d0 + 0x18);
|
|
}
|
|
pvVar12 = local_c8;
|
|
if (local_c8 == (void *)0x0) {
|
|
if (local_d0 == (undefined *)0x0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_140095370(local_110,0,(ulonglong)local_c0,local_108);
|
|
}
|
|
pvVar12 = pvVar15;
|
|
if (*(int *)(local_d0 + 0x18) != 0) {
|
|
pvVar12 = *(void **)(local_d0 + 0x10);
|
|
}
|
|
}
|
|
_Dst = local_108;
|
|
if (local_108 == (void *)0x0) {
|
|
if (local_110 == (undefined2 *)0x0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_140095370(0,pvVar12,(ulonglong)local_c0,0);
|
|
}
|
|
_Dst = pvVar15;
|
|
if (*(int *)(local_110 + 0xc) != 0) {
|
|
_Dst = *(void **)(local_110 + 8);
|
|
}
|
|
}
|
|
memcpy(_Dst,pvVar12,(longlong)(int)local_c0);
|
|
local_b0._8_2_ = 0;
|
|
local_b0._10_2_ = 0;
|
|
local_b0._12_2_ = 0;
|
|
local_b0._14_2_ = 0;
|
|
local_b0._16_8_ = 0;
|
|
local_b0._24_2_ = 0;
|
|
local_b0._26_2_ = 0;
|
|
local_b0._28_2_ = 0;
|
|
local_b0._30_2_ = 0;
|
|
local_b0._0_8_ = Proud::CReceivedMessageList::vftable;
|
|
local_b0._32_2_ = 1000;
|
|
local_b0._34_2_ = 0;
|
|
local_b0._36_2_ = 1;
|
|
local_b0._38_2_ = 0;
|
|
pvVar12 = pvVar15;
|
|
if (local_120 != (longlong *)0x0) {
|
|
pvVar12 = (void *)*local_120;
|
|
}
|
|
pppuVar11 = (undefined ***)((longlong)pvVar12 + 0x638);
|
|
pppuVar20 = &local_res18;
|
|
pIVar19 = (IMAGE_DOS_HEADER *)local_b0;
|
|
plVar9 = (longlong *)&local_118;
|
|
FUN_1400b8570((longlong)pppuVar11,plVar9,(longlong)pIVar19,(undefined4 *)pppuVar20);
|
|
if ((int)local_res18 != 0) {
|
|
FUN_140030200(pppuVar11,plVar9,pIVar19,pppuVar20);
|
|
local_128 = (undefined **)PTR_DAT_140155010;
|
|
uVar4 = FUN_140030080(L"Stream Extract Error at Reliable UDP");
|
|
pvVar12 = pvVar15;
|
|
if ((local_128 != (undefined **)0x0) &&
|
|
(pvVar12 = (void *)0x0, local_128 != (undefined **)PTR_DAT_140155010)) {
|
|
pvVar12 = (void *)(ulonglong)*(uint *)(local_128 + -1);
|
|
}
|
|
uVar5 = uVar4;
|
|
if ((((int)uVar4 <= (int)pvVar12) && (uVar5 = uVar22, local_128 != (undefined **)0x0)) &&
|
|
(local_128 != (undefined **)PTR_DAT_140155010)) {
|
|
uVar5 = *(uint *)(local_128 + -1);
|
|
}
|
|
uVar16 = 1;
|
|
if (1 < (int)uVar5) {
|
|
uVar16 = uVar5;
|
|
}
|
|
uVar5 = uVar22;
|
|
if ((local_128 != (undefined **)0x0) && (local_128 != (undefined **)PTR_DAT_140155010)) {
|
|
uVar5 = *(uint *)(local_128 + -1);
|
|
}
|
|
if ((int)uVar5 < (int)uVar16) {
|
|
if (local_128 == (undefined **)0x0) {
|
|
local_128 = (undefined **)PTR_DAT_140155010;
|
|
}
|
|
if ((int)uVar16 < 0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f590();
|
|
}
|
|
if (uVar16 == 0) {
|
|
FUN_140003240((longlong *)&local_128,PTR_DAT_140155010,pvVar12,pppuVar20);
|
|
}
|
|
else {
|
|
uVar5 = uVar22;
|
|
if ((local_128 != (undefined **)0x0) && (local_128 != (undefined **)PTR_DAT_140155010)) {
|
|
uVar5 = *(uint *)(local_128 + -1);
|
|
}
|
|
if (uVar16 != uVar5) {
|
|
puVar8 = (uint *)FUN_140030280((longlong)(int)uVar16 * 2 + 10);
|
|
if (puVar8 != (uint *)0x0) {
|
|
*puVar8 = 0;
|
|
puVar8[1] = 1;
|
|
}
|
|
*puVar8 = uVar16;
|
|
uVar5 = uVar22;
|
|
if ((local_128 != (undefined **)0x0) && (local_128 != (undefined **)PTR_DAT_140155010)) {
|
|
uVar5 = *(uint *)(local_128 + -1);
|
|
}
|
|
ppuVar10 = (undefined **)PTR_DAT_140155010;
|
|
if ((int)uVar16 < (int)uVar5) {
|
|
LAB_1400a8775:
|
|
if (local_128 != (undefined **)0x0) {
|
|
ppuVar10 = local_128;
|
|
}
|
|
}
|
|
else {
|
|
uVar16 = uVar22;
|
|
if (local_128 != (undefined **)0x0) {
|
|
if (local_128 != (undefined **)PTR_DAT_140155010) {
|
|
uVar16 = *(uint *)(local_128 + -1);
|
|
}
|
|
goto LAB_1400a8775;
|
|
}
|
|
}
|
|
uVar7 = (ulonglong)uVar16;
|
|
FUN_1400300b0(puVar8 + 2,ppuVar10,uVar16);
|
|
FUN_140003240((longlong *)&local_128,ppuVar10,uVar7,pppuVar20);
|
|
local_128 = (undefined **)(puVar8 + 2);
|
|
}
|
|
}
|
|
}
|
|
FUN_140002ea0((longlong *)&local_128);
|
|
ppuVar10 = local_128;
|
|
if (local_128 == (undefined **)0x0) {
|
|
ppuVar10 = (undefined **)PTR_DAT_140155010;
|
|
}
|
|
FUN_1400300b0(ppuVar10,L"Stream Extract Error at Reliable UDP",uVar4);
|
|
ppuVar10 = local_128;
|
|
if (local_128 == (undefined **)0x0) {
|
|
ppuVar10 = (undefined **)PTR_DAT_140155010;
|
|
}
|
|
uVar4 = FUN_140030080((short *)ppuVar10);
|
|
uVar22 = uVar21;
|
|
if (0 < (int)uVar4) {
|
|
uVar22 = uVar4;
|
|
}
|
|
uVar4 = uVar21;
|
|
if ((local_128 != (undefined **)0x0) && (local_128 != (undefined **)PTR_DAT_140155010)) {
|
|
uVar4 = *(uint *)(local_128 + -1);
|
|
}
|
|
if (((int)uVar22 < (int)uVar4) || (uVar22 = uVar21, local_128 == (undefined **)0x0)) {
|
|
LAB_1400a8811:
|
|
if (((local_128 != (undefined **)PTR_DAT_140155010) && (local_128 != (undefined **)0x0)) &&
|
|
(local_128 + -1 != (undefined **)0x0)) {
|
|
*(uint *)(local_128 + -1) = uVar22;
|
|
*(undefined2 *)((longlong)local_128 + (longlong)(int)uVar22 * 2) = 0;
|
|
}
|
|
}
|
|
else if (local_128 != (undefined **)PTR_DAT_140155010) {
|
|
uVar22 = *(uint *)(local_128 + -1);
|
|
goto LAB_1400a8811;
|
|
}
|
|
local_78._0_2_ = 0;
|
|
local_78._2_2_ = 0;
|
|
local_78._4_4_ = 0;
|
|
local_70[0] = 0;
|
|
local_70[1] = 0;
|
|
local_70[2] = 0;
|
|
local_70[3] = 0;
|
|
local_70[4] = 0;
|
|
local_70[5] = 0;
|
|
local_70[6] = 0;
|
|
local_70[7] = 0;
|
|
local_70[8] = 0;
|
|
local_70[9] = 0;
|
|
local_70[10] = 0;
|
|
local_70[0xb] = 0;
|
|
local_70[0xc] = 0;
|
|
local_70[0xd] = 0;
|
|
local_70[0xe] = 0;
|
|
local_70[0xf] = 0;
|
|
local_70[0x10] = 0;
|
|
local_70[0x11] = 0;
|
|
local_70[0x12] = 0;
|
|
local_70[0x13] = 0;
|
|
local_70[0x14] = 0;
|
|
local_70[0x15] = 0;
|
|
local_70[0x16] = 0;
|
|
local_70[0x17] = 0;
|
|
local_80 = Proud::ByteArray::vftable;
|
|
pvVar12 = pvVar15;
|
|
if (local_120 != (longlong *)0x0) {
|
|
pvVar12 = (void *)*local_120;
|
|
}
|
|
pppuVar20 = &local_128;
|
|
plVar9 = FUN_14003c120(&local_48,(ulonglong)local_res18 & 0xffffffff,
|
|
(ulonglong)*(uint *)((longlong)pvVar12 + 0x56c),(longlong *)pppuVar20,
|
|
(longlong)&local_80);
|
|
pIVar19 = (IMAGE_DOS_HEADER *)*param_1[0x21];
|
|
(**(code **)(pIVar19 + 1))();
|
|
pppuVar11 = &local_80;
|
|
FUN_14003b870(pppuVar11);
|
|
ppuVar10 = local_128;
|
|
if (((local_128 != (undefined **)0x0) && (local_128 != (undefined **)PTR_DAT_140155010)) &&
|
|
(ppuVar1 = local_128 + -1, ppuVar1 != (undefined **)0x0)) {
|
|
pppuVar11 = (undefined ***)FUN_140030200(pppuVar11,plVar9,pIVar19,pppuVar20);
|
|
local_58 = pppuVar11;
|
|
FUN_14002e6e0((int *)pppuVar11);
|
|
local_50 = 1;
|
|
puVar8 = (uint *)((longlong)ppuVar10 + -4);
|
|
*puVar8 = *puVar8 - 1;
|
|
if (*puVar8 == 0) {
|
|
FUN_1400302f0(ppuVar1);
|
|
}
|
|
FUN_14002e770((longlong)pppuVar11);
|
|
local_50 = 0;
|
|
}
|
|
local_128 = (undefined **)PTR_DAT_140155010;
|
|
}
|
|
while (iVar14 = (int)pvVar15, iVar14 != local_b0._24_4_) {
|
|
if ((iVar14 < 0) || ((int)local_b0._24_4_ <= iVar14)) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f5c0(pppuVar11,plVar9,pIVar19,pppuVar20);
|
|
}
|
|
pIVar19 = (IMAGE_DOS_HEADER *)(local_b0._16_8_ + (longlong)iVar14 * 0x48);
|
|
pIVar19->e_program[0] = 1;
|
|
pppuVar11 = param_1;
|
|
plVar9 = param_2;
|
|
FUN_1400aa720((IMAGE_DOS_HEADER *)param_1,(IMAGE_DOS_HEADER *)param_2,pIVar19,pppuVar20);
|
|
if ((int)local_b0._24_4_ <= iVar14) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f5c0(pppuVar11,plVar9,pIVar19,pppuVar20);
|
|
}
|
|
pvVar15 = (void *)(ulonglong)(iVar14 + 1);
|
|
}
|
|
FUN_140089980((undefined8 *)local_b0);
|
|
if (local_f8 != (longlong *)0x0) {
|
|
plVar9 = local_f8 + 1;
|
|
*plVar9 = *plVar9 + -1;
|
|
if (*plVar9 == 0) {
|
|
FUN_140043d50((longlong)&local_f8,local_f8);
|
|
}
|
|
}
|
|
local_40 = &local_110;
|
|
FUN_140095270((longlong *)&local_110);
|
|
if (local_108 != (void *)0x0) {
|
|
if ((longlong)local_100 < 0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f590();
|
|
}
|
|
local_100 = local_100 & 0xffffffff00000000;
|
|
}
|
|
LAB_1400a89b9:
|
|
if ((local_120 != (longlong *)0x0) && (local_120[1] = local_120[1] + -1, local_120[1] == 0)) {
|
|
puVar3 = (undefined8 *)*local_120;
|
|
if (puVar3 != (undefined8 *)0x0) {
|
|
(**(code **)*puVar3)(puVar3,1);
|
|
}
|
|
FUN_1400302f0(local_120);
|
|
}
|
|
local_res18 = &local_d0;
|
|
FUN_140095270((longlong *)&local_d0);
|
|
if ((local_c8 != (void *)0x0) && (local_bc < 0)) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14002f590();
|
|
}
|
|
return;
|
|
}
|
|
|