On Thu Oct 10 07:52:24 2024 +0000, Nikolay Sivov wrote:
The problem here is that WCHAR* and BSTR are potentially different, BSTR can support embedded nulls. What should happen if you have VT_BSTR propvar as input?
I add a test in V2:
``` WCHAR *bstr, test_bstr[] = {'a', 0, 'b', 0, 'c'};
...
PropVariantInit(&propvar); propvar.vt = VT_BSTR; propvar.bstrVal = SysAllocStringLen(test_bstr, ARRAY_SIZE(test_bstr)); hr = PropVariantToBSTR(&propvar, &bstr); todo_wine ok(hr == S_OK, "PropVariantToBSTR returned %#lx.\n", hr); if (hr == S_OK) { length = SysStringLen(bstr); ok(length == wcslen(test_bstr), "Unexpected length %u.\n", length); ok(!wcscmp(bstr, test_bstr), "Unexpected bstr %s.", debugstr_wn(bstr, ARRAY_SIZE(test_bstr))); SysFreeString(bstr); } PropVariantClear(&propvar); ```
The test indicate that for BSTR input, the first NULL will be treated as terminating.