RtlpCreateServerAcl
INT64 __fastcall RtlpCreateServerAcl(
_ACL *Acl,
UINT8 AclUntrusted,
VOID *ServerSid,
_ACL **ServerAcl,
UINT8 *ServerAclAllocated){
UINT16 v7;
UINT8 *v9;
_ACL *v10;
unsigned int AceCount;
UINT16 v12;
unsigned int v13;
_ACL *v14;
INT64 result;
UINT16 v16;
UINT16 v17;
__int64 v18;
__int64 v19;
__int64 v20;
_ACL *PoolWithTag;
_ACL *v22;
unsigned int v23;
unsigned int v24;
UINT8 *v25;
UINT8 *v26;
UINT8 AclRevision;
__int64 AclSize;
UINT8 *v29;
UINT8 *v30;
UINT8 *v31;
UINT8 *v32;
__int16 v33;
_ACL *pusResult;
void *Src;
Src = ServerSid;
LOWORD(pusResult) = 8;
v7 = 8;
if( !Acl )
{
v9 = ServerAclAllocated;
*ServerAcl = 0i64;
*v9 = 0;
return 0i64;
}
v10 = Acl + 1;
AceCount = Acl->AceCount;
v12 = 4 * (*((unsigned __int8 *)ServerSid + 1) + 2);
v13 = 0;
v14 = Acl + 1;
if( Acl->AceCount )
{
while( v14->AclRevision )
{
if( AclUntrusted && v14->AclRevision == 4 )
{
v18 = (unsigned __int16)(4 * HIBYTE(v14[1].AceCount));
if( (unsigned __int16)(v18 + 8) <= v12 )
v17 = v12 - v18 - 8;
else
v17 = v18 + 8 - v12;
v16 = v7;
LABEL_13:
LODWORD(result) = RtlUShortAdd(v16, v17, (UINT16 *)&pusResult);
if( (int)result < 0 )
return result;
v7 = (unsigned __int16)pusResult;
}
LODWORD(result) = RtlUShortAdd(v7, v14->AclSize, (UINT16 *)&pusResult);
if( (int)result < 0 )
return result;
v7 = (unsigned __int16)pusResult;
++v13;
v14 = (_ACL *)(v20 + v19);
if( v13 >= AceCount )
goto LABEL_17;
}
LODWORD(result) = RtlUShortAdd(v7, v12, (UINT16 *)&pusResult);
if( (int)result < 0 )
return result;
v16 = (unsigned __int16)pusResult;
v17 = 4;
goto LABEL_13;
}
LABEL_17:
PoolWithTag = (_ACL *)ExAllocatePoolWithTag(PagedPool, v7, 0x63416553ui64);
*ServerAcl = PoolWithTag;
if( !PoolWithTag )
return 3221225626i64;
*ServerAclAllocated = 1;
RtlCreateAcl(PoolWithTag, v7, 3u);
v22 = *ServerAcl;
v23 = 0;
LOWORD(v24) = Acl->AceCount;
pusResult = v22;
v25 = (UINT8 *)&v22[1];
if( (_WORD)v24 )
{
v26 = (UINT8 *)Src;
do
{
AclRevision = v10->AclRevision;
if( !v10->AclRevision || AclUntrusted && AclRevision == 4 )
{
v29 = v25;
if( AclRevision )
v30 = (UINT8 *)&v10[1].AceCount + (unsigned int)RtlLengthSid(&v10[1].AceCount);
else
v30 = (UINT8 *)&v10[1];
*(_ACL *)v25 = *v10;
v31 = v25 + 12;
memmove(v31, v26, 4i64 * v26[1] + 8);
v32 = &v31[(unsigned __int8)(4 * (v26[1] + 2))];
memmove(v32, v30, 4i64 * v30[1] + 8);
AclSize = v30[1];
v33 = v26[1];
*v29 = 4;
*((_WORD *)v29 + 1) = 4 * (AclSize + v33 + 7);
*((_WORD *)v29 + 4) = 1;
v25 = &v32[4 * AclSize + 8];
LOWORD(AclSize) = v10->AclSize;
}
else
{
memmove(v25, (UINT8 *)v10, v10->AclSize);
AclSize = v10->AclSize;
v25 += AclSize;
}
++v23;
v10 = (_ACL *)((char *)v10 + (unsigned __int16)AclSize);
v24 = Acl->AceCount;
}
while( v23 < v24 );
v22 = pusResult;
}
v22->AceCount = v24;
return 0i64;
}Referenced by:
RtlpNewSecurityObject
RtlpSetSecurityObject