IopStartNextPacketByKeyEx

VOID __fastcall IopStartNextPacketByKeyEx(DEVICE_OBJECT *DeviceObject, UINT64 Key, UINT8 *Flags){
  unsigned int v4; 
  __int64 v5; 
  signed __int32 v6; 
  __int64 v7; 
  int v8; 
  UINT64 v9; 
  v4 = Key;
  v5 = *((_QWORD *)DeviceObject + 39);
  do
  {
    v6 = _InterlockedExchangeAdd((volatile signed __int32 *)(v5 + 56), 1u);
    v7 = *((_QWORD *)DeviceObject + 39);
    v8 = *(_DWORD *)(v7 + 64);
    if( v6 + 1 <= 1 )
    {
      *(_DWORD *)(v7 + 64) = v8 & 0xFFFFFF1F;
      v9 = (unsigned __int8)Flags & 0x80;
      *(_DWORD *)(*((_QWORD *)DeviceObject + 39) + 60i64) = 0;
      if( ((unsigned __int8)Flags & 0x40) != 0 )
      {
        IopStartNextPacketByKey(DeviceObject, v9, v4);
      }
      else if( ((unsigned __int8)Flags & 0x20) != 0 )
      {
        IopStartNextPacket(DeviceObject, v9);
      }
    }
    else
    {
      *(_DWORD *)(v7 + 64) = (unsigned int)Flags | v8;
      *(_DWORD *)(*((_QWORD *)DeviceObject + 39) + 60i64) = v4;
    }
    if( _InterlockedExchangeAdd((volatile signed __int32 *)(*((_QWORD *)DeviceObject + 39) + 56i64), 0xFFFFFFFF) != 1 )
      break;
    v5 = *((_QWORD *)DeviceObject + 39);
    v4 = *(_DWORD *)(v5 + 60);
    LODWORD(Flags) = *(_DWORD *)(v5 + 64) & 0xE0;
  }
  while( (*(_BYTE *)(v5 + 64) & 0x60) != 0 );
}

Referenced by:

IoStartNextPacket
IoStartNextPacketByKey