IopRemoveDeviceRelationsFromList

NTSTATUS __stdcall IopRemoveDeviceRelationsFromList(_RELATION_LIST *List){
  _DEVICE_OBJECT_LIST *DeviceObjectList; 
  unsigned int Count; 
  _DEVICE_RELATION_LEVEL RelationLevel; 
  _DEVICE_OBJECT *DeviceObject; 

  DeviceObjectList = List->DeviceObjectList;
  RelationLevel = RELATION_LEVEL_REMOVE_EJECT;
  Count = DeviceObjectList->Count;
  while( (--Count & 0x80000000) == 0 )
  {
    PipDeviceObjectListElementAt(List->DeviceObjectList, Count, &DeviceObject, &RelationLevel, 0i64);
    if( RelationLevel == RELATION_LEVEL_REMOVE_EJECT )
      PipDeviceObjectListRemove(List->DeviceObjectList, Count);
  }
  return 0;
}

Referenced by:

PnpProcessQueryRemoveAndEject