IopMergeRelationLists

NTSTATUS __stdcall IopMergeRelationLists(_RELATION_LIST *TargetList, _RELATION_LIST *SourceList, UINT8 MergeTags){
  _DEVICE_OBJECT_LIST *DeviceObjectList; 
  NTSTATUS v4; 
  unsigned int v8; 
  unsigned int Count; 
  __int64 v10; 
  int v11; 
  char v12; 
  INT64 v13; 
  NTSTATUS v14; 
  UINT64 v16; 
  EVENT_FILTER_DESCRIPTOR *v17; 
  void *v18; 
  UINT64 MatchAnyKeyword; 
  DeviceObjectList = SourceList->DeviceObjectList;
  v4 = 0;
  v8 = 0;
  Count = TargetList->DeviceObjectList->Count;
  if( SourceList->DeviceObjectList->Count )
  {
    while( 1 )
    {
      PipDeviceObjectListIndexOf(
        (GUID *)TargetList->DeviceObjectList,
        (UINT64)DeviceObjectList->Devices[v8].DeviceObject,
        Count,
        (UINT64)&MatchAnyKeyword,
        v16,
        v17,
        v18);
      if( v11 < 0 )
      {
        v12 = 0;
        v13 = *(_BYTE *)(v10 + 24i64 * v8 + 32) & 1;
      }
      else
      {
        v12 = 1;
        v13 = MergeTags && (*(_DWORD *)(v10 + 24i64 * v8 + 32) & 1) != 0;
      }
      v14 = IopAddRelationToList(
              (INT64)TargetList,
              *(_QWORD *)(v10 + 24i64 * v8 + 16),
              *(unsigned int *)(v10 + 24i64 * v8 + 24),
              v13);
      if( v12 && v14 == -1073741771 )
        v14 = 0;
      if( v14 < 0 )
        return v14;
      DeviceObjectList = SourceList->DeviceObjectList;
      if( ++v8 >= SourceList->DeviceObjectList->Count )
      {
        Count = TargetList->DeviceObjectList->Count;
        goto LABEL_14;
      }
    }
  }
  else
  {
LABEL_14:
    if( !Count )
      TargetList->Sorted = SourceList->Sorted;
  }
  return v4;
}

Referenced by:

PnpProcessRelation
PnpQueuePendingSurpriseRemoval