IopCreateSecurityDescriptorPerType
NTSTATUS __stdcall IopCreateSecurityDescriptorPerType(
PVOID Descriptor,
UINT64 SecurityDescriptorFlavor,
_ACL **AllocatedSacl,
UINT64 *SecurityInformation){
char v4;
int v8;
int v9;
_ACL *v10;
NTSTATUS result;
int v12;
int v13;
__int64 v14;
VOID **PoolWithTag;
UINT64 v16;
_ACL *v17;
UINT64 v18;
int v19;
void *v20;
void *AccessMask;
v4 = 0;
v8 = SecurityDescriptorFlavor - 1;
if( v8 )
{
v9 = v8 - 1;
if( !v9 )
{
v10 = SePublicDefaultUnrestrictedDacl;
goto LABEL_4;
}
v12 = v9 - 1;
if( !v12 )
{
v10 = SePublicOpenDacl;
goto LABEL_10;
}
v13 = v12 - 1;
if( !v13 )
{
v10 = SePublicOpenUnrestrictedDacl;
LABEL_10:
v4 = 1;
goto LABEL_4;
}
if( v13 != 1 )
return -1073741811;
v10 = SeSystemDefaultDacl;
}
else
{
v10 = SePublicDefaultDacl;
}
LABEL_4:
RtlCreateSecurityDescriptor(Descriptor, 1ui64);
if( v4 == 1 )
{
v14 = (unsigned __int16)(4 * (*((unsigned __int8 *)SeLowMandatorySid + 1) + 6));
PoolWithTag = ExAllocatePoolWithTag(1ui64, (unsigned __int16)v14, 1699966793i64);
v17 = (_ACL *)PoolWithTag;
if( !PoolWithTag )
return -1073741670;
RtlCreateAcl((PACL)PoolWithTag, (_ACL)(unsigned __int16)v14, 2ui64, v16);
LODWORD(AccessMask) = 1;
RtlAddMandatoryAce(v17, v18, 0i64, (UINT64)SeLowMandatorySid, v20, AccessMask);
RtlSetSaclSecurityDescriptor(Descriptor, 1u, v17, 0);
*AllocatedSacl = v17;
}
result = RtlSetDaclSecurityDescriptor(Descriptor, 1u, v10, 0);
if( SecurityInformation )
{
v19 = *(_DWORD *)SecurityInformation | 4;
*(_DWORD *)SecurityInformation = v19;
if( v4 )
*(_DWORD *)SecurityInformation = v19 | 0x10;
}
return result;
}Referenced by:
IopCreateDefaultDeviceSecurityDescriptor