UtilStringCopyWithAlloc function

The UtilStringCopyWithAlloc function allocates and copies a source string.

Syntax


HRESULT UtilStringCopyWithAlloc(
  _Out_  LPWSTR *Buffer,
  _In_   UINT BufferMax,
  _In_   LPCWSTR Source
);

Parameters

Buffer [out]

Type: LPWSTR*

The location where the pointer to the allocated memory is stored. When no longer needed, it must be released with CoTaskMemFree. This buffer is always null-terminated.

BufferMax [in]

Type: UINT

The maximum number of characters to read from Source.

Source [in]

Type: LPCWSTR

The string to be copied.

Return value

Type: HRESULT

Possible return values include, but are not limited to, the following.

Return codeDescription
S_OK

The operation succeeded.

E_INVALIDARG

One or more parameters has not been provided correctly.

 

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Ndattributils.h

See also

CoTaskMemFree
UtilAssembleStringsWithAlloc
UtilLoadStringWithAlloc

 

 

Community Additions

ADD
Show:
© 2014 Microsoft