PiAuAllocateAndInitializeSid

NTSTATUS __stdcall PiAuAllocateAndInitializeSid(
        VOID **Sid,
        _SID_IDENTIFIER_AUTHORITY *IdentifierAuthority,
        UINT64 SubAuthorityCount){
  UINT8 v3; 
  unsigned int v6; 
  VOID **PoolWithTag; 
  int v8; 

  v3 = SubAuthorityCount;
  if( (unsigned int)SubAuthorityCount > 0x3FFFFFF7 )
    v6 = -1;
  else
    v6 = 4 * SubAuthorityCount + 8;
  PoolWithTag = ExAllocatePoolWithTag(1ui64, v6, 538996816i64);
  *Sid = PoolWithTag;
  if( PoolWithTag )
  {
    v8 = RtlInitializeSid(PoolWithTag, IdentifierAuthority, v3);
    if( v8 >= 0 )
      return v8;
  }
  else
  {
    v8 = -1073741670;
  }
  if( *Sid )
  {
    ExFreePoolWithTag(*Sid, 0);
    *Sid = 0i64;
  }
  return v8;
}

Referenced by:

PiAuCreateStandardSecurityObject
PiAuCreateUserSids