WindowsGetStringRawBuffer function (winstring.h)

Retrieves the backing buffer for the specified string.


PCWSTR WindowsGetStringRawBuffer(
  HSTRING string,
  UINT32  *length



Type: [in, optional] HSTRING

An optional string for which the backing buffer is to be retrieved. Can be NULL.


Type: [out, optional] UINT32 *

An optional pointer to a UINT32. If NULL is passed for length, then it is ignored. If length is a valid pointer to a UINT32, and string is a valid HSTRING, then on successful completion the function sets the value pointed to by length to the number of Unicode characters in the backing buffer for string (including embedded null characters, but excluding the terminating null). If length is a valid pointer to a UINT32, and string is NULL, then the value pointed to by length is set to 0.

Return value


A pointer to the buffer that provides the backing store for string, or the empty string if string is NULL or the empty string.


Use the WindowsGetStringRawBuffer function to obtain a pointer to the backing buffer of an HSTRING.

Don't change the contents of the buffer—an HSTRING is required to be immutable.


Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header winstring.h