IopEnumerateRelations

UINT8 __stdcall IopEnumerateRelations(
        _RELATION_LIST *List,
        _RELATION_LIST_MARKER *Marker,
        _DEVICE_OBJECT **DeviceObject,
        _DEVICE_RELATION_LEVEL *RelationLevel,
        _DEVICE_TAGGED_FOR_REMOVAL *Tagged){
  bool v5; 
  _RELATION_LIST_ENUMERATION_MODE Mode; 
  _DEVICE_OBJECT_LIST *DeviceObjectList; 
  UINT64 Counter; 
  unsigned int Count; 

  v5 = 0;
  *DeviceObject = 0i64;
  if( RelationLevel )
    *RelationLevel = RELATION_LEVEL_REMOVE_EJECT;
  if( Tagged )
    *Tagged = DEVICE_UNTAGGED;
  Mode = Marker->Mode;
  if( Marker->Mode == ENUMERATE_ANY_ORDER || List->Sorted )
  {
    DeviceObjectList = List->DeviceObjectList;
    Counter = Marker->Counter;
    Count = List->DeviceObjectList->Count;
    if( (unsigned int)Counter < Count && Mode >= ENUMERATE_ANY_ORDER )
    {
      if( Mode > ENUMERATE_FORWARD )
      {
        if( Mode != ENUMERATE_BACKWARD )
          return v5;
        Counter = Count + ~(_DWORD)Counter;
      }
      v5 = PipDeviceObjectListElementAt(DeviceObjectList, Counter, DeviceObject, RelationLevel, Tagged) >= 0;
      ++Marker->Counter;
    }
  }
  return v5;
}

Referenced by:

IopCheckIfMergeRequired
PiEventBuildPdoList
PiProcessCanceledRemoveForReset
PiRestartRemovalRelations
PnpBuildUnsafeRemovalDeviceList
PnpCancelRemoveOnHungDevices
PnpCompileDeviceInstancePaths
PnpDeleteLockedDeviceNodes
PnpInvalidateRelationsInList
PnpProcessQueryRemoveAndEject
PnpQueuePendingSurpriseRemoval
PnpTrackQueryRemoveDevices
PnpUnlinkDeviceRemovalRelations