MiMarkPrivateImageCfgBits

NTSTATUS __stdcall MiMarkPrivateImageCfgBits(_MI_CFG_BITMAP_INFO *BitMapInfo, _MI_RVA_LIST_TYPE ListType, _MMVAD *Vad){
  _LARGE_INTEGER *ControlArea; 
  _LARGE_INTEGER v6; 
  char *CopyOption; 
  char *EndVa; 
  int v9; 
  _MMPTE *FirstPrototypePte; 
  _MMPTE *v11; 
  __int64 v12; 
  _MI_RVA_LIST_TYPE v13; 
  NTSTATUS result; 
  __int16 v15; 
  char *v16; 
  __int64 v17; 

  ControlArea = (_LARGE_INTEGER *)Vad->Subsection->ControlArea;
  v6 = *ControlArea;
  CopyOption = (char *)(((Vad->Core.EndingVpn | ((unsigned __int64)Vad->Core.EndingVpnHigh << 32)) << 12) + 4096);
  EndVa = (char *)((Vad->Core.StartingVpn | ((unsigned __int64)Vad->Core.StartingVpnHigh << 32)) << 12);
  if( MiVadMapsLargeImage(Vad) )
  {
    result = MiMarkPrivateOpenCfgBits(BitMapInfo, EndVa, CopyOption, 0i64);
    if( result < 0 )
      return result;
    EndVa += 0x10000 * (unsigned __int64)*((unsigned __int8 *)MiLocateVadEvent((__int64)Vad, 16) + 8);
    v15 = _InterlockedCompareExchange64((volatile signed __int64 *)(v6.QuadPart + 24), -1i64, -1i64);
    v9 = 1;
    v16 = &EndVa[4096
               * ((__int64)(*(_QWORD *)(v6.QuadPart + 64)
                          + 8
                          * (((v15 & 0xFFF) != 0i64)
                           + ((unsigned __int64)_InterlockedCompareExchange64(
                                                  (volatile signed __int64 *)(v6.QuadPart + 24),
                                                  -1i64,
                                                  -1i64) >> 12))
                          - (unsigned __int64)Vad->FirstPrototypePte) >> 3)];
    if( CopyOption > v16 )
      LODWORD(CopyOption) = (_DWORD)v16;
  }
  FirstPrototypePte = Vad->FirstPrototypePte;
  v11 = *(_MMPTE **)(v6.QuadPart + 64);
  if( FirstPrototypePte != v11 && !v9 )
  {
    v17 = (FirstPrototypePte - v11) << 12;
    EndVa += v17;
    LODWORD(CopyOption) = v17 + (_DWORD)CopyOption;
  }
  LODWORD(v12) = MiGetControlAreaLoadConfig(ControlArea);
  return MiPopulateCfgBitMap(
           BitMapInfo,
           *(VOID **)(v12 + 16),
           v13,
           0i64,
           EndVa,
           (_MI_CFG_COPY_TO_BITMAP_OPTION)CopyOption);
}

Referenced by:

MiMarkProcessCfgBits