PiGetDmaAdapterFromBusInterface

NTSTATUS __stdcall PiGetDmaAdapterFromBusInterface(ULONG MaxDataSize){
  __int64 v1; 
  __int64 v2; 
  __int64 v3; 
  __int64 v4; 
  _DEVICE_OBJECT *v5; 
  NTSTATUS v6; 
  _DWORD *DeviceNode; 
  __int16 *p_Type; 
  _UNICODE_STRING *p_DriverName; 
  VOID **v11; 
  VOID **v12; 
  _DEVOBJ_EXTENSION *DeviceObjectExtension; 
  _WORD *v14; 
  __int64 v15; 
  _WORD *v16; 
  __int64 v17; 
  __int64 v18[8]; 

  v3 = v1;
  v4 = v2;
  v5 = *(_DEVICE_OBJECT **)&MaxDataSize;
  memset(v18, 0i64, sizeof(v18));
  v6 = 0;
  if( !v5 )
    goto LABEL_20;
  DeviceNode = v5->DeviceObjectExtension->DeviceNode;
  if( !DeviceNode || (DeviceNode[99] & 0x20000) != 0 )
  {
    IoAddTriageDumpDataBlock(v5, (_BYTE *)v5->Size);
    p_Type = &v5->DriverObject->Type;
    if( p_Type )
    {
      IoAddTriageDumpDataBlock(p_Type, (_BYTE *)(unsigned int)p_Type[1]);
      p_DriverName = &v5->DriverObject->DriverName;
      if( p_DriverName->Length )
      {
        IoAddTriageDumpDataBlock(p_DriverName, (_BYTE *)2);
        IoAddTriageDumpDataBlock(v5->DriverObject->DriverName.Buffer, (_BYTE *)v5->DriverObject->DriverName.Length);
      }
    }
    v11 = (VOID **)v5->DeviceObjectExtension->DeviceNode;
    if( v11 )
    {
      v12 = v11 + 5;
      IoAddTriageDumpDataBlock(v11, (_BYTE *)0x310);
      if( *(_WORD *)v12 )
      {
        IoAddTriageDumpDataBlock(v12, (_BYTE *)2);
        IoAddTriageDumpDataBlock(v12[1], (_BYTE *)*(unsigned __int16 *)v12);
      }
      DeviceObjectExtension = v5->DeviceObjectExtension;
      v14 = (char *)DeviceObjectExtension->DeviceNode + 56;
      if( *v14 )
      {
        IoAddTriageDumpDataBlock(v14, (_BYTE *)2);
        IoAddTriageDumpDataBlock(
          *((VOID **)v5->DeviceObjectExtension->DeviceNode + 8),
          (_BYTE *)*((unsigned __int16 *)v5->DeviceObjectExtension->DeviceNode + 28));
        DeviceObjectExtension = v5->DeviceObjectExtension;
      }
      v15 = *((_QWORD *)DeviceObjectExtension->DeviceNode + 2);
      if( v15 )
      {
        v16 = (_WORD *)(v15 + 56);
        if( *v16 )
        {
          IoAddTriageDumpDataBlock(v16, (_BYTE *)2);
          v17 = *((_QWORD *)v5->DeviceObjectExtension->DeviceNode + 2);
          IoAddTriageDumpDataBlock(*(VOID **)(v17 + 64), (_BYTE *)*(unsigned __int16 *)(v17 + 56));
        }
      }
    }
LABEL_20:
    KeBugCheckEx(0xCAu, (PVOID)2, v5, 0i64, 0i64);
  }
  if( (int)PnpQueryInterface(v5, (_IO_SECURITY_CONTEXT *)&GUID_BUS_INTERFACE_STANDARD, 1, 0x40u, 0i64, v18) >= 0 )
  {
    if( v18[5] )
      v6 = ((__int64(__fastcall *)(__int64, __int64, __int64))v18[5])(v18[1], v3, v4);
    ((void(__fastcall *)(__int64))v18[3])(v18[1]);
  }
  return v6;
}

Referenced by:

IoGetDmaAdapter