PnpAllocatePWSTR

__int64 __fastcall PnpAllocatePWSTR(WCHAR *pszSrc, UINT64 a2, UINT32 a3, PVOID *a4){
  NTSTATUS v4; 
  VOID **PoolWithTag; 
  UINT64 pullResult; 
  UINT64 pcchLength; 

  v4 = 0;
  pcchLength = 0i64;
  pullResult = 0i64;
  *a4 = 0i64;
  if( !pszSrc )
    return(unsigned int)v4;
  v4 = RtlStringCchLengthW(pszSrc, a2, &pcchLength);
  if( v4 >= 0 )
  {
    if( !pcchLength )
      goto LABEL_8;
    v4 = RtlULongLongMult(pcchLength + 1, 2ui64, &pullResult);
    if( v4 >= 0 )
    {
      PoolWithTag = ExAllocatePoolWithTag(1ui64, pullResult, a3);
      *a4 = PoolWithTag;
      if( PoolWithTag )
      {
        v4 = RtlStringCbCopyW((WCHAR *)PoolWithTag, pullResult, pszSrc);
LABEL_8:
        if( v4 >= 0 )
          return(unsigned int)v4;
        goto LABEL_11;
      }
      v4 = -1073741670;
    }
  }
LABEL_11:
  if( *a4 )
  {
    ExFreePoolWithTag(*a4, a3);
    *a4 = 0i64;
  }
  return(unsigned int)v4;
}

Referenced by:

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