SepValidateAndCopyGlobalEntry

__int64 __fastcall SepValidateAndCopyGlobalEntry(__int64 a1, _QWORD *a2){
  int ProcUniqueLuidAndIndexFromAttributeInfo; 
  _AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION *PoolWithTag; 
  _AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION *v5; 
  _LIST_ENTRY *p_SecurityAttributesList; 
  UINT64 v7; 
  INT64 SingletonEntryFromIndexNumber; 
  unsigned __int64 v9; 
  _AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION *v10; 
  int v11; 
  UINT64 v13; 
  __int64 v14; 
  *a2 = 0i64;
  LODWORD(v13) = 0;
  v14 = 0i64;
  ProcUniqueLuidAndIndexFromAttributeInfo = SepGetProcUniqueLuidAndIndexFromAttributeInfo(a1, &v13, &v14);
  if( ProcUniqueLuidAndIndexFromAttributeInfo >= 0 )
  {
    PoolWithTag = (_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION *)ExAllocatePoolWithTag(
                                                                   NonPagedPoolNx,
                                                                   0x30ui64,
                                                                   0x74416553ui64);
    v5 = PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag->SecurityAttributeCount = 0;
      PoolWithTag->WorkingSecurityAttributeCount = 0;
      p_SecurityAttributesList = &PoolWithTag->SecurityAttributesList;
      v7 = (unsigned int)v13;
      p_SecurityAttributesList->Blink = p_SecurityAttributesList;
      p_SecurityAttributesList->Flink = p_SecurityAttributesList;
      v5->WorkingSecurityAttributesList.Blink = &v5->WorkingSecurityAttributesList;
      v5->WorkingSecurityAttributesList.Flink = &v5->WorkingSecurityAttributesList;
      SingletonEntryFromIndexNumber = SepGetSingletonEntryFromIndexNumber(v7);
      v9 = ExAcquireSpinLockShared((PEX_SPIN_LOCK)SingletonEntryFromIndexNumber);
      if( *(_QWORD *)(SingletonEntryFromIndexNumber + 8) == v14 )
      {
        v10 = *(_AUTHZBASEP_SECURITY_ATTRIBUTES_INFORMATION **)(SingletonEntryFromIndexNumber + 16);
        if( v10 )
        {
          v11 = AuthzBasepDuplicateSecurityAttributes(v10, v5, 0i64);
          *a2 = v5;
          ProcUniqueLuidAndIndexFromAttributeInfo = v11;
          v5 = 0i64;
        }
        ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)SingletonEntryFromIndexNumber);
      }
      else
      {
        ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)SingletonEntryFromIndexNumber);
        ProcUniqueLuidAndIndexFromAttributeInfo = -1073741275;
      }
      __writecr8(v9);
      if( v5 )
        ExFreePoolWithTag(v5, 0x74416553u);
    }
    else
    {
      return(unsigned int)-1073741801;
    }
  }
  return(unsigned int)ProcUniqueLuidAndIndexFromAttributeInfo;
}

Referenced by:

AuthzBasepEvaluateAceCondition