SHDOCVW: Added implementation of IConnectionPoint::Advise and Unadvise.

Robert Shearman rob at codeweavers.com
Thu Dec 1 17:13:11 CST 2005


Jacek Caban wrote:

>@@ -181,15 +184,52 @@ static HRESULT WINAPI ConnectionPoint_Ad
>                                              DWORD *pdwCookie)
> {
>     ConnectionPoint *This = CONPOINT_THIS(iface);
>-    FIXME("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
>-    return E_NOTIMPL;
>+    IDispatch *disp;
>+    DWORD i;
>+    HRESULT hres;
>+
>+    TRACE("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
>+
>+    hres = IUnknown_QueryInterface(pUnkSink, &This->iid, (void**)&disp);
>+    if(FAILED(hres)) {
>+        hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatch, (void**)&disp);
>+        if(FAILED(hres))
>+            return CONNECT_E_CANNOTCONNECT;
>+    }
>+
>+    if(This->sinks) {
>+        for(i=0; i<This->sinks_size; i++) {
>+            if(!This->sinks[i])
>+                break;
>+        }
>+
>+        if(i == This->sinks_size)
>+            This->sinks = HeapReAlloc(GetProcessHeap(), 0, This->sinks,
>+                                      (++This->sinks_size)*sizeof(*This->sinks));
>+    }else {
>+        This->sinks = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->sinks));
>+        This->sinks_size = 1;
>+        i = 0;
>+    }
>+
>+    This->sinks[i] = disp;
>+    *pdwCookie = i+1;
>+
>+    return S_OK;
> }
>  
>

I think you need to AddRef disp here and release it appropriately in 
both Unadvise and on the final release.

-- 
Rob Shearman




More information about the wine-devel mailing list