PnpAllocatePWSTR

INT64 __stdcall PnpAllocatePWSTR(WCHAR *InString, UINT64 MaxLength, UINT64 Tag, WCHAR **OutString){
  NTSTATUS v4; 
  ULONG v6; 
  WCHAR *PoolWithTag; 
  ULONGLONG pullResult; 
  size_t pcchLength; 
  v4 = 0;
  pcchLength = 0i64;
  v6 = Tag;
  pullResult = 0i64;
  *OutString = 0i64;
  if( !InString )
    return(unsigned int)v4;
  v4 = RtlStringCchLengthW(InString, MaxLength, &pcchLength);
  if( v4 >= 0 )
  {
    if( !pcchLength )
      goto LABEL_8;
    v4 = RtlULongLongMult(pcchLength + 1, 2ui64, &pullResult);
    if( v4 >= 0 )
    {
      PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, pullResult, v6);
      *OutString = PoolWithTag;
      if( PoolWithTag )
      {
        v4 = RtlStringCbCopyW(PoolWithTag, pullResult, InString);
LABEL_8:
        if( v4 >= 0 )
          return(unsigned int)v4;
        goto LABEL_11;
      }
      v4 = -1073741670;
    }
  }
LABEL_11:
  if( *OutString )
  {
    ExFreePoolWithTag(*OutString, v6);
    *OutString = 0i64;
  }
  return(unsigned int)v4;
}

Referenced by:

PiDmObjectCreate
PiDqActionDataCreate
PiDqPnPGetObjectProperty
PiPnpRtlObjectEventWorker
PiSwBusRelationAdd
PiSwCompleteCreate
PiSwDeviceInterfaceSetState
PiSwDeviceInterfacesUpdateState
PiSwInstanceInfoInit
PiSwInterfaceCreate
PiSwIrpPropertySet
PiSwPdoPnPDispatch
PiSwPnPInfoInit
PiSwQueuedCreateInfoCreate
PnpCopyDevProperty