Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function creates a BSTRthat contains a specified number of characters from an old BSTR, and frees the old BSTR.

Syntax

HRESULT SysReAllocStringLen(
  BSTR FAR* 
pbstr,
  OLECHAR FAR* 
pch,
  unsigned int 
cch 
);

Parameters

pbstr

[out] Pointer to a string.

pch

[in] Pointer to cchcharacters to copy, or NULL to keep the string uninitialized.

cch

[in] Number of characters to copy from pch.A null character is placed afterward, allocating a total of cch+1 characters.

Return Value

Returns an HRESULT value.

Remarks

The SysReAllocStringLenfunction does the following:

  • Allocates a new string

  • Copies cchcharacters from the passed string into it

  • Appends a null character

  • Frees the BSTRreferenced by pbstr

  • Resets pbstrto point to the new BSTR

If pchis NULL, a string of length cchis allocated but not initialized.

The pchstring can contain embedded null characters and does not need to end with a NULL.

Only Unicode strings are supported.

Passing invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.

Requirements

Header oleauto.h
Library oleaut32.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also