OPERATING SYSTEM EDITION
Converts text in system default encoding to UTF-16
[Plain C] 0 if the function succeeded or one of Error codes if the function failed.
This function is currently implemented only in CBFS Storage OS edition for Linux, FreeBSD and macOS.
Use this method to convert the string in current encoding (the one used by the OS for the current process), to UTF-16 encoding used by CBFS Storage. Current encoding is determined using GetACP() function on Windows and setlocale() on Linux, FreeBSD and macOS.
You can specify the existing buffer to store the result by setting AllocateBuffer parameter to false. In this case you need to pass the existing buffer in Buffer parameter and set BufferSize to the size of the buffer. On return BufferSize will contain size of the converted data including terminating null character. If the passed buffer was large enough to hold the data, the data is copied to this buffer.
Alternatively you can tell CBFS Storage API to allocate new buffer. In this case Buffer parameter will be set to the newly allocated buffer and BufferSize will contain the size of the buffer (i.e. the size of the returned data including terminating null character). Allocated buffer must be freed using a call to FreeBuffer.