include: Specify calling convention explicitly in idl files where needed.
[wine/hramrach.git] / dlls / mshtml / htmlselect.c
blobf3aa36f650f938d7b72afd82665daa25bdf08714
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
31 #include "htmlevent.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 typedef struct {
36 HTMLElement element;
38 const IHTMLSelectElementVtbl *lpHTMLSelectElementVtbl;
40 nsIDOMHTMLSelectElement *nsselect;
41 } HTMLSelectElement;
43 #define HTMLSELECT(x) ((IHTMLSelectElement*) &(x)->lpHTMLSelectElementVtbl)
45 static HRESULT htmlselect_item(HTMLSelectElement *This, int i, IDispatch **ret)
47 nsIDOMHTMLOptionsCollection *nscol;
48 nsIDOMNode *nsnode;
49 nsresult nsres;
51 nsres = nsIDOMHTMLSelectElement_GetOptions(This->nsselect, &nscol);
52 if(NS_FAILED(nsres)) {
53 ERR("GetOptions failed: %08x\n", nsres);
54 return E_FAIL;
57 nsres = nsIDOMHTMLOptionsCollection_Item(nscol, i, &nsnode);
58 nsIDOMHTMLOptionsCollection_Release(nscol);
59 if(NS_FAILED(nsres)) {
60 ERR("Item failed: %08x\n", nsres);
61 return E_FAIL;
64 if(nsnode) {
65 HTMLDOMNode *node;
67 node = get_node(This->element.node.doc, nsnode, TRUE);
68 nsIDOMNode_Release(nsnode);
69 if(!node) {
70 ERR("Could not find node\n");
71 return E_FAIL;
74 IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
75 *ret = (IDispatch*)HTMLDOMNODE(node);
76 }else {
77 *ret = NULL;
79 return S_OK;
82 #define HTMLSELECT_THIS(iface) DEFINE_THIS(HTMLSelectElement, HTMLSelectElement, iface)
84 static HRESULT WINAPI HTMLSelectElement_QueryInterface(IHTMLSelectElement *iface,
85 REFIID riid, void **ppv)
87 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
89 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
92 static ULONG WINAPI HTMLSelectElement_AddRef(IHTMLSelectElement *iface)
94 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
96 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
99 static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
101 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
103 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
106 static HRESULT WINAPI HTMLSelectElement_GetTypeInfoCount(IHTMLSelectElement *iface, UINT *pctinfo)
108 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
110 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
113 static HRESULT WINAPI HTMLSelectElement_GetTypeInfo(IHTMLSelectElement *iface, UINT iTInfo,
114 LCID lcid, ITypeInfo **ppTInfo)
116 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
118 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
121 static HRESULT WINAPI HTMLSelectElement_GetIDsOfNames(IHTMLSelectElement *iface, REFIID riid,
122 LPOLESTR *rgszNames, UINT cNames,
123 LCID lcid, DISPID *rgDispId)
125 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
127 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
130 static HRESULT WINAPI HTMLSelectElement_Invoke(IHTMLSelectElement *iface, DISPID dispIdMember,
131 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
132 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
134 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
136 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid,
137 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
140 static HRESULT WINAPI HTMLSelectElement_put_size(IHTMLSelectElement *iface, LONG v)
142 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
143 FIXME("(%p)->(%d)\n", This, v);
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLSelectElement_get_size(IHTMLSelectElement *iface, LONG *p)
149 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
150 FIXME("(%p)->(%p)\n", This, p);
151 return E_NOTIMPL;
154 static HRESULT WINAPI HTMLSelectElement_put_multiple(IHTMLSelectElement *iface, VARIANT_BOOL v)
156 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
157 FIXME("(%p)->(%x)\n", This, v);
158 return E_NOTIMPL;
161 static HRESULT WINAPI HTMLSelectElement_get_multiple(IHTMLSelectElement *iface, VARIANT_BOOL *p)
163 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
164 FIXME("(%p)->(%p)\n", This, p);
165 return E_NOTIMPL;
168 static HRESULT WINAPI HTMLSelectElement_put_name(IHTMLSelectElement *iface, BSTR v)
170 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
171 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
172 return E_NOTIMPL;
175 static HRESULT WINAPI HTMLSelectElement_get_name(IHTMLSelectElement *iface, BSTR *p)
177 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
178 nsAString name_str;
179 const PRUnichar *name = NULL;
180 nsresult nsres;
182 TRACE("(%p)->(%p)\n", This, p);
184 nsAString_Init(&name_str, NULL);
186 nsres = nsIDOMHTMLSelectElement_GetName(This->nsselect, &name_str);
187 if(NS_SUCCEEDED(nsres)) {
188 static const WCHAR wszGarbage[] = {'g','a','r','b','a','g','e',0};
190 nsAString_GetData(&name_str, &name);
193 * Native never returns empty string here. If an element has no name,
194 * name of previous element or ramdom data is returned.
196 *p = SysAllocString(*name ? name : wszGarbage);
197 }else {
198 ERR("GetName failed: %08x\n", nsres);
201 nsAString_Finish(&name_str);
203 TRACE("name=%s\n", debugstr_w(*p));
204 return S_OK;
207 static HRESULT WINAPI HTMLSelectElement_get_options(IHTMLSelectElement *iface, IDispatch **p)
209 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
211 TRACE("(%p)->(%p)\n", This, p);
213 *p = (IDispatch*)HTMLSELECT(This);
214 IDispatch_AddRef(*p);
215 return S_OK;
218 static HRESULT WINAPI HTMLSelectElement_put_onchange(IHTMLSelectElement *iface, VARIANT v)
220 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
222 TRACE("(%p)->()\n", This);
224 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
227 static HRESULT WINAPI HTMLSelectElement_get_onchange(IHTMLSelectElement *iface, VARIANT *p)
229 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
230 FIXME("(%p)->(%p)\n", This, p);
231 return E_NOTIMPL;
234 static HRESULT WINAPI HTMLSelectElement_put_selectedIndex(IHTMLSelectElement *iface, LONG v)
236 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
237 nsresult nsres;
239 TRACE("(%p)->(%d)\n", This, v);
241 nsres = nsIDOMHTMLSelectElement_SetSelectedIndex(This->nsselect, v);
242 if(NS_FAILED(nsres))
243 ERR("SetSelectedIndex failed: %08x\n", nsres);
245 return S_OK;
248 static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *iface, LONG *p)
250 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
251 PRInt32 idx = 0;
252 nsresult nsres;
254 TRACE("(%p)->(%p)\n", This, p);
256 nsres = nsIDOMHTMLSelectElement_GetSelectedIndex(This->nsselect, &idx);
257 if(NS_FAILED(nsres))
258 ERR("GetSelectedIndex failed: %08x\n", nsres);
260 *p = idx;
261 return S_OK;
264 static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p)
266 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
267 const PRUnichar *type;
268 nsAString type_str;
269 nsresult nsres;
270 HRESULT hres = S_OK;
272 TRACE("(%p)->(%p)\n", This, p);
274 nsAString_Init(&type_str, NULL);
275 nsres = nsIDOMHTMLSelectElement_GetType(This->nsselect, &type_str);
276 if(NS_SUCCEEDED(nsres)) {
277 nsAString_GetData(&type_str, &type);
278 *p = *type ? SysAllocString(type) : NULL;
279 }else {
280 ERR("GetType failed: %08x\n", nsres);
281 hres = E_FAIL;
284 nsAString_Finish(&type_str);
286 return hres;
289 static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BSTR v)
291 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
292 nsAString value_str;
293 nsresult nsres;
295 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
297 nsAString_InitDepend(&value_str, v);
298 nsres = nsIDOMHTMLSelectElement_SetValue(This->nsselect, &value_str);
299 nsAString_Finish(&value_str);
300 if(NS_FAILED(nsres))
301 ERR("SetValue failed: %08x\n", nsres);
303 return S_OK;
306 static HRESULT WINAPI HTMLSelectElement_get_value(IHTMLSelectElement *iface, BSTR *p)
308 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
309 nsAString value_str;
310 const PRUnichar *value = NULL;
311 nsresult nsres;
313 TRACE("(%p)->(%p)\n", This, p);
315 nsAString_Init(&value_str, NULL);
317 nsres = nsIDOMHTMLSelectElement_GetValue(This->nsselect, &value_str);
318 if(NS_SUCCEEDED(nsres)) {
319 nsAString_GetData(&value_str, &value);
320 *p = *value ? SysAllocString(value) : NULL;
321 }else {
322 ERR("GetValue failed: %08x\n", nsres);
325 nsAString_Finish(&value_str);
327 TRACE("value=%s\n", debugstr_w(*p));
328 return S_OK;
331 static HRESULT WINAPI HTMLSelectElement_put_disabled(IHTMLSelectElement *iface, VARIANT_BOOL v)
333 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
334 nsresult nsres;
336 TRACE("(%p)->(%x)\n", This, v);
338 nsres = nsIDOMHTMLSelectElement_SetDisabled(This->nsselect, v != VARIANT_FALSE);
339 if(NS_FAILED(nsres)) {
340 ERR("SetDisabled failed: %08x\n", nsres);
341 return E_FAIL;
344 return S_OK;
347 static HRESULT WINAPI HTMLSelectElement_get_disabled(IHTMLSelectElement *iface, VARIANT_BOOL *p)
349 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
350 PRBool disabled = FALSE;
351 nsresult nsres;
353 TRACE("(%p)->(%p)\n", This, p);
355 nsres = nsIDOMHTMLSelectElement_GetDisabled(This->nsselect, &disabled);
356 if(NS_FAILED(nsres)) {
357 ERR("GetDisabled failed: %08x\n", nsres);
358 return E_FAIL;
361 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
362 return S_OK;
365 static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTMLFormElement **p)
367 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
368 FIXME("(%p)->(%p)\n", This, p);
369 return E_NOTIMPL;
372 static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElement *element,
373 VARIANT before)
375 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
376 IHTMLDOMNode *node, *tmp;
377 HRESULT hres;
379 FIXME("(%p)->(%p %s): semi-stub\n", This, element, debugstr_variant(&before));
381 if(V_VT(&before) != VT_EMPTY) {
382 FIXME("unhandled before %s\n", debugstr_variant(&before));
383 return E_NOTIMPL;
386 hres = IHTMLElement_QueryInterface(element, &IID_IHTMLDOMNode, (void**)&node);
387 if(FAILED(hres))
388 return hres;
390 hres = IHTMLDOMNode_appendChild(HTMLDOMNODE(&This->element.node), node, &tmp);
391 IHTMLDOMNode_Release(node);
392 if(SUCCEEDED(hres) && tmp)
393 IHTMLDOMNode_Release(tmp);
395 return hres;
398 static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG index)
400 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
401 FIXME("(%p)->(%d)\n", This, index);
402 return E_NOTIMPL;
405 static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LONG v)
407 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
408 nsresult nsres;
410 TRACE("(%p)->(%d)\n", This, v);
412 nsres = nsIDOMHTMLSelectElement_SetLength(This->nsselect, v);
413 if(NS_FAILED(nsres))
414 ERR("SetLength failed: %08x\n", nsres);
416 return S_OK;
419 static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, LONG *p)
421 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
422 PRUint32 length = 0;
423 nsresult nsres;
425 TRACE("(%p)->(%p)\n", This, p);
427 nsres = nsIDOMHTMLSelectElement_GetLength(This->nsselect, &length);
428 if(NS_FAILED(nsres))
429 ERR("GetLength failed: %08x\n", nsres);
431 *p = length;
433 TRACE("ret %d\n", *p);
434 return S_OK;
437 static HRESULT WINAPI HTMLSelectElement_get__newEnum(IHTMLSelectElement *iface, IUnknown **p)
439 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
440 FIXME("(%p)->(%p)\n", This, p);
441 return E_NOTIMPL;
444 static HRESULT WINAPI HTMLSelectElement_item(IHTMLSelectElement *iface, VARIANT name,
445 VARIANT index, IDispatch **pdisp)
447 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
449 TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&name), debugstr_variant(&index), pdisp);
451 if(!pdisp)
452 return E_POINTER;
453 *pdisp = NULL;
455 if(V_VT(&name) == VT_I4) {
456 if(V_I4(&name) < 0)
457 return E_INVALIDARG;
458 return htmlselect_item(This, V_I4(&name), pdisp);
461 FIXME("Unsupported args\n");
462 return E_NOTIMPL;
465 static HRESULT WINAPI HTMLSelectElement_tags(IHTMLSelectElement *iface, VARIANT tagName,
466 IDispatch **pdisp)
468 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
469 FIXME("(%p)->(v %p)\n", This, pdisp);
470 return E_NOTIMPL;
473 #undef HTMLSELECT_THIS
475 static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
476 HTMLSelectElement_QueryInterface,
477 HTMLSelectElement_AddRef,
478 HTMLSelectElement_Release,
479 HTMLSelectElement_GetTypeInfoCount,
480 HTMLSelectElement_GetTypeInfo,
481 HTMLSelectElement_GetIDsOfNames,
482 HTMLSelectElement_Invoke,
483 HTMLSelectElement_put_size,
484 HTMLSelectElement_get_size,
485 HTMLSelectElement_put_multiple,
486 HTMLSelectElement_get_multiple,
487 HTMLSelectElement_put_name,
488 HTMLSelectElement_get_name,
489 HTMLSelectElement_get_options,
490 HTMLSelectElement_put_onchange,
491 HTMLSelectElement_get_onchange,
492 HTMLSelectElement_put_selectedIndex,
493 HTMLSelectElement_get_selectedIndex,
494 HTMLSelectElement_get_type,
495 HTMLSelectElement_put_value,
496 HTMLSelectElement_get_value,
497 HTMLSelectElement_put_disabled,
498 HTMLSelectElement_get_disabled,
499 HTMLSelectElement_get_form,
500 HTMLSelectElement_add,
501 HTMLSelectElement_remove,
502 HTMLSelectElement_put_length,
503 HTMLSelectElement_get_length,
504 HTMLSelectElement_get__newEnum,
505 HTMLSelectElement_item,
506 HTMLSelectElement_tags
509 #define HTMLSELECT_NODE_THIS(iface) DEFINE_THIS2(HTMLSelectElement, element.node, iface)
511 static HRESULT HTMLSelectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
513 HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
515 *ppv = NULL;
517 if(IsEqualGUID(&IID_IUnknown, riid)) {
518 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
519 *ppv = HTMLSELECT(This);
520 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
521 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
522 *ppv = HTMLSELECT(This);
523 }else if(IsEqualGUID(&IID_IHTMLSelectElement, riid)) {
524 TRACE("(%p)->(IID_IHTMLSelectElement %p)\n", This, ppv);
525 *ppv = HTMLSELECT(This);
528 if(*ppv) {
529 IUnknown_AddRef((IUnknown*)*ppv);
530 return S_OK;
533 return HTMLElement_QI(&This->element.node, riid, ppv);
536 static void HTMLSelectElement_destructor(HTMLDOMNode *iface)
538 HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
540 nsIDOMHTMLSelectElement_Release(This->nsselect);
542 HTMLElement_destructor(&This->element.node);
545 static HRESULT HTMLSelectElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
547 HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
548 return IHTMLSelectElement_put_disabled(HTMLSELECT(This), v);
551 static HRESULT HTMLSelectElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
553 HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
554 return IHTMLSelectElement_get_disabled(HTMLSELECT(This), p);
557 #define DISPID_OPTIONCOL_0 MSHTML_DISPID_CUSTOM_MIN
559 static HRESULT HTMLSelectElement_get_dispid(HTMLDOMNode *iface, BSTR name, DWORD flags, DISPID *dispid)
561 const WCHAR *ptr;
562 DWORD idx = 0;
564 for(ptr = name; *ptr && isdigitW(*ptr); ptr++) {
565 idx = idx*10 + (*ptr-'0');
566 if(idx > MSHTML_CUSTOM_DISPID_CNT) {
567 WARN("too big idx\n");
568 return DISP_E_UNKNOWNNAME;
571 if(*ptr)
572 return DISP_E_UNKNOWNNAME;
574 *dispid = DISPID_OPTIONCOL_0 + idx;
575 return S_OK;
578 static HRESULT HTMLSelectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
579 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
581 HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
583 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
585 switch(flags) {
586 case DISPATCH_PROPERTYGET: {
587 IDispatch *ret;
588 HRESULT hres;
590 hres = htmlselect_item(This, id-DISPID_OPTIONCOL_0, &ret);
591 if(FAILED(hres))
592 return hres;
594 if(ret) {
595 V_VT(res) = VT_DISPATCH;
596 V_DISPATCH(res) = ret;
597 }else {
598 V_VT(res) = VT_NULL;
600 break;
603 default:
604 FIXME("unimplemented flags %x\n", flags);
605 return E_NOTIMPL;
608 return S_OK;
611 #undef HTMLSELECT_NODE_THIS
613 static const NodeImplVtbl HTMLSelectElementImplVtbl = {
614 HTMLSelectElement_QI,
615 HTMLSelectElement_destructor,
616 NULL,
617 NULL,
618 HTMLSelectElementImpl_put_disabled,
619 HTMLSelectElementImpl_get_disabled,
620 NULL,
621 NULL,
622 HTMLSelectElement_get_dispid,
623 HTMLSelectElement_invoke
626 static const tid_t HTMLSelectElement_tids[] = {
627 HTMLELEMENT_TIDS,
628 IHTMLSelectElement_tid,
632 static dispex_static_data_t HTMLSelectElement_dispex = {
633 NULL,
634 DispHTMLSelectElement_tid,
635 NULL,
636 HTMLSelectElement_tids
639 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
641 HTMLSelectElement *ret = heap_alloc_zero(sizeof(HTMLSelectElement));
642 nsresult nsres;
644 ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
645 ret->element.node.vtbl = &HTMLSelectElementImplVtbl;
647 HTMLElement_Init(&ret->element, doc, nselem, &HTMLSelectElement_dispex);
649 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement,
650 (void**)&ret->nsselect);
651 if(NS_FAILED(nsres))
652 ERR("Could not get nsIDOMHTMLSelectElement interfce: %08x\n", nsres);
654 return &ret->element;