ViPendingCompleteAfterWait

VOID __stdcall ViPendingCompleteAfterWait(PVOID Context){
  UINT64 v1; 
  _QWORD *v3; 
  __int64 v4; 
  __int64 v5; 
  char v6; 
  __int64 v7; 
  struct _DMA_ADAPTER *v8; 
  bool v9; 
  UINT8 *v10; 
  UINT64 v11; 
  unsigned int(__fastcall *v12)(_QWORD, __int64, _QWORD); 
  UINT8 OldIrql; 
  if( *((_DWORD *)Context + 42) == 1 )
    KeWaitForSingleObject((char *)Context + 104, Executive, 0, 0, 0i64);
  v3 = *(_QWORD **)Context;
  KeAcquireSpinLockRaiseToDpc((UINT64 *)(*(_QWORD *)Context + 8i64), v1);
  v4 = *v3;
  v5 = v3[27];
  *((_BYTE *)v3 + 16) = v6;
  v7 = *(_QWORD *)(v4 + 184);
  *((_DWORD *)v3 + 14) &= ~0x10u;
  if( !v5 || (v8 = *(struct _DMA_ADAPTER **)(v5 + 40)) == 0i64 )
    v8 = 0i64;
  v9 = (*((_DWORD *)v3 + 6))-- == 1;
  OldIrql = 0;
  if( v9 )
  {
    ViIrpDatabaseAcquireLockExclusive(&OldIrql);
    v10 = (UINT8 *)*v3;
    ((void(__fastcall *)(_QWORD *, _QWORD, __int64))v3[6])(v3, *v3, 1i64);
    *v3 = 0i64;
    VfUtilAddressRangeRemoveCheckEmpty(
      (_VF_ADDRESS_RANGE *)(ViIrpDatabaseAddressRanges + 16i64 * (unsigned __int8)(-125 * ((unsigned __int64)v10 >> 12))),
      v10,
      v11);
    ViIrpDatabaseReleaseLockExclusive(OldIrql);
  }
  _InterlockedDecrement((volatile signed __int32 *)v3 + 5);
  VfIrpDatabaseEntryReleaseLock(v3);
  v12 = *(unsigned int(__fastcall **)(_QWORD, __int64, _QWORD))(v7 - 16);
  if( !v12 || v12(*((_QWORD *)Context + 1), v4, *(_QWORD *)(v7 - 8)) != -1073741802 )
    IofCompleteRequest((_IRP *)v4, *((_BYTE *)Context + 172));
  if( v8 )
    HalPutDmaAdapter(v8);
  ExFreePoolWithTag(Context, 0);
}

Referenced by:

ViPendingCompleteAtDPC
ViPendingWorkerThread