diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 560c79c2369..6e91fa77a92 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -8,6 +8,7 @@ EXTRALIBS = $(LIBUNICODE) -lstrmiids -luuid EXTRADEFS = -DCOM_NO_WINDOWS_H C_SRCS = \ + htmldoc.c \ main.c @MAKE_DLL_RULES@ diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c new file mode 100644 index 00000000000..54309727c84 --- /dev/null +++ b/dlls/mshtml/htmldoc.c @@ -0,0 +1,929 @@ +/* + * Copyright 2005 Jacek Caban + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" + +#include "mshtml.h" +#include "mshtmdid.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +typedef struct { + IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl; + ULONG ref; +} HTMLDocument; + +#define HTMLDOC(x) ((IHTMLDocument2*)&(x)->lpHTMLDocument2Vtbl) + + +static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppvObject) +{ + HTMLDocument *This = (HTMLDocument*)iface; + + *ppvObject = NULL; + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown, %s)\n", This, debugstr_guid(riid)); + *ppvObject = HTMLDOC(This); + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch, %s)\n", This, debugstr_guid(riid)); + *ppvObject = HTMLDOC(This); + }else if(IsEqualGUID(&IID_IHTMLDocument, riid)) { + TRACE("(%p)->(IID_IHTMLDocument, %s)\n", This, debugstr_guid(riid)); + *ppvObject = HTMLDOC(This); + }else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) { + TRACE("(%p)->(IID_IDocument2, %s)\n", This, debugstr_guid(riid)); + *ppvObject = HTMLDOC(This); + } + if(*ppvObject) { + IHTMLDocument2_AddRef(iface); + return S_OK; + } + + FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppvObject); + return E_NOINTERFACE; +} + +static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface) +{ + HTMLDocument *This = (HTMLDocument*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ref = %lu\n", This, ref); + return ref; +} + +static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) +{ + HTMLDocument *This = (HTMLDocument*)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref = %lu\n", This, ref); + + if(!ref) + HeapFree(GetProcessHeap(), 0, This); + + return ref; +} + +static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo) +{ + FIXME("(%p)->(%p)\n", iface, pctinfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + FIXME("(%p)->(%u %lu %p)\n", iface, iTInfo, lcid, ppTInfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + FIXME("(%p)->(%s %p %u %lu %p)\n", iface, debugstr_guid(riid), rgszNames, cNames, + lcid, rgDispId); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", iface, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)->()\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v) +{ + FIXME("(%p)->(%x)\n", iface, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray) +{ + FIXME("(%p)->(%p)\n", iface, psarray); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray) +{ + FIXME("(%p)->(%p)\n", iface, psarray); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name, + VARIANT features, VARIANT replace, IDispatch **pomWindowResult) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(url), pomWindowResult); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID, + BSTR *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %x %p)\n", iface, debugstr_w(cmdID), showUI, pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag, + IHTMLElement **newElem) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(eTag), newElem); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, long x, long y, + IHTMLElement **elementHit) +{ + FIXME("(%p)->(%ld %ld %p)\n", iface, x, y, elementHit); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface, + IHTMLStyleSheetsCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String) +{ + FIXME("(%p)->(%p)\n", iface, String); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref, + long lIndex, IHTMLStyleSheet **ppnewStyleSheet) +{ + FIXME("(%p)->(%s %ld %p)\n", iface, debugstr_w(bstrHref), lIndex, ppnewStyleSheet); + return E_NOTIMPL; +} + +static IHTMLDocument2Vtbl HTMLDocumentVtbl = { + HTMLDocument_QueryInterface, + HTMLDocument_AddRef, + HTMLDocument_Release, + HTMLDocument_GetTypeInfoCount, + HTMLDocument_GetTypeInfo, + HTMLDocument_GetIDsOfNames, + HTMLDocument_Invoke, + HTMLDocument_get_Script, + HTMLDocument_get_all, + HTMLDocument_get_body, + HTMLDocument_get_activeElement, + HTMLDocument_get_images, + HTMLDocument_get_applets, + HTMLDocument_get_links, + HTMLDocument_get_forms, + HTMLDocument_get_anchors, + HTMLDocument_put_title, + HTMLDocument_get_title, + HTMLDocument_get_scripts, + HTMLDocument_put_designMode, + HTMLDocument_get_designMode, + HTMLDocument_get_selection, + HTMLDocument_get_readyState, + HTMLDocument_get_frames, + HTMLDocument_get_embeds, + HTMLDocument_get_plugins, + HTMLDocument_put_alinkColor, + HTMLDocument_get_alinkColor, + HTMLDocument_put_bgColor, + HTMLDocument_get_bgColor, + HTMLDocument_put_fgColor, + HTMLDocument_get_fgColor, + HTMLDocument_put_linkColor, + HTMLDocument_get_linkColor, + HTMLDocument_put_vlinkColor, + HTMLDocument_get_vlinkColor, + HTMLDocument_get_referrer, + HTMLDocument_get_location, + HTMLDocument_get_lastModified, + HTMLDocument_put_URL, + HTMLDocument_get_URL, + HTMLDocument_put_domain, + HTMLDocument_get_domain, + HTMLDocument_put_cookie, + HTMLDocument_get_cookie, + HTMLDocument_put_expando, + HTMLDocument_get_expando, + HTMLDocument_put_charset, + HTMLDocument_get_charset, + HTMLDocument_put_defaultCharset, + HTMLDocument_get_defaultCharset, + HTMLDocument_get_mimeType, + HTMLDocument_get_fileSize, + HTMLDocument_get_fileCreatedDate, + HTMLDocument_get_fileModifiedDate, + HTMLDocument_get_fileUpdatedDate, + HTMLDocument_get_security, + HTMLDocument_get_protocol, + HTMLDocument_get_nameProp, + HTMLDocument_write, + HTMLDocument_writeln, + HTMLDocument_open, + HTMLDocument_close, + HTMLDocument_clear, + HTMLDocument_queryCommandSupported, + HTMLDocument_queryCommandEnabled, + HTMLDocument_queryCommandState, + HTMLDocument_queryCommandIndeterm, + HTMLDocument_queryCommandText, + HTMLDocument_queryCommandValue, + HTMLDocument_execCommand, + HTMLDocument_execCommandShowHelp, + HTMLDocument_createElement, + HTMLDocument_put_onhelp, + HTMLDocument_get_onhelp, + HTMLDocument_put_onclick, + HTMLDocument_get_onclick, + HTMLDocument_put_ondblclick, + HTMLDocument_get_ondblclick, + HTMLDocument_put_onkeyup, + HTMLDocument_get_onkeyup, + HTMLDocument_put_onkeydown, + HTMLDocument_get_onkeydown, + HTMLDocument_put_onkeypress, + HTMLDocument_get_onkeypress, + HTMLDocument_put_onmouseup, + HTMLDocument_get_onmouseup, + HTMLDocument_put_onmousedown, + HTMLDocument_get_onmousedown, + HTMLDocument_put_onmousemove, + HTMLDocument_get_onmousemove, + HTMLDocument_put_onmouseout, + HTMLDocument_get_onmouseout, + HTMLDocument_put_onmouseover, + HTMLDocument_get_onmouseover, + HTMLDocument_put_onreadystatechange, + HTMLDocument_get_onreadystatechange, + HTMLDocument_put_onafterupdate, + HTMLDocument_get_onafterupdate, + HTMLDocument_put_onrowexit, + HTMLDocument_get_onrowexit, + HTMLDocument_put_onrowenter, + HTMLDocument_get_onrowenter, + HTMLDocument_put_ondragstart, + HTMLDocument_get_ondragstart, + HTMLDocument_put_onselectstart, + HTMLDocument_get_onselectstart, + HTMLDocument_elementFromPoint, + HTMLDocument_get_parentWindow, + HTMLDocument_get_styleSheets, + HTMLDocument_put_onbeforeupdate, + HTMLDocument_get_onbeforeupdate, + HTMLDocument_put_onerrorupdate, + HTMLDocument_get_onerrorupdate, + HTMLDocument_toString, + HTMLDocument_createStyleSheet +}; + +HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) +{ + HTMLDocument *ret; + HRESULT hres; + + TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject); + + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLDocument)); + ret->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl; + ret->ref = 0; + + hres = IHTMLDocument_QueryInterface(HTMLDOC(ret), riid, ppvObject); + if(FAILED(hres)) + HeapFree(GetProcessHeap(), 0, ret); + + return hres; +} diff --git a/dlls/mshtml/main.c b/dlls/mshtml/main.c index 3405ec29bfd..a1cdbb0e98b 100644 --- a/dlls/mshtml/main.c +++ b/dlls/mshtml/main.c @@ -3,6 +3,7 @@ * * Copyright 2002 Lionel Ulmer * Copyright 2003 Mike McCormack + * Copyright 2005 Jacek Caban * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +25,8 @@ #include #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "winuser.h" @@ -32,6 +35,7 @@ #include "ole2.h" #include "mshtml.h" +#include "mshtml_private.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -45,7 +49,7 @@ DEFINE_GUID( CLSID_MozillaBrowser, 0x1339B54C,0x3453,0x11D2,0x93,0xB9,0x00,0x00, typedef HRESULT (WINAPI *fnGetClassObject)(REFCLSID rclsid, REFIID iid, LPVOID *ppv); typedef BOOL (WINAPI *fnCanUnloadNow)(); -HMODULE hMozCtl; +static HMODULE hMozCtl; /* convert a guid to a wide character string */ @@ -96,61 +100,150 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) switch(fdwReason) { case DLL_PROCESS_ATTACH: - if( !MSHTML_GetMozctlPath( szPath, sizeof szPath ) ) - { + if(MSHTML_GetMozctlPath(szPath, sizeof szPath)) { + hMozCtl = LoadLibraryExW(szPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if(!hMozCtl) + ERR("Can't load the Mozilla ActiveX control\n"); + }else { MESSAGE("You need to install the Mozilla ActiveX control to\n"); MESSAGE("use Wine's builtin MSHTML dll.\n"); - return FALSE; - } - hMozCtl = LoadLibraryExW(szPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if( !hMozCtl ) - { - ERR("Can't load the Mozilla ActiveX control\n"); - return FALSE; } break; case DLL_PROCESS_DETACH: - FreeLibrary( hMozCtl ); + if(hMozCtl) + FreeLibrary( hMozCtl ); break; } return TRUE; } -HRESULT WINAPI MSHTML_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) +/*********************************************************** + * ClassFactory implementation + */ +typedef HRESULT (*CreateInstanceFunc)(IUnknown*,REFIID,void**); +typedef struct { + const IClassFactoryVtbl *lpVtbl; + ULONG ref; + CreateInstanceFunc fnCreateInstance; +} ClassFactory; + +static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFGUID riid, void **ppvObject) { - HRESULT r; - fnGetClassObject pGetClassObject; + if(IsEqualGUID(&IID_IClassFactory, riid) || IsEqualGUID(&IID_IUnknown, riid)) { + IClassFactory_AddRef(iface); + *ppvObject = iface; + return S_OK; + } - TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv ); + WARN("not supported iid %s\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; +} - if( !IsEqualGUID( &CLSID_HTMLDocument, rclsid ) ) - WARN("Unknown class %s\n", debugstr_guid(rclsid) ); +static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) +{ + ClassFactory *This = (ClassFactory*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ref = %lu\n", This, ref); + return ref; +} - pGetClassObject = (fnGetClassObject) GetProcAddress( hMozCtl, "DllGetClassObject" ); - if( !pGetClassObject ) - return CLASS_E_CLASSNOTAVAILABLE; - r = pGetClassObject( &CLSID_MozillaBrowser, iid, ppv ); +static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) +{ + ClassFactory *This = (ClassFactory*)iface; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("r = %08lx *ppv = %p\n", r, *ppv ); + TRACE("(%p) ref = %lu\n", This, ref); + if(!ref) + HeapFree(GetProcessHeap(), 0, This); + + return ref; +} + +static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, + REFIID riid, void **ppvObject) +{ + ClassFactory *This = (ClassFactory*)iface; + return This->fnCreateInstance(pUnkOuter, riid, ppvObject); +} + +static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) +{ + FIXME("(%p)->(%x) stub\n", iface, dolock); return S_OK; } -BOOL WINAPI MSHTML_DllCanUnloadNow(void) +static const IClassFactoryVtbl HTMLClassFactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + ClassFactory_CreateInstance, + ClassFactory_LockServer +}; + +static HRESULT ClassFactory_Create(REFIID riid, void **ppv, CreateInstanceFunc fnCreateInstance) { - fnCanUnloadNow pCanUnloadNow; - BOOL r; + ClassFactory *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ClassFactory)); + HRESULT hres; - TRACE("\n"); + ret->lpVtbl = &HTMLClassFactoryVtbl; + ret->ref = 0; + ret->fnCreateInstance = fnCreateInstance; - pCanUnloadNow = (fnCanUnloadNow) GetProcAddress( hMozCtl, "DllCanUnloadNow" ); - if( !pCanUnloadNow ) - return FALSE; - r = pCanUnloadNow(); + hres = IClassFactory_QueryInterface((IClassFactory*)ret, riid, ppv); + if(FAILED(hres)) { + HeapFree(GetProcessHeap(), 0, ret); + *ppv = NULL; + } + return hres; +} - TRACE("r = %d\n", r); +HRESULT WINAPI MSHTML_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) +{ + HRESULT hres; + fnGetClassObject pGetClassObject; - return r; + TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv ); + + if(hMozCtl && IsEqualGUID(&CLSID_HTMLDocument, rclsid)) { + pGetClassObject = (fnGetClassObject) GetProcAddress(hMozCtl, "DllGetClassObject"); + if(pGetClassObject) { + hres = pGetClassObject(&CLSID_MozillaBrowser, riid, ppv); + if(SUCCEEDED(hres)) { + TRACE("returning Mozilla ActiveX Control hres = %08lx *ppv = %p\n", hres, *ppv); + return hres; + } + } + } + + if(IsEqualGUID(&CLSID_HTMLDocument, rclsid)) { + hres = ClassFactory_Create(riid, ppv, HTMLDocument_Create); + TRACE("hres = %08lx\n", hres); + return hres; + } + + FIXME("Unknown class %s\n", debugstr_guid(rclsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI MSHTML_DllCanUnloadNow(void) +{ + fnCanUnloadNow pCanUnloadNow = NULL; + HRESULT hres; + + TRACE("()\n"); + + if(hMozCtl) + pCanUnloadNow = (fnCanUnloadNow) GetProcAddress(hMozCtl, "DllCanUnloadNow"); + if(!pCanUnloadNow) + return S_FALSE; + + hres = pCanUnloadNow(); + + TRACE("hres = %08lx\n", hres); + + return hres; } /* appears to have the same prototype as WinMain */ diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h new file mode 100644 index 00000000000..ac87f4ee0a2 --- /dev/null +++ b/dlls/mshtml/mshtml_private.h @@ -0,0 +1,19 @@ +/* + * Copyright 2005 Jacek Caban + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);