sub_140960EA4
__int64 __fastcall sub_140960EA4(__int64 a1, __int64 a2, __int64 a3, __int64 a4){
signed int v7;
unsigned int *v8;
unsigned int *v9;
unsigned int i;
__int64 v11;
unsigned int *v12;
unsigned int v13;
unsigned int *v14;
unsigned int *v15;
WCHAR *v16;
UINT64 v17;
unsigned int j;
__int64 v19;
unsigned int *v20;
UINT64 v21;
unsigned int *v22;
__int64 v23;
size_t v24;
VOID **PoolWithTag;
VOID **v26;
VOID **v27;
unsigned int *v28;
unsigned int k;
__int64 v30;
unsigned int *v31;
unsigned int v32;
unsigned int *v33;
unsigned int m;
__int64 v35;
unsigned int *v36;
unsigned int *v37;
int v38;
int v39;
unsigned int v40;
VOID **v41;
int v42;
unsigned int v43;
__int64 v44;
unsigned int v45;
int v46;
unsigned int v47;
unsigned __int64 v48;
unsigned int v49;
unsigned int v50;
__int64 v52;
UINT64 pcbLength;
v52 = 0i64;
if( !a2 || !a4 )
return(unsigned int)-1073741811;
v8 = *(unsigned int **)(a1 + 8);
if( v8 && *(_DWORD *)a1 > 3u )
{
v9 = v8;
for( i = 0; i < 3; ++i )
{
v11 = *v9;
v12 = v9 + 1;
if( v9 + 1 < v9 )
goto LABEL_17;
v9 = (unsigned int *)((char *)v12 + v11);
if( (unsigned int *)((char *)v12 + v11) < v12 )
goto LABEL_17;
}
v13 = *v9;
v14 = v9 + 1;
if( v9 + 1 < v9 )
{
LABEL_17:
v7 = -1073741675;
}
else
{
v15 = 0i64;
if( v13 )
v15 = v14;
v7 = 0;
if( v13 != 8 )
return(unsigned int)-1073741789;
v52 = *(_QWORD *)v15;
}
}
else
{
v7 = -1073741811;
}
if( v7 < 0 )
return(unsigned int)v7;
pcbLength = 0i64;
v16 = 0i64;
LODWORD(v17) = 0;
if( v8 && *(_DWORD *)a1 > 4u )
{
for( j = 0; j < 4; ++j )
{
v19 = *v8;
v20 = v8 + 1;
if( v8 + 1 < v8 )
goto LABEL_39;
v8 = (unsigned int *)((char *)v20 + v19);
if( (unsigned int *)((char *)v20 + v19) < v20 )
goto LABEL_39;
}
v21 = *v8;
if( v8 + 1 < v8 )
{
LABEL_39:
v7 = -1073741675;
}
else
{
if( (_DWORD)v21 )
v16 = (WCHAR *)(v8 + 1);
v7 = 0;
if( !(_DWORD)v21
|| (v21 & 1) != 0
|| v16[(v21 >> 1) - 1]
|| StringCbLengthW(v16, v21, &pcbLength) < 0
|| pcbLength + 2 != v23 )
{
return(unsigned int)-1073741762;
}
v17 = pcbLength >> 1;
}
}
else
{
v7 = -1073741811;
}
if( v7 < 0 )
return(unsigned int)v7;
if( 2 * (_DWORD)v17 == -2 )
return(unsigned int)-1073741762;
v24 = 2 * v17 + 2;
PoolWithTag = ExAllocatePoolWithTag(1ui64, v24, 542329939i64);
v26 = PoolWithTag;
if( !PoolWithTag )
return(unsigned int)-1073741801;
memmove(PoolWithTag, v16, v24);
v27 = v26;
v22 = *(unsigned int **)(a1 + 8);
if( !v22 || *(_DWORD *)a1 <= 5u )
goto LABEL_33;
v28 = *(unsigned int **)(a1 + 8);
for( k = 0; k < 5; ++k )
{
v30 = *v28;
v31 = v28 + 1;
if( v28 + 1 < v28 )
goto LABEL_85;
v28 = (unsigned int *)((char *)v31 + v30);
if( (unsigned int *)((char *)v31 + v30) < v31 )
goto LABEL_85;
}
v32 = *v28;
if( v28 + 1 >= v28 )
{
v33 = 0i64;
if( v32 )
v33 = v28 + 1;
if( *(_DWORD *)a1 > 6u )
{
for( m = 0; m < 6; ++m )
{
v35 = *v22;
v36 = v22 + 1;
if( v22 + 1 < v22 )
goto LABEL_85;
v22 = (unsigned int *)((char *)v36 + v35);
if( (unsigned int *)((char *)v36 + v35) < v36 )
goto LABEL_85;
}
if( v22 + 1 < v22 )
goto LABEL_85;
v37 = 0i64;
if( *v22 )
v37 = v22 + 1;
if( qword_140D2C420 )
v38 = qword_140D2C420(v27, v33, v32, v37, *v22);
else
v38 = -1073741637;
v7 = v38;
if( v38 < 0 )
goto LABEL_86;
v39 = *(_DWORD *)(a2 + 32);
if( *(_DWORD *)(a2 + 16) < 0xFFFFFFD0 )
{
v40 = *(_DWORD *)(a2 + 16) + 52;
if( v40 >= *(_DWORD *)(a2 + 16) + 48 )
{
v7 = v40 + v39 < v40 ? 0xC0000095 : 0;
if( v40 + v39 < v40 )
goto LABEL_86;
*(_DWORD *)(a4 + 4) = 20;
v41 = ExAllocatePoolWithTag(1ui64, 0x14ui64, 542329939i64);
if( !v41 )
{
v7 = -1073741801;
goto LABEL_86;
}
*(_QWORD *)(a4 + 8) = v41;
*(_DWORD *)a4 = 0;
v42 = v38 | 0x10000000;
if( (VOID **)((char *)v41 + 4) >= v41 )
{
if( v41 + 1 > (VOID **)((char *)v41 + *(unsigned int *)(a4 + 4)) )
{
LABEL_72:
v7 = -1073741789;
goto LABEL_86;
}
*(_DWORD *)v41 = 4;
*((_DWORD *)v41 + 1) = v42;
v43 = ++*(_DWORD *)a4;
v44 = *(_QWORD *)(a4 + 8);
if( !v44 )
{
v45 = *(_DWORD *)(a4 + 4);
v46 = -1;
v47 = v45 + 12;
if( v45 + 12 >= v45 )
v46 = v45 + 12;
v7 = v47 < v45 ? 0xC0000095 : 0;
*(_DWORD *)(a4 + 4) = v46;
if( v47 >= v45 )
{
v7 = 0;
*(_DWORD *)a4 = v43 + 1;
}
goto LABEL_86;
}
v48 = *(_QWORD *)(a4 + 8);
v49 = 0;
if( v43 )
{
while( 1 )
{
v50 = *(_DWORD *)v48 + 4;
if( *(_DWORD *)v48 >= 0xFFFFFFFC || v48 + v50 < v48 )
break;
++v49;
v48 += v50;
if( v49 >= v43 )
goto LABEL_82;
}
}
else
{
LABEL_82:
if( v48 + 4 >= v48 )
{
v7 = 0;
if( v48 + 12 > v44 + (unsigned __int64)*(unsigned int *)(a4 + 4) )
goto LABEL_72;
*(_DWORD *)v48 = 8;
*(_QWORD *)(v48 + 4) = v52;
++*(_DWORD *)a4;
goto LABEL_86;
}
}
}
}
}
goto LABEL_85;
}
LABEL_33:
v7 = -1073741811;
goto LABEL_86;
}
LABEL_85:
v7 = -1073741675;
LABEL_86:
if( v27 )
ExFreePoolWithTag(v27, 0x20534C53u);
return(unsigned int)v7;
}Referenced by:
sub_1405F50F8