IoGetDmaAdapter

struct _DMA_ADAPTER *__stdcall IoGetDmaAdapter(
        PDEVICE_OBJECT PhysicalDeviceObject,
        struct _DEVICE_DESCRIPTION *DeviceDescription,
        PULONG NumberOfMapRegisters){
  struct _DMA_ADAPTER *DmaAdapterFromBusInterface; 
  __int64 v6; 
  UINT64 v8; 
  NTSTATUS DeviceProperty; 
  int v10; 
  __int16 *v11; 
  _WORD *v12; 
  PVOID *v13; 
  PVOID *v14; 
  __int64 v15; 
  _WORD *v16; 
  __int64 v17; 
  _WORD *v18; 
  __int64 v19; 
  int ResultLength[4]; 
  UINT8 result[20]; 
  int PropertyBuffer[11]; 
  memset((INT64)result, 0i64);
  DmaAdapterFromBusInterface = 0i64;
  ResultLength[0] = 0;
  if( PhysicalDeviceObject )
  {
    v6 = *(_QWORD *)(*((_QWORD *)PhysicalDeviceObject + 39) + 40i64);
    if( !v6 || (*(_DWORD *)(v6 + 396) & 0x20000) != 0 )
    {
      IoAddTriageDumpDataBlock(PhysicalDeviceObject, *((unsigned __int16 *)PhysicalDeviceObject + 1));
      v11 = (__int16 *)*((_QWORD *)PhysicalDeviceObject + 1);
      if( v11 )
      {
        IoAddTriageDumpDataBlock(v11, (unsigned int)v11[1]);
        v12 = (_WORD *)(*((_QWORD *)PhysicalDeviceObject + 1) + 56i64);
        if( *v12 )
        {
          IoAddTriageDumpDataBlock(v12, 2ui64);
          IoAddTriageDumpDataBlock(
            *(PVOID *)(*((_QWORD *)PhysicalDeviceObject + 1) + 64i64),
            *(unsigned __int16 *)(*((_QWORD *)PhysicalDeviceObject + 1) + 56i64));
        }
      }
      v13 = *(PVOID **)(*((_QWORD *)PhysicalDeviceObject + 39) + 40i64);
      if( v13 )
      {
        v14 = v13 + 5;
        IoAddTriageDumpDataBlock(v13, 0x310ui64);
        if( *(_WORD *)v14 )
        {
          IoAddTriageDumpDataBlock(v14, 2ui64);
          IoAddTriageDumpDataBlock(v14[1], *(unsigned __int16 *)v14);
        }
        v15 = *((_QWORD *)PhysicalDeviceObject + 39);
        v16 = (_WORD *)(*(_QWORD *)(v15 + 40) + 56i64);
        if( *v16 )
        {
          IoAddTriageDumpDataBlock(v16, 2ui64);
          IoAddTriageDumpDataBlock(
            *(PVOID *)(*(_QWORD *)(*((_QWORD *)PhysicalDeviceObject + 39) + 40i64) + 64i64),
            *(unsigned __int16 *)(*(_QWORD *)(*((_QWORD *)PhysicalDeviceObject + 39) + 40i64) + 56i64));
          v15 = *((_QWORD *)PhysicalDeviceObject + 39);
        }
        v17 = *(_QWORD *)(*(_QWORD *)(v15 + 40) + 16i64);
        if( v17 )
        {
          v18 = (_WORD *)(v17 + 56);
          if( *v18 )
          {
            IoAddTriageDumpDataBlock(v18, 2ui64);
            v19 = *(_QWORD *)(*(_QWORD *)(*((_QWORD *)PhysicalDeviceObject + 39) + 40i64) + 16i64);
            IoAddTriageDumpDataBlock(*(PVOID *)(v19 + 64), *(unsigned __int16 *)(v19 + 56));
          }
        }
      }
      KeBugCheckEx(0xCAu, 2ui64, (ULONG_PTR)PhysicalDeviceObject, 0i64, 0i64);
    }
    ((void(__fastcall *)(struct _KTHREAD *, PDEVICE_OBJECT))off_140C00908[0])(
      KeGetCurrentThread(),
      PhysicalDeviceObject);
    if( ((DeviceDescription->InterfaceType + 1) & 0xFFFFFFEF) == 0 )
    {
      if( DeviceDescription->Version >= 3 )
      {
        v8 = 0i64;
        if( DeviceDescription->Version == 3 )
          v8 = 64i64;
      }
      else
      {
        v8 = 40i64;
      }
      memmove(result, (UINT8 *)DeviceDescription, v8);
      DeviceProperty = IoGetDeviceProperty(
                         PhysicalDeviceObject,
                         DevicePropertyLegacyBusType,
                         4u,
                         PropertyBuffer,
                         (PULONG)ResultLength);
      v10 = PropertyBuffer[0];
      if( DeviceProperty < 0 )
        v10 = 1;
      PropertyBuffer[0] = v10;
    }
    DmaAdapterFromBusInterface = (struct _DMA_ADAPTER *)PiGetDmaAdapterFromBusInterface();
    ((void(__fastcall *)(struct _KTHREAD *, _QWORD))off_140C00908[0])(KeGetCurrentThread(), 0i64);
  }
  return DmaAdapterFromBusInterface;
}

Referenced by:

VfGetDmaAdapter