MmLockPagableDataSection

PVOID __stdcall MmLockPagableDataSection(PVOID AddressWithinSection){
  _ETHREAD *CurrentThread; 
  VOID *v3; 
  INT64 v4; 
  _BYTE *v5; 
  char *v6; 
  IMAGE_NT_HEADERS *v7; 
  unsigned int NumberOfSections; 
  _DWORD *v9; 
  int v10; 
  unsigned __int64 v11; 
  unsigned int v12; 
  if( (unsigned int)MI_IS_PHYSICAL_ADDRESS(AddressWithinSection) )
    return(PVOID)1;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v3 = 0i64;
  --*((_WORD *)CurrentThread + 242);
  ExAcquireResourceExclusiveLite(&PsLoadedModuleResource, 1u);
  v5 = *(_BYTE **)(MiLookupDataTableEntry((unsigned __int64)AddressWithinSection, 0i64, v4) + 48);
  v6 = (char *)((_BYTE *)AddressWithinSection - v5);
  v7 = RtlImageNtHeader(v5);
  NumberOfSections = v7->FileHeader.NumberOfSections;
  v9 = (_DWORD *)((char *)&v7->OptionalHeader.Magic + v7->FileHeader.SizeOfOptionalHeader);
  v10 = 0;
  if( v7->FileHeader.NumberOfSections )
  {
    while( 1 )
    {
      v11 = (unsigned int)v9[3];
      v12 = v9[4];
      if( (unsigned __int64)v6 >= v11 )
      {
        if( v12 < v9[2] )
          v12 = v9[2];
        if( (unsigned __int64)v6 < (unsigned int)v11 + v12 )
          break;
      }
      v9 += 10;
      if( ++v10 >= NumberOfSections )
        goto LABEL_10;
    }
    v3 = v9;
  }
LABEL_10:
  ExReleaseResourceLite(&PsLoadedModuleResource);
  KeLeaveCriticalRegionThread((__int64)CurrentThread);
  if( !v3 )
    KeBugCheckEx(0x1Au, 0x1234ui64, (ULONG_PTR)AddressWithinSection, 0i64, 0i64);
  MiLockPagableImageSection(v3, 1ui64);
  return v3;
}

Referenced by:

BgkpLockBgfxCodeSection
HalpPowerInitSystem
HeadlessInit
MiInitSystem
MiLockPagableSections
VfInitSystemNoRebootNeeded