dbghelp: Implement SymEnumerateSymbols64.
[wine/hacks.git] / dlls / msxml3 / comment.c
blob9a45be601e91128cdcc5266d53851a3abd1ec0e4
1 /*
2 * DOM comment node implementation
4 * Copyright 2006 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "msxml2.h"
32 #include "msxml_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
38 #ifdef HAVE_LIBXML2
40 typedef struct _domcomment
42 const struct IXMLDOMCommentVtbl *lpVtbl;
43 LONG ref;
44 IUnknown *node_unk;
45 IXMLDOMNode *node;
46 } domcomment;
48 static inline domcomment *impl_from_IXMLDOMComment( IXMLDOMComment *iface )
50 return (domcomment *)((char*)iface - FIELD_OFFSET(domcomment, lpVtbl));
53 static HRESULT WINAPI domcomment_QueryInterface(
54 IXMLDOMComment *iface,
55 REFIID riid,
56 void** ppvObject )
58 domcomment *This = impl_from_IXMLDOMComment( iface );
59 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
61 if ( IsEqualGUID( riid, &IID_IXMLDOMComment ) ||
62 IsEqualGUID( riid, &IID_IDispatch ) ||
63 IsEqualGUID( riid, &IID_IUnknown ) )
65 *ppvObject = iface;
67 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
69 return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
71 else
73 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
74 return E_NOINTERFACE;
77 IXMLDOMComment_AddRef( iface );
79 return S_OK;
82 static ULONG WINAPI domcomment_AddRef(
83 IXMLDOMComment *iface )
85 domcomment *This = impl_from_IXMLDOMComment( iface );
86 return InterlockedIncrement( &This->ref );
89 static ULONG WINAPI domcomment_Release(
90 IXMLDOMComment *iface )
92 domcomment *This = impl_from_IXMLDOMComment( iface );
93 ULONG ref;
95 ref = InterlockedDecrement( &This->ref );
96 if ( ref == 0 )
98 IUnknown_Release( This->node_unk );
99 HeapFree( GetProcessHeap(), 0, This );
102 return ref;
105 static HRESULT WINAPI domcomment_GetTypeInfoCount(
106 IXMLDOMComment *iface,
107 UINT* pctinfo )
109 domcomment *This = impl_from_IXMLDOMComment( iface );
111 TRACE("(%p)->(%p)\n", This, pctinfo);
113 *pctinfo = 1;
115 return S_OK;
118 static HRESULT WINAPI domcomment_GetTypeInfo(
119 IXMLDOMComment *iface,
120 UINT iTInfo, LCID lcid,
121 ITypeInfo** ppTInfo )
123 domcomment *This = impl_from_IXMLDOMComment( iface );
124 HRESULT hr;
126 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
128 hr = get_typeinfo(IXMLDOMComment_tid, ppTInfo);
130 return hr;
133 static HRESULT WINAPI domcomment_GetIDsOfNames(
134 IXMLDOMComment *iface,
135 REFIID riid, LPOLESTR* rgszNames,
136 UINT cNames, LCID lcid, DISPID* rgDispId )
138 domcomment *This = impl_from_IXMLDOMComment( iface );
139 ITypeInfo *typeinfo;
140 HRESULT hr;
142 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
143 lcid, rgDispId);
145 if(!rgszNames || cNames == 0 || !rgDispId)
146 return E_INVALIDARG;
148 hr = get_typeinfo(IXMLDOMComment_tid, &typeinfo);
149 if(SUCCEEDED(hr))
151 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
152 ITypeInfo_Release(typeinfo);
155 return hr;
158 static HRESULT WINAPI domcomment_Invoke(
159 IXMLDOMComment *iface,
160 DISPID dispIdMember, REFIID riid, LCID lcid,
161 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
162 EXCEPINFO* pExcepInfo, UINT* puArgErr )
164 domcomment *This = impl_from_IXMLDOMComment( iface );
165 ITypeInfo *typeinfo;
166 HRESULT hr;
168 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
169 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
171 hr = get_typeinfo(IXMLDOMComment_tid, &typeinfo);
172 if(SUCCEEDED(hr))
174 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
175 pVarResult, pExcepInfo, puArgErr);
176 ITypeInfo_Release(typeinfo);
179 return hr;
182 static HRESULT WINAPI domcomment_get_nodeName(
183 IXMLDOMComment *iface,
184 BSTR* p )
186 domcomment *This = impl_from_IXMLDOMComment( iface );
187 return IXMLDOMNode_get_nodeName( This->node, p );
190 static HRESULT WINAPI domcomment_get_nodeValue(
191 IXMLDOMComment *iface,
192 VARIANT* var1 )
194 domcomment *This = impl_from_IXMLDOMComment( iface );
195 return IXMLDOMNode_get_nodeValue( This->node, var1 );
198 static HRESULT WINAPI domcomment_put_nodeValue(
199 IXMLDOMComment *iface,
200 VARIANT var1 )
202 domcomment *This = impl_from_IXMLDOMComment( iface );
203 return IXMLDOMNode_put_nodeValue( This->node, var1 );
206 static HRESULT WINAPI domcomment_get_nodeType(
207 IXMLDOMComment *iface,
208 DOMNodeType* domNodeType )
210 domcomment *This = impl_from_IXMLDOMComment( iface );
211 return IXMLDOMNode_get_nodeType( This->node, domNodeType );
214 static HRESULT WINAPI domcomment_get_parentNode(
215 IXMLDOMComment *iface,
216 IXMLDOMNode** parent )
218 domcomment *This = impl_from_IXMLDOMComment( iface );
219 return IXMLDOMNode_get_parentNode( This->node, parent );
222 static HRESULT WINAPI domcomment_get_childNodes(
223 IXMLDOMComment *iface,
224 IXMLDOMNodeList** outList)
226 domcomment *This = impl_from_IXMLDOMComment( iface );
227 return IXMLDOMNode_get_childNodes( This->node, outList );
230 static HRESULT WINAPI domcomment_get_firstChild(
231 IXMLDOMComment *iface,
232 IXMLDOMNode** domNode)
234 domcomment *This = impl_from_IXMLDOMComment( iface );
235 return IXMLDOMNode_get_firstChild( This->node, domNode );
238 static HRESULT WINAPI domcomment_get_lastChild(
239 IXMLDOMComment *iface,
240 IXMLDOMNode** domNode)
242 domcomment *This = impl_from_IXMLDOMComment( iface );
243 return IXMLDOMNode_get_lastChild( This->node, domNode );
246 static HRESULT WINAPI domcomment_get_previousSibling(
247 IXMLDOMComment *iface,
248 IXMLDOMNode** domNode)
250 domcomment *This = impl_from_IXMLDOMComment( iface );
251 return IXMLDOMNode_get_previousSibling( This->node, domNode );
254 static HRESULT WINAPI domcomment_get_nextSibling(
255 IXMLDOMComment *iface,
256 IXMLDOMNode** domNode)
258 domcomment *This = impl_from_IXMLDOMComment( iface );
259 return IXMLDOMNode_get_nextSibling( This->node, domNode );
262 static HRESULT WINAPI domcomment_get_attributes(
263 IXMLDOMComment *iface,
264 IXMLDOMNamedNodeMap** attributeMap)
266 domcomment *This = impl_from_IXMLDOMComment( iface );
267 return IXMLDOMNode_get_attributes( This->node, attributeMap );
270 static HRESULT WINAPI domcomment_insertBefore(
271 IXMLDOMComment *iface,
272 IXMLDOMNode* newNode, VARIANT var1,
273 IXMLDOMNode** outOldNode)
275 domcomment *This = impl_from_IXMLDOMComment( iface );
276 return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
279 static HRESULT WINAPI domcomment_replaceChild(
280 IXMLDOMComment *iface,
281 IXMLDOMNode* newNode,
282 IXMLDOMNode* oldNode,
283 IXMLDOMNode** outOldNode)
285 domcomment *This = impl_from_IXMLDOMComment( iface );
286 return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
289 static HRESULT WINAPI domcomment_removeChild(
290 IXMLDOMComment *iface,
291 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
293 domcomment *This = impl_from_IXMLDOMComment( iface );
294 return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
297 static HRESULT WINAPI domcomment_appendChild(
298 IXMLDOMComment *iface,
299 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
301 domcomment *This = impl_from_IXMLDOMComment( iface );
302 return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
305 static HRESULT WINAPI domcomment_hasChildNodes(
306 IXMLDOMComment *iface,
307 VARIANT_BOOL* pbool)
309 domcomment *This = impl_from_IXMLDOMComment( iface );
310 return IXMLDOMNode_hasChildNodes( This->node, pbool );
313 static HRESULT WINAPI domcomment_get_ownerDocument(
314 IXMLDOMComment *iface,
315 IXMLDOMDocument** domDocument)
317 domcomment *This = impl_from_IXMLDOMComment( iface );
318 return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
321 static HRESULT WINAPI domcomment_cloneNode(
322 IXMLDOMComment *iface,
323 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
325 domcomment *This = impl_from_IXMLDOMComment( iface );
326 return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
329 static HRESULT WINAPI domcomment_get_nodeTypeString(
330 IXMLDOMComment *iface,
331 BSTR* p)
333 domcomment *This = impl_from_IXMLDOMComment( iface );
334 return IXMLDOMNode_get_nodeTypeString( This->node, p );
337 static HRESULT WINAPI domcomment_get_text(
338 IXMLDOMComment *iface,
339 BSTR* p)
341 domcomment *This = impl_from_IXMLDOMComment( iface );
342 return IXMLDOMNode_get_text( This->node, p );
345 static HRESULT WINAPI domcomment_put_text(
346 IXMLDOMComment *iface,
347 BSTR p)
349 domcomment *This = impl_from_IXMLDOMComment( iface );
350 return IXMLDOMNode_put_text( This->node, p );
353 static HRESULT WINAPI domcomment_get_specified(
354 IXMLDOMComment *iface,
355 VARIANT_BOOL* pbool)
357 domcomment *This = impl_from_IXMLDOMComment( iface );
358 return IXMLDOMNode_get_specified( This->node, pbool );
361 static HRESULT WINAPI domcomment_get_definition(
362 IXMLDOMComment *iface,
363 IXMLDOMNode** domNode)
365 domcomment *This = impl_from_IXMLDOMComment( iface );
366 return IXMLDOMNode_get_definition( This->node, domNode );
369 static HRESULT WINAPI domcomment_get_nodeTypedValue(
370 IXMLDOMComment *iface,
371 VARIANT* var1)
373 domcomment *This = impl_from_IXMLDOMComment( iface );
374 return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
377 static HRESULT WINAPI domcomment_put_nodeTypedValue(
378 IXMLDOMComment *iface,
379 VARIANT var1)
381 domcomment *This = impl_from_IXMLDOMComment( iface );
382 return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
385 static HRESULT WINAPI domcomment_get_dataType(
386 IXMLDOMComment *iface,
387 VARIANT* var1)
389 domcomment *This = impl_from_IXMLDOMComment( iface );
390 return IXMLDOMNode_get_dataType( This->node, var1 );
393 static HRESULT WINAPI domcomment_put_dataType(
394 IXMLDOMComment *iface,
395 BSTR p)
397 domcomment *This = impl_from_IXMLDOMComment( iface );
398 return IXMLDOMNode_put_dataType( This->node, p );
401 static HRESULT WINAPI domcomment_get_xml(
402 IXMLDOMComment *iface,
403 BSTR* p)
405 domcomment *This = impl_from_IXMLDOMComment( iface );
406 return IXMLDOMNode_get_xml( This->node, p );
409 static HRESULT WINAPI domcomment_transformNode(
410 IXMLDOMComment *iface,
411 IXMLDOMNode* domNode, BSTR* p)
413 domcomment *This = impl_from_IXMLDOMComment( iface );
414 return IXMLDOMNode_transformNode( This->node, domNode, p );
417 static HRESULT WINAPI domcomment_selectNodes(
418 IXMLDOMComment *iface,
419 BSTR p, IXMLDOMNodeList** outList)
421 domcomment *This = impl_from_IXMLDOMComment( iface );
422 return IXMLDOMNode_selectNodes( This->node, p, outList );
425 static HRESULT WINAPI domcomment_selectSingleNode(
426 IXMLDOMComment *iface,
427 BSTR p, IXMLDOMNode** outNode)
429 domcomment *This = impl_from_IXMLDOMComment( iface );
430 return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
433 static HRESULT WINAPI domcomment_get_parsed(
434 IXMLDOMComment *iface,
435 VARIANT_BOOL* pbool)
437 domcomment *This = impl_from_IXMLDOMComment( iface );
438 return IXMLDOMNode_get_parsed( This->node, pbool );
441 static HRESULT WINAPI domcomment_get_namespaceURI(
442 IXMLDOMComment *iface,
443 BSTR* p)
445 domcomment *This = impl_from_IXMLDOMComment( iface );
446 return IXMLDOMNode_get_namespaceURI( This->node, p );
449 static HRESULT WINAPI domcomment_get_prefix(
450 IXMLDOMComment *iface,
451 BSTR* p)
453 domcomment *This = impl_from_IXMLDOMComment( iface );
454 return IXMLDOMNode_get_prefix( This->node, p );
457 static HRESULT WINAPI domcomment_get_baseName(
458 IXMLDOMComment *iface,
459 BSTR* p)
461 domcomment *This = impl_from_IXMLDOMComment( iface );
462 return IXMLDOMNode_get_baseName( This->node, p );
465 static HRESULT WINAPI domcomment_transformNodeToObject(
466 IXMLDOMComment *iface,
467 IXMLDOMNode* domNode, VARIANT var1)
469 domcomment *This = impl_from_IXMLDOMComment( iface );
470 return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
473 static HRESULT WINAPI domcomment_get_data(
474 IXMLDOMComment *iface,
475 BSTR *p)
477 domcomment *This = impl_from_IXMLDOMComment( iface );
478 HRESULT hr = E_FAIL;
479 VARIANT vRet;
481 if(!p)
482 return E_INVALIDARG;
484 hr = IXMLDOMNode_get_nodeValue( This->node, &vRet );
485 if(hr == S_OK)
487 *p = V_BSTR(&vRet);
490 return hr;
493 static HRESULT WINAPI domcomment_put_data(
494 IXMLDOMComment *iface,
495 BSTR data)
497 domcomment *This = impl_from_IXMLDOMComment( iface );
498 HRESULT hr = E_FAIL;
499 VARIANT val;
501 TRACE("%p %s\n", This, debugstr_w(data) );
503 V_VT(&val) = VT_BSTR;
504 V_BSTR(&val) = data;
506 hr = IXMLDOMNode_put_nodeValue( This->node, val );
508 return hr;
511 static HRESULT WINAPI domcomment_get_length(
512 IXMLDOMComment *iface,
513 long *len)
515 domcomment *This = impl_from_IXMLDOMComment( iface );
516 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
517 xmlChar *pContent;
518 long nLength = 0;
520 TRACE("%p\n", iface);
522 if(!len)
523 return E_INVALIDARG;
525 pContent = xmlNodeGetContent(pDOMNode->node);
526 if(pContent)
528 nLength = xmlStrlen(pContent);
529 xmlFree(pContent);
532 *len = nLength;
534 return S_OK;
537 static HRESULT WINAPI domcomment_substringData(
538 IXMLDOMComment *iface,
539 long offset, long count, BSTR *p)
541 domcomment *This = impl_from_IXMLDOMComment( iface );
542 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
543 xmlChar *pContent;
544 long nLength = 0;
545 HRESULT hr = S_FALSE;
547 TRACE("%p\n", iface);
549 if(!p)
550 return E_INVALIDARG;
552 *p = NULL;
553 if(offset < 0 || count < 0)
554 return E_INVALIDARG;
556 if(count == 0)
557 return hr;
559 pContent = xmlNodeGetContent(pDOMNode->node);
560 if(pContent)
562 nLength = xmlStrlen(pContent);
564 if( offset < nLength)
566 BSTR sContent = bstr_from_xmlChar(pContent);
567 if(offset + count > nLength)
568 *p = SysAllocString(&sContent[offset]);
569 else
570 *p = SysAllocStringLen(&sContent[offset], count);
572 SysFreeString(sContent);
573 hr = S_OK;
576 xmlFree(pContent);
579 return hr;
582 static HRESULT WINAPI domcomment_appendData(
583 IXMLDOMComment *iface,
584 BSTR p)
586 domcomment *This = impl_from_IXMLDOMComment( iface );
587 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
588 xmlChar *pContent;
589 HRESULT hr = S_FALSE;
591 TRACE("%p\n", iface);
593 /* Nothing to do if NULL or an Empty string passed in. */
594 if(p == NULL || SysStringLen(p) == 0)
595 return S_OK;
597 pContent = xmlChar_from_wchar( (WCHAR*)p );
598 if(pContent)
600 /* Older versions of libxml < 2.6.27 didn't correctly support
601 xmlTextConcat on Comment nodes. Fallback to setting the
602 contents directly if xmlTextConcat fails.
604 NOTE: if xmlTextConcat fails, pContent is destroyed.
606 if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0)
607 hr = S_OK;
608 else
610 xmlChar *pNew;
611 pContent = xmlChar_from_wchar( (WCHAR*)p );
612 if(pContent)
614 pNew = xmlStrcat(xmlNodeGetContent(pDOMNode->node), pContent);
615 if(pNew)
617 xmlNodeSetContent(pDOMNode->node, pNew);
618 hr = S_OK;
620 else
621 hr = E_FAIL;
623 else
624 hr = E_FAIL;
627 else
628 hr = E_FAIL;
630 return hr;
633 static HRESULT WINAPI domcomment_insertData(
634 IXMLDOMComment *iface,
635 long offset, BSTR p)
637 domcomment *This = impl_from_IXMLDOMComment( iface );
638 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
639 xmlChar *pXmlContent;
640 BSTR sNewString;
641 HRESULT hr = S_FALSE;
642 long nLength = 0, nLengthP = 0;
643 xmlChar *str = NULL;
645 TRACE("%p\n", This);
647 /* If have a NULL or empty string, don't do anything. */
648 if(SysStringLen(p) == 0)
649 return S_OK;
651 if(offset < 0)
653 return E_INVALIDARG;
656 pXmlContent = xmlNodeGetContent(pDOMNode->node);
657 if(pXmlContent)
659 BSTR sContent = bstr_from_xmlChar( pXmlContent );
660 nLength = SysStringLen(sContent);
661 nLengthP = SysStringLen(p);
663 if(nLength < offset)
665 SysFreeString(sContent);
666 xmlFree(pXmlContent);
668 return E_INVALIDARG;
671 sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1);
672 if(sNewString)
674 if(offset > 0)
675 memcpy(sNewString, sContent, offset * sizeof(WCHAR));
677 memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR));
679 if(offset+nLengthP < nLength)
680 memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR));
682 sNewString[nLengthP + nLength] = 0;
684 str = xmlChar_from_wchar((WCHAR*)sNewString);
685 if(str)
687 xmlNodeSetContent(pDOMNode->node, str);
688 hr = S_OK;
691 SysFreeString(sNewString);
694 SysFreeString(sContent);
696 xmlFree(pXmlContent);
699 return hr;
702 static HRESULT WINAPI domcomment_deleteData(
703 IXMLDOMComment *iface,
704 long offset, long count)
706 FIXME("\n");
707 return E_NOTIMPL;
710 static HRESULT WINAPI domcomment_replaceData(
711 IXMLDOMComment *iface,
712 long offset, long count, BSTR p)
714 FIXME("\n");
715 return E_NOTIMPL;
718 static const struct IXMLDOMCommentVtbl domcomment_vtbl =
720 domcomment_QueryInterface,
721 domcomment_AddRef,
722 domcomment_Release,
723 domcomment_GetTypeInfoCount,
724 domcomment_GetTypeInfo,
725 domcomment_GetIDsOfNames,
726 domcomment_Invoke,
727 domcomment_get_nodeName,
728 domcomment_get_nodeValue,
729 domcomment_put_nodeValue,
730 domcomment_get_nodeType,
731 domcomment_get_parentNode,
732 domcomment_get_childNodes,
733 domcomment_get_firstChild,
734 domcomment_get_lastChild,
735 domcomment_get_previousSibling,
736 domcomment_get_nextSibling,
737 domcomment_get_attributes,
738 domcomment_insertBefore,
739 domcomment_replaceChild,
740 domcomment_removeChild,
741 domcomment_appendChild,
742 domcomment_hasChildNodes,
743 domcomment_get_ownerDocument,
744 domcomment_cloneNode,
745 domcomment_get_nodeTypeString,
746 domcomment_get_text,
747 domcomment_put_text,
748 domcomment_get_specified,
749 domcomment_get_definition,
750 domcomment_get_nodeTypedValue,
751 domcomment_put_nodeTypedValue,
752 domcomment_get_dataType,
753 domcomment_put_dataType,
754 domcomment_get_xml,
755 domcomment_transformNode,
756 domcomment_selectNodes,
757 domcomment_selectSingleNode,
758 domcomment_get_parsed,
759 domcomment_get_namespaceURI,
760 domcomment_get_prefix,
761 domcomment_get_baseName,
762 domcomment_transformNodeToObject,
763 domcomment_get_data,
764 domcomment_put_data,
765 domcomment_get_length,
766 domcomment_substringData,
767 domcomment_appendData,
768 domcomment_insertData,
769 domcomment_deleteData,
770 domcomment_replaceData
773 IUnknown* create_comment( xmlNodePtr comment )
775 domcomment *This;
776 HRESULT hr;
778 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
779 if ( !This )
780 return NULL;
782 This->lpVtbl = &domcomment_vtbl;
783 This->ref = 1;
785 This->node_unk = create_basic_node( comment, (IUnknown*)&This->lpVtbl );
786 if(!This->node_unk)
788 HeapFree(GetProcessHeap(), 0, This);
789 return NULL;
792 hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
793 if(FAILED(hr))
795 IUnknown_Release(This->node_unk);
796 HeapFree( GetProcessHeap(), 0, This );
797 return NULL;
799 /* The ref on This->node is actually looped back into this object, so release it */
800 IXMLDOMNode_Release(This->node);
802 return (IUnknown*) &This->lpVtbl;
805 #endif