From: Ziqing Hui Subject: Re: [PATCH 4/5] d2d1: Implement RegisterEffectFromString(). Message-Id: <2740861e-dc18-b9f2-8ca8-a62df4638891@codeweavers.com> Date: Mon, 6 Jun 2022 18:31:13 +0800 In-Reply-To: <395dc210-cebf-6811-bde2-fabc5ac232d3@codeweavers.com> References: <20220606073525.1774002-1-zhui@codeweavers.com> <20220606073525.1774002-4-zhui@codeweavers.com> <395dc210-cebf-6811-bde2-fabc5ac232d3@codeweavers.com> On 6/6/22 4:37 PM, Nikolay Sivov wrote: > > > On 6/6/22 10:35, Ziqing Hui wrote: >> +    size = sizeof(*property_xml) * (wcslen(property_xml) + 1); >> +    hglobal = GlobalAlloc(0, size); >> +    data = GlobalLock(hglobal); >> +    memcpy(data, property_xml, size); >> +    GlobalUnlock(hglobal); >> + >> +    if (FAILED(hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream))) >> +        return hr; > Seems easier to write whole string in a stream, and seek back. > I'm not familiar with IStream interface... I'm not pretty sure how to do this. Do I still use CreateStreamOnHGlobal() to create a stream? Do you mean I should create a stream first. And then use IStream_Write() to write the string to it, then seek back?