PiRestartRemovalRelations

BOOL __stdcall PiRestartRemovalRelations(INT64 a1, UINT64 **a2, _DEVICE_OBJECT *a3){
  BOOL result; 
  UINT64 v7; 
  _DEVICE_OBJECT *v8; 
  _DEVICE_NODE *DeviceNode; 
  unsigned int DeviceState; 
  _RELATION_LIST_MARKER Marker; 
  _DEVICE_OBJECT *DeviceObject; 
  _DEVICE_RELATION_LEVEL RelationLevel; 

  DeviceObject = 0i64;
  RelationLevel = RELATION_LEVEL_REMOVE_EJECT;
  Marker.Counter = 0;
  Marker.Mode = ENUMERATE_FORWARD;
  while( 1 )
  {
    result = IopEnumerateRelations((_RELATION_LIST *)a2, &Marker, &DeviceObject, &RelationLevel, 0i64);
    if( !result )
      return result;
    v8 = DeviceObject;
    if( DeviceObject )
      DeviceNode = (_DEVICE_NODE *)DeviceObject->DeviceObjectExtension->DeviceNode;
    else
      DeviceNode = 0i64;
    if( *(_DWORD *)(a1 + 16) != 54 || RelationLevel == RELATION_LEVEL_DEPENDENT )
    {
      if( DeviceObject == a3 )
      {
        if( (*(_DWORD *)(a1 + 144) & 2) == 0
          && DeviceNode->State == DeviceNodeRemoved
          && (DeviceNode->Flags & 0x2000) != 0
          && DeviceNode->Problem == 21 )
        {
          PipClearDevNodeProblem(DeviceNode);
          goto LABEL_20;
        }
      }
      else if( (DeviceNode->Flags & 0x6000) == 0 && DeviceNode->State == DeviceNodeRemoved )
      {
LABEL_20:
        PnpRestartDeviceNode(DeviceNode);
      }
    }
    else if( DeviceNode->State != DeviceNodeDeleted )
    {
      DeviceObject->Flags |= 0x4000000u;
      IopQueryDeviceState(v8, &DeviceState, v7);
    }
  }
}

Referenced by:

PnpProcessQueryRemoveAndEject