SepInitializeSingletonAttributesStructures

NTSTATUS __stdcall SepInitializeSingletonAttributesStructures(){
  PEX_SPIN_LOCK v0; 
  NTSTATUS v1; 
  _EX_PUSH_LOCK *v2; 
  VOID **PoolWithTag; 
  VOID **v4; 
  VOID **v5; 
  VOID **v6; 
  PEX_SPIN_LOCK v7; 
  _EX_PUSH_LOCK *v8; 
  void *v10; 

  v0 = SepSingletonGlobal;
  v1 = 0;
  *((_DWORD *)SepSingletonGlobal + 1) = 0;
  *((_QWORD *)v0 + 1) = 0i64;
  *((_DWORD *)v0 + 4) = 0;
  *v0 = 0;
  v2 = SeLuidToIndexMapping;
  SeLuidToIndexMapping->_bf_0 = 0i64;
  v2[1]._bf_0 = 0i64;
  if( (*(&stru_140CF2E80 + 7296) & 3) == 3 )
  {
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 8ui64, 1950639443i64);
    if( PoolWithTag )
    {
      v4 = ExAllocatePoolWithTag(0x200ui64, 0x600ui64, 1950639443i64);
      v5 = v4;
      if( v4 )
      {
        memset(v4, 0i64, 0x600u);
        v6 = ExAllocatePoolWithTag(0x200ui64, 8ui64, 1950639443i64);
        v7 = SepSingletonGlobal;
        *((_QWORD *)SepSingletonGlobal + 1) = v6;
        if( v6 )
        {
          *v6 = v5;
          ++*((_DWORD *)v7 + 1);
          if( RtlpCreateHashTable((_RTL_DYNAMIC_HASH_TABLE **)&SeLuidToIndexMapping[1], 0x80ui64, 0i64, 0i64) )
          {
            v8 = SeLuidToIndexMapping;
            LODWORD(SeLuidToIndexMapping[2]._bf_0) = 64;
            v8[3]._bf_0 = (__int64)PoolWithTag;
            *PoolWithTag = 0i64;
            return v1;
          }
        }
        ExFreePoolWithTag(v5, 0x74446553u);
      }
      ExFreePoolWithTag(PoolWithTag, 0x74446553u);
    }
    v1 = -1073741801;
    v10 = (void *)*((_QWORD *)SepSingletonGlobal + 1);
    if( v10 )
      ExFreePoolWithTag(v10, 0x74446553u);
  }
  return v1;
}

Referenced by:

SepInitializationPhase1