IoRetrievePriorityInfo

NTSTATUS __fastcall IoRetrievePriorityInfo(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
  int v4; 
  int v5; 
  __int64 v8; 
  unsigned int IoPriorityHint; 
  int v10; 
  unsigned int v11; 
  int v13; 
  unsigned __int8 CurrentIrql; 
  struct _KPRCB *CurrentPrcb; 
  __int64 v16; 
  __int64 i; 

  v4 = 0;
  v5 = 2;
  *(_DWORD *)(a4 + 12) = 2;
  if( a1 && (*(_DWORD *)(a1 + 16) & 0xE0000) != 0 )
  {
    IoPriorityHint = IoGetIoPriorityHint(a1);
    goto LABEL_9;
  }
  if( !a2 )
  {
LABEL_17:
    if( !a3 )
      goto LABEL_31;
    IoPriorityHint = PsGetIoPriorityThread((_ETHREAD *)a3);
    goto LABEL_9;
  }
  v8 = *(_QWORD *)(a2 + 208);
  if( v8 )
  {
    v13 = *(_DWORD *)(v8 + 80);
    if( v13 )
    {
      IoPriorityHint = v13 - 1;
      goto LABEL_9;
    }
    goto LABEL_17;
  }
  if( !a3 )
  {
LABEL_31:
    *(_QWORD *)(a4 + 4) = -1i64;
    return 0;
  }
  IoPriorityHint = (*(_DWORD *)(a3 + 1296) >> 9) & 7;
  if( (*(_DWORD *)(*(_QWORD *)(a3 + 544) + 1124i64) & 0x100000) != 0 )
    IoPriorityHint = 0;
  if( IoPriorityHint < 2 && (struct _KTHREAD *)a3 == KeGetCurrentThread() && *(_DWORD *)(a3 + 1360) )
    IoPriorityHint = 2;
LABEL_9:
  *(_DWORD *)(a4 + 12) = IoPriorityHint;
  if( !a3 )
    goto LABEL_31;
  if( *(char *)(a3 + 195) >= 16 || !*(_QWORD *)(a3 + 104) )
    goto LABEL_12;
  CurrentIrql = KeGetCurrentIrql();
  __writecr8(2ui64);
  CurrentPrcb = KeGetCurrentPrcb();
  v16 = *(_QWORD *)(a3 + 104);
  if( v16 )
  {
    for( i = CurrentPrcb->ScbOffset + v16; i; i = *(_QWORD *)(i + 408) )
    {
      v4 = (*(unsigned __int8 *)(i + 112) >> 3) & 1;
      if( v4 )
        break;
    }
  }
  if( CurrentIrql < 2u )
    __writecr8(CurrentIrql);
  if( v4 )
    v10 = 1;
  else
LABEL_12:
    v10 = *(char *)(a3 + 563);
  *(_DWORD *)(a4 + 4) = v10;
  v11 = (*(_DWORD *)(a3 + 1296) >> 12) & 7;
  if( (*(_DWORD *)(*(_QWORD *)(a3 + 544) + 1124i64) & 0x100000) != 0 )
  {
    if( v11 < 2 )
      v5 = (*(_DWORD *)(a3 + 1296) >> 12) & 7;
    v11 = v5;
  }
  *(_DWORD *)(a4 + 8) = v11;
  return 0;
}

Referenced by:

No references.