KeRemoveByKeyDeviceQueueIfBusy

NTSTATUS __fastcall KeRemoveByKeyDeviceQueueIfBusy(INT64 a1, UINT64 a2){
  UINT8 v2; 
  unsigned int v3; 
  __int64 *v5; 
  INT64 v6; 
  __int64 *v7; 
  __int64 *v9; 
  __int64 **v10; 
  __int64 v11; 
  __int64 v12; 
  _KLOCK_QUEUE_HANDLE LockHandle; 

  v3 = a2;
  memset(&LockHandle, 0, sizeof(LockHandle));
  LODWORD(v5) = 0;
  KeAcquireInStackQueuedSpinLockForDpc((UINT64 *)(a1 + 24), &LockHandle, v2);
  if( !*(_BYTE *)(a1 + 32) )
    goto LABEL_4;
  v6 = a1 + 8;
  v7 = *(__int64 **)(a1 + 8);
  if( v7 == (__int64 *)(a1 + 8) )
  {
    *(_BYTE *)(a1 + 32) = 0;
    goto LABEL_4;
  }
  do
  {
    v5 = v7;
    if( v3 <= *((_DWORD *)v7 + 4) )
      break;
    v7 = (__int64 *)*v7;
  }
  while( v7 != (__int64 *)v6 );
  if( v7 != (__int64 *)v6 )
  {
    v9 = (__int64 *)*v5;
    if( *(__int64 **)(*v5 + 8) == v5 )
    {
      v10 = (__int64 **)v5[1];
      if( *v10 == v5 )
      {
        *v10 = v9;
        v9[1] = (__int64)v10;
        goto LABEL_14;
      }
    }
LABEL_16:
    __fastfail(3u);
  }
  v5 = *(__int64 **)v6;
  if( *(_QWORD *)(*(_QWORD *)v6 + 8i64) != v6 )
    goto LABEL_16;
  v11 = *v5;
  if( *(__int64 **)(*v5 + 8) != v5 )
    goto LABEL_16;
  *(_QWORD *)v6 = v11;
  *(_QWORD *)(v11 + 8) = v6;
LABEL_14:
  *((_BYTE *)v5 + 20) = 0;
  v12 = *(_QWORD *)(a1 + 32);
  if( v5 == (__int64 *)(v12 >> 8) )
    *(_QWORD *)(a1 + 32) = (unsigned __int8)v12;
LABEL_4:
  KeReleaseInStackQueuedSpinLockForDpc(&LockHandle);
  return(int)v5;
}

Referenced by:

No references.