PiDmaGuardQueueFlush

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

Referenced by:

PipDmgFlushQueueAndRestartDevices