From d6655767312653cc8431fb3db37aa7a4cd5af5a5 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Mon, 16 Jan 2012 12:27:17 +0400 Subject: [eterhack 2/2] mshtml: Add IHTMLBaseElement stub implementation (eterbug #8023). --- dlls/mshtml/Makefile.in | 1 + dlls/mshtml/htmlbase.c | 210 ++++++++++++++++++++++++++++++++++++++++++ dlls/mshtml/htmlelem.c | 2 + dlls/mshtml/mshtml_private.h | 3 + 4 files changed, 216 insertions(+), 0 deletions(-) create mode 100644 dlls/mshtml/htmlbase.c diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index e5abee1..261bdf1 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -11,6 +11,7 @@ C_SRCS = \ hlink.c \ htmlanchor.c \ htmlattr.c \ + htmlbase.c \ htmlbody.c \ htmlcomment.c \ htmlcurstyle.c \ diff --git a/dlls/mshtml/htmlbase.c b/dlls/mshtml/htmlbase.c new file mode 100644 index 0000000..e00801e --- /dev/null +++ b/dlls/mshtml/htmlbase.c @@ -0,0 +1,210 @@ +/* + * Copyright 2007 Jacek Caban for CodeWeavers + * Copyright 2009 Konstantin Kondratyuk (Etersoft) + * Copyright 2012 Alexander Morozov (Etersoft) + * + * 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); + +typedef struct { + HTMLElement element; + + IHTMLBaseElement IHTMLBaseElement_iface; +} HTMLBaseElement; + +static inline HTMLBaseElement *impl_from_IHTMLBaseElement(IHTMLBaseElement *iface) +{ + return CONTAINING_RECORD(iface, HTMLBaseElement, IHTMLBaseElement_iface); +} + +static HRESULT WINAPI HTMLBaseElement_QueryInterface(IHTMLBaseElement *iface, + REFIID riid, void **ppv) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + + return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); +} + +static ULONG WINAPI HTMLBaseElement_AddRef(IHTMLBaseElement *iface) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + + return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface); +} + +static ULONG WINAPI HTMLBaseElement_Release(IHTMLBaseElement *iface) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + + return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); +} + +static HRESULT WINAPI HTMLBaseElement_GetTypeInfoCount(IHTMLBaseElement *iface, UINT *pctinfo) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLBaseElement_GetTypeInfo(IHTMLBaseElement *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, + ppTInfo); +} + +static HRESULT WINAPI HTMLBaseElement_GetIDsOfNames(IHTMLBaseElement *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLBaseElement_Invoke(IHTMLBaseElement *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLBaseElement_put_href(IHTMLBaseElement* iface, BSTR v) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLBaseElement_get_href(IHTMLBaseElement* iface, BSTR *p) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLBaseElement_put_target(IHTMLBaseElement* iface, BSTR v) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLBaseElement_get_target(IHTMLBaseElement* iface, BSTR *p) +{ + HTMLBaseElement *This = impl_from_IHTMLBaseElement(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLBaseElementVtbl HTMLBaseElementVtbl = { + HTMLBaseElement_QueryInterface, + HTMLBaseElement_AddRef, + HTMLBaseElement_Release, + HTMLBaseElement_GetTypeInfoCount, + HTMLBaseElement_GetTypeInfo, + HTMLBaseElement_GetIDsOfNames, + HTMLBaseElement_Invoke, + HTMLBaseElement_put_href, + HTMLBaseElement_get_href, + HTMLBaseElement_put_target, + HTMLBaseElement_get_target, +}; + +static inline HTMLBaseElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface) +{ + return CONTAINING_RECORD(iface, HTMLBaseElement, element.node); +} + +static HRESULT HTMLBaseElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) +{ + HTMLBaseElement *This = impl_from_HTMLDOMNode(iface); + + *ppv = NULL; + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IHTMLBaseElement_iface; + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = &This->IHTMLBaseElement_iface; + }else if(IsEqualGUID(&IID_IHTMLBaseElement, riid)) { + TRACE("(%p)->(IID_IHTMLBaseElement %p)\n", This, ppv); + *ppv = &This->IHTMLBaseElement_iface; + } + + if(*ppv) { + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; + } + + return HTMLElement_QI(&This->element.node, riid, ppv); +} + +static void HTMLBaseElement_destructor(HTMLDOMNode *iface) +{ + HTMLBaseElement *This = impl_from_HTMLDOMNode(iface); + HTMLElement_destructor(&This->element.node); +} + +static const NodeImplVtbl HTMLBaseElementImplVtbl = { + HTMLBaseElement_QI, + HTMLBaseElement_destructor +}; + +static const tid_t HTMLBaseElement_iface_tids[] = { + HTMLELEMENT_TIDS, + IHTMLBaseElement_tid, + 0 +}; + +static dispex_static_data_t HTMLBaseElement_dispex = { + NULL, + DispHTMLBaseElement_tid, + NULL, + HTMLBaseElement_iface_tids +}; + +HRESULT HTMLBaseElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem) +{ + HTMLBaseElement *ret; + + ret = heap_alloc_zero(sizeof(*ret)); + if(!ret) + return E_OUTOFMEMORY; + + ret->IHTMLBaseElement_iface.lpVtbl = &HTMLBaseElementVtbl; + ret->element.node.vtbl = &HTMLBaseElementImplVtbl; + + HTMLElement_Init(&ret->element, doc, nselem, &HTMLBaseElement_dispex); + *elem = &ret->element; + return S_OK; +} diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 36103be..a6c06da 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -37,6 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); static const WCHAR aW[] = {'A',0}; +static const WCHAR baseW[] = {'B','A','S','E',0}; static const WCHAR bodyW[] = {'B','O','D','Y',0}; static const WCHAR embedW[] = {'E','M','B','E','D',0}; static const WCHAR formW[] = {'F','O','R','M',0}; @@ -62,6 +63,7 @@ typedef struct { static const tag_desc_t tag_descs[] = { {aW, HTMLAnchorElement_Create}, + {baseW, HTMLBaseElement_Create}, {bodyW, HTMLBodyElement_Create}, {embedW, HTMLEmbedElement_Create}, {formW, HTMLFormElement_Create}, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 5480435..7367a49 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -74,6 +74,7 @@ typedef struct event_target_t event_target_t; XDIID(DispDOMChildrenCollection) \ XDIID(DispHTMLAnchorElement) \ XDIID(DispHTMLAttributeCollection) \ + XDIID(DispHTMLBaseElement) \ XDIID(DispHTMLBody) \ XDIID(DispHTMLCommentElement) \ XDIID(DispHTMLCurrentStyle) \ @@ -110,6 +111,7 @@ typedef struct event_target_t event_target_t; XIID(IHTMLAttributeCollection) \ XIID(IHTMLAttributeCollection2) \ XIID(IHTMLAttributeCollection3) \ + XIID(IHTMLBaseElement) \ XIID(IHTMLBodyElement) \ XIID(IHTMLBodyElement2) \ XIID(IHTMLCommentElement) \ @@ -755,6 +757,7 @@ HRESULT HTMLDOMAttribute_Create(HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; +HRESULT HTMLBaseElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; -- 1.7.7.4