Jacek Caban : mshtml: Added generic IDispatchEx implementation and use it in OnNavigator.

Alexandre Julliard julliard at winehq.org
Thu Apr 17 07:38:39 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Apr 17 02:31:43 2008 +0200

mshtml: Added generic IDispatchEx implementation and use it in OnNavigator.

---

 dlls/mshtml/Makefile.in      |    1 +
 dlls/mshtml/dispex.c         |  176 ++++++++++++++++++++++++++++++++++++++++++
 dlls/mshtml/mshtml_private.h |   11 +++
 dlls/mshtml/omnavigator.c    |    6 ++
 4 files changed, 194 insertions(+), 0 deletions(-)

diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in
index a19428a..97ae6f1 100644
--- a/dlls/mshtml/Makefile.in
+++ b/dlls/mshtml/Makefile.in
@@ -10,6 +10,7 @@ EXTRADEFS = -DCOM_NO_WINDOWS_H
 
 C_SRCS = \
 	conpoint.c \
+	dispex.c \
 	editor.c \
 	hlink.c \
 	htmlanchor.c \
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
new file mode 100644
index 0000000..f665c8f
--- /dev/null
+++ b/dlls/mshtml/dispex.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2008 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+
+#include "wine/debug.h"
+
+#include "mshtml_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+
+#define DISPATCHEX_THIS(iface) DEFINE_THIS(DispatchEx, IDispatchEx, iface)
+
+static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+
+    return IUnknown_QueryInterface(This->outer, riid, ppv);
+}
+
+static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+
+    return IUnknown_AddRef(This->outer);
+}
+
+static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+
+    return IUnknown_Release(This->outer);
+}
+
+static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+
+    TRACE("(%p)->(%p)\n", This, pctinfo);
+
+    *pctinfo = 1;
+    return S_OK;
+}
+
+static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
+                                              LCID lcid, ITypeInfo **ppTInfo)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
+                                                LPOLESTR *rgszNames, UINT cNames,
+                                                LCID lcid, DISPID *rgDispId)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
+          lcid, rgDispId);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
+                            REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+                            VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
+          lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
+        VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%x)\n", This, id);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%x %p)\n", This, id, pbstrName);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
+{
+    DispatchEx *This = DISPATCHEX_THIS(iface);
+    FIXME("(%p)->(%p)\n", This, ppunk);
+    return E_NOTIMPL;
+}
+
+#undef DISPATCHEX_THIS
+
+static IDispatchExVtbl DispatchExVtbl = {
+    DispatchEx_QueryInterface,
+    DispatchEx_AddRef,
+    DispatchEx_Release,
+    DispatchEx_GetTypeInfoCount,
+    DispatchEx_GetTypeInfo,
+    DispatchEx_GetIDsOfNames,
+    DispatchEx_Invoke,
+    DispatchEx_GetDispID,
+    DispatchEx_InvokeEx,
+    DispatchEx_DeleteMemberByName,
+    DispatchEx_DeleteMemberByDispID,
+    DispatchEx_GetMemberProperties,
+    DispatchEx_GetMemberName,
+    DispatchEx_GetNextDispID,
+    DispatchEx_GetNameSpaceParent
+};
+
+void init_dispex(DispatchEx *dispex, IUnknown *outer)
+{
+    dispex->lpIDispatchExVtbl = &DispatchExVtbl;
+    dispex->outer = outer;
+}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 6682370..1bd4bb1 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -21,6 +21,7 @@
 #include "mshtml.h"
 #include "mshtmhst.h"
 #include "hlink.h"
+#include "dispex.h"
 
 #include "wine/list.h"
 #include "wine/unicode.h"
@@ -57,6 +58,14 @@ typedef struct BSCallback BSCallback;
 typedef struct nsChannelBSC nsChannelBSC;
 
 typedef struct {
+    const IDispatchExVtbl  *lpIDispatchExVtbl;
+
+    IUnknown *outer;
+} DispatchEx;
+
+void init_dispex(DispatchEx*,IUnknown*);
+
+typedef struct {
     const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
 
     LONG ref;
@@ -334,6 +343,8 @@ typedef struct {
 #define HTMLOPTFACTORY(x)  ((IHTMLOptionElementFactory*)  &(x)->lpHTMLOptionElementFactoryVtbl)
 #define HTMLLOCATION(x)  ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
 
+#define DISPATCHEX(x)    ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
+
 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
 
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c
index d1bcdca..1a1e7e8 100644
--- a/dlls/mshtml/omnavigator.c
+++ b/dlls/mshtml/omnavigator.c
@@ -32,6 +32,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 typedef struct {
+    DispatchEx dispex;
     const IOmNavigatorVtbl  *lpIOmNavigatorVtbl;
 
     LONG ref;
@@ -53,6 +54,9 @@ static HRESULT WINAPI OmNavigator_QueryInterface(IOmNavigator *iface, REFIID rii
     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
         *ppv = OMNAVIGATOR(This);
+    }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
+        TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
+        *ppv = DISPATCHEX(&This->dispex);
     }else if(IsEqualGUID(&IID_IOmNavigator, riid)) {
         TRACE("(%p)->(IID_IOmNavigator %p)\n", This, ppv);
         *ppv = OMNAVIGATOR(This);
@@ -305,5 +309,7 @@ IOmNavigator *OmNavigator_Create(void)
     ret->lpIOmNavigatorVtbl = &OmNavigatorVtbl;
     ret->ref = 1;
 
+    init_dispex(&ret->dispex, (IUnknown*)OMNAVIGATOR(ret));
+
     return OMNAVIGATOR(ret);
 }




More information about the wine-cvs mailing list