MiPfCompleteCoalescedIo

NTSTATUS __stdcall MiPfCompleteCoalescedIo(VOID *CoalescedSupport, _MMSUPPORT_INSTANCE *Vm){
  NTSTATUS v2; 
  __int16 v5; 
  void *v6; 
  void *v7; 
  _QWORD *v8; 
  _QWORD *v9; 
  __int64 v10; 
  __int64 v11; 
  NTSTATUS v12; 

  v2 = 0;
  KeWaitForSingleObject((UINT64)CoalescedSupport + 32, 9, 0, 0, 0i64);
  v5 = *((_WORD *)CoalescedSupport + 141);
  if( (v5 & 0x200) != 0 )
  {
    MiRetardMdl((_MDL *)((char *)CoalescedSupport + 272));
    *((_QWORD *)CoalescedSupport + 11) = 0i64;
    v5 = *((_WORD *)CoalescedSupport + 141);
    *((_DWORD *)CoalescedSupport + 20) = -1073741670;
  }
  if( (v5 & 1) != 0 )
    MmUnmapLockedPages(*((VOID **)CoalescedSupport + 37), (_MDL *)((char *)CoalescedSupport + 272));
  if( *((int *)CoalescedSupport + 20) < 0 )
  {
    v2 = *((_DWORD *)CoalescedSupport + 20);
  }
  else
  {
    v6 = (void *)*((unsigned int *)CoalescedSupport + 78);
    v7 = (void *)*((_QWORD *)CoalescedSupport + 11);
    if( v7 != v6 )
      KeBugCheckEx(0x7Au, (PVOID)5, v7, v6, CoalescedSupport);
  }
  v8 = (char *)CoalescedSupport + 16;
  while( 1 )
  {
    v9 = (_QWORD *)*v8;
    if( (_QWORD *)*v8 == v8 )
      break;
    if( (_QWORD *)v9[1] != v8 || (v10 = *v9, *(_QWORD **)(*v9 + 8i64) != v9) )
      __fastfail(3u);
    *v8 = v10;
    *(_QWORD *)(v10 + 8) = v8;
    *((_DWORD *)v9 + 20) = *((_DWORD *)CoalescedSupport + 20);
    if( *((int *)CoalescedSupport + 20) < 0 )
      v11 = 0i64;
    else
      v11 = *((unsigned int *)v9 + 46);
    v9[11] = v11;
    KeSetEvent((PRKEVENT)(v9 + 4), 0, 0);
    v12 = MiPfCompleteInPageSupport((ULONG_PTR)v9, Vm);
    if( v12 < 0 && v12 != -1073740748 )
      v2 = v12;
  }
  ExFreePoolWithTag(CoalescedSupport, 0);
  return v2;
}

Referenced by:

MiPfCompletePrefetchIos