MiInitializeApiSets

NTSTATUS __stdcall MiInitializeApiSets(_LOADER_PARAMETER_BLOCK *LoaderBlock){
  _LOADER_PARAMETER_EXTENSION *Extension; 
  NTSTATUS result; 
  VOID *v4; 
  int v5; 
  VOID *v6; 
  UINT64 SectionPageProtection; 
  UINT64 AllocationAttributes; 
  VOID *Section; 
  VOID *MappedBase; 
  UINT64 ViewSize; 

  Extension = LoaderBlock->Extension;
  MappedBase = 0i64;
  Section = 0i64;
  ViewSize = Extension->ApiSetSchemaSize;
  LODWORD(AllocationAttributes) = 0x8000000;
  LODWORD(SectionPageProtection) = 4;
  result = MmCreateSection(
             &Section,
             0xF001Fui64,
             0i64,
             (_LARGE_INTEGER *)&ViewSize,
             SectionPageProtection,
             AllocationAttributes,
             0i64,
             0i64);
  if( result >= 0 )
  {
    v4 = Section;
    ViewSize = 0i64;
    v5 = MmMapViewInSystemSpace(Section, &MappedBase, &ViewSize);
    if( v5 < 0 )
    {
      ObfDereferenceObjectWithTag(v4, 0x746C6644ui64);
      return v5;
    }
    else
    {
      v6 = MappedBase;
      memmove(MappedBase, LoaderBlock->Extension->ApiSetSchema, LoaderBlock->Extension->ApiSetSchemaSize);
      SectionToMap = v4;
      qword_140C4C940 = (__int64)v6;
      result = 0;
      qword_140C4C948 = LoaderBlock->Extension->ApiSetSchemaSize;
    }
  }
  return result;
}

Referenced by:

MiInitSystem