From ed6a8acca71a37060234168aa5c755787d5dce2f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 17 Apr 2008 02:31:43 +0200 Subject: [PATCH] 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(+) create mode 100644 dlls/mshtml/dispex.c diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index a19428a8e12..97ae6f133a5 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 00000000000..f665c8f8e00 --- /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 + +#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 66823706b38..1bd4bb121bb 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" @@ -56,6 +57,14 @@ typedef struct ConnectionPoint ConnectionPoint; 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; @@ -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 d1bcdca7310..1a1e7e8bea4 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); }