MSDN says:

> Return value
> Type: PCWSTR
> A pointer to the buffer that provides the backing store for string, or the empty string if string is NULL or the empty string.
> 
> Remarks
> Use the WindowsGetStringRawBuffer function to obtain a pointer to the backing buffer of an HSTRING.
> Do not change the contents of the buffer as all HSTRINGs are required to be immutable.

If I understand correctly, it means that WindowsGetStringRawBuffer returns pointer on iternal buffer. In this case lpStr in invalid after WindowsDeleteString.