MiInitializeMemoryEvents

NTSTATUS __stdcall MiInitializeMemoryEvents(_MI_PARTITION *Partition){
  NTSTATUS MemoryEventSD; 
  unsigned int v3; 
  INT64 v4; 
  __int128 SecurityDescriptor[2]; 
  __int64 v7; 
  unsigned __int8 DaclPresent; 
  unsigned __int8 DaclDefaulted; 
  PACL Dacl; 

  memset(SecurityDescriptor, 0, sizeof(SecurityDescriptor));
  v7 = 0i64;
  MemoryEventSD = MiCreateMemoryEventSD(SecurityDescriptor);
  if( MemoryEventSD >= 0 )
  {
    MemoryEventSD = MiCreatePartitionNamespace();
    if( MemoryEventSD >= 0 )
    {
      v3 = 0;
      while( 1 )
      {
        if( v3 >= 4 || Partition == &Irp )
        {
          MemoryEventSD = MiCreateMemoryEvent((_UNICODE_STRING *)&MiMemoryEventNames[8 * v3], (_KEVENT **)v3);
          if( MemoryEventSD < 0 )
            break;
        }
        if( ++v3 >= 0xB )
        {
          if( Partition == &Irp )
          {
            MiInitializePagedPoolEvents();
            MiSignalNonPagedPoolWatchers(v4);
          }
          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