[PATCH 1/5] msxml3: When writing to stream \0 terminate output.

Nikolay Sivov nsivov at codeweavers.com
Tue Apr 27 03:42:04 CDT 2021



On 4/27/21 11:35 AM, Dmitry Timoshkov wrote:
> Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
>>>  static int XMLCALL domdoc_stream_save_closecallback(void *ctx)
>>>  {
>>> +    ULONG written;
>>> +    HRESULT hr;
>>> +
>>> +    hr = IStream_Write((IStream*)ctx, "\0", 1, &written);
>>> +    if (hr != S_OK)
>>> +    {
>>> +        WARN("stream write error: 0x%08x\n", hr);
>>> +        hr = -1;
>>> +    }
>>> +
>>>      IStream_Release((IStream*)ctx);
>>> -    return 0;
>>> +    return hr;
>>>  }
>> This will need a test on its own, if it really does that.
> It appears that Windows started to do that since Windows 8. What kind of
> test would you like to see?

The one that shows additional single 0 byte, regardless of document
encoding. Or initial stream memory block contents.

>
>> Callback
>> should return 0 or -1, as documented.
> Yes, and the logic in domdoc_stream_save_closecallback() follows that.
>
Ok, it's confusing. It's more readable to do SUCCEEDED(hr) ? 0 : -1, or
similar.



More information about the wine-devel mailing list