PnpDelayedRemoveWorker

VOID __stdcall PnpDelayedRemoveWorker(PVOID Context){
  PVOID *v2; 
  PVOID **v3; 
  PVOID **v4; 
  _QWORD *v5; 
  _QWORD *v6; 
  __int64 v7; 
  __int64 v8; 
  __int64 v9; 
  INT64 v10; 
  PVOID P; 
  PVOID *p_P; 
  p_P = &P;
  P = &P;
  PpDevNodeLockTree(1);
  PnpDelayedRemoveWorkerThread = (__int64)KeGetCurrentThread();
  ExAcquireResourceExclusiveLite(&IopSurpriseRemoveListLock, 1u);
  v2 = (PVOID *)IopPendingSurpriseRemovals;
  if( IopPendingSurpriseRemovals != &IopPendingSurpriseRemovals )
  {
    do
    {
      v3 = (PVOID **)*v2;
      if( *((_BYTE *)v2 + 104) )
      {
        if( *(_DWORD *)(*(_QWORD *)v2[8] + 8i64) == **(_DWORD **)v2[8] )
        {
          if( v3[1] != v2
            || (v4 = (PVOID **)v2[1], *v4 != v2)
            || (*v4 = (PVOID *)v3, v3[1] = (PVOID *)v4, v5 = p_P, *p_P != &P) )
          {
LABEL_19:
            __fastfail(3u);
          }
          v2[1] = p_P;
          *v2 = &P;
          *v5 = v2;
          p_P = v2;
        }
        else
        {
          *((_BYTE *)v2 + 104) = 0;
        }
      }
      v2 = (PVOID *)v3;
    }
    while( v3 != (PVOID **)&IopPendingSurpriseRemovals );
  }
  PnpDelayedRemovePending = 0;
  ExReleaseResourceLite(&IopSurpriseRemoveListLock);
  while( 1 )
  {
    v6 = P;
    if( P == &P )
      break;
    if( *((PVOID **)P + 1) != &P )
      goto LABEL_19;
    v7 = *(_QWORD *)P;
    if( *(PVOID *)(*(_QWORD *)P + 8i64) != P )
      goto LABEL_19;
    P = *(PVOID *)P;
    *(_QWORD *)(v7 + 8) = &P;
    if( Context )
    {
      *((_QWORD *)Context + 2) = v6;
      *((_QWORD *)Context + 1) = v6[7];
      v8 = v6[7];
      if( v8 )
        v9 = *(_QWORD *)(*(_QWORD *)(v8 + 312) + 40i64);
      else
        v9 = 0i64;
      *(_QWORD *)Context = v9;
      *((_QWORD *)Context + 3) = PnpEnableWatchdog(3i64, (INT64)Context);
    }
    PipRemoveDevicesInRelationList(v6);
    if( Context )
    {
      v10 = *((_QWORD *)Context + 3);
      if( v10 )
      {
        PnpDisableWatchdog(v10);
        *((_QWORD *)Context + 3) = 0i64;
      }
    }
  }
  PnpDelayedRemoveWorkerThread = 0i64;
  if( Context )
    ExFreePoolWithTag(Context, 0x54706E50u);
  PpDevNodeUnlockTree(1);
}

Referenced by:

PnpChainDereferenceComplete