MiPfIssueCoalescedSupport

int __fastcall MiPfIssueCoalescedSupport(_QWORD *a1, unsigned int a2){
  LARGE_INTEGER v2; 
  __int64 v3; 
  __int64 v5; 
  __int64 v6; 
  char *v7; 
  int v8; 
  __int64 *v9; 
  __int64 v10; 
  __int64 **v11; 
  _FILE_OBJECT *v12; 
  ULONG v13; 
  unsigned __int64 v14; 
  UINT64 v15; 
  __int64 v16; 
  NTSTATUS v17; 
  UINT64 Flags; 
  LARGE_INTEGER StartingOffset; 
  PFILE_OBJECT FileObject; 
  v2.QuadPart = 0i64;
  v3 = a2;
  StartingOffset.QuadPart = 0i64;
  LODWORD(v5) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
  v6 = v5;
  if( v5 )
  {
    MiInitializeInPageSupport(v5, 0);
    *(_DWORD *)(v6 + 192) |= 0x800000u;
    *(_QWORD *)(v6 + 272) = 0i64;
    v7 = (char *)(v6 + 320);
    *(_WORD *)(v6 + 282) = 0;
    v8 = 0;
    *(_WORD *)(v6 + 280) = 8 * (((unsigned __int64)(v3 + 4095) >> 12) + 6);
    *(_QWORD *)(v6 + 304) = 0i64;
    *(_DWORD *)(v6 + 316) = 0;
    *(_DWORD *)(v6 + 312) = v3;
    *(_WORD *)(v6 + 282) |= 0x4042u;
    FileObject = (PFILE_OBJECT)MmBadPointer;
    while( 1 )
    {
      v9 = (__int64 *)*a1;
      if( (_QWORD *)*a1 == a1 )
        break;
      if( (_QWORD *)v9[1] != a1
        || (v10 = *v9, *(__int64 **)(*v9 + 8) != v9)
        || (*a1 = v10, *(_QWORD *)(v10 + 8) = a1, v11 = *(__int64 ***)(v6 + 24), *v11 != (__int64 *)(v6 + 16)) )
      {
        __fastfail(3u);
      }
      v9[1] = (__int64)v11;
      *v9 = v6 + 16;
      *v11 = v9;
      *(_QWORD *)(v6 + 24) = v9;
      if( (*((_WORD *)v9 + 141) & 0x4000) == 0 )
        *(_WORD *)(v6 + 282) &= ~0x4000u;
      if( v8 )
      {
        if( v2.QuadPart != v9[12] )
        {
          *(_WORD *)(v6 + 282) &= ~0x4000u;
          v13 = *((_DWORD *)v9 + 24) - v2.LowPart;
          v14 = (unsigned __int64)(8 * (v13 >> 12)) >> 3;
          memset64(v7, qword_140C4EAB8, v14);
          v7 += 8 * v14;
          v2.QuadPart += v13;
          v8 += v13;
        }
      }
      else
      {
        v2.QuadPart = v9[12];
        v12 = (_FILE_OBJECT *)v9[25];
        StartingOffset = v2;
        FileObject = v12;
      }
      v15 = (unsigned int)(8 * (*((_DWORD *)v9 + 46) >> 12));
      memmove((UINT8 *)v7, (UINT8 *)v9 + 320, v15);
      v16 = *((unsigned int *)v9 + 46);
      v2.QuadPart += v16;
      v8 += v16;
      v7 += 8 * (v15 >> 3);
    }
    LODWORD(Flags) = 6;
    v17 = IoPageReadEx(
            FileObject,
            (MDL *)(v6 + 272),
            &StartingOffset,
            (KEVENT *)(v6 + 32),
            (IO_STATUS_BLOCK *)(v6 + 80),
            Flags,
            0i64);
    if( v17 < 0 )
    {
      *(_QWORD *)(v6 + 88) = 0i64;
      *(_DWORD *)(v6 + 80) = v17;
      KeSetEvent((PRKEVENT)(v6 + 32), 0);
    }
    LODWORD(v5) = v6;
  }
  return v5;
}

Referenced by:

MiPfIssueCoalesceCandidates