240 lines
7.2 KiB
C
240 lines
7.2 KiB
C
/* DBCServer_Release_x64.exe sha256 d9e4fccdf3482e50247686d4452c0b13c75a53efc4bd7320668eece8d1ce828c
|
|
* Ghidra 12.1.2 decompiler output for 0x1401a93d0 FUN_1401a93d0
|
|
* Pseudocode, not original source. */
|
|
|
|
longlong FUN_1401a93d0(longlong param_1)
|
|
|
|
{
|
|
undefined *puVar1;
|
|
int *piVar2;
|
|
ulonglong *puVar3;
|
|
undefined *puVar4;
|
|
int iVar5;
|
|
uint uVar6;
|
|
uint uVar7;
|
|
uint uVar8;
|
|
longlong lVar9;
|
|
undefined8 uVar10;
|
|
uint *puVar11;
|
|
ulonglong uVar12;
|
|
ulonglong uVar13;
|
|
uint *puVar14;
|
|
uint uVar15;
|
|
uint uVar16;
|
|
ulonglong uVar17;
|
|
uint *local_res8;
|
|
undefined *local_res10;
|
|
undefined1 local_res18 [8];
|
|
undefined1 local_res20 [8];
|
|
undefined **local_b8;
|
|
undefined8 local_b0;
|
|
undefined8 local_a8;
|
|
undefined8 local_a0;
|
|
undefined8 local_98;
|
|
undefined **local_90;
|
|
undefined8 local_88;
|
|
undefined8 local_80;
|
|
undefined8 local_78;
|
|
undefined8 local_70;
|
|
undefined8 local_68;
|
|
undefined1 local_60;
|
|
undefined8 local_58;
|
|
undefined1 local_50;
|
|
undefined8 local_48;
|
|
|
|
local_48 = 0xfffffffffffffffe;
|
|
uVar17 = 0;
|
|
do {
|
|
lVar9 = *(longlong *)(param_1 + 0x148);
|
|
uVar13 = lVar9 + 0x60;
|
|
if (lVar9 == 0) {
|
|
uVar13 = uVar17;
|
|
}
|
|
uVar12 = uVar17;
|
|
if (*(longlong *)(lVar9 + 0x750) != 0) {
|
|
uVar12 = *(ulonglong *)(*(longlong *)(lVar9 + 0x750) + 0x38);
|
|
}
|
|
lVar9 = FUN_1401aee60(uVar12,uVar13);
|
|
if (lVar9 == 0) {
|
|
FUN_14016d8c0();
|
|
local_res8 = (uint *)PTR_DAT_1403440a0;
|
|
uVar6 = FUN_14016d740(L"FATAL: Cannot create TCP socket for AcceptEx!");
|
|
uVar8 = 0;
|
|
if ((local_res8 != (uint *)0x0) && (uVar17 = 0, local_res8 != (uint *)PTR_DAT_1403440a0)) {
|
|
uVar17 = (ulonglong)local_res8[-2];
|
|
}
|
|
uVar7 = uVar6;
|
|
if ((((int)uVar6 <= (int)uVar17) && (uVar7 = uVar8, local_res8 != (uint *)0x0)) &&
|
|
(local_res8 != (uint *)PTR_DAT_1403440a0)) {
|
|
uVar7 = local_res8[-2];
|
|
}
|
|
uVar15 = 1;
|
|
if (1 < (int)uVar7) {
|
|
uVar15 = uVar7;
|
|
}
|
|
uVar7 = uVar8;
|
|
if ((local_res8 != (uint *)0x0) && (local_res8 != (uint *)PTR_DAT_1403440a0)) {
|
|
uVar7 = local_res8[-2];
|
|
}
|
|
uVar16 = 0;
|
|
if ((int)uVar7 < (int)uVar15) {
|
|
if (local_res8 == (uint *)0x0) {
|
|
local_res8 = (uint *)PTR_DAT_1403440a0;
|
|
}
|
|
if ((int)uVar15 < 0) {
|
|
/* WARNING: Subroutine does not return */
|
|
FUN_14016d6b0();
|
|
}
|
|
if (uVar15 == 0) {
|
|
FUN_14004eb70(&local_res8);
|
|
}
|
|
else {
|
|
uVar7 = uVar8;
|
|
if ((local_res8 != (uint *)0x0) && (local_res8 != (uint *)PTR_DAT_1403440a0)) {
|
|
uVar7 = local_res8[-2];
|
|
}
|
|
if (uVar15 != uVar7) {
|
|
puVar11 = (uint *)FUN_14016d940((longlong)(int)uVar15 * 2 + 10);
|
|
if (puVar11 != (uint *)0x0) {
|
|
*puVar11 = 0;
|
|
puVar11[1] = 1;
|
|
}
|
|
*puVar11 = uVar15;
|
|
uVar7 = uVar16;
|
|
if ((local_res8 != (uint *)0x0) && (local_res8 != (uint *)PTR_DAT_1403440a0)) {
|
|
uVar7 = local_res8[-2];
|
|
}
|
|
puVar14 = (uint *)PTR_DAT_1403440a0;
|
|
if ((int)uVar15 < (int)uVar7) {
|
|
LAB_1401a9677:
|
|
if (local_res8 != (uint *)0x0) {
|
|
puVar14 = local_res8;
|
|
}
|
|
}
|
|
else {
|
|
uVar15 = uVar8;
|
|
if (local_res8 != (uint *)0x0) {
|
|
if (local_res8 != (uint *)PTR_DAT_1403440a0) {
|
|
uVar15 = local_res8[-2];
|
|
}
|
|
goto LAB_1401a9677;
|
|
}
|
|
}
|
|
FUN_14016d770(puVar11 + 2,puVar14,uVar15);
|
|
FUN_14004eb70(&local_res8);
|
|
local_res8 = puVar11 + 2;
|
|
}
|
|
}
|
|
}
|
|
FUN_14004e850(&local_res8);
|
|
puVar11 = local_res8;
|
|
if (local_res8 == (uint *)0x0) {
|
|
puVar11 = (uint *)PTR_DAT_1403440a0;
|
|
}
|
|
FUN_14016d770(puVar11,L"FATAL: Cannot create TCP socket for AcceptEx!",uVar6);
|
|
puVar11 = local_res8;
|
|
if (local_res8 == (uint *)0x0) {
|
|
puVar11 = (uint *)PTR_DAT_1403440a0;
|
|
}
|
|
uVar8 = FUN_14016d740(puVar11);
|
|
uVar6 = 0;
|
|
if (0 < (int)uVar8) {
|
|
uVar6 = uVar8;
|
|
}
|
|
uVar8 = uVar16;
|
|
if ((local_res8 != (uint *)0x0) && (local_res8 != (uint *)PTR_DAT_1403440a0)) {
|
|
uVar8 = local_res8[-2];
|
|
}
|
|
if (((int)uVar8 <= (int)uVar6) && (uVar6 = uVar16, local_res8 != (uint *)0x0)) {
|
|
if (local_res8 == (uint *)PTR_DAT_1403440a0) goto LAB_1401a972b;
|
|
uVar6 = local_res8[-2];
|
|
}
|
|
if (((local_res8 != (uint *)PTR_DAT_1403440a0) && (local_res8 != (uint *)0x0)) &&
|
|
(local_res8 + -2 != (uint *)0x0)) {
|
|
local_res8[-2] = uVar6;
|
|
*(undefined2 *)((longlong)local_res8 + (longlong)(int)uVar6 * 2) = 0;
|
|
}
|
|
LAB_1401a972b:
|
|
local_b0 = 0;
|
|
local_a8 = 0;
|
|
local_a0 = 0;
|
|
local_98 = 0;
|
|
local_b8 = Proud::ByteArray::vftable;
|
|
uVar10 = FUN_140198f80(local_res20,1,1,&local_res8,&local_b8);
|
|
(**(code **)(**(longlong **)(param_1 + 0x148) + 0x80))(*(longlong **)(param_1 + 0x148),uVar10)
|
|
;
|
|
FUN_14019a9e0(&local_b8);
|
|
puVar11 = local_res8;
|
|
if (local_res8 == (uint *)0x0) {
|
|
return 0;
|
|
}
|
|
if (local_res8 == (uint *)PTR_DAT_1403440a0) {
|
|
return 0;
|
|
}
|
|
puVar14 = local_res8 + -2;
|
|
if (puVar14 == (uint *)0x0) {
|
|
return 0;
|
|
}
|
|
uVar10 = FUN_14016d8c0();
|
|
local_68 = uVar10;
|
|
FUN_14016db50(uVar10);
|
|
local_60 = 1;
|
|
puVar11 = puVar11 + -1;
|
|
*puVar11 = *puVar11 - 1;
|
|
if (*puVar11 == 0) {
|
|
FUN_14016d970(puVar14);
|
|
}
|
|
FUN_14016dbe0(uVar10);
|
|
return 0;
|
|
}
|
|
puVar3 = *(ulonglong **)(*(longlong *)(param_1 + 0x148) + 0x748);
|
|
uVar13 = uVar17;
|
|
if (puVar3 != (ulonglong *)0x0) {
|
|
uVar13 = *puVar3;
|
|
}
|
|
iVar5 = FUN_14019dbe0(uVar13,lVar9);
|
|
if (iVar5 == 0) {
|
|
return lVar9;
|
|
}
|
|
if (iVar5 != 0x2746) {
|
|
if (iVar5 != 0x2736) {
|
|
FUN_14016d8c0();
|
|
local_res10 = PTR_DAT_1403440a0;
|
|
FUN_14004c020(&local_res10,
|
|
L"FATAL: AcceptEx failed with error code %d! No more accept will be possible."
|
|
,iVar5);
|
|
local_88 = 0;
|
|
local_80 = 0;
|
|
local_78 = 0;
|
|
local_70 = 0;
|
|
local_90 = Proud::ByteArray::vftable;
|
|
uVar10 = FUN_140198f80(local_res18,1,1,&local_res10,&local_90);
|
|
(**(code **)(**(longlong **)(param_1 + 0x148) + 0x80))
|
|
(*(longlong **)(param_1 + 0x148),uVar10);
|
|
FUN_14019a9e0(&local_90);
|
|
puVar4 = local_res10;
|
|
if (((local_res10 != (undefined *)0x0) && (local_res10 != PTR_DAT_1403440a0)) &&
|
|
(puVar1 = local_res10 + -8, puVar1 != (undefined *)0x0)) {
|
|
uVar10 = FUN_14016d8c0();
|
|
local_58 = uVar10;
|
|
FUN_14016db50(uVar10);
|
|
local_50 = 1;
|
|
piVar2 = (int *)(puVar4 + -4);
|
|
*piVar2 = *piVar2 + -1;
|
|
if (*piVar2 == 0) {
|
|
FUN_14016d970(puVar1);
|
|
}
|
|
FUN_14016dbe0(uVar10);
|
|
}
|
|
}
|
|
LAB_1401a9563:
|
|
FUN_14019c9e0(lVar9);
|
|
FUN_14016d970(lVar9);
|
|
return 0;
|
|
}
|
|
if (*(char *)(param_1 + 0x140) != '\0') goto LAB_1401a9563;
|
|
FUN_14019c9e0(lVar9);
|
|
FUN_14016d970(lVar9);
|
|
} while( true );
|
|
}
|
|
|