RtlpCombineAcls
NTSTATUS __stdcall RtlpCombineAcls(
_ACL *pAuditAcl,
_ACL *pLabelAcl,
_ACL *pAttributeAcl,
_ACL *pScopeAcl,
_ACL *pTrustAcl,
_ACL **ppNewAcl,
UINT64 *pSaclSecurityInformation){
_ACL **v7;
unsigned int v8;
_ACL *v9;
unsigned int AclRevision;
VOID **PoolWithTag;
unsigned int v15;
_ACL *v16;
unsigned int j;
unsigned int v18;
_ACL *v19;
unsigned int v20;
char *v21;
__int64 v22;
char *v23;
NTSTATUS v24;
NTSTATUS result;
_ACL *v26;
unsigned int n;
_ACL *v28;
unsigned int mm;
__int64 v30;
_ACL *v31;
unsigned int i;
_ACL *v33;
unsigned int v34;
char *v35;
__int64 AclSize;
_ACL *v37;
unsigned int k;
_ACL *v39;
unsigned int jj;
__int64 v41;
_ACL **v42;
unsigned int m;
_ACL *v44;
unsigned int ii;
_WORD *v46;
unsigned int kk;
__int64 v48;
_ACL *v49;
__int64 v50;
char *v51;
int v52;
unsigned int v53;
_DWORD *v55;
v7 = ppNewAcl;
v8 = 0;
v9 = pTrustAcl;
AclRevision = 2;
v52 = 2;
PoolWithTag = 0i64;
if( __PAIR128__((unsigned __int64)pAuditAcl, (unsigned __int64)pLabelAcl) != 0
|| pAttributeAcl
|| pScopeAcl
|| pTrustAcl
|| ppNewAcl )
{
v15 = 8;
if( pAuditAcl )
{
v31 = pAuditAcl + 1;
for( i = 0; i < pAuditAcl->AceCount; v31 = (_ACL *)((char *)v31 + v31->AclSize) )
{
switch( v31->AclRevision )
{
case 2u:
case 3u:
case 7u:
case 8u:
case 0xDu:
case 0xEu:
case 0xFu:
case 0x10u:
if( v15 + v31->AclSize < v15 )
goto LABEL_106;
v15 += v31->AclSize;
if( v55 )
*v55 |= 8u;
if( pAuditAcl->AclRevision > AclRevision )
{
AclRevision = pAuditAcl->AclRevision;
v52 = AclRevision;
}
break;
default:
break;
}
++i;
}
}
if( pLabelAcl )
{
v16 = pLabelAcl + 1;
for( j = 0; j < pLabelAcl->AceCount; v16 = (_ACL *)((char *)v16 + v16->AclSize) )
{
if( v16->AclRevision == 17 )
{
if( v15 + v16->AclSize < v15 )
goto LABEL_106;
v15 += v16->AclSize;
if( v55 )
*v55 |= 0x10u;
if( pLabelAcl->AclRevision > AclRevision )
{
AclRevision = pLabelAcl->AclRevision;
v52 = AclRevision;
}
}
++j;
}
}
if( pTrustAcl )
{
v37 = pTrustAcl + 1;
for( k = 0; k < pTrustAcl->AceCount; v37 = (_ACL *)((char *)v37 + v37->AclSize) )
{
if( v37->AclRevision == 20 )
{
if( v15 + v37->AclSize < v15 )
goto LABEL_106;
v15 += v37->AclSize;
if( v55 )
*v55 |= 0x80u;
if( pTrustAcl->AclRevision > AclRevision )
{
AclRevision = pTrustAcl->AclRevision;
v52 = AclRevision;
}
}
++k;
}
}
if( ppNewAcl )
{
v42 = ppNewAcl + 1;
for( m = 0; m < *((unsigned __int16 *)ppNewAcl + 2); v42 = (_ACL **)((char *)v42 + *((unsigned __int16 *)v42 + 1)) )
{
if( *(_BYTE *)v42 == 21 )
{
if( v15 + *((unsigned __int16 *)v42 + 1) < v15 )
goto LABEL_106;
v15 += *((unsigned __int16 *)v42 + 1);
if( v55 )
*v55 |= 0x100u;
if( *(unsigned __int8 *)ppNewAcl > AclRevision )
AclRevision = *(unsigned __int8 *)ppNewAcl;
v52 = AclRevision;
}
++m;
}
}
if( pAttributeAcl )
{
v26 = pAttributeAcl + 1;
for( n = 0; n < pAttributeAcl->AceCount; v26 = (_ACL *)((char *)v26 + v26->AclSize) )
{
if( v26->AclRevision == 18 )
{
if( v15 + v26->AclSize < v15 )
goto LABEL_106;
v15 += v26->AclSize;
if( v55 )
*v55 |= 0x20u;
if( pAttributeAcl->AclRevision > AclRevision )
{
AclRevision = pAttributeAcl->AclRevision;
v52 = AclRevision;
}
}
++n;
}
}
if( pScopeAcl )
{
v44 = pScopeAcl + 1;
for( ii = 0; ii < pScopeAcl->AceCount; v44 = (_ACL *)((char *)v44 + v44->AclSize) )
{
if( v44->AclRevision == 19 )
{
if( v15 + v44->AclSize < v15 )
goto LABEL_106;
v15 += v44->AclSize;
if( v55 )
*v55 |= 0x40u;
if( pScopeAcl->AclRevision > AclRevision )
AclRevision = pScopeAcl->AclRevision;
v52 = AclRevision;
}
++ii;
}
}
if( v15 + 3 < v15 )
{
LABEL_106:
v24 = -1073741675;
}
else
{
v18 = (v15 + 3) & 0xFFFFFFFC;
PoolWithTag = ExAllocatePoolWithTag(1ui64, v18, 1683187027i64);
if( PoolWithTag )
{
if( v18 < 8 )
{
v24 = -1073741789;
}
else
{
if( (unsigned int)(v52 - 2) <= 2 && v18 <= 0xFFFC )
{
memset(PoolWithTag, 0i64, v18);
*(_BYTE *)PoolWithTag = v52;
*((_WORD *)PoolWithTag + 1) = v18;
*((_BYTE *)PoolWithTag + 1) = 0;
*((_DWORD *)PoolWithTag + 1) = 0;
v51 = 0i64;
if( PoolWithTag + 1 <= (VOID **)((char *)PoolWithTag + (unsigned __int16)v18) )
v51 = (char *)(PoolWithTag + 1);
if( pAuditAcl )
{
v33 = pAuditAcl + 1;
v34 = 0;
v53 = 0;
if( pAuditAcl->AceCount )
{
v35 = v51;
do
{
switch( v33->AclRevision )
{
case 2u:
case 3u:
case 7u:
case 8u:
case 0xDu:
case 0xEu:
case 0xFu:
case 0x10u:
memmove(v35, v33, v33->AclSize);
++*((_WORD *)PoolWithTag + 2);
AclSize = v33->AclSize;
v34 = v53;
v35 += AclSize;
break;
case 4u:
case 5u:
case 6u:
case 9u:
case 0xAu:
case 0xBu:
case 0xCu:
v34 = v53;
goto LABEL_58;
default:
LABEL_58:
LOWORD(AclSize) = v33->AclSize;
break;
}
++v34;
v33 = (_ACL *)((char *)v33 + (unsigned __int16)AclSize);
v53 = v34;
}
while( v34 < pAuditAcl->AceCount );
v9 = pTrustAcl;
v51 = v35;
v7 = ppNewAcl;
}
}
if( pLabelAcl )
{
v19 = pLabelAcl + 1;
v20 = 0;
if( pLabelAcl->AceCount )
{
v21 = v51;
do
{
LOWORD(v22) = v19->AclSize;
if( v19->AclRevision == 17 )
{
memmove(v21, v19, v19->AclSize);
++*((_WORD *)PoolWithTag + 2);
v22 = v19->AclSize;
v21 += v22;
}
++v20;
v19 = (_ACL *)((char *)v19 + (unsigned __int16)v22);
}
while( v20 < pLabelAcl->AceCount );
v51 = v21;
v9 = pTrustAcl;
}
}
v23 = v51;
if( v9 )
{
v39 = v9 + 1;
for( jj = 0; jj < v9->AceCount; v39 = (_ACL *)((char *)v39 + (unsigned __int16)v41) )
{
LOWORD(v41) = v39->AclSize;
if( v39->AclRevision == 20 )
{
memmove(v23, v39, v39->AclSize);
++*((_WORD *)PoolWithTag + 2);
v41 = v39->AclSize;
v23 += v41;
}
++jj;
}
}
if( v7 )
{
v46 = v7 + 1;
for( kk = 0; kk < *((unsigned __int16 *)v7 + 2); v46 = (_WORD *)((char *)v46 + (unsigned __int16)v48) )
{
LOWORD(v48) = v46[1];
if( *(_BYTE *)v46 == 21 )
{
memmove(v23, v46, (unsigned __int16)v46[1]);
++*((_WORD *)PoolWithTag + 2);
v48 = (unsigned __int16)v46[1];
v23 += v48;
}
++kk;
}
}
if( pAttributeAcl )
{
v28 = pAttributeAcl + 1;
for( mm = 0; mm < pAttributeAcl->AceCount; v28 = (_ACL *)((char *)v28 + (unsigned __int16)v30) )
{
LOWORD(v30) = v28->AclSize;
if( v28->AclRevision == 18 )
{
memmove(v23, v28, v28->AclSize);
++*((_WORD *)PoolWithTag + 2);
v30 = v28->AclSize;
v23 += v30;
}
++mm;
}
}
if( pScopeAcl && (v49 = pScopeAcl + 1, pScopeAcl->AceCount) )
{
do
{
LOWORD(v50) = v49->AclSize;
if( v49->AclRevision == 19 )
{
memmove(v23, v49, v49->AclSize);
++*((_WORD *)PoolWithTag + 2);
v50 = v49->AclSize;
v23 += v50;
}
++v8;
v49 = (_ACL *)((char *)v49 + (unsigned __int16)v50);
}
while( v8 < pScopeAcl->AceCount );
v24 = 0;
}
else
{
v24 = 0;
}
goto LABEL_36;
}
v24 = -1073741811;
}
ExFreePoolWithTag(PoolWithTag, 0);
PoolWithTag = 0i64;
}
else
{
v24 = -1073741801;
}
}
LABEL_36:
result = v24;
*pSaclSecurityInformation = (UINT64)PoolWithTag;
return result;
}
*pSaclSecurityInformation = 0i64;
return 0;
}Referenced by:
RtlpNewSecurityObject
RtlpSetSecurityObject