*RESULTP and *LENGTHP should initially be a scratch buffer and its size,
or *RESULTP can initially be NULL.
May erase the contents of the memory at *RESULTP.
- Return value: 0 if successful, otherwise -1 and errno set.
If successful: The resulting Unicode string (non-NULL) is returned and its
length stored in *LENGTHP. The resulting string is RESULTBUF if no dynamic
memory allocation was necessary, or a freshly allocated memory block