IopMergeRelationLists

VOID __fastcall IopMergeRelationLists(_RELATION_LIST *TargetList, _RELATION_LIST *SourceList, UINT8 MergeTags){
  _DEVICE_OBJECT_LIST *DeviceObjectList; 
  unsigned int v6; 
  unsigned int Count; 
  bool v8; 
  __int64 v9; 
  int v10; 
  _DEVICE_OBJECT_LIST_ENTRY *Result; 

  DeviceObjectList = SourceList->DeviceObjectList;
  v6 = 0;
  Count = TargetList->DeviceObjectList->Count;
  if( SourceList->DeviceObjectList->Count )
  {
    while( 1 )
    {
      v8 = PipDeviceObjectListIndexOf(
             TargetList->DeviceObjectList,
             DeviceObjectList->Devices[v6].DeviceObject,
             Count,
             &Result) >= 0;
      IopAddRelationToList((_FILE_OBJECT *)TargetList, *(_SHARE_ACCESS **)(v9 + 24i64 * v6 + 16));
      if( v8 && v10 == -1073741771 )
        v10 = 0;
      if( v10 < 0 )
        break;
      DeviceObjectList = SourceList->DeviceObjectList;
      if( ++v6 >= SourceList->DeviceObjectList->Count )
      {
        Count = TargetList->DeviceObjectList->Count;
        goto LABEL_8;
      }
    }
  }
  else
  {
LABEL_8:
    if( !Count )
      TargetList->Sorted = SourceList->Sorted;
  }
}

Referenced by:

PnpProcessRelation
PnpQueuePendingSurpriseRemoval