urlmon: Store STGMEDIUM in Binding object and set its pUnkForRelease.

This commit is contained in:
Jacek Caban 2006-05-27 22:56:20 +02:00 committed by Alexandre Julliard
parent 21621b2856
commit 4797edf4bc
2 changed files with 24 additions and 5 deletions

View File

@ -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;

View File

@ -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);