BSTR stores the string length in some bytes before the string. Use SysAllocString and SysFreeString for conversion.