Changes of picasa-wine-2.2.2820-5 except to configure
[wine/hacks.git] / dlls / mshtml / htmlelem.c
blob7adfc89a935dfa7c345fe342ec057c2d0de7da88
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
32 #include "wine/debug.h"
33 #include "wine/unicode.h"
35 #include "mshtml_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 static HRESULT HTMLElementCollection_Create(IUnknown*,HTMLElement**,DWORD,IDispatch**);
41 typedef struct {
42 HTMLElement **buf;
43 DWORD len;
44 DWORD size;
45 } elem_vector;
47 static void elem_vector_add(elem_vector *buf, HTMLElement *elem)
49 if(buf->len == buf->size) {
50 buf->size <<= 1;
51 buf->buf = HeapReAlloc(GetProcessHeap(), 0, buf->buf, buf->size*sizeof(HTMLElement**));
54 buf->buf[buf->len++] = elem;
57 #define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
59 static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
60 REFIID riid, void **ppv)
62 HTMLElement *This = HTMLELEM_THIS(iface);
63 HRESULT hres;
65 if(This->impl)
66 return IUnknown_QueryInterface(This->impl, riid, ppv);
68 hres = HTMLElement_QI(This, riid, ppv);
69 if(FAILED(hres))
70 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
72 return hres;
75 static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
77 HTMLElement *This = HTMLELEM_THIS(iface);
79 if(This->impl)
80 return IUnknown_AddRef(This->impl);
82 TRACE("(%p)\n", This);
83 return IHTMLDocument2_AddRef(HTMLDOC(This->node->doc));
86 static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
88 HTMLElement *This = HTMLELEM_THIS(iface);
90 if(This->impl)
91 return IUnknown_Release(This->impl);
93 TRACE("(%p)\n", This);
94 return IHTMLDocument2_Release(HTMLDOC(This->node->doc));
97 static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
99 HTMLElement *This = HTMLELEM_THIS(iface);
100 FIXME("(%p)->(%p)\n", This, pctinfo);
101 return E_NOTIMPL;
104 static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
105 LCID lcid, ITypeInfo **ppTInfo)
107 HTMLElement *This = HTMLELEM_THIS(iface);
108 FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
109 return E_NOTIMPL;
112 static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
113 LPOLESTR *rgszNames, UINT cNames,
114 LCID lcid, DISPID *rgDispId)
116 HTMLElement *This = HTMLELEM_THIS(iface);
117 FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
118 lcid, rgDispId);
119 return E_NOTIMPL;
122 static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
123 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
124 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
126 HTMLElement *This = HTMLELEM_THIS(iface);
127 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
128 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
129 return E_NOTIMPL;
132 static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
133 VARIANT AttributeValue, LONG lFlags)
135 HTMLElement *This = HTMLELEM_THIS(iface);
136 FIXME("(%p)->(%s . %08lx)\n", This, debugstr_w(strAttributeName), lFlags);
137 return E_NOTIMPL;
140 static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
141 LONG lFlags, VARIANT *AttributeValue)
143 HTMLElement *This = HTMLELEM_THIS(iface);
144 nsAString attr_str;
145 nsAString value_str;
146 const PRUnichar *value;
147 nsresult nsres;
148 HRESULT hres = S_OK;
150 WARN("(%p)->(%s %08lx %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
152 nsAString_Init(&attr_str, strAttributeName);
153 nsAString_Init(&value_str, NULL);
155 nsres = nsIDOMHTMLElement_GetAttribute(This->nselem, &attr_str, &value_str);
156 nsAString_Finish(&attr_str);
158 if(NS_SUCCEEDED(nsres)) {
159 nsAString_GetData(&value_str, &value, NULL);
160 V_VT(AttributeValue) = VT_BSTR;
161 V_BSTR(AttributeValue) = SysAllocString(value);;
162 TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
163 }else {
164 ERR("GetAttribute failed: %08lx\n", nsres);
165 hres = E_FAIL;
168 nsAString_Finish(&value_str);
170 return hres;
173 static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
174 LONG lFlags, VARIANT_BOOL *pfSuccess)
176 HTMLElement *This = HTMLELEM_THIS(iface);
177 FIXME("(%p)->()\n", This);
178 return E_NOTIMPL;
181 static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
183 HTMLElement *This = HTMLELEM_THIS(iface);
184 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
185 return E_NOTIMPL;
188 static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
190 HTMLElement *This = HTMLELEM_THIS(iface);
191 FIXME("(%p)->(%p)\n", This, p);
192 return E_NOTIMPL;
195 static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
197 HTMLElement *This = HTMLELEM_THIS(iface);
198 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
199 return E_NOTIMPL;
202 static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
204 HTMLElement *This = HTMLELEM_THIS(iface);
205 FIXME("(%p)->(%p)\n", This, p);
206 return E_NOTIMPL;
209 static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
211 HTMLElement *This = HTMLELEM_THIS(iface);
212 FIXME("(%p)->(%p)\n", This, p);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
218 HTMLElement *This = HTMLELEM_THIS(iface);
219 FIXME("(%p)->(%p)\n", This, p);
220 return E_NOTIMPL;
223 static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
225 HTMLElement *This = HTMLELEM_THIS(iface);
226 FIXME("(%p)->(%p)\n", This, p);
227 return E_NOTIMPL;
230 static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
232 HTMLElement *This = HTMLELEM_THIS(iface);
233 FIXME("(%p)->()\n", This);
234 return E_NOTIMPL;
237 static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
239 HTMLElement *This = HTMLELEM_THIS(iface);
240 FIXME("(%p)->(%p)\n", This, p);
241 return E_NOTIMPL;
244 static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
246 HTMLElement *This = HTMLELEM_THIS(iface);
247 FIXME("(%p)->()\n", This);
248 return E_NOTIMPL;
251 static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
253 HTMLElement *This = HTMLELEM_THIS(iface);
254 FIXME("(%p)->(%p)\n", This, p);
255 return E_NOTIMPL;
258 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
260 HTMLElement *This = HTMLELEM_THIS(iface);
261 FIXME("(%p)->()\n", This);
262 return E_NOTIMPL;
265 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
267 HTMLElement *This = HTMLELEM_THIS(iface);
268 FIXME("(%p)->(%p)\n", This, p);
269 return E_NOTIMPL;
272 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
274 HTMLElement *This = HTMLELEM_THIS(iface);
275 FIXME("(%p)->()\n", This);
276 return E_NOTIMPL;
279 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
281 HTMLElement *This = HTMLELEM_THIS(iface);
282 FIXME("(%p)->(%p)\n", This, p);
283 return E_NOTIMPL;
286 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
288 HTMLElement *This = HTMLELEM_THIS(iface);
289 FIXME("(%p)->()\n", This);
290 return E_NOTIMPL;
293 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
295 HTMLElement *This = HTMLELEM_THIS(iface);
296 FIXME("(%p)->(%p)\n", This, p);
297 return E_NOTIMPL;
300 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
302 HTMLElement *This = HTMLELEM_THIS(iface);
303 FIXME("(%p)->()\n", This);
304 return E_NOTIMPL;
307 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
309 HTMLElement *This = HTMLELEM_THIS(iface);
310 FIXME("(%p)->(%p)\n", This, p);
311 return E_NOTIMPL;
314 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
316 HTMLElement *This = HTMLELEM_THIS(iface);
317 FIXME("(%p)->()\n", This);
318 return E_NOTIMPL;
321 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
323 HTMLElement *This = HTMLELEM_THIS(iface);
324 FIXME("(%p)->(%p)\n", This, p);
325 return E_NOTIMPL;
328 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
330 HTMLElement *This = HTMLELEM_THIS(iface);
331 FIXME("(%p)->()\n", This);
332 return E_NOTIMPL;
335 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
337 HTMLElement *This = HTMLELEM_THIS(iface);
338 FIXME("(%p)->(%p)\n", This, p);
339 return E_NOTIMPL;
342 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
344 HTMLElement *This = HTMLELEM_THIS(iface);
345 FIXME("(%p)->()\n", This);
346 return E_NOTIMPL;
349 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
351 HTMLElement *This = HTMLELEM_THIS(iface);
352 FIXME("(%p)->(%p)\n", This, p);
353 return E_NOTIMPL;
356 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
358 HTMLElement *This = HTMLELEM_THIS(iface);
359 FIXME("(%p)->()\n", This);
360 return E_NOTIMPL;
363 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
365 HTMLElement *This = HTMLELEM_THIS(iface);
366 FIXME("(%p)->(%p)\n", This, p);
367 return E_NOTIMPL;
370 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
372 HTMLElement *This = HTMLELEM_THIS(iface);
373 FIXME("(%p)->()\n", This);
374 return E_NOTIMPL;
377 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
379 HTMLElement *This = HTMLELEM_THIS(iface);
380 FIXME("(%p)->(%p)\n", This, p);
381 return E_NOTIMPL;
384 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
386 HTMLElement *This = HTMLELEM_THIS(iface);
387 FIXME("(%p)->(%p)\n", This, p);
388 return E_NOTIMPL;
391 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
393 HTMLElement *This = HTMLELEM_THIS(iface);
394 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
395 return E_NOTIMPL;
398 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
400 HTMLElement *This = HTMLELEM_THIS(iface);
401 FIXME("(%p)->(%p)\n", This, p);
402 return E_NOTIMPL;
405 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
407 HTMLElement *This = HTMLELEM_THIS(iface);
408 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
409 return E_NOTIMPL;
412 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
414 HTMLElement *This = HTMLELEM_THIS(iface);
415 FIXME("(%p)->(%p)\n", This, p);
416 return E_NOTIMPL;
419 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
421 HTMLElement *This = HTMLELEM_THIS(iface);
422 FIXME("(%p)->()\n", This);
423 return E_NOTIMPL;
426 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
428 HTMLElement *This = HTMLELEM_THIS(iface);
429 FIXME("(%p)->(%p)\n", This, p);
430 return E_NOTIMPL;
433 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
435 HTMLElement *This = HTMLELEM_THIS(iface);
436 FIXME("(%p)->()\n", This);
437 return E_NOTIMPL;
440 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
441 VARIANT_BOOL *pfResult)
443 HTMLElement *This = HTMLELEM_THIS(iface);
444 FIXME("(%p)->(%p %p)\n", This, pChild, pfResult);
445 return E_NOTIMPL;
448 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, long *p)
450 HTMLElement *This = HTMLELEM_THIS(iface);
451 FIXME("(%p)->(%p)\n", This, p);
452 return E_NOTIMPL;
455 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
457 HTMLElement *This = HTMLELEM_THIS(iface);
458 FIXME("(%p)->(%p)\n", This, p);
459 return E_NOTIMPL;
462 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
464 HTMLElement *This = HTMLELEM_THIS(iface);
465 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
466 return E_NOTIMPL;
469 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
471 HTMLElement *This = HTMLELEM_THIS(iface);
472 FIXME("(%p)->(%p)\n", This, p);
473 return E_NOTIMPL;
476 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, long *p)
478 HTMLElement *This = HTMLELEM_THIS(iface);
479 FIXME("(%p)->(%p)\n", This, p);
480 return E_NOTIMPL;
483 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, long *p)
485 HTMLElement *This = HTMLELEM_THIS(iface);
486 FIXME("(%p)->(%p)\n", This, p);
487 return E_NOTIMPL;
490 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, long *p)
492 HTMLElement *This = HTMLELEM_THIS(iface);
493 FIXME("(%p)->(%p)\n", This, p);
494 return E_NOTIMPL;
497 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, long *p)
499 HTMLElement *This = HTMLELEM_THIS(iface);
500 FIXME("(%p)->(%p)\n", This, p);
501 return E_NOTIMPL;
504 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
506 HTMLElement *This = HTMLELEM_THIS(iface);
507 FIXME("(%p)->(%p)\n", This, p);
508 return E_NOTIMPL;
511 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
513 HTMLElement *This = HTMLELEM_THIS(iface);
514 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
515 return E_NOTIMPL;
518 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
520 HTMLElement *This = HTMLELEM_THIS(iface);
521 FIXME("(%p)->(%p)\n", This, p);
522 return E_NOTIMPL;
525 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
527 HTMLElement *This = HTMLELEM_THIS(iface);
528 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
529 return E_NOTIMPL;
532 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
534 HTMLElement *This = HTMLELEM_THIS(iface);
535 FIXME("(%p)->(%p)\n", This, p);
536 return E_NOTIMPL;
539 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
541 HTMLElement *This = HTMLELEM_THIS(iface);
542 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
543 return E_NOTIMPL;
546 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
548 HTMLElement *This = HTMLELEM_THIS(iface);
549 FIXME("(%p)->(%p)\n", This, p);
550 return E_NOTIMPL;
553 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
555 HTMLElement *This = HTMLELEM_THIS(iface);
556 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
557 return E_NOTIMPL;
560 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
562 HTMLElement *This = HTMLELEM_THIS(iface);
563 FIXME("(%p)->(%p)\n", This, p);
564 return E_NOTIMPL;
567 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
568 BSTR html)
570 HTMLElement *This = HTMLELEM_THIS(iface);
571 FIXME("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
572 return E_NOTIMPL;
575 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
576 BSTR text)
578 HTMLElement *This = HTMLELEM_THIS(iface);
579 FIXME("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
580 return E_NOTIMPL;
583 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
585 HTMLElement *This = HTMLELEM_THIS(iface);
586 FIXME("(%p)->(%p)\n", This, p);
587 return E_NOTIMPL;
590 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
592 HTMLElement *This = HTMLELEM_THIS(iface);
593 FIXME("(%p)->(%p)\n", This, p);
594 return E_NOTIMPL;
597 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
599 HTMLElement *This = HTMLELEM_THIS(iface);
600 FIXME("(%p)\n", This);
601 return E_NOTIMPL;
604 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,
605 IHTMLFiltersCollection **p)
607 HTMLElement *This = HTMLELEM_THIS(iface);
608 FIXME("(%p)->(%p)\n", This, p);
609 return E_NOTIMPL;
612 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
614 HTMLElement *This = HTMLELEM_THIS(iface);
615 FIXME("(%p)->()\n", This);
616 return E_NOTIMPL;
619 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
621 HTMLElement *This = HTMLELEM_THIS(iface);
622 FIXME("(%p)->(%p)\n", This, p);
623 return E_NOTIMPL;
626 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
628 HTMLElement *This = HTMLELEM_THIS(iface);
629 FIXME("(%p)->(%p)\n", This, String);
630 return E_NOTIMPL;
633 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
635 HTMLElement *This = HTMLELEM_THIS(iface);
636 FIXME("(%p)->()\n", This);
637 return E_NOTIMPL;
640 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
642 HTMLElement *This = HTMLELEM_THIS(iface);
643 FIXME("(%p)->(%p)\n", This, p);
644 return E_NOTIMPL;
647 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
649 HTMLElement *This = HTMLELEM_THIS(iface);
650 FIXME("(%p)->()\n", This);
651 return E_NOTIMPL;
654 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
656 HTMLElement *This = HTMLELEM_THIS(iface);
657 FIXME("(%p)->(%p)\n", This, p);
658 return E_NOTIMPL;
661 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
663 HTMLElement *This = HTMLELEM_THIS(iface);
664 FIXME("(%p)->()\n", This);
665 return E_NOTIMPL;
668 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
670 HTMLElement *This = HTMLELEM_THIS(iface);
671 FIXME("(%p)->(%p)\n", This, p);
672 return E_NOTIMPL;
675 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
677 HTMLElement *This = HTMLELEM_THIS(iface);
678 FIXME("(%p)->()\n", This);
679 return E_NOTIMPL;
682 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
684 HTMLElement *This = HTMLELEM_THIS(iface);
685 FIXME("(%p)->(%p)\n", This, p);
686 return E_NOTIMPL;
689 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
691 HTMLElement *This = HTMLELEM_THIS(iface);
692 FIXME("(%p)->()\n", This);
693 return E_NOTIMPL;
696 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
698 HTMLElement *This = HTMLELEM_THIS(iface);
699 FIXME("(%p)->(%p)\n", This, p);
700 return E_NOTIMPL;
703 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
705 HTMLElement *This = HTMLELEM_THIS(iface);
706 FIXME("(%p)->()\n", This);
707 return E_NOTIMPL;
710 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
712 HTMLElement *This = HTMLELEM_THIS(iface);
713 FIXME("(%p)->(%p)\n", This, p);
714 return E_NOTIMPL;
717 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
719 HTMLElement *This = HTMLELEM_THIS(iface);
720 FIXME("(%p)->()\n", This);
721 return E_NOTIMPL;
724 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
726 HTMLElement *This = HTMLELEM_THIS(iface);
727 FIXME("(%p)->(%p)\n", This, p);
728 return E_NOTIMPL;
731 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
733 HTMLElement *This = HTMLELEM_THIS(iface);
734 FIXME("(%p)->()\n", This);
735 return E_NOTIMPL;
738 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
740 HTMLElement *This = HTMLELEM_THIS(iface);
741 FIXME("(%p)->(%p)\n", This, p);
742 return E_NOTIMPL;
745 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
747 HTMLElement *This = HTMLELEM_THIS(iface);
748 FIXME("(%p)->()\n", This);
749 return E_NOTIMPL;
752 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
754 HTMLElement *This = HTMLELEM_THIS(iface);
755 FIXME("(%p)->(%p)\n", This, p);
756 return E_NOTIMPL;
759 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
761 HTMLElement *This = HTMLELEM_THIS(iface);
762 FIXME("(%p)->(%p)\n", This, p);
763 return E_NOTIMPL;
766 static void create_all_list(HTMLDocument *doc, HTMLElement *elem, elem_vector *buf)
768 nsIDOMNodeList *nsnode_list;
769 nsIDOMNode *iter;
770 PRUint32 list_len = 0, i;
771 HTMLDOMNode *node;
772 nsresult nsres;
774 nsres = nsIDOMNode_GetChildNodes(elem->node->nsnode, &nsnode_list);
775 if(NS_FAILED(nsres)) {
776 ERR("GetChildNodes failed: %08lx\n", nsres);
777 return;
780 nsIDOMNodeList_GetLength(nsnode_list, &list_len);
781 if(!list_len)
782 return;
784 for(i=0; i<list_len; i++) {
785 nsres = nsIDOMNodeList_Item(nsnode_list, i, &iter);
786 if(NS_FAILED(nsres)) {
787 ERR("Item failed: %08lx\n", nsres);
788 continue;
791 node = get_node(doc, iter);
792 if(node->node_type != NT_HTMLELEM)
793 continue;
795 elem_vector_add(buf, (HTMLElement*)node->impl.elem);
796 create_all_list(doc, (HTMLElement*)node->impl.elem, buf);
800 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
802 HTMLElement *This = HTMLELEM_THIS(iface);
803 elem_vector buf = {NULL, 0, 8};
805 TRACE("(%p)->(%p)\n", This, p);
807 buf.buf = HeapAlloc(GetProcessHeap(), 0, buf.size*sizeof(HTMLElement**));
809 create_all_list(This->node->doc, This, &buf);
811 if(!buf.len) {
812 HeapFree(GetProcessHeap(), 0, buf.buf);
813 buf.buf = NULL;
814 }else if(buf.size > buf.len) {
815 buf.buf = HeapReAlloc(GetProcessHeap(), 0, buf.buf, buf.len*sizeof(HTMLElement**));
818 return HTMLElementCollection_Create((IUnknown*)HTMLELEM(This), buf.buf, buf.len, p);
821 static void HTMLElement_destructor(IUnknown *iface)
823 HTMLElement *This = HTMLELEM_THIS(iface);
825 if(This->destructor)
826 This->destructor(This->impl);
828 if(This->nselem)
829 nsIDOMHTMLElement_Release(This->nselem);
831 HeapFree(GetProcessHeap(), 0, This);
834 #undef HTMLELEM_THIS
836 static const IHTMLElementVtbl HTMLElementVtbl = {
837 HTMLElement_QueryInterface,
838 HTMLElement_AddRef,
839 HTMLElement_Release,
840 HTMLElement_GetTypeInfoCount,
841 HTMLElement_GetTypeInfo,
842 HTMLElement_GetIDsOfNames,
843 HTMLElement_Invoke,
844 HTMLElement_setAttribute,
845 HTMLElement_getAttribute,
846 HTMLElement_removeAttribute,
847 HTMLElement_put_className,
848 HTMLElement_get_className,
849 HTMLElement_put_id,
850 HTMLElement_get_id,
851 HTMLElement_get_tagName,
852 HTMLElement_get_parentElement,
853 HTMLElement_get_style,
854 HTMLElement_put_onhelp,
855 HTMLElement_get_onhelp,
856 HTMLElement_put_onclick,
857 HTMLElement_get_onclick,
858 HTMLElement_put_ondblclick,
859 HTMLElement_get_ondblclick,
860 HTMLElement_put_onkeydown,
861 HTMLElement_get_onkeydown,
862 HTMLElement_put_onkeyup,
863 HTMLElement_get_onkeyup,
864 HTMLElement_put_onkeypress,
865 HTMLElement_get_onkeypress,
866 HTMLElement_put_onmouseout,
867 HTMLElement_get_onmouseout,
868 HTMLElement_put_onmouseover,
869 HTMLElement_get_onmouseover,
870 HTMLElement_put_onmousemove,
871 HTMLElement_get_onmousemove,
872 HTMLElement_put_onmousedown,
873 HTMLElement_get_onmousedown,
874 HTMLElement_put_onmouseup,
875 HTMLElement_get_onmouseup,
876 HTMLElement_get_document,
877 HTMLElement_put_title,
878 HTMLElement_get_title,
879 HTMLElement_put_language,
880 HTMLElement_get_language,
881 HTMLElement_put_onselectstart,
882 HTMLElement_get_onselectstart,
883 HTMLElement_scrollIntoView,
884 HTMLElement_contains,
885 HTMLElement_get_sourceIndex,
886 HTMLElement_get_recordNumber,
887 HTMLElement_put_lang,
888 HTMLElement_get_lang,
889 HTMLElement_get_offsetLeft,
890 HTMLElement_get_offsetTop,
891 HTMLElement_get_offsetWidth,
892 HTMLElement_get_offsetHeight,
893 HTMLElement_get_offsetParent,
894 HTMLElement_put_innerHTML,
895 HTMLElement_get_innerHTML,
896 HTMLElement_put_innerText,
897 HTMLElement_get_innerText,
898 HTMLElement_put_outerHTML,
899 HTMLElement_get_outerHTML,
900 HTMLElement_put_outerText,
901 HTMLElement_get_outerText,
902 HTMLElement_insertAdjacentHTML,
903 HTMLElement_insertAdjacentText,
904 HTMLElement_get_parentTextEdit,
905 HTMLElement_get_isTextEdit,
906 HTMLElement_click,
907 HTMLElement_get_filters,
908 HTMLElement_put_ondragstart,
909 HTMLElement_get_ondragstart,
910 HTMLElement_toString,
911 HTMLElement_put_onbeforeupdate,
912 HTMLElement_get_onbeforeupdate,
913 HTMLElement_put_onafterupdate,
914 HTMLElement_get_onafterupdate,
915 HTMLElement_put_onerrorupdate,
916 HTMLElement_get_onerrorupdate,
917 HTMLElement_put_onrowexit,
918 HTMLElement_get_onrowexit,
919 HTMLElement_put_onrowenter,
920 HTMLElement_get_onrowenter,
921 HTMLElement_put_ondatasetchanged,
922 HTMLElement_get_ondatasetchanged,
923 HTMLElement_put_ondataavailable,
924 HTMLElement_get_ondataavailable,
925 HTMLElement_put_ondatasetcomplete,
926 HTMLElement_get_ondatasetcomplete,
927 HTMLElement_put_onfilterchange,
928 HTMLElement_get_onfilterchange,
929 HTMLElement_get_children,
930 HTMLElement_get_all
933 HRESULT HTMLElement_QI(HTMLElement *This, REFIID riid, void **ppv)
935 *ppv = NULL;
937 if(IsEqualGUID(&IID_IUnknown, riid)) {
938 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
939 *ppv = HTMLELEM(This);
940 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
941 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
942 *ppv = HTMLELEM(This);
943 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
944 TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
945 *ppv = HTMLELEM(This);
946 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
947 TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This, ppv);
948 *ppv = HTMLELEM2(This);
951 if(*ppv) {
952 IHTMLElement_AddRef(HTMLELEM(This));
953 return S_OK;
956 return HTMLDOMNode_QI(This->node, riid, ppv);
959 void HTMLElement_Create(HTMLDOMNode *node)
961 HTMLElement *ret;
962 nsAString class_name_str;
963 const PRUnichar *class_name;
964 nsresult nsres;
966 static const WCHAR wszBODY[] = {'B','O','D','Y',0};
967 static const WCHAR wszINPUT[] = {'I','N','P','U','T',0};
968 static const WCHAR wszSELECT[] = {'S','E','L','E','C','T',0};
969 static const WCHAR wszTEXTAREA[] = {'T','E','X','T','A','R','E','A',0};
971 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElement));
972 ret->lpHTMLElementVtbl = &HTMLElementVtbl;
973 ret->node = node;
974 ret->impl = NULL;
975 ret->destructor = NULL;
977 node->node_type = NT_HTMLELEM;
978 node->impl.elem = HTMLELEM(ret);
979 node->destructor = HTMLElement_destructor;
981 HTMLElement2_Init(ret);
983 nsres = nsIDOMNode_QueryInterface(node->nsnode, &IID_nsIDOMHTMLElement, (void**)&ret->nselem);
984 if(NS_FAILED(nsres))
985 return;
987 nsAString_Init(&class_name_str, NULL);
988 nsIDOMHTMLElement_GetTagName(ret->nselem, &class_name_str);
990 nsAString_GetData(&class_name_str, &class_name, NULL);
992 if(!strcmpW(class_name, wszBODY))
993 HTMLBodyElement_Create(ret);
994 else if(!strcmpW(class_name, wszINPUT))
995 HTMLInputElement_Create(ret);
996 else if(!strcmpW(class_name, wszSELECT))
998 static const WCHAR wszFontName[] = {'F','o','n','t','N','a','m','e',0};
999 static const WCHAR wszFontSize[] = {'F','o','n','t','S','i','z','e',0};
1000 nsAString nodenamestr;
1001 const PRUnichar *node_name;
1002 nsAString_Init(&nodenamestr, NULL);
1003 nsIDOMHTMLElement_GetId(ret->nselem, &nodenamestr);
1004 nsAString_GetData(&nodenamestr, &node_name, NULL);
1005 TRACE("JPW node name [%s]\n", debugstr_w(node_name));
1006 if(strcmpW(node_name, wszFontName) && strcmpW(node_name, wszFontSize))
1007 HTMLSelectElement_Create(ret);
1008 else
1009 TRACE("JPW hack alert skipped! node name [%s]\n", debugstr_w(node_name));
1011 else if(!strcmpW(class_name, wszTEXTAREA))
1012 HTMLTextAreaElement_Create(ret);
1014 nsAString_Finish(&class_name_str);
1017 typedef struct {
1018 const IHTMLElementCollectionVtbl *lpHTMLElementCollectionVtbl;
1020 IUnknown *ref_unk;
1021 HTMLElement **elems;
1022 DWORD len;
1024 LONG ref;
1025 } HTMLElementCollection;
1027 #define HTMLELEMCOL(x) ((IHTMLElementCollection*) &(x)->lpHTMLElementCollectionVtbl)
1029 #define ELEMCOL_THIS(iface) DEFINE_THIS(HTMLElementCollection, HTMLElementCollection, iface)
1031 static HRESULT WINAPI HTMLElementCollection_QueryInterface(IHTMLElementCollection *iface,
1032 REFIID riid, void **ppv)
1034 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1036 *ppv = NULL;
1038 if(IsEqualGUID(&IID_IUnknown, riid)) {
1039 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1040 *ppv = HTMLELEMCOL(This);
1041 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1042 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1043 *ppv = HTMLELEMCOL(This);
1044 }else if(IsEqualGUID(&IID_IHTMLElementCollection, riid)) {
1045 TRACE("(%p)->(IID_IHTMLElementCollection %p)\n", This, ppv);
1046 *ppv = HTMLELEMCOL(This);
1049 if(*ppv) {
1050 IHTMLElementCollection_AddRef(HTMLELEMCOL(This));
1051 return S_OK;
1054 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
1055 return E_NOINTERFACE;
1058 static ULONG WINAPI HTMLElementCollection_AddRef(IHTMLElementCollection *iface)
1060 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1061 LONG ref = InterlockedIncrement(&This->ref);
1063 TRACE("(%p) ref=%ld\n", This, ref);
1065 return ref;
1068 static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface)
1070 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1071 LONG ref = InterlockedDecrement(&This->ref);
1073 TRACE("(%p) ref=%ld\n", This, ref);
1075 if(!ref) {
1076 IUnknown_Release(This->ref_unk);
1077 HeapFree(GetProcessHeap(), 0, This->elems);
1078 HeapFree(GetProcessHeap(), 0, This);
1081 return ref;
1084 static HRESULT WINAPI HTMLElementCollection_GetTypeInfoCount(IHTMLElementCollection *iface,
1085 UINT *pctinfo)
1087 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1088 FIXME("(%p)->(%p)\n", This, pctinfo);
1089 return E_NOTIMPL;
1092 static HRESULT WINAPI HTMLElementCollection_GetTypeInfo(IHTMLElementCollection *iface,
1093 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
1095 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1096 FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
1097 return E_NOTIMPL;
1100 static HRESULT WINAPI HTMLElementCollection_GetIDsOfNames(IHTMLElementCollection *iface,
1101 REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1103 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1104 FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
1105 lcid, rgDispId);
1106 return E_NOTIMPL;
1109 static HRESULT WINAPI HTMLElementCollection_Invoke(IHTMLElementCollection *iface,
1110 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1111 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1113 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1114 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1115 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1116 return E_NOTIMPL;
1119 static HRESULT WINAPI HTMLElementCollection_toString(IHTMLElementCollection *iface,
1120 BSTR *String)
1122 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1123 FIXME("(%p)->(%p)\n", This, String);
1124 return E_NOTIMPL;
1127 static HRESULT WINAPI HTMLElementCollection_put_length(IHTMLElementCollection *iface,
1128 long v)
1130 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1131 FIXME("(%p)->(%ld)\n", This, v);
1132 return E_NOTIMPL;
1135 static HRESULT WINAPI HTMLElementCollection_get_length(IHTMLElementCollection *iface,
1136 long *p)
1138 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1140 TRACE("(%p)->(%p)\n", This, p);
1142 *p = This->len;
1143 return S_OK;
1146 static HRESULT WINAPI HTMLElementCollection_get__newEnum(IHTMLElementCollection *iface,
1147 IUnknown **p)
1149 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1150 FIXME("(%p)->(%p)\n", This, p);
1151 return E_NOTIMPL;
1154 static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface,
1155 VARIANT name, VARIANT index, IDispatch **pdisp)
1157 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1159 if(V_VT(&index) != VT_I4) {
1160 WARN("Invalid index vt=%d\n", V_VT(&index));
1161 return E_INVALIDARG;
1164 if(V_VT(&name) != VT_I4 || V_I4(&name) != V_I4(&index))
1165 FIXME("Unsupproted name vt=%d\n", V_VT(&name));
1167 TRACE("(%p)->(%ld %ld %p)\n", This, V_I4(&name), V_I4(&index), pdisp);
1169 if(V_I4(&index) < 0 || V_I4(&index) >= This->len)
1170 return E_INVALIDARG;
1172 *pdisp = (IDispatch*)This->elems[V_I4(&index)];
1173 IDispatch_AddRef(*pdisp);
1174 return S_OK;
1177 static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface,
1178 VARIANT tagName, IDispatch **pdisp)
1180 HTMLElementCollection *This = ELEMCOL_THIS(iface);
1181 DWORD i;
1182 nsAString tag_str;
1183 const PRUnichar *tag;
1184 elem_vector buf = {NULL, 0, 8};
1186 if(V_VT(&tagName) != VT_BSTR) {
1187 WARN("Invalid arg\n");
1188 return DISP_E_MEMBERNOTFOUND;
1191 TRACE("(%p)->(%s %p)\n", This, debugstr_w(V_BSTR(&tagName)), pdisp);
1193 buf.buf = HeapAlloc(GetProcessHeap(), 0, buf.size*sizeof(HTMLElement*));
1195 nsAString_Init(&tag_str, NULL);
1197 for(i=0; i<This->len; i++) {
1198 if(!This->elems[i]->nselem)
1199 continue;
1201 nsIDOMElement_GetTagName(This->elems[i]->nselem, &tag_str);
1202 nsAString_GetData(&tag_str, &tag, NULL);
1204 if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, tag, -1,
1205 V_BSTR(&tagName), -1) == CSTR_EQUAL)
1206 elem_vector_add(&buf, This->elems[i]);
1209 nsAString_Finish(&tag_str);
1211 TRACE("fount %ld tags\n", buf.len);
1213 if(!buf.len) {
1214 HeapFree(GetProcessHeap(), 0, buf.buf);
1215 buf.buf = NULL;
1216 }else if(buf.size > buf.len) {
1217 buf.buf = HeapReAlloc(GetProcessHeap(), 0, buf.buf,
1218 buf.len*sizeof(HTMLElement**));
1221 return HTMLElementCollection_Create(This->ref_unk, buf.buf, buf.len, pdisp);
1224 #undef ELEMCOL_THIS
1226 static const IHTMLElementCollectionVtbl HTMLElementCollectionVtbl = {
1227 HTMLElementCollection_QueryInterface,
1228 HTMLElementCollection_AddRef,
1229 HTMLElementCollection_Release,
1230 HTMLElementCollection_GetTypeInfoCount,
1231 HTMLElementCollection_GetTypeInfo,
1232 HTMLElementCollection_GetIDsOfNames,
1233 HTMLElementCollection_Invoke,
1234 HTMLElementCollection_toString,
1235 HTMLElementCollection_put_length,
1236 HTMLElementCollection_get_length,
1237 HTMLElementCollection_get__newEnum,
1238 HTMLElementCollection_item,
1239 HTMLElementCollection_tags
1242 static HRESULT HTMLElementCollection_Create(IUnknown *ref_unk, HTMLElement **elems, DWORD len,
1243 IDispatch **p)
1245 HTMLElementCollection *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLElementCollection));
1247 ret->lpHTMLElementCollectionVtbl = &HTMLElementCollectionVtbl;
1248 ret->ref = 1;
1249 ret->elems = elems;
1250 ret->len = len;
1252 IUnknown_AddRef(ref_unk);
1253 ret->ref_unk = ref_unk;
1255 TRACE("ret=%p len=%ld\n", ret, len);
1257 *p = (IDispatch*)ret;
1258 return S_OK;