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

Alexandre Julliard julliard at wine.codeweavers.com
Sun May 28 11:33:23 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 4797edf4bc4b54e170d29605492dab5fed3bcd99
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=4797edf4bc4b54e170d29605492dab5fed3bcd99

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat May 27 22:56:20 2006 +0200

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 37f2752..6862be5 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 InternetProtocolSi
         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 InternetProtocolSi
 
     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 InternetProtocolSi
     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 ur
     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 1c6129e..d9ba6a6 100644
--- a/dlls/urlmon/tests/url.c
+++ b/dlls/urlmon/tests/url.c
@@ -460,6 +460,24 @@ static HRESULT WINAPI statusclb_OnDataAv
 
     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);




More information about the wine-cvs mailing list