MiGetCcAccessLog

_MM_PAGE_ACCESS_INFO_HEADER *__fastcall MiGetCcAccessLog(_FILE_OBJECT *FileObject, UINT64 EntryCount){
  __int64 v4; 
  UINT64 v5; 
  __int64 v6; 
  unsigned __int64 v7; 
  void *FsContext; 
  void **v9; 
  _MM_PAGE_ACCESS_INFO_HEADER *result; 
  INT64 v11; 
  CHAR *AnyMultiplexedVm; 
  INT64 v13; 
  if( !qword_140C4E540 )
    goto LABEL_12;
  v4 = _InterlockedExchange64(&qword_140C4E540, 0i64);
  if( !v4 )
    goto LABEL_12;
  v5 = *(_QWORD *)(v4 + 40);
  if( *(_QWORD *)(v4 + 32) + 8 * EntryCount > v5
    || (__int64)((*(_QWORD *)(v4 + 48) - v5) & 0xFFFFFFFFFFFFFFF8ui64) >= 4096 )
  {
    MiQueuePageAccessLog((PSLIST_ENTRY)v4);
    v4 = 0i64;
  }
  if( !v4 )
  {
LABEL_12:
    v11 = (8 * EntryCount + 4183) & 0xFFFFFFFFFFFFF000ui64;
    LODWORD(result) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
    if( !result )
      return result;
    AnyMultiplexedVm = MiGetAnyMultiplexedVm(0i64);
    MiInitializePageAccessLogging((INT64)AnyMultiplexedVm, v13, v11);
    *(_DWORD *)(v4 + 8) = 1;
  }
  v6 = *(_QWORD *)(v4 + 40);
  v7 = *(_QWORD *)(v4 + 48);
  FsContext = FileObject->FsContext;
  v9 = (void **)(v6 + 8);
  if( v6 + 8 >= v7 )
    goto LABEL_11;
  do
  {
    if( *v9 == FsContext )
      break;
    ++v9;
  }
  while( (unsigned __int64)v9 < v7 );
  if( (unsigned __int64)v9 >= v7 )
  {
LABEL_11:
    v9 = *(void ***)(v4 + 40);
    *(_QWORD *)(v4 + 40) = v6 - 8;
    *v9 = FsContext;
  }
  *(_QWORD *)(v4 + 24) = *(_QWORD *)(v4 + 32);
  result = (_MM_PAGE_ACCESS_INFO_HEADER *)v4;
  *(_DWORD *)(v4 + 12) = (__int64)(v7 - (_QWORD)v9) >> 3;
  return result;
}

Referenced by:

MmPrefetchForCacheManager