DrvDbGetSecurityDescriptor
VOID *__stdcall DrvDbGetSecurityDescriptor(){
VOID **v0;
VOID **PoolWithTag;
VOID **Sid;
_DWORD *v3;
VOID **v4;
VOID **v5;
_DWORD *v6;
VOID **v7;
VOID **v8;
_DWORD *v9;
VOID **v10;
VOID **v11;
_DWORD *v12;
_DWORD *v13;
NTSTATUS v14;
int v15;
unsigned int v16;
VOID **v17;
UINT64 v18;
_ACL *v19;
unsigned int v20;
size_t v21;
VOID **v22;
VOID **v23;
__int128 SecurityDescriptor[2];
__int64 v26;
_SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
_SID_IDENTIFIER_AUTHORITY v28;
_SID_IDENTIFIER_AUTHORITY v29;
VOID **v30;
*(_WORD *)&IdentifierAuthority.Value[4] = 1280;
v30 = 0i64;
*(_DWORD *)IdentifierAuthority.Value = 0;
*(_DWORD *)v28.Value = 0;
*(_WORD *)&v28.Value[4] = 768;
*(_DWORD *)v29.Value = 0;
*(_WORD *)&v29.Value[4] = 256;
v26 = 0i64;
v0 = 0i64;
memset(SecurityDescriptor, 0, sizeof(SecurityDescriptor));
PoolWithTag = ExAllocatePoolWithTag(1ui64, 0xCui64, 1111770192i64);
Sid = PoolWithTag;
if( PoolWithTag )
{
if( RtlInitializeSid(PoolWithTag, &IdentifierAuthority, 1u) >= 0 )
{
LODWORD(v3) = RtlSubAuthoritySid((INT64)Sid, 0i64);
*v3 = 18;
if( RtlValidSid(Sid) )
{
v4 = ExAllocatePoolWithTag(1ui64, 0xCui64, 1111770192i64);
v5 = v4;
if( v4 )
{
if( RtlInitializeSid(v4, &v28, 1u) >= 0 )
{
LODWORD(v6) = RtlSubAuthoritySid((INT64)v5, 0i64);
*v6 = 4;
if( RtlValidSid(v5) )
{
v7 = ExAllocatePoolWithTag(1ui64, 0xCui64, 1111770192i64);
v8 = v7;
if( v7 )
{
if( RtlInitializeSid(v7, &v29, 1u) >= 0 )
{
LODWORD(v9) = RtlSubAuthoritySid((INT64)v8, 0i64);
*v9 = 0;
if( RtlValidSid(v8) )
{
v10 = ExAllocatePoolWithTag(1ui64, 0x10ui64, 1111770192i64);
v11 = v10;
if( v10 )
{
if( RtlInitializeSid(v10, &IdentifierAuthority, 2u) >= 0 )
{
LODWORD(v12) = RtlSubAuthoritySid((INT64)v11, 0i64);
*v12 = 32;
LODWORD(v13) = RtlSubAuthoritySid((INT64)v11, 1ui64);
*v13 = 544;
if( RtlValidSid(v11) )
{
v14 = RtlLengthSid((INT64)v8);
v15 = RtlLengthSid((INT64)v5) + v14;
v16 = RtlLengthSid((INT64)Sid) + 32 + v15;
v17 = ExAllocatePoolWithTag(1ui64, v16, 1111770192i64);
v19 = (_ACL *)v17;
if( v17 )
{
if( RtlCreateAcl((PACL)v17, (_ACL)v16, 2ui64, v18) >= 0
&& RtlpAddKnownAce(v19, 2ui64, 2ui64, 0xF003Fui64, Sid, 0) >= 0
&& RtlpAddKnownAce(v19, 2ui64, 2ui64, 0x20000ui64, v5, 0) >= 0
&& RtlpAddKnownAce(v19, 2ui64, 2ui64, 0x20019ui64, v8, 0) >= 0
&& RtlCreateSecurityDescriptor(SecurityDescriptor, 1ui64) >= 0
&& RtlSetDaclSecurityDescriptor(SecurityDescriptor, 1u, v19, 0) >= 0
&& RtlSetOwnerSecurityDescriptor(SecurityDescriptor, v11, 1u) >= 0
&& RtlSetGroupSecurityDescriptor(SecurityDescriptor, v11, 1u) >= 0 )
{
WORD1(SecurityDescriptor[0]) |= 0x1400u;
if( RtlValidSecurityDescriptor(SecurityDescriptor) )
{
v20 = RtlLengthSecurityDescriptor((INT64)SecurityDescriptor);
*(_DWORD *)IdentifierAuthority.Value = v20;
if( v20 >= 0x28 )
{
v21 = v20;
v22 = ExAllocatePoolWithTag(1ui64, v20, 1111770192i64);
v23 = v22;
if( v22 )
{
memset(v22, 0i64, v21);
if( RtlAbsoluteToSelfRelativeSD(
SecurityDescriptor,
v23,
(UINT64 *)IdentifierAuthority.Value) < 0 )
{
v0 = v30;
}
else
{
v0 = v23;
v23 = 0i64;
}
if( v23 )
ExFreePoolWithTag(v23, 0);
}
else
{
v0 = v30;
}
}
}
}
ExFreePoolWithTag(v19, 0);
}
}
}
ExFreePoolWithTag(v11, 0);
}
}
}
ExFreePoolWithTag(v8, 0);
}
}
}
ExFreePoolWithTag(v5, 0);
}
}
}
ExFreePoolWithTag(Sid, 0);
}
return v0;
}Referenced by:
DrvDbLoadDatabaseNode