shell32: Make the tests of the value returned from function SHGetFileInfoA more stric...
[wine.git] / dlls / msxml3 / text.c
blob0e231994d695c8448623f7ac6061e090a778d16f
1 /*
2 * DOM text node implementation
4 * Copyright 2006 Huw Davies
5 * Copyright 2007-2008 Alistair Leslie-Hughes
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define COBJMACROS
24 #include "config.h"
26 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "msxml2.h"
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
39 #ifdef HAVE_LIBXML2
41 typedef struct _domtext
43 const struct IXMLDOMTextVtbl *lpVtbl;
44 LONG ref;
45 IUnknown *node_unk;
46 IXMLDOMNode *node;
47 } domtext;
49 static inline domtext *impl_from_IXMLDOMText( IXMLDOMText *iface )
51 return (domtext *)((char*)iface - FIELD_OFFSET(domtext, lpVtbl));
54 static HRESULT WINAPI domtext_QueryInterface(
55 IXMLDOMText *iface,
56 REFIID riid,
57 void** ppvObject )
59 domtext *This = impl_from_IXMLDOMText( iface );
60 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
62 if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
63 IsEqualGUID( riid, &IID_IXMLDOMCharacterData) ||
64 IsEqualGUID( riid, &IID_IDispatch ) ||
65 IsEqualGUID( riid, &IID_IUnknown ) )
67 *ppvObject = iface;
69 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
71 return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
73 else if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
74 IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) )
76 /* IXMLDOMText is known to be correct in not implementing these */
77 TRACE("Unsupported interface\n");
78 return E_NOINTERFACE;
80 else
82 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
83 return E_NOINTERFACE;
86 IXMLDOMText_AddRef( iface );
88 return S_OK;
91 static ULONG WINAPI domtext_AddRef(
92 IXMLDOMText *iface )
94 domtext *This = impl_from_IXMLDOMText( iface );
95 return InterlockedIncrement( &This->ref );
98 static ULONG WINAPI domtext_Release(
99 IXMLDOMText *iface )
101 domtext *This = impl_from_IXMLDOMText( iface );
102 ULONG ref;
104 ref = InterlockedDecrement( &This->ref );
105 if ( ref == 0 )
107 IUnknown_Release( This->node_unk );
108 HeapFree( GetProcessHeap(), 0, This );
111 return ref;
114 static HRESULT WINAPI domtext_GetTypeInfoCount(
115 IXMLDOMText *iface,
116 UINT* pctinfo )
118 domtext *This = impl_from_IXMLDOMText( iface );
120 TRACE("(%p)->(%p)\n", This, pctinfo);
122 *pctinfo = 1;
124 return S_OK;
127 static HRESULT WINAPI domtext_GetTypeInfo(
128 IXMLDOMText *iface,
129 UINT iTInfo, LCID lcid,
130 ITypeInfo** ppTInfo )
132 domtext *This = impl_from_IXMLDOMText( iface );
133 HRESULT hr;
135 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
137 hr = get_typeinfo(IXMLDOMText_tid, ppTInfo);
139 return hr;
142 static HRESULT WINAPI domtext_GetIDsOfNames(
143 IXMLDOMText *iface,
144 REFIID riid, LPOLESTR* rgszNames,
145 UINT cNames, LCID lcid, DISPID* rgDispId )
147 domtext *This = impl_from_IXMLDOMText( iface );
148 ITypeInfo *typeinfo;
149 HRESULT hr;
151 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
152 lcid, rgDispId);
154 if(!rgszNames || cNames == 0 || !rgDispId)
155 return E_INVALIDARG;
157 hr = get_typeinfo(IXMLDOMText_tid, &typeinfo);
158 if(SUCCEEDED(hr))
160 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
161 ITypeInfo_Release(typeinfo);
164 return hr;
167 static HRESULT WINAPI domtext_Invoke(
168 IXMLDOMText *iface,
169 DISPID dispIdMember, REFIID riid, LCID lcid,
170 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
171 EXCEPINFO* pExcepInfo, UINT* puArgErr )
173 domtext *This = impl_from_IXMLDOMText( iface );
174 ITypeInfo *typeinfo;
175 HRESULT hr;
177 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
178 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
180 hr = get_typeinfo(IXMLDOMText_tid, &typeinfo);
181 if(SUCCEEDED(hr))
183 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
184 pVarResult, pExcepInfo, puArgErr);
185 ITypeInfo_Release(typeinfo);
188 return hr;
191 static HRESULT WINAPI domtext_get_nodeName(
192 IXMLDOMText *iface,
193 BSTR* p )
195 domtext *This = impl_from_IXMLDOMText( iface );
196 return IXMLDOMNode_get_nodeName( This->node, p );
199 static HRESULT WINAPI domtext_get_nodeValue(
200 IXMLDOMText *iface,
201 VARIANT* var1 )
203 domtext *This = impl_from_IXMLDOMText( iface );
204 return IXMLDOMNode_get_nodeValue( This->node, var1 );
207 static HRESULT WINAPI domtext_put_nodeValue(
208 IXMLDOMText *iface,
209 VARIANT var1 )
211 domtext *This = impl_from_IXMLDOMText( iface );
212 return IXMLDOMNode_put_nodeValue( This->node, var1 );
215 static HRESULT WINAPI domtext_get_nodeType(
216 IXMLDOMText *iface,
217 DOMNodeType* domNodeType )
219 domtext *This = impl_from_IXMLDOMText( iface );
220 return IXMLDOMNode_get_nodeType( This->node, domNodeType );
223 static HRESULT WINAPI domtext_get_parentNode(
224 IXMLDOMText *iface,
225 IXMLDOMNode** parent )
227 domtext *This = impl_from_IXMLDOMText( iface );
228 return IXMLDOMNode_get_parentNode( This->node, parent );
231 static HRESULT WINAPI domtext_get_childNodes(
232 IXMLDOMText *iface,
233 IXMLDOMNodeList** outList)
235 domtext *This = impl_from_IXMLDOMText( iface );
236 return IXMLDOMNode_get_childNodes( This->node, outList );
239 static HRESULT WINAPI domtext_get_firstChild(
240 IXMLDOMText *iface,
241 IXMLDOMNode** domNode)
243 domtext *This = impl_from_IXMLDOMText( iface );
244 return IXMLDOMNode_get_firstChild( This->node, domNode );
247 static HRESULT WINAPI domtext_get_lastChild(
248 IXMLDOMText *iface,
249 IXMLDOMNode** domNode)
251 domtext *This = impl_from_IXMLDOMText( iface );
252 return IXMLDOMNode_get_lastChild( This->node, domNode );
255 static HRESULT WINAPI domtext_get_previousSibling(
256 IXMLDOMText *iface,
257 IXMLDOMNode** domNode)
259 domtext *This = impl_from_IXMLDOMText( iface );
260 return IXMLDOMNode_get_previousSibling( This->node, domNode );
263 static HRESULT WINAPI domtext_get_nextSibling(
264 IXMLDOMText *iface,
265 IXMLDOMNode** domNode)
267 domtext *This = impl_from_IXMLDOMText( iface );
268 return IXMLDOMNode_get_nextSibling( This->node, domNode );
271 static HRESULT WINAPI domtext_get_attributes(
272 IXMLDOMText *iface,
273 IXMLDOMNamedNodeMap** attributeMap)
275 domtext *This = impl_from_IXMLDOMText( iface );
276 return IXMLDOMNode_get_attributes( This->node, attributeMap );
279 static HRESULT WINAPI domtext_insertBefore(
280 IXMLDOMText *iface,
281 IXMLDOMNode* newNode, VARIANT var1,
282 IXMLDOMNode** outOldNode)
284 domtext *This = impl_from_IXMLDOMText( iface );
285 return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
288 static HRESULT WINAPI domtext_replaceChild(
289 IXMLDOMText *iface,
290 IXMLDOMNode* newNode,
291 IXMLDOMNode* oldNode,
292 IXMLDOMNode** outOldNode)
294 domtext *This = impl_from_IXMLDOMText( iface );
295 return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
298 static HRESULT WINAPI domtext_removeChild(
299 IXMLDOMText *iface,
300 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
302 domtext *This = impl_from_IXMLDOMText( iface );
303 return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
306 static HRESULT WINAPI domtext_appendChild(
307 IXMLDOMText *iface,
308 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
310 domtext *This = impl_from_IXMLDOMText( iface );
311 return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
314 static HRESULT WINAPI domtext_hasChildNodes(
315 IXMLDOMText *iface,
316 VARIANT_BOOL* pbool)
318 domtext *This = impl_from_IXMLDOMText( iface );
319 return IXMLDOMNode_hasChildNodes( This->node, pbool );
322 static HRESULT WINAPI domtext_get_ownerDocument(
323 IXMLDOMText *iface,
324 IXMLDOMDocument** domDocument)
326 domtext *This = impl_from_IXMLDOMText( iface );
327 return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
330 static HRESULT WINAPI domtext_cloneNode(
331 IXMLDOMText *iface,
332 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
334 domtext *This = impl_from_IXMLDOMText( iface );
335 return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
338 static HRESULT WINAPI domtext_get_nodeTypeString(
339 IXMLDOMText *iface,
340 BSTR* p)
342 domtext *This = impl_from_IXMLDOMText( iface );
343 return IXMLDOMNode_get_nodeTypeString( This->node, p );
346 static HRESULT WINAPI domtext_get_text(
347 IXMLDOMText *iface,
348 BSTR* p)
350 domtext *This = impl_from_IXMLDOMText( iface );
351 return IXMLDOMNode_get_text( This->node, p );
354 static HRESULT WINAPI domtext_put_text(
355 IXMLDOMText *iface,
356 BSTR p)
358 domtext *This = impl_from_IXMLDOMText( iface );
359 return IXMLDOMNode_put_text( This->node, p );
362 static HRESULT WINAPI domtext_get_specified(
363 IXMLDOMText *iface,
364 VARIANT_BOOL* pbool)
366 domtext *This = impl_from_IXMLDOMText( iface );
367 return IXMLDOMNode_get_specified( This->node, pbool );
370 static HRESULT WINAPI domtext_get_definition(
371 IXMLDOMText *iface,
372 IXMLDOMNode** domNode)
374 domtext *This = impl_from_IXMLDOMText( iface );
375 return IXMLDOMNode_get_definition( This->node, domNode );
378 static HRESULT WINAPI domtext_get_nodeTypedValue(
379 IXMLDOMText *iface,
380 VARIANT* var1)
382 domtext *This = impl_from_IXMLDOMText( iface );
383 return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
386 static HRESULT WINAPI domtext_put_nodeTypedValue(
387 IXMLDOMText *iface,
388 VARIANT var1)
390 domtext *This = impl_from_IXMLDOMText( iface );
391 return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
394 static HRESULT WINAPI domtext_get_dataType(
395 IXMLDOMText *iface,
396 VARIANT* var1)
398 domtext *This = impl_from_IXMLDOMText( iface );
399 return IXMLDOMNode_get_dataType( This->node, var1 );
402 static HRESULT WINAPI domtext_put_dataType(
403 IXMLDOMText *iface,
404 BSTR p)
406 domtext *This = impl_from_IXMLDOMText( iface );
407 return IXMLDOMNode_put_dataType( This->node, p );
410 static HRESULT WINAPI domtext_get_xml(
411 IXMLDOMText *iface,
412 BSTR* p)
414 domtext *This = impl_from_IXMLDOMText( iface );
415 return IXMLDOMNode_get_xml( This->node, p );
418 static HRESULT WINAPI domtext_transformNode(
419 IXMLDOMText *iface,
420 IXMLDOMNode* domNode, BSTR* p)
422 domtext *This = impl_from_IXMLDOMText( iface );
423 return IXMLDOMNode_transformNode( This->node, domNode, p );
426 static HRESULT WINAPI domtext_selectNodes(
427 IXMLDOMText *iface,
428 BSTR p, IXMLDOMNodeList** outList)
430 domtext *This = impl_from_IXMLDOMText( iface );
431 return IXMLDOMNode_selectNodes( This->node, p, outList );
434 static HRESULT WINAPI domtext_selectSingleNode(
435 IXMLDOMText *iface,
436 BSTR p, IXMLDOMNode** outNode)
438 domtext *This = impl_from_IXMLDOMText( iface );
439 return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
442 static HRESULT WINAPI domtext_get_parsed(
443 IXMLDOMText *iface,
444 VARIANT_BOOL* pbool)
446 domtext *This = impl_from_IXMLDOMText( iface );
447 return IXMLDOMNode_get_parsed( This->node, pbool );
450 static HRESULT WINAPI domtext_get_namespaceURI(
451 IXMLDOMText *iface,
452 BSTR* p)
454 domtext *This = impl_from_IXMLDOMText( iface );
455 return IXMLDOMNode_get_namespaceURI( This->node, p );
458 static HRESULT WINAPI domtext_get_prefix(
459 IXMLDOMText *iface,
460 BSTR* p)
462 domtext *This = impl_from_IXMLDOMText( iface );
463 return IXMLDOMNode_get_prefix( This->node, p );
466 static HRESULT WINAPI domtext_get_baseName(
467 IXMLDOMText *iface,
468 BSTR* p)
470 domtext *This = impl_from_IXMLDOMText( iface );
471 return IXMLDOMNode_get_baseName( This->node, p );
474 static HRESULT WINAPI domtext_transformNodeToObject(
475 IXMLDOMText *iface,
476 IXMLDOMNode* domNode, VARIANT var1)
478 domtext *This = impl_from_IXMLDOMText( iface );
479 return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
482 static HRESULT WINAPI domtext_get_data(
483 IXMLDOMText *iface,
484 BSTR *p)
486 domtext *This = impl_from_IXMLDOMText( iface );
487 HRESULT hr = E_FAIL;
488 VARIANT vRet;
490 if(!p)
491 return E_INVALIDARG;
493 hr = IXMLDOMNode_get_nodeValue( This->node, &vRet );
494 if(hr == S_OK)
496 *p = V_BSTR(&vRet);
499 return hr;
502 static HRESULT WINAPI domtext_put_data(
503 IXMLDOMText *iface,
504 BSTR data)
506 domtext *This = impl_from_IXMLDOMText( iface );
507 HRESULT hr = E_FAIL;
508 VARIANT val;
510 TRACE("%p %s\n", This, debugstr_w(data) );
512 V_VT(&val) = VT_BSTR;
513 V_BSTR(&val) = data;
515 hr = IXMLDOMNode_put_nodeValue( This->node, val );
517 return hr;
520 static HRESULT WINAPI domtext_get_length(
521 IXMLDOMText *iface,
522 LONG *len)
524 domtext *This = impl_from_IXMLDOMText( iface );
525 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
526 xmlChar *pContent;
527 LONG nLength = 0;
529 TRACE("%p\n", iface);
531 if(!len)
532 return E_INVALIDARG;
534 pContent = xmlNodeGetContent(pDOMNode->node);
535 if(pContent)
537 nLength = xmlStrlen(pContent);
538 xmlFree(pContent);
541 *len = nLength;
543 return S_OK;
546 static HRESULT WINAPI domtext_substringData(
547 IXMLDOMText *iface,
548 LONG offset, LONG count, BSTR *p)
550 domtext *This = impl_from_IXMLDOMText( iface );
551 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
552 xmlChar *pContent;
553 LONG nLength = 0;
554 HRESULT hr = S_FALSE;
556 TRACE("%p\n", iface);
558 if(!p)
559 return E_INVALIDARG;
561 *p = NULL;
562 if(offset < 0 || count < 0)
563 return E_INVALIDARG;
565 if(count == 0)
566 return hr;
568 pContent = xmlNodeGetContent(pDOMNode->node);
569 if(pContent)
571 nLength = xmlStrlen(pContent);
573 if( offset < nLength)
575 BSTR sContent = bstr_from_xmlChar(pContent);
576 if(offset + count > nLength)
577 *p = SysAllocString(&sContent[offset]);
578 else
579 *p = SysAllocStringLen(&sContent[offset], count);
581 SysFreeString(sContent);
582 hr = S_OK;
585 xmlFree(pContent);
588 return hr;
591 static HRESULT WINAPI domtext_appendData(
592 IXMLDOMText *iface,
593 BSTR p)
595 domtext *This = impl_from_IXMLDOMText( iface );
596 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
597 xmlChar *pContent;
598 HRESULT hr = S_FALSE;
600 TRACE("%p\n", iface);
602 /* Nothing to do if NULL or an Empty string passed in. */
603 if(p == NULL || SysStringLen(p) == 0)
604 return S_OK;
606 pContent = xmlChar_from_wchar( p );
607 if(pContent)
609 if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0)
610 hr = S_OK;
611 else
612 hr = E_FAIL;
613 HeapFree( GetProcessHeap(), 0, pContent );
615 else
616 hr = E_FAIL;
618 return hr;
621 static HRESULT WINAPI domtext_insertData(
622 IXMLDOMText *iface,
623 LONG offset, BSTR p)
625 domtext *This = impl_from_IXMLDOMText( iface );
626 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
627 xmlChar *pXmlContent;
628 BSTR sNewString;
629 HRESULT hr = S_FALSE;
630 LONG nLength = 0, nLengthP = 0;
631 xmlChar *str = NULL;
633 TRACE("%p\n", This);
635 /* If have a NULL or empty string, don't do anything. */
636 if(SysStringLen(p) == 0)
637 return S_OK;
639 if(offset < 0)
641 return E_INVALIDARG;
644 pXmlContent = xmlNodeGetContent(pDOMNode->node);
645 if(pXmlContent)
647 BSTR sContent = bstr_from_xmlChar( pXmlContent );
648 nLength = SysStringLen(sContent);
649 nLengthP = SysStringLen(p);
651 if(nLength < offset)
653 SysFreeString(sContent);
654 xmlFree(pXmlContent);
656 return E_INVALIDARG;
659 sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1);
660 if(sNewString)
662 if(offset > 0)
663 memcpy(sNewString, sContent, offset * sizeof(WCHAR));
665 memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR));
667 if(offset+nLengthP < nLength)
668 memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR));
670 sNewString[nLengthP + nLength] = 0;
672 str = xmlChar_from_wchar(sNewString);
673 if(str)
675 xmlNodeSetContent(pDOMNode->node, str);
676 hr = S_OK;
678 HeapFree(GetProcessHeap(), 0, str);
680 SysFreeString(sNewString);
683 SysFreeString(sContent);
685 xmlFree(pXmlContent);
688 return hr;
691 static HRESULT WINAPI domtext_deleteData(
692 IXMLDOMText *iface,
693 LONG offset, LONG count)
695 FIXME("\n");
696 return E_NOTIMPL;
699 static HRESULT WINAPI domtext_replaceData(
700 IXMLDOMText *iface,
701 LONG offset, LONG count, BSTR p)
703 FIXME("\n");
704 return E_NOTIMPL;
707 static HRESULT WINAPI domtext_splitText(
708 IXMLDOMText *iface,
709 LONG offset, IXMLDOMText **txtNode)
711 FIXME("\n");
712 return E_NOTIMPL;
716 static const struct IXMLDOMTextVtbl domtext_vtbl =
718 domtext_QueryInterface,
719 domtext_AddRef,
720 domtext_Release,
721 domtext_GetTypeInfoCount,
722 domtext_GetTypeInfo,
723 domtext_GetIDsOfNames,
724 domtext_Invoke,
725 domtext_get_nodeName,
726 domtext_get_nodeValue,
727 domtext_put_nodeValue,
728 domtext_get_nodeType,
729 domtext_get_parentNode,
730 domtext_get_childNodes,
731 domtext_get_firstChild,
732 domtext_get_lastChild,
733 domtext_get_previousSibling,
734 domtext_get_nextSibling,
735 domtext_get_attributes,
736 domtext_insertBefore,
737 domtext_replaceChild,
738 domtext_removeChild,
739 domtext_appendChild,
740 domtext_hasChildNodes,
741 domtext_get_ownerDocument,
742 domtext_cloneNode,
743 domtext_get_nodeTypeString,
744 domtext_get_text,
745 domtext_put_text,
746 domtext_get_specified,
747 domtext_get_definition,
748 domtext_get_nodeTypedValue,
749 domtext_put_nodeTypedValue,
750 domtext_get_dataType,
751 domtext_put_dataType,
752 domtext_get_xml,
753 domtext_transformNode,
754 domtext_selectNodes,
755 domtext_selectSingleNode,
756 domtext_get_parsed,
757 domtext_get_namespaceURI,
758 domtext_get_prefix,
759 domtext_get_baseName,
760 domtext_transformNodeToObject,
761 domtext_get_data,
762 domtext_put_data,
763 domtext_get_length,
764 domtext_substringData,
765 domtext_appendData,
766 domtext_insertData,
767 domtext_deleteData,
768 domtext_replaceData,
769 domtext_splitText
772 IUnknown* create_text( xmlNodePtr text )
774 domtext *This;
775 HRESULT hr;
777 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
778 if ( !This )
779 return NULL;
781 This->lpVtbl = &domtext_vtbl;
782 This->ref = 1;
784 This->node_unk = create_basic_node( text, (IUnknown*)&This->lpVtbl );
785 if(!This->node_unk)
787 HeapFree(GetProcessHeap(), 0, This);
788 return NULL;
791 hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
792 if(FAILED(hr))
794 IUnknown_Release(This->node_unk);
795 HeapFree( GetProcessHeap(), 0, This );
796 return NULL;
798 /* The ref on This->node is actually looped back into this object, so release it */
799 IXMLDOMNode_Release(This->node);
801 return (IUnknown*) &This->lpVtbl;
804 #endif