MiInitializeMemoryEvents

UINT64 __fastcall MiInitializeMemoryEvents(_MI_PARTITION *Partition){
  INT64 v2; 
  int MemoryEventSD; 
  WCHAR v4; 
  unsigned int v5; 
  INT64 v6; 
  __int128 SecurityDescriptor[2]; 
  __int64 v9; 
  unsigned __int8 DaclPresent; 
  unsigned __int8 DaclDefaulted; 
  PACL Dacl; 
  memset(SecurityDescriptor, 0, sizeof(SecurityDescriptor));
  v9 = 0i64;
  MemoryEventSD = MiCreateMemoryEventSD(SecurityDescriptor);
  if( MemoryEventSD >= 0 )
  {
    MemoryEventSD = MiCreatePartitionNamespace((INT64)Partition, v2, v4);
    if( MemoryEventSD >= 0 )
    {
      v5 = 0;
      while( 1 )
      {
        if( v5 >= 4 || Partition == (_MI_PARTITION *)&MiSystemPartition )
        {
          MemoryEventSD = MiCreateMemoryEvent((_UNICODE_STRING *)&MiMemoryEventNames[8 * v5], (_KEVENT **)v5);
          if( MemoryEventSD < 0 )
            break;
        }
        if( ++v5 >= 0xB )
        {
          if( Partition == (_MI_PARTITION *)&MiSystemPartition )
          {
            MiInitializePagedPoolEvents();
            MiSignalNonPagedPoolWatchers(v6);
          }
          MiUpdateAvailableEvents(Partition);
          MemoryEventSD = 0;
          break;
        }
      }
    }
  }
  Dacl = 0i64;
  DaclPresent = 0;
  if( RtlGetDaclSecurityDescriptor(SecurityDescriptor, &DaclPresent, &Dacl, &DaclDefaulted) >= 0 && DaclPresent )
    ExFreePoolWithTag(Dacl, 0);
  return MemoryEventSD >= 0;
}

Referenced by:

MiInitSystem