SeComputeCreatorDeniedRights
UINT64 __stdcall SeComputeCreatorDeniedRights(
SECURITY_SUBJECT_CONTEXT *Context,
ACCESS_STATE *AccessState,
UINT64 CurrentAccess,
PVOID ObjectSecurityDescriptor){
int v5;
unsigned int v7;
__int64 v9;
__int16 v10;
__int64 v11;
ACL *v12;
UINT8 v13;
__int64 v14;
ACL *v15;
void *ClientToken;
void *v17;
NTSTATUS Cap;
RTL_DYNAMIC_HASH_TABLE_ENTRY *v19;
UINT64 PreviouslyGrantedAccess;
UINT64 GrantedAccess;
RTL_DYNAMIC_HASH_TABLE_ENTRY *v22;
INT64 AccessStatus;
LODWORD(AccessStatus) = 0;
v5 = CurrentAccess;
LODWORD(GrantedAccess) = 0;
v7 = 0;
if( (CurrentAccess & 0xC0000) == 0 )
return 0i64;
v9 = *((_QWORD *)AccessState + 9);
if( *(_QWORD *)(v9 + 48) )
ObjectSecurityDescriptor = *(PVOID *)(v9 + 48);
if( !ObjectSecurityDescriptor )
{
ObjectSecurityDescriptor = (PVOID)*((_QWORD *)AccessState + 8);
if( !ObjectSecurityDescriptor )
return 0i64;
}
v10 = *((_WORD *)ObjectSecurityDescriptor + 1);
if( (v10 & 4) != 0 )
{
if( v10 >= 0 )
{
v12 = (ACL *)*((_QWORD *)ObjectSecurityDescriptor + 4);
}
else
{
v11 = *((unsigned int *)ObjectSecurityDescriptor + 4);
v12 = (_DWORD)v11 ? (ACL *)((char *)ObjectSecurityDescriptor + v11) : 0i64;
}
}
else
{
v12 = 0i64;
}
if( !RtlpOwnerAcesPresent(0, v12) )
{
if( (v10 & 0x10) != 0 )
{
if( v10 >= 0 )
{
v15 = (ACL *)*((_QWORD *)ObjectSecurityDescriptor + 3);
}
else
{
v14 = *((unsigned int *)ObjectSecurityDescriptor + 3);
v15 = (_DWORD)v14 ? (ACL *)((char *)ObjectSecurityDescriptor + v14) : 0i64;
}
}
else
{
v15 = 0i64;
}
v22 = 0i64;
if( !SepRmEnforceCap )
return 0i64;
if( !v15 )
return 0i64;
LODWORD(v17) = SepGetScopedPolicySid(v15);
if( !v17 )
return 0i64;
Cap = SepRmReferenceFindCap(v17, &v22);
v19 = v22;
if( Cap < 0 )
v19 = (RTL_DYNAMIC_HASH_TABLE_ENTRY *)SepRmDefaultCap;
if( ((__int64)v19[2].Linkage.Blink & 1) == 0 )
return 0i64;
}
ClientToken = Context->ClientToken;
if( !Context->ClientToken )
ClientToken = Context->PrimaryToken;
if( !SepTokenIsOwner(ClientToken, ObjectSecurityDescriptor, v13) )
return 0i64;
if( (v5 & 0x40000) != 0 )
{
LODWORD(PreviouslyGrantedAccess) = 0;
if( !SeAccessCheck(
ObjectSecurityDescriptor,
Context,
1u,
0x40000ui64,
PreviouslyGrantedAccess,
0i64,
(GENERIC_MAPPING *)&StandardBitMapping,
*((_BYTE *)KeGetCurrentThread() + 562),
&GrantedAccess,
&AccessStatus) )
v7 = 0x40000;
}
if( (v5 & 0x80000) != 0 )
{
LODWORD(PreviouslyGrantedAccess) = 0;
if( !SeAccessCheck(
ObjectSecurityDescriptor,
Context,
1u,
0x80000ui64,
PreviouslyGrantedAccess,
0i64,
(GENERIC_MAPPING *)&StandardBitMapping,
*((_BYTE *)KeGetCurrentThread() + 562),
&GrantedAccess,
&AccessStatus) )
v7 |= 0x80000u;
}
return v7;
}Referenced by:
ObpAdjustCreatorAccessState
ObpCreateHandle