SepGetTokenSessionMapEntry

NTSTATUS __stdcall SepGetTokenSessionMapEntry(
        UINT64 SessionId,
        UINT8 ExclusiveLockHeld,
        _SEP_LOWBOX_NUMBER_MAPPING **LowboxMap){
  VOID **v4; 
  int v6; 
  VOID **i; 
  _SEP_LOWBOX_NUMBER_MAPPING *v9; 
  VOID **PoolWithTag; 
  VOID ***v11; 
  VOID **v12; 

  *LowboxMap = 0i64;
  v4 = (VOID **)qword_140C25D48;
  v6 = SessionId;
  if( qword_140C25D48 )
  {
LABEL_5:
    for( i = (VOID **)*v4; i != v4; i = (VOID **)*i )
    {
      if( *((_DWORD *)i + 4) == v6 )
      {
        v9 = (_SEP_LOWBOX_NUMBER_MAPPING *)(i + 3);
LABEL_17:
        *LowboxMap = v9;
        return 0;
      }
    }
    if( !ExclusiveLockHeld )
      return -1073741275;
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x40ui64, 1934386515i64);
    if( PoolWithTag )
    {
      v11 = (VOID ***)qword_140C25D48;
      v9 = (_SEP_LOWBOX_NUMBER_MAPPING *)(PoolWithTag + 3);
      PoolWithTag[3] = 0i64;
      *((_BYTE *)PoolWithTag + 56) = 0;
      *((_DWORD *)PoolWithTag + 4) = v6;
      v12 = *v11;
      if( (*v11)[1] != v11 )
        __fastfail(3u);
      *PoolWithTag = v12;
      PoolWithTag[1] = v11;
      v12[1] = PoolWithTag;
      *v11 = PoolWithTag;
      goto LABEL_17;
    }
    return -1073741670;
  }
  if( !ExclusiveLockHeld )
    return -1073741275;
  v4 = ExAllocatePoolWithTag(
         (unsigned int)((_DWORD)qword_140C25D48 + 1),
         (unsigned int)((_DWORD)qword_140C25D48 + 16),
         1934386515i64);
  qword_140C25D48 = v4;
  if( v4 )
  {
    v4[1] = v4;
    *v4 = v4;
    goto LABEL_5;
  }
  return -1073741670;
}

Referenced by:

SepDereferenceLowBoxNumberEntry
SepIsParentOfChildAppContainer
SepSetTokenLowboxNumber