PiDmaGuardQueueRemoveEntry

VOID __fastcall PiDmaGuardQueueRemoveEntry(INT64 a1){
  _ETHREAD *CurrentThread; 
  _QWORD *v3; 
  _QWORD *v4; 
  _QWORD *v5; 
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --*((_WORD *)CurrentThread + 242);
  ExAcquireResourceExclusiveLite(&PipDgqListLock, 1u);
  v3 = *(PBOOLEAN *)((char *)&KdDebuggerEnabled + 7);
  if( *(PBOOLEAN *)((char *)&KdDebuggerEnabled + 7) != (PBOOLEAN)((char *)&KdDebuggerEnabled + 7) )
  {
    while( 1 )
    {
      v4 = (_QWORD *)*v3;
      if( v3[2] == a1 )
        break;
      v3 = (_QWORD *)*v3;
      if( v4 == (PBOOLEAN *)((char *)&KdDebuggerEnabled + 7) )
        goto LABEL_4;
    }
    if( (_QWORD *)v4[1] != v3 || (v5 = (_QWORD *)v3[1], (_QWORD *)*v5 != v3) )
      __fastfail(3u);
    *v5 = v4;
    v4[1] = v5;
    PipDgqFreeEntry(v3);
  }
LABEL_4:
  ExReleaseResourceLite(&PipDgqListLock);
  KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
}

Referenced by:

PiDmaGuardProcessPostRemove