Jacek Caban : mshtml: Added Advise implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 26 07:13:04 CDT 2006


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Jun 25 15:48:47 2006 +0200

mshtml: Added Advise implementation.

---

 dlls/mshtml/conpoint.c |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c
index 480814a..6ef49ea 100644
--- a/dlls/mshtml/conpoint.c
+++ b/dlls/mshtml/conpoint.c
@@ -40,6 +40,14 @@ struct ConnectionPoint {
     const IConnectionPointVtbl *lpConnectionPointVtbl;
 
     HTMLDocument *doc;
+
+    union {
+        IUnknown *unk;
+        IDispatch *disp;
+        IPropertyNotifySink *propnotif;
+    } *sinks;
+    DWORD sinks_size;
+
     IID iid;
 };
 
@@ -113,8 +121,38 @@ static HRESULT WINAPI ConnectionPoint_Ad
                                              DWORD *pdwCookie)
 {
     ConnectionPoint *This = CONPOINT_THIS(iface);
-    FIXME("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
-    return E_NOTIMPL;
+    IUnknown *sink;
+    DWORD i;
+    HRESULT hres;
+
+    TRACE("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
+
+    hres = IUnknown_QueryInterface(pUnkSink, &This->iid, (void**)&sink);
+    if(FAILED(hres) && !IsEqualGUID(&IID_IPropertyNotifySink, &This->iid)) {
+        hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatch, (void**)&sink);
+        if(FAILED(hres))
+            return CONNECT_E_CANNOTCONNECT;
+    }
+
+    if(This->sinks) {
+        for(i=0; i<This->sinks_size; i++) {
+            if(!This->sinks[i].unk)
+                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].unk = sink;
+    *pdwCookie = i+1;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
@@ -152,6 +190,8 @@ static void ConnectionPoint_Create(HTMLD
 
     ret->lpConnectionPointVtbl = &ConnectionPointVtbl;
     ret->doc = doc;
+    ret->sinks = NULL;
+    ret->sinks_size = 0;
     memcpy(&ret->iid, riid, sizeof(IID));
 
     *cp = ret;




More information about the wine-cvs mailing list