SepFindSharedSidEntry

_RTL_DYNAMIC_HASH_TABLE_ENTRY *__fastcall SepFindSharedSidEntry(PVOID Sid1){
  _EX_PUSH_LOCK *v1; 
  _RTL_DYNAMIC_HASH_TABLE_ENTRY *v2; 
  __int64 v4; 
  UINT64 v5; 
  _RTL_DYNAMIC_HASH_TABLE_ENTRY *i; 
  _RTL_DYNAMIC_HASH_TABLE_ENTRY *v7; 
  _RTL_DYNAMIC_HASH_TABLE_CONTEXT Context; 

  v1 = g_SepSidMapping;
  v2 = 0i64;
  memset(&Context, 0, sizeof(Context));
  v4 = *((unsigned int *)Sid1 + (unsigned int)*((unsigned __int8 *)Sid1 + 1) + 1);
  v5 = v4 + 1;
  if( (_DWORD)v4 )
    v5 = *((unsigned int *)Sid1 + (unsigned int)*((unsigned __int8 *)Sid1 + 1) + 1);
  for( i = (_RTL_DYNAMIC_HASH_TABLE_ENTRY *)RtlLookupEntryHashTable(
                                               (_RTL_DYNAMIC_HASH_TABLE *)g_SepSidMapping[1]._bf_0,
                                               v5,
                                               &Context);
        ;
        i = RtlGetNextEntryHashTable((_RTL_DYNAMIC_HASH_TABLE *)v1[1]._bf_0, &Context) )
  {
    v7 = i;
    if( !i )
      break;
    if( RtlEqualSid(Sid1, i[1].Linkage.Blink) )
      return v7;
  }
  return v2;
}

Referenced by:

SepDeReferenceSharedSidEntries
SepInsertOrReferenceSharedSidEntries