PnpConcatPWSTR

VOID PnpConcatPWSTR(UINT64 MaxLength, UINT64 Tag, WCHAR **OutString, UINT64 InputStringCount, ...){
  ULONG v5; 
  UINT64 v7; 
  UINT64 v8; 
  STRSAFE_PCNZWCH *v9; 
  __int64 v10; 
  WCHAR *PoolWithTag; 
  UINT64 v12; 
  UINT64 v13; 
  PWCHAR *v14; 
  ULONGLONG pullResult; 
  __int64 pcchLength[2]; 
  UINT64 v17; 
  v17 = InputStringCount;
  pcchLength[0] = 0i64;
  v5 = Tag;
  pullResult = 0i64;
  *OutString = 0i64;
  v7 = 1i64;
  v8 = 0i64;
  if( InputStringCount )
  {
    v9 = (STRSAFE_PCNZWCH *)&v17;
    do
    {
      if( *++v9 )
      {
        if( RtlStringCchLengthW(*v9, MaxLength, (SIZE_T *)pcchLength) < 0 )
          goto LABEL_17;
        v7 = pcchLength[0] + v10;
        InputStringCount = v17;
      }
      ++v8;
    }
    while( v8 < InputStringCount );
  }
  if( v7 <= MaxLength
    && RtlULongLongMult(v7, 2ui64, &pullResult) >= 0
    && (PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, pullResult, v5), (*OutString = PoolWithTag) != 0i64) )
  {
    *PoolWithTag = 0;
    v12 = v17;
    v13 = 0i64;
    if( v17 )
    {
      v14 = (PWCHAR *)&v17;
      do
      {
        if( *++v14 )
        {
          if( RtlStringCbCatW(*OutString, pullResult, *v14) < 0 )
            goto LABEL_17;
          v12 = v17;
        }
        ++v13;
      }
      while( v13 < v12 );
    }
  }
  else
  {
LABEL_17:
    if( *OutString )
    {
      ExFreePoolWithTag(*OutString, v5);
      *OutString = 0i64;
    }
  }
}

Referenced by:

PiDqOpenUserObjectRegKey
PiSwGetChildPdo
PiSwInstanceInfoInit
PiSwStopDestroy
PipCheckForDenyExecute