SmKmStoreFileMakeSecurityDescriptor
INT64 __fastcall SmKmStoreFileMakeSecurityDescriptor(_SECURITY_DESCRIPTOR *SecurityDescriptor, _ACL **DaclOut){
void *v4;
void *v5;
_ACL *v6;
VOID *PoolWithTag;
UINT64 v8;
void *v9;
int Acl;
VOID *v11;
UINT64 v12;
VOID *v13;
UINT64 v14;
int v15;
int v16;
UINT32 v17;
struct _ACL *v18;
SID_IDENTIFIER_AUTHORITY v20;
struct _SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
*(_WORD *)&IdentifierAuthority.Value[4] = 256;
*(_DWORD *)IdentifierAuthority.Value = 0;
*(_DWORD *)v20.Value = 0;
*(_WORD *)&v20.Value[4] = 1280;
v4 = 0i64;
v5 = 0i64;
v6 = 0i64;
PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0xCui64, 0x53446D73ui64);
v9 = PoolWithTag;
if( !PoolWithTag )
return(unsigned int)-1073741670;
LOBYTE(v8) = 1;
Acl = RtlInitializeSid(PoolWithTag, &IdentifierAuthority, v8);
if( Acl >= 0 )
{
v11 = ExAllocatePoolWithTag(PagedPool, 0xCui64, 0x53446D73ui64);
v4 = v11;
if( v11 )
{
LOBYTE(v12) = 1;
Acl = RtlInitializeSid(v11, &v20, v12);
if( Acl < 0 )
goto LABEL_17;
v13 = ExAllocatePoolWithTag(PagedPool, 0x10ui64, 0x53446D73ui64);
v5 = v13;
if( v13 )
{
LOBYTE(v14) = 2;
Acl = RtlInitializeSid(v13, &v20, v14);
if( Acl < 0 )
goto LABEL_17;
*RtlSubAuthoritySid(v9, 0i64) = 0;
*RtlSubAuthoritySid(v4, 0i64) = 18;
*RtlSubAuthoritySid(v5, 0i64) = 32;
*RtlSubAuthoritySid(v5, 1ui64) = 544;
v15 = RtlLengthSid(v5);
v16 = RtlLengthSid(v4) + v15;
v17 = RtlLengthSid(v9) + 32 + v16;
v18 = (struct _ACL *)ExAllocatePoolWithTag(PagedPool, v17, 0x61446D73ui64);
v6 = v18;
if( v18 )
{
Acl = RtlCreateAcl(v18, v17, 2u);
if( Acl >= 0 )
{
Acl = RtlpAddKnownAce(v6, 2ui64, 0i64, 0x1F01FFui64, v5, 0);
if( Acl >= 0 )
{
Acl = RtlpAddKnownAce(v6, 2ui64, 0i64, 0x1F01FFui64, v4, 0);
if( Acl >= 0 )
{
Acl = RtlpAddKnownAce(v6, 2ui64, 0i64, 0x10000ui64, v9, 0);
if( Acl >= 0 )
{
Acl = RtlCreateSecurityDescriptor(SecurityDescriptor, 1ui64);
if( Acl >= 0 )
{
Acl = RtlSetDaclSecurityDescriptor(SecurityDescriptor, 1u, v6, 0);
if( Acl >= 0 )
{
*DaclOut = v6;
v6 = 0i64;
Acl = 0;
}
}
}
}
}
}
goto LABEL_17;
}
}
}
Acl = -1073741670;
}
LABEL_17:
ExFreePoolWithTag(v9, 0);
if( v4 )
ExFreePoolWithTag(v4, 0);
if( v5 )
ExFreePoolWithTag(v5, 0);
if( v6 )
ExFreePoolWithTag(v6, 0);
return(unsigned int)Acl;
}Referenced by:
SmKmStoreFileCreateForIoType