SPCallServerHandleGetAppPolicyValue
NTSTATUS __stdcall SPCallServerHandleGetAppPolicyValue(
SSPCallParameters *pInParams,
SSPCallCipherTextData *pCipherData,
SSPCallParameters *pOutParams,
SSPCallParameters *a4){
unsigned int *v4;
VOID **v7;
unsigned int *v8;
unsigned int i;
__int64 v10;
unsigned int *v11;
NTSTATUS v12;
__int64 *v13;
unsigned int v14;
unsigned int *v15;
unsigned int *v16;
unsigned int *v17;
unsigned int n;
__int64 v19;
unsigned int *v20;
unsigned int v21;
unsigned int *v22;
unsigned int ii;
size_t v24;
VOID **PoolWithTag;
VOID **v26;
unsigned int *v27;
unsigned int v28;
unsigned int *v29;
unsigned int k;
__int64 v31;
unsigned int *v32;
unsigned int v33;
unsigned int *v34;
unsigned int *v35;
unsigned int m;
unsigned int jj;
size_t *v38;
__int64 v39;
int v40;
_DWORD *v41;
unsigned int v42;
unsigned int v43;
__int64 v44;
int v45;
_DWORD *v46;
unsigned int v47;
unsigned int v48;
__int64 v49;
int v50;
_DWORD *v51;
unsigned int v52;
unsigned int v53;
int v55;
__int64 v56;
unsigned int v57;
unsigned int v58;
size_t *v59;
UINT64 v60;
size_t v61;
int v62;
VOID **v63;
VOID **v64;
int v65;
unsigned int v66;
unsigned int v67;
unsigned int v68;
unsigned int v69;
SSPCallCipherTextData v70;
unsigned int v71;
unsigned int v72;
__int64 v73;
int v74;
SSPCallParameters v75;
_DWORD *v76;
unsigned int v77;
unsigned int v78;
__int64 v79;
unsigned __int64 v80;
unsigned int v81;
unsigned int v82;
VOID **v83;
unsigned int v84;
WCHAR *v85;
unsigned int j;
unsigned int v87;
__int64 *v88;
UINT64 v89;
__int64 v90;
unsigned int *v91;
unsigned __int64 v92;
__int64 v93;
__int64 v94;
unsigned int *v95;
__int64 v96;
unsigned int *v97;
unsigned int v98;
SSPCallParameters v99;
unsigned int v100;
unsigned int v101;
SSPCallParameters v102;
unsigned int v103;
__int64 v104;
unsigned int v105;
SSPCallParameters v106;
unsigned int v107;
unsigned int v108;
SSPCallParameters v109;
unsigned int v110;
unsigned int v111;
SSPCallParameters v112;
unsigned int v113;
unsigned int v114;
unsigned int v115;
VOID **Src;
UINT64 NumberOfBytes;
int v118;
int v119;
int v120;
PVOID P;
UINT64 pcbLength;
__int64 v123;
size_t Size;
v4 = (unsigned int *)*((_QWORD *)pInParams + 1);
NumberOfBytes = 0i64;
v123 = 0i64;
P = 0i64;
v7 = 0i64;
Src = 0i64;
Size = 0;
v118 = 0;
v119 = 0;
v120 = 0;
if( v4 && (unsigned int)*pInParams > 3 )
{
v8 = v4;
for( i = 0; i < 3; ++i )
{
v10 = *v8;
v11 = v8 + 1;
if( v8 + 1 < v8 )
goto LABEL_6;
v8 = (unsigned int *)((char *)v11 + v10);
if( (unsigned int *)((char *)v11 + v10) < v11 )
goto LABEL_6;
}
v87 = *v8;
v88 = (__int64 *)(v8 + 1);
if( v8 + 1 < v8 )
{
LABEL_6:
v12 = -1073741675;
}
else
{
v13 = 0i64;
if( v87 )
v13 = v88;
v12 = 0;
if( v87 != 8 )
return -1073741789;
v123 = *v13;
}
}
else
{
v12 = -1073741811;
}
if( v12 >= 0 )
{
pcbLength = 0i64;
v85 = 0i64;
LODWORD(v89) = 0;
if( v4 && (unsigned int)*pInParams > 4 )
{
for( j = 0; j < 4; ++j )
{
v90 = *v4;
v91 = v4 + 1;
if( v4 + 1 < v4 )
goto LABEL_160;
v4 = (unsigned int *)((char *)v91 + v90);
if( (unsigned int *)((char *)v91 + v90) < v91 )
goto LABEL_160;
}
v92 = *v4;
if( v4 + 1 < v4 )
{
LABEL_160:
v12 = -1073741675;
}
else
{
if( (_DWORD)v92 )
v85 = (WCHAR *)(v4 + 1);
v12 = 0;
if( !(_DWORD)v92 || (v92 & 1) != 0 )
return -1073741762;
if( v85[(v92 >> 1) - 1] )
return -1073741762;
if( StringCbLengthW(v85, *v4, &pcbLength) < 0 || pcbLength + 2 != v93 )
return -1073741762;
v89 = pcbLength >> 1;
}
}
else
{
v12 = -1073741811;
}
if( v12 < 0 )
return v12;
if( 2 * (_DWORD)v89 != -2 )
{
v24 = 2 * v89 + 2;
PoolWithTag = ExAllocatePoolWithTag(1ui64, v24, 542329939i64);
v26 = PoolWithTag;
if( !PoolWithTag )
return -1073741801;
memmove(PoolWithTag, v85, v24);
P = v26;
v27 = (unsigned int *)*((_QWORD *)pInParams + 1);
if( !v27 || (v28 = *pInParams, (unsigned int)*pInParams <= 5) )
{
v12 = -1073741811;
goto LABEL_68;
}
v29 = (unsigned int *)*((_QWORD *)pInParams + 1);
for( k = 0; k < 5; ++k )
{
v31 = *v29;
v32 = v29 + 1;
if( v29 + 1 >= v29 )
{
v29 = (unsigned int *)((char *)v32 + v31);
if( (unsigned int *)((char *)v32 + v31) >= v32 )
continue;
}
v12 = -1073741675;
goto LABEL_68;
}
v33 = *v29;
if( v29 + 1 < v29 )
{
v12 = -1073741675;
goto LABEL_68;
}
v34 = 0i64;
if( v33 )
v34 = v29 + 1;
if( v28 <= 6 )
{
v12 = -1073741811;
}
else
{
v35 = (unsigned int *)*((_QWORD *)pInParams + 1);
for( m = 0; m < 6; ++m )
{
v94 = *v35;
v95 = v35 + 1;
if( v35 + 1 < v35 )
goto LABEL_179;
v35 = (unsigned int *)((char *)v95 + v94);
if( (unsigned int *)((char *)v95 + v94) < v95 )
goto LABEL_179;
}
v14 = *v35;
v15 = v35 + 1;
if( v35 + 1 >= v35 )
{
v16 = 0i64;
if( v14 )
v16 = v15;
v12 = 0;
if( v14 == 4 )
{
HIDWORD(NumberOfBytes) = *v16;
goto LABEL_20;
}
LABEL_178:
v12 = -1073741789;
goto LABEL_67;
}
LABEL_179:
v12 = -1073741675;
}
LABEL_20:
if( v12 < 0 )
goto LABEL_67;
if( v28 <= 7 )
goto LABEL_180;
v17 = (unsigned int *)*((_QWORD *)pInParams + 1);
for( n = 0; n < 7; ++n )
{
v19 = *v17;
v20 = v17 + 1;
if( v17 + 1 < v17 )
goto LABEL_240;
v17 = (unsigned int *)((char *)v20 + v19);
if( (unsigned int *)((char *)v20 + v19) < v20 )
goto LABEL_240;
}
v21 = *v17;
if( v17 + 1 < v17 )
{
LABEL_240:
v12 = -1073741675;
goto LABEL_67;
}
v22 = 0i64;
if( v21 )
v22 = v17 + 1;
if( v28 > 8 )
{
for( ii = 0; ii < 8; ++ii )
{
v96 = *v27;
v97 = v27 + 1;
if( v27 + 1 < v27 )
goto LABEL_186;
v27 = (unsigned int *)((char *)v97 + v96);
if( (unsigned int *)((char *)v97 + v96) < v97 )
goto LABEL_186;
}
v58 = *v27;
if( v27 + 1 < v27 )
{
LABEL_186:
v12 = -1073741675;
goto LABEL_187;
}
v59 = 0i64;
if( v58 )
v59 = v27 + 1;
v12 = 0;
if( v58 == 4 )
{
v60 = *v59;
Size = *v59;
goto LABEL_95;
}
goto LABEL_178;
}
v12 = -1073741811;
LABEL_187:
v60 = 0i64;
LABEL_95:
if( v12 < 0 )
{
LABEL_67:
v7 = Src;
goto LABEL_68;
}
if( (_DWORD)v60 )
{
v61 = v60;
v62 = 0;
v63 = ExAllocatePoolWithTag(1ui64, v60, 542329939i64);
Src = v63;
if( v63 )
{
memset(v63, 0i64, v61);
LODWORD(v60) = Size;
goto LABEL_99;
}
v12 = -1073741801;
v7 = 0i64;
LABEL_68:
if( P )
ExFreePoolWithTag(P, 0x20534C53u);
if( v7 )
ExFreePoolWithTag(v7, 0x20534C53u);
return v12;
}
v62 = 1;
LABEL_99:
if( qword_140D2C408 )
{
v64 = 0i64;
if( !v62 )
v64 = Src;
v65 = qword_140D2C408(P, v34, v33, HIDWORD(NumberOfBytes), v22, v21, v64, v60, &v118, &v119, &v120);
}
else
{
v65 = -1073741637;
}
v66 = Size + 4;
if( Size >= 0xFFFFFFFC )
{
v67 = 0;
v55 = -1073741675;
v12 = -1073741675;
}
else
{
if( v66 >= 0xFFFFFFEC
|| Size + 32 < Size + 24
|| Size + 40 < Size + 32
|| (v67 = Size + 48, LODWORD(NumberOfBytes) = Size + 48, Size + 48 < Size + 40) )
{
v12 = -1073741675;
goto LABEL_67;
}
v12 = 0;
v55 = -1073741675;
}
if( v12 < 0 )
goto LABEL_67;
v68 = 0;
if( v67 >= 0xFFFFFFF8 )
goto LABEL_142;
v69 = (v67 + 15) & 0xFFFFFFF8;
if( v69 >= v67 + 8 )
{
v68 = v69 + 8;
if( v69 + 8 < v69 )
{
v12 = -1073741675;
goto LABEL_117;
}
v12 = 0;
}
else
{
v12 = -1073741675;
}
if( v12 < 0 )
goto LABEL_67;
v70 = pCipherData[4];
v71 = v68 + 4;
v72 = v68 + 8;
if( v72 < v71 || (v84 = v72 + v70, v72 + v70 < v72) || v84 + 4 < v84 )
v12 = -1073741675;
else
v12 = v84 + 4 + pCipherData[8] < v84 + 4 ? 0xC0000095 : 0;
v67 = NumberOfBytes;
LABEL_117:
if( v12 < 0 )
goto LABEL_67;
if( a4 )
{
a4[1] = v67;
v12 = 0;
if( v67 )
{
v83 = ExAllocatePoolWithTag(1ui64, v67, 542329939i64);
if( v83 )
{
*((_QWORD *)a4 + 1) = v83;
*a4 = 0;
}
else
{
v12 = -1073741801;
}
}
else
{
v12 = -1073741762;
}
if( v12 < 0 )
goto LABEL_67;
v73 = *((_QWORD *)a4 + 1);
v74 = v65 | 0x10000000;
v75 = -1;
if( v73 )
{
v76 = (_DWORD *)*((_QWORD *)a4 + 1);
v77 = 0;
if( *a4 )
{
while( 1 )
{
v78 = *v76 + 4;
if( *v76 >= 0xFFFFFFFC )
break;
if( (_DWORD *)((char *)v76 + v78) < v76 )
goto LABEL_142;
++v77;
v76 = (_DWORD *)((char *)v76 + v78);
if( v77 >= *a4 )
goto LABEL_199;
}
v12 = -1073741675;
}
else
{
LABEL_199:
if( v76 + 1 < v76 )
goto LABEL_142;
v12 = 0;
if( (unsigned __int64)(v76 + 2) > v73 + (unsigned __int64)(unsigned int)a4[1] )
goto LABEL_178;
*v76 = 4;
v76[1] = v74;
++*a4;
}
}
else
{
v98 = a4[1];
v99 = -1;
v100 = v98 + 8;
if( v98 + 8 >= v98 )
v99 = v98 + 8;
v12 = v100 < v98 ? 0xC0000095 : 0;
a4[1] = v99;
if( v100 >= v98 )
{
++*a4;
goto LABEL_127;
}
}
if( v12 < 0 )
goto LABEL_67;
LABEL_127:
v79 = *((_QWORD *)a4 + 1);
if( v79 )
{
v80 = *((_QWORD *)a4 + 1);
v81 = 0;
if( *a4 )
{
while( 1 )
{
v82 = *(_DWORD *)v80 + 4;
if( *(_DWORD *)v80 >= 0xFFFFFFFC )
break;
if( v80 + v82 < v80 )
goto LABEL_66;
++v81;
v80 += v82;
if( v81 >= *a4 )
goto LABEL_206;
}
v12 = -1073741675;
}
else
{
LABEL_206:
if( v80 + 4 < v80 )
goto LABEL_66;
v12 = 0;
if( v80 + 12 > v79 + (unsigned __int64)(unsigned int)a4[1] )
goto LABEL_178;
v104 = v123;
*(_DWORD *)v80 = 8;
*(_QWORD *)(v80 + 4) = v104;
++*a4;
}
}
else
{
v101 = a4[1];
v102 = -1;
v103 = v101 + 12;
if( v101 + 12 >= v101 )
v102 = v101 + 12;
v12 = v103 < v101 ? 0xC0000095 : 0;
a4[1] = v102;
if( v103 >= v101 )
{
++*a4;
goto LABEL_75;
}
}
if( v12 < 0 )
goto LABEL_67;
LABEL_75:
v55 = 0;
if( Src )
{
if( Size )
goto LABEL_77;
}
else if( !Size )
{
LABEL_77:
v56 = *((_QWORD *)a4 + 1);
if( v56 )
{
v38 = (size_t *)*((_QWORD *)a4 + 1);
for( jj = 0; jj < *a4; v38 = (size_t *)((char *)v38 + v57) )
{
v57 = *v38 + 4;
if( *v38 >= 0xFFFFFFFC )
goto LABEL_80;
if( (size_t *)((char *)v38 + v57) < v38 )
goto LABEL_216;
++jj;
}
if( v38 + 1 < v38 )
{
LABEL_216:
v12 = -1073741675;
}
else
{
v12 = 0;
if( (unsigned __int64)v38 + Size + 4 <= v56 + (unsigned __int64)(unsigned int)a4[1] )
{
*v38 = Size;
if( Src )
memmove(v38 + 1, Src, Size);
++*a4;
goto LABEL_52;
}
v12 = -1073741789;
}
v7 = Src;
goto LABEL_68;
}
if( v66 < 4 )
{
LABEL_80:
v12 = -1073741675;
goto LABEL_52;
}
v105 = a4[1];
v106 = -1;
v107 = v105 + v66;
if( v105 + v66 >= v105 )
v106 = v105 + v66;
v12 = v107 < v105 ? 0xC0000095 : 0;
a4[1] = v106;
if( v107 >= v105 )
{
++*a4;
goto LABEL_53;
}
LABEL_52:
if( v12 < 0 )
goto LABEL_67;
LABEL_53:
v39 = *((_QWORD *)a4 + 1);
v40 = v118;
if( v39 )
{
v41 = (_DWORD *)*((_QWORD *)a4 + 1);
v42 = 0;
if( *a4 )
{
while( 1 )
{
v43 = *v41 + 4;
if( *v41 >= 0xFFFFFFFC )
break;
if( (_DWORD *)((char *)v41 + v43) < v41 )
goto LABEL_66;
++v42;
v41 = (_DWORD *)((char *)v41 + v43);
if( v42 >= *a4 )
goto LABEL_223;
}
v12 = -1073741675;
}
else
{
LABEL_223:
if( v41 + 1 < v41 )
goto LABEL_66;
v12 = 0;
if( (unsigned __int64)(v41 + 2) > v39 + (unsigned __int64)(unsigned int)a4[1] )
goto LABEL_178;
*v41 = 4;
v41[1] = v40;
++*a4;
}
}
else
{
v108 = a4[1];
v109 = -1;
v110 = v108 + 8;
if( v108 + 8 >= v108 )
v109 = v108 + 8;
v12 = v110 < v108 ? 0xC0000095 : 0;
a4[1] = v109;
if( v110 >= v108 )
{
++*a4;
goto LABEL_58;
}
}
if( v12 < 0 )
goto LABEL_67;
LABEL_58:
v44 = *((_QWORD *)a4 + 1);
v45 = v119;
if( v44 )
{
v46 = (_DWORD *)*((_QWORD *)a4 + 1);
v47 = 0;
if( *a4 )
{
while( 1 )
{
v48 = *v46 + 4;
if( *v46 >= 0xFFFFFFFC )
break;
if( (_DWORD *)((char *)v46 + v48) < v46 )
goto LABEL_66;
++v47;
v46 = (_DWORD *)((char *)v46 + v48);
if( v47 >= *a4 )
goto LABEL_230;
}
v12 = -1073741675;
}
else
{
LABEL_230:
if( v46 + 1 < v46 )
goto LABEL_66;
v12 = 0;
if( (unsigned __int64)(v46 + 2) > v44 + (unsigned __int64)(unsigned int)a4[1] )
goto LABEL_178;
*v46 = 4;
v46[1] = v45;
++*a4;
}
}
else
{
v111 = a4[1];
v112 = -1;
v113 = v111 + 8;
if( v111 + 8 >= v111 )
v112 = v111 + 8;
v12 = v113 < v111 ? 0xC0000095 : 0;
a4[1] = v112;
if( v113 >= v111 )
{
++*a4;
LABEL_63:
v49 = *((_QWORD *)a4 + 1);
v50 = v120;
if( v49 )
{
v51 = (_DWORD *)*((_QWORD *)a4 + 1);
v52 = 0;
if( *a4 )
{
while( 1 )
{
v53 = *v51 + 4;
if( *v51 >= 0xFFFFFFFC || (_DWORD *)((char *)v51 + v53) < v51 )
break;
++v52;
v51 = (_DWORD *)((char *)v51 + v53);
if( v52 >= *a4 )
goto LABEL_237;
}
}
else
{
LABEL_237:
if( v51 + 1 >= v51 )
{
v12 = 0;
if( (unsigned __int64)(v51 + 2) > v49 + (unsigned __int64)(unsigned int)a4[1] )
goto LABEL_178;
*v51 = 4;
v51[1] = v50;
++*a4;
goto LABEL_67;
}
}
LABEL_66:
v12 = -1073741675;
goto LABEL_67;
}
v114 = a4[1];
v115 = v114 + 8;
if( v114 + 8 >= v114 )
v75 = v114 + 8;
v12 = v115 < v114 ? 0xC0000095 : 0;
a4[1] = v75;
if( v115 < v114 )
goto LABEL_67;
++*a4;
LABEL_142:
v12 = v55;
goto LABEL_67;
}
}
if( v12 < 0 )
goto LABEL_67;
goto LABEL_63;
}
v12 = -1073741811;
goto LABEL_52;
}
LABEL_180:
v12 = -1073741811;
goto LABEL_67;
}
return -1073741762;
}
return v12;
}Referenced by:
sub_1405F50F8