From 4797edf4bc4b54e170d29605492dab5fed3bcd99 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 27 May 2006 22:56:20 +0200 Subject: [PATCH] urlmon: Store STGMEDIUM in Binding object and set its pUnkForRelease. --- dlls/urlmon/binding.c | 11 ++++++----- dlls/urlmon/tests/url.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c index 37f2752c61f..6862be52793 100644 --- a/dlls/urlmon/binding.c +++ b/dlls/urlmon/binding.c @@ -56,6 +56,8 @@ typedef struct { DWORD apartment_thread; HWND notif_hwnd; + + STGMEDIUM stgmed; } Binding; struct ProtocolStream { @@ -707,7 +709,6 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { Binding *This = PROTSINK_THIS(iface); - STGMEDIUM stgmed; FORMATETC formatetc; TRACE("(%p)->(%ld %lu %lu)\n", This, grfBSCF, ulProgress, ulProgressMax); @@ -729,9 +730,6 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa fill_stream_buffer(This->stream); - stgmed.tymed = TYMED_ISTREAM; - stgmed.u.pstm = STREAM(This->stream); - formatetc.cfFormat = 0; /* FIXME */ formatetc.ptd = NULL; formatetc.dwAspect = 1; @@ -739,7 +737,7 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa formatetc.tymed = TYMED_ISTREAM; IBindStatusCallback_OnDataAvailable(This->callback, grfBSCF, This->stream->buf_size, - &formatetc, &stgmed); + &formatetc, &This->stgmed); if(grfBSCF & BSCF_LASTDATANOTIFICATION) IBindStatusCallback_OnStopBinding(This->callback, S_OK, NULL); @@ -1026,6 +1024,9 @@ static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding * memcpy(ret->url, url, len*sizeof(WCHAR)); ret->stream = create_stream(ret->protocol); + ret->stgmed.tymed = TYMED_ISTREAM; + ret->stgmed.u.pstm = STREAM(ret->stream); + ret->stgmed.pUnkForRelease = (IUnknown*)BINDING(ret); /* NOTE: Windows uses other IUnknown */ *binding = ret; return S_OK; diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index 1c6129e961b..d9ba6a6e180 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -460,6 +460,24 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWOR CHECK_EXPECT2(OnDataAvailable); +#if 0 /* Uncomment after removing BindToStorage hack. */ + ok(pformatetc != NULL, "pformatetx == NULL\n"); + if(pformatetc) { + ok(pformatetc->cfFormat == 0xc02d, "clipformat=%x\n", pformatetc->cfFormat); + ok(pformatetc->ptd == NULL, "ptd = %p\n", pformatetc->ptd); + ok(pformatetc->dwAspect == 1, "dwAspect=%ld\n", pformatetc->dwAspect); + ok(pformatetc->lindex == -1, "lindex=%ld\n", pformatetc->lindex); + ok(pformatetc->tymed == TYMED_ISTREAM, "tymed=%ld\n", pformatetc->tymed); + } + + ok(pstgmed != NULL, "stgmeg == NULL\n"); + if(pstgmed) { + ok(pstgmed->tymed == TYMED_ISTREAM, "tymed=%ld\n", pstgmed->tymed); + ok(U(*pstgmed).pstm != NULL, "pstm == NULL\n"); + ok(pstgmed->pUnkForRelease != NULL, "pUnkForRelease == NULL\n"); + } +#endif + if(U(*pstgmed).pstm) { do hres = IStream_Read(U(*pstgmed).pstm, buf, 512, &readed); while(hres == S_OK); -- 2.11.4.GIT