From 5673a58297d5b7cbc75d6a5357974c625f299474 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 10 Feb 2006 15:14:33 +0100 Subject: [PATCH] msxml: Add ISupportErrorInfo for named node maps. --- dlls/msxml3/nodemap.c | 57 ++++++++++++++++++++++++++++++++++++-- dlls/msxml3/tests/domdoc.c | 11 ++++++++ 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c index 51660204fa8..4edb950bd46 100644 --- a/dlls/msxml3/nodemap.c +++ b/dlls/msxml3/nodemap.c @@ -41,6 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); typedef struct _xmlnodemap { const struct IXMLDOMNamedNodeMapVtbl *lpVtbl; + const struct ISupportErrorInfoVtbl *lpSEIVtbl; LONG ref; IXMLDOMNode *node; } xmlnodemap; @@ -50,19 +51,28 @@ static inline xmlnodemap *impl_from_IXMLDOMNamedNodeMap( IXMLDOMNamedNodeMap *if return (xmlnodemap *)((char*)iface - FIELD_OFFSET(xmlnodemap, lpVtbl)); } +static inline xmlnodemap *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface ) +{ + return (xmlnodemap *)((char*)iface - FIELD_OFFSET(xmlnodemap, lpSEIVtbl)); +} + static HRESULT WINAPI xmlnodemap_QueryInterface( IXMLDOMNamedNodeMap *iface, REFIID riid, void** ppvObject ) { + xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); - if( IsEqualGUID( riid, &IID_IXMLDOMElement ) || - IsEqualGUID( riid, &IID_IUnknown ) || + if( IsEqualGUID( riid, &IID_IUnknown ) || IsEqualGUID( riid, &IID_IDispatch ) || - IsEqualGUID( riid, &IID_IXMLDOMNode ) ) + IsEqualGUID( riid, &IID_IXMLDOMNamedNodeMap ) ) { *ppvObject = iface; } + else if( IsEqualGUID( riid, &IID_ISupportErrorInfo )) + { + *ppvObject = &This->lpSEIVtbl; + } else { FIXME("interface %s not implemented\n", debugstr_guid(riid)); @@ -321,6 +331,46 @@ static const struct IXMLDOMNamedNodeMapVtbl xmlnodemap_vtbl = xmlnodemap__newEnum, }; +static HRESULT WINAPI support_error_QueryInterface( + ISupportErrorInfo *iface, + REFIID riid, void** ppvObject ) +{ + xmlnodemap *This = impl_from_ISupportErrorInfo( iface ); + TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); + + return IXMLDOMNamedNodeMap_QueryInterface((IXMLDOMNamedNodeMap*)&This->lpVtbl, riid, ppvObject); +} + +static ULONG WINAPI support_error_AddRef( + ISupportErrorInfo *iface ) +{ + xmlnodemap *This = impl_from_ISupportErrorInfo( iface ); + return IXMLDOMNamedNodeMap_AddRef((IXMLDOMNamedNodeMap*)&This->lpVtbl); +} + +static ULONG WINAPI support_error_Release( + ISupportErrorInfo *iface ) +{ + xmlnodemap *This = impl_from_ISupportErrorInfo( iface ); + return IXMLDOMNamedNodeMap_Release((IXMLDOMNamedNodeMap*)&This->lpVtbl); +} + +static HRESULT WINAPI support_error_InterfaceSupportsErrorInfo( + ISupportErrorInfo *iface, + REFIID riid ) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_guid(riid)); + return S_FALSE; +} + +static const struct ISupportErrorInfoVtbl support_error_vtbl = +{ + support_error_QueryInterface, + support_error_AddRef, + support_error_Release, + support_error_InterfaceSupportsErrorInfo +}; + IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node ) { xmlnodemap *nodemap; @@ -330,6 +380,7 @@ IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node ) return NULL; nodemap->lpVtbl = &xmlnodemap_vtbl; + nodemap->lpSEIVtbl = &support_error_vtbl; nodemap->node = node; nodemap->ref = 1; diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 5d745ced177..901afc51b75 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -347,6 +347,17 @@ void test_domnode( void ) if (map) { + ISupportErrorInfo *support_error; + r = IXMLDOMNamedNodeMap_QueryInterface( map, &IID_ISupportErrorInfo, (LPVOID*)&support_error ); + ok( r == S_OK, "ret %08lx\n", r ); + + r = ISupportErrorInfo_InterfaceSupportsErrorInfo( support_error, &IID_IXMLDOMNamedNodeMap ); +todo_wine +{ + ok( r == S_OK, "ret %08lx\n", r ); +} + ISupportErrorInfo_Release( support_error ); + str = SysAllocString( szdl ); r = IXMLDOMNamedNodeMap_getNamedItem( map, str, &node ); ok( r == S_OK, "getNamedItem returned wrong code\n");