PfSnPrefetchFileMetadata

NTSTATUS __stdcall PfSnPrefetchFileMetadata(
        PFSN_PREFETCH_HEADER *PrefetchHeader,
        VOID *VolumeHandle,
        _FILE_PREFETCH_EX *FilePrefetch,
        UINT64 StartIndex,
        UINT64 RecordsToPrefetch,
        VOID *EventHandle){
  NTSTATUS v6; 
  int v7; 
  unsigned int Count; 
  unsigned int v11; 
  UINT64 v13; 
  unsigned int v14; 
  VOID *v15; 
  int v16; 
  UINT64 IoControlCode; 
  UINT64 v18[2]; 

  v6 = 0;
  v7 = StartIndex;
  *(_OWORD *)v18 = 0i64;
  if( (_DWORD)RecordsToPrefetch )
  {
    Count = FilePrefetch->Count;
    if( Count <= (unsigned int)StartIndex || Count - (unsigned int)StartIndex < (unsigned int)RecordsToPrefetch )
    {
      return -1073741701;
    }
    else
    {
      v11 = PrefetchHeader[24] & 7 | (8 * (PrefetchHeader[25] & 7 | 8));
      if( (_DWORD)StartIndex || (unsigned int)RecordsToPrefetch > 0x300 )
      {
        v13 = *((_QWORD *)PrefetchHeader + 10);
        v14 = 0;
        *(_DWORD *)(v13 + 4) = 0;
        *(_DWORD *)v13 = 3;
        *(_QWORD *)(v13 + 8) = v11;
        v15 = (VOID *)(v13 + 16);
        do
        {
          v16 = 768;
          if( (unsigned int)RecordsToPrefetch - v14 < 0x300 )
            v16 = RecordsToPrefetch - v14;
          *(_DWORD *)(v13 + 4) = v16;
          memmove(v15, &FilePrefetch->Prefetch[v14 + v7], 8 * v16);
          NtResetEvent(EventHandle, 0i64);
          LODWORD(IoControlCode) = 590112;
          v6 = IopXxxControlFile(VolumeHandle, EventHandle, 0i64, 0i64, v18, IoControlCode, v13);
          if( v6 == 259 )
          {
            NtWaitForSingleObject((UINT64)EventHandle, 0, 0i64);
            v6 = v18[0];
          }
          if( (v6 & 0xC0000000) == -1073741824 )
            break;
          v14 += v16;
          v15 = (VOID *)(v13 + 16);
        }
        while( v14 < (unsigned int)RecordsToPrefetch );
      }
      else
      {
        FilePrefetch->Context = (PVOID)v11;
        FilePrefetch->Count = RecordsToPrefetch;
        NtResetEvent(EventHandle, 0i64);
        LODWORD(IoControlCode) = 590112;
        v6 = IopXxxControlFile(VolumeHandle, EventHandle, 0i64, 0i64, v18, IoControlCode, (UINT64)FilePrefetch);
        if( v6 == 259 )
        {
          NtWaitForSingleObject((UINT64)EventHandle, 0, 0i64);
          v6 = v18[0];
        }
        FilePrefetch->Count = Count;
      }
    }
  }
  return v6;
}

Referenced by:

PfSnGetSectionObject
PfSnPrefetchMetadata