Nikolay Sivov : mshtml: Added ISupportErrorInfo for IHTMLDocument.

Alexandre Julliard julliard at winehq.org
Mon Jan 19 08:59:11 CST 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Mon Jan 19 02:03:03 2009 +0300

mshtml: Added ISupportErrorInfo for IHTMLDocument.

---

 dlls/mshtml/htmldoc.c        |   37 +++++++++++++++++++++++++++++++++++++
 dlls/mshtml/mshtml_private.h |    4 +++-
 dlls/mshtml/tests/htmldoc.c  |   26 ++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 8e5981b..32da2e0 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -129,6 +129,9 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID
     }else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) {
         TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppvObject);
         *ppvObject = HTMLDOC(This);
+    }else if(IsEqualGUID(&IID_ISupportErrorInfo, riid)) {
+        TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This, ppvObject);
+        *ppvObject = SUPPERRINFO(This);
     }else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
         FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppvObject);
         return E_NOINTERFACE;
@@ -1572,6 +1575,39 @@ static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
     HTMLDocument_createStyleSheet
 };
 
+#define SUPPINFO_THIS(iface) DEFINE_THIS(HTMLDocument, SupportErrorInfo, iface)
+
+static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **ppv)
+{
+    HTMLDocument *This = SUPPINFO_THIS(iface);
+    return IHTMLDocument_QueryInterface(HTMLDOC(This), riid, ppv);
+}
+
+static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
+{
+    HTMLDocument *This = SUPPINFO_THIS(iface);
+    return IHTMLDocument_AddRef(HTMLDOC(This));
+}
+
+static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
+{
+    HTMLDocument *This = SUPPINFO_THIS(iface);
+    return IHTMLDocument_Release(HTMLDOC(This));
+}
+
+static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
+{
+    FIXME("(%p)->(%s)\n", iface, debugstr_guid(riid));
+    return S_FALSE;
+}
+
+static const ISupportErrorInfoVtbl SupportErrorInfoVtbl = {
+    SupportErrorInfo_QueryInterface,
+    SupportErrorInfo_AddRef,
+    SupportErrorInfo_Release,
+    SupportErrorInfo_InterfaceSupportsErrorInfo
+};
+
 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface)
 
 static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
@@ -1742,6 +1778,7 @@ static HRESULT alloc_doc(HTMLDocument **ret)
     doc = heap_alloc_zero(sizeof(HTMLDocument));
     doc->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl;
     doc->lpIDispatchExVtbl = &DocDispatchExVtbl;
+    doc->lpSupportErrorInfoVtbl = &SupportErrorInfoVtbl;
     doc->ref = 1;
     doc->readystate = READYSTATE_UNINITIALIZED;
     doc->scriptmode = SCRIPTMODE_GECKO;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 148c997..d884ca3 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -238,7 +238,7 @@ struct HTMLDocument {
     const IPersistStreamInitVtbl          *lpPersistStreamInitVtbl;
     const ICustomDocVtbl                  *lpCustomDocVtbl;
     const IDispatchExVtbl                 *lpIDispatchExVtbl;
-
+    const ISupportErrorInfoVtbl           *lpSupportErrorInfoVtbl;
     LONG ref;
 
     NSContainer *nscontainer;
@@ -474,6 +474,8 @@ typedef struct {
 
 #define DISPATCHEX(x)    ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
 
+#define SUPPERRINFO(x)   ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
+
 #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/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index ed69725..c870989 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -4135,6 +4135,31 @@ static void gecko_installer_workaround(BOOL disable)
     RegCloseKey(hkey);
 }
 
+static void test_HTMLDoc_ISupportErrorInfo(void)
+{
+    HRESULT hres;
+    IUnknown *unk;
+    ISupportErrorInfo *sinfo;
+    LONG ref;
+
+    hres = create_document(&unk);
+    if(FAILED(hres))
+        return;
+
+    hres = IUnknown_QueryInterface(unk, &IID_ISupportErrorInfo, (void**)&sinfo);
+    ok(hres == S_OK, "got %x\n", hres);
+    ok(sinfo != NULL, "got %p\n", sinfo);
+    if(sinfo)
+    {
+        hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
+        ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
+    }
+
+    IUnknown_Release(sinfo);
+    ref = IUnknown_Release(unk);
+    ok(ref == 0, "ref=%d, expected 0\n", ref);
+}
+
 START_TEST(htmldoc)
 {
     gecko_installer_workaround(TRUE);
@@ -4151,6 +4176,7 @@ START_TEST(htmldoc)
         test_editing_mode(FALSE);
         test_editing_mode(TRUE);
     }
+    test_HTMLDoc_ISupportErrorInfo();
 
     DestroyWindow(container_hwnd);
     CoUninitialize();




More information about the wine-cvs mailing list