PnpRequestDeviceRemovalWorker

char __fastcall PnpRequestDeviceRemovalWorker(int a1, __int64 a2, char a3, int a4, char a5){
  char v9; 
  _LIST_ENTRY *DependentList; 
  _QWORD *i; 
  _LIST_ENTRY *v12; 
  _LIST_ENTRY *Flink; 
  _DEVICE_OBJECT *Dependent; 
  UINT64 DependencyTypes; 

  Dependent = 0i64;
  if( a4 != 2 && !a5 )
  {
    LOBYTE(DependentList) = PipIsDevNodeDNStarted(a2);
    goto LABEL_5;
  }
  v9 = 1;
  if( *(_DWORD *)(a2 + 300) == 782 )
    goto LABEL_11;
  if( *(_DWORD *)(a2 + 300) == 783 )
  {
    if( a3 )
    {
      PipRestoreDevNodeState((_DEVICE_NODE *)a2);
      PipSetDevNodeState((_DEVICE_NODE *)a2, DeviceNodeAwaitingQueuedDeletion);
    }
LABEL_11:
    v9 = 0;
  }
  LOBYTE(DependentList) = v9;
LABEL_5:
  if( (_BYTE)DependentList )
  {
    PipSetDevNodeState((_DEVICE_NODE *)a2, (_PNP_DEVNODE_STATE)(783 - (a3 != 0)));
    for( i = *(_QWORD **)(a2 + 8); i; i = (_QWORD *)*i )
      PnpRequestDeviceRemovalWorker(a1, (__int64)i, 1, a4, 1);
    DependentList = PiGetDependentList(*(_DEVICE_OBJECT **)(a2 + 32));
    v12 = DependentList;
    Flink = DependentList->Flink;
    while( Flink != v12 )
    {
      PiEnumerateDependentListEntry(Flink, &Dependent, &DependencyTypes);
      LOBYTE(DependentList) = (_BYTE)Dependent;
      Flink = Flink->Flink;
      if( Dependent )
        LOBYTE(DependentList) = PnpRequestDeviceRemovalWorker(
                                  a1,
                                  (__int64)Dependent->DeviceObjectExtension->DeviceNode,
                                  0,
                                  1,
                                  0);
    }
  }
  return(char)DependentList;
}

Referenced by:

PnpRequestDeviceRemoval
PnpRequestDeviceRemovalWorker