MiInitializeApiSets

NTSTATUS __stdcall MiInitializeApiSets(_LOADER_PARAMETER_BLOCK *LoaderBlock){
  __int64 v1; 
  NTSTATUS result; 
  PVOID v4; 
  int v5; 
  PVOID v6; 
  UINT64 SectionPageProtection; 
  UINT64 AllocationAttributes; 
  PVOID Section; 
  PVOID MappedBase; 
  ULONG_PTR ViewSize; 
  v1 = *((_QWORD *)LoaderBlock + 30);
  MappedBase = 0i64;
  Section = 0i64;
  ViewSize = *(unsigned int *)(v1 + 2696);
  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(
        (UINT8 *)MappedBase,
        *(UINT8 **)(*((_QWORD *)LoaderBlock + 30) + 2688i64),
        *(unsigned int *)(*((_QWORD *)LoaderBlock + 30) + 2696i64));
      *(_QWORD *)::LoaderBlock = v4;
      qword_140C4C940 = (__int64)v6;
      result = 0;
      qword_140C4C948 = *(unsigned int *)(*((_QWORD *)LoaderBlock + 30) + 2696i64);
    }
  }
  return result;
}

Referenced by:

MiInitSystem