SysAllocStringLen function (oleauto.h)
Allocates a new string, copies the specified number of characters from the passed string, and appends a null-terminating character.
BSTR SysAllocStringLen( [in] const OLECHAR *strIn, [in] UINT ui );
The input string.
The number of characters to copy. A null character is placed afterwards, allocating a total of ui plus one characters.
A copy of the string, or NULL if there is insufficient memory to complete the operation.
The string can contain embedded null characters and does not need to end with a NULL. Free the returned string later with SysFreeString. If strIn is not NULL, then the memory allocated to strIn must be at least ui characters long.