2 * Copyright 2008 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
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
34 typedef struct HTMLPluginsCollection HTMLPluginsCollection
;
35 typedef struct HTMLMimeTypesCollection HTMLMimeTypesCollection
;
39 IOmNavigator IOmNavigator_iface
;
43 HTMLPluginsCollection
*plugins
;
44 HTMLMimeTypesCollection
*mime_types
;
49 IOmHistory IOmHistory_iface
;
54 static inline OmHistory
*impl_from_IOmHistory(IOmHistory
*iface
)
56 return CONTAINING_RECORD(iface
, OmHistory
, IOmHistory_iface
);
59 static HRESULT WINAPI
OmHistory_QueryInterface(IOmHistory
*iface
, REFIID riid
, void **ppv
)
61 OmHistory
*This
= impl_from_IOmHistory(iface
);
65 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
66 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
67 *ppv
= &This
->IOmHistory_iface
;
68 }else if(IsEqualGUID(&IID_IOmHistory
, riid
)) {
69 TRACE("(%p)->(IID_IOmHistory %p)\n", This
, ppv
);
70 *ppv
= &This
->IOmHistory_iface
;
71 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
72 return *ppv
? S_OK
: E_NOINTERFACE
;
76 IUnknown_AddRef((IUnknown
*)*ppv
);
80 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
84 static ULONG WINAPI
OmHistory_AddRef(IOmHistory
*iface
)
86 OmHistory
*This
= impl_from_IOmHistory(iface
);
87 LONG ref
= InterlockedIncrement(&This
->ref
);
89 TRACE("(%p) ref=%d\n", This
, ref
);
94 static ULONG WINAPI
OmHistory_Release(IOmHistory
*iface
)
96 OmHistory
*This
= impl_from_IOmHistory(iface
);
97 LONG ref
= InterlockedDecrement(&This
->ref
);
99 TRACE("(%p) ref=%d\n", This
, ref
);
102 release_dispex(&This
->dispex
);
109 static HRESULT WINAPI
OmHistory_GetTypeInfoCount(IOmHistory
*iface
, UINT
*pctinfo
)
111 OmHistory
*This
= impl_from_IOmHistory(iface
);
112 FIXME("(%p)->(%p)\n", This
, pctinfo
);
116 static HRESULT WINAPI
OmHistory_GetTypeInfo(IOmHistory
*iface
, UINT iTInfo
,
117 LCID lcid
, ITypeInfo
**ppTInfo
)
119 OmHistory
*This
= impl_from_IOmHistory(iface
);
121 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
124 static HRESULT WINAPI
OmHistory_GetIDsOfNames(IOmHistory
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
125 LCID lcid
, DISPID
*rgDispId
)
127 OmHistory
*This
= impl_from_IOmHistory(iface
);
129 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
133 static HRESULT WINAPI
OmHistory_Invoke(IOmHistory
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
134 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
136 OmHistory
*This
= impl_from_IOmHistory(iface
);
138 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
139 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
142 static HRESULT WINAPI
OmHistory_get_length(IOmHistory
*iface
, short *p
)
144 OmHistory
*This
= impl_from_IOmHistory(iface
);
145 FIXME("(%p)->(%p)\n", This
, p
);
149 static HRESULT WINAPI
OmHistory_back(IOmHistory
*iface
, VARIANT
*pvargdistance
)
151 OmHistory
*This
= impl_from_IOmHistory(iface
);
152 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
156 static HRESULT WINAPI
OmHistory_forward(IOmHistory
*iface
, VARIANT
*pvargdistance
)
158 OmHistory
*This
= impl_from_IOmHistory(iface
);
159 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
163 static HRESULT WINAPI
OmHistory_go(IOmHistory
*iface
, VARIANT
*pvargdistance
)
165 OmHistory
*This
= impl_from_IOmHistory(iface
);
166 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
170 static const IOmHistoryVtbl OmHistoryVtbl
= {
171 OmHistory_QueryInterface
,
174 OmHistory_GetTypeInfoCount
,
175 OmHistory_GetTypeInfo
,
176 OmHistory_GetIDsOfNames
,
178 OmHistory_get_length
,
184 static const tid_t OmHistory_iface_tids
[] = {
188 static dispex_static_data_t OmHistory_dispex
= {
196 HRESULT
create_history(IOmHistory
**ret
)
200 history
= heap_alloc_zero(sizeof(*history
));
202 return E_OUTOFMEMORY
;
204 init_dispex(&history
->dispex
, (IUnknown
*)&history
->IOmHistory_iface
, &OmHistory_dispex
);
205 history
->IOmHistory_iface
.lpVtbl
= &OmHistoryVtbl
;
208 *ret
= &history
->IOmHistory_iface
;
212 struct HTMLPluginsCollection
{
214 IHTMLPluginsCollection IHTMLPluginsCollection_iface
;
218 OmNavigator
*navigator
;
221 static inline HTMLPluginsCollection
*impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection
*iface
)
223 return CONTAINING_RECORD(iface
, HTMLPluginsCollection
, IHTMLPluginsCollection_iface
);
226 static HRESULT WINAPI
HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection
*iface
, REFIID riid
, void **ppv
)
228 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
230 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
231 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
232 *ppv
= &This
->IHTMLPluginsCollection_iface
;
233 }else if(IsEqualGUID(&IID_IHTMLPluginsCollection
, riid
)) {
234 TRACE("(%p)->(IID_IHTMLPluginCollection %p)\n", This
, ppv
);
235 *ppv
= &This
->IHTMLPluginsCollection_iface
;
236 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
237 return *ppv
? S_OK
: E_NOINTERFACE
;
240 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
241 return E_NOINTERFACE
;
244 IUnknown_AddRef((IUnknown
*)*ppv
);
248 static ULONG WINAPI
HTMLPluginsCollection_AddRef(IHTMLPluginsCollection
*iface
)
250 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
251 LONG ref
= InterlockedIncrement(&This
->ref
);
253 TRACE("(%p) ref=%d\n", This
, ref
);
258 static ULONG WINAPI
HTMLPluginsCollection_Release(IHTMLPluginsCollection
*iface
)
260 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
261 LONG ref
= InterlockedDecrement(&This
->ref
);
263 TRACE("(%p) ref=%d\n", This
, ref
);
267 This
->navigator
->plugins
= NULL
;
268 release_dispex(&This
->dispex
);
275 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection
*iface
, UINT
*pctinfo
)
277 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
278 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
281 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection
*iface
, UINT iTInfo
,
282 LCID lcid
, ITypeInfo
**ppTInfo
)
284 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
285 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
288 static HRESULT WINAPI
HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection
*iface
, REFIID riid
,
289 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
291 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
292 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
296 static HRESULT WINAPI
HTMLPluginsCollection_Invoke(IHTMLPluginsCollection
*iface
, DISPID dispIdMember
,
297 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
298 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
300 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
301 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
302 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
305 static HRESULT WINAPI
HTMLPluginsCollection_get_length(IHTMLPluginsCollection
*iface
, LONG
*p
)
307 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
309 TRACE("(%p)->(%p)\n", This
, p
);
311 /* IE always returns 0 here */
316 static HRESULT WINAPI
HTMLPluginsCollection_refresh(IHTMLPluginsCollection
*iface
, VARIANT_BOOL reload
)
318 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
319 FIXME("(%p)->(%x)\n", This
, reload
);
323 static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl
= {
324 HTMLPluginsCollection_QueryInterface
,
325 HTMLPluginsCollection_AddRef
,
326 HTMLPluginsCollection_Release
,
327 HTMLPluginsCollection_GetTypeInfoCount
,
328 HTMLPluginsCollection_GetTypeInfo
,
329 HTMLPluginsCollection_GetIDsOfNames
,
330 HTMLPluginsCollection_Invoke
,
331 HTMLPluginsCollection_get_length
,
332 HTMLPluginsCollection_refresh
335 static const tid_t HTMLPluginsCollection_iface_tids
[] = {
336 IHTMLPluginsCollection_tid
,
339 static dispex_static_data_t HTMLPluginsCollection_dispex
= {
343 HTMLPluginsCollection_iface_tids
346 static HRESULT
create_plugins_collection(OmNavigator
*navigator
, HTMLPluginsCollection
**ret
)
348 HTMLPluginsCollection
*col
;
350 col
= heap_alloc_zero(sizeof(*col
));
352 return E_OUTOFMEMORY
;
354 col
->IHTMLPluginsCollection_iface
.lpVtbl
= &HTMLPluginsCollectionVtbl
;
356 col
->navigator
= navigator
;
358 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLPluginsCollection_iface
,
359 &HTMLPluginsCollection_dispex
);
365 struct HTMLMimeTypesCollection
{
367 IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface
;
371 OmNavigator
*navigator
;
374 static inline HTMLMimeTypesCollection
*impl_from_IHTMLMimeTypesCollection(IHTMLMimeTypesCollection
*iface
)
376 return CONTAINING_RECORD(iface
, HTMLMimeTypesCollection
, IHTMLMimeTypesCollection_iface
);
379 static HRESULT WINAPI
HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesCollection
*iface
, REFIID riid
, void **ppv
)
381 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
383 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
384 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
385 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
386 }else if(IsEqualGUID(&IID_IHTMLMimeTypesCollection
, riid
)) {
387 TRACE("(%p)->(IID_IHTMLMimeTypesCollection %p)\n", This
, ppv
);
388 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
389 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
390 return *ppv
? S_OK
: E_NOINTERFACE
;
393 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
394 return E_NOINTERFACE
;
397 IUnknown_AddRef((IUnknown
*)*ppv
);
401 static ULONG WINAPI
HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection
*iface
)
403 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
404 LONG ref
= InterlockedIncrement(&This
->ref
);
406 TRACE("(%p) ref=%d\n", This
, ref
);
411 static ULONG WINAPI
HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection
*iface
)
413 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
414 LONG ref
= InterlockedDecrement(&This
->ref
);
416 TRACE("(%p) ref=%d\n", This
, ref
);
420 This
->navigator
->mime_types
= NULL
;
421 release_dispex(&This
->dispex
);
428 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfoCount(IHTMLMimeTypesCollection
*iface
, UINT
*pctinfo
)
430 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
431 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
434 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfo(IHTMLMimeTypesCollection
*iface
, UINT iTInfo
,
435 LCID lcid
, ITypeInfo
**ppTInfo
)
437 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
438 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
441 static HRESULT WINAPI
HTMLMimeTypesCollection_GetIDsOfNames(IHTMLMimeTypesCollection
*iface
, REFIID riid
,
442 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
444 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
445 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
449 static HRESULT WINAPI
HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection
*iface
, DISPID dispIdMember
,
450 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
451 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
453 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
454 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
455 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
458 static HRESULT WINAPI
HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection
*iface
, LONG
*p
)
460 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
462 TRACE("(%p)->(%p)\n", This
, p
);
464 /* This is just a stub for compatibility with other browser in IE */
469 static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl
= {
470 HTMLMimeTypesCollection_QueryInterface
,
471 HTMLMimeTypesCollection_AddRef
,
472 HTMLMimeTypesCollection_Release
,
473 HTMLMimeTypesCollection_GetTypeInfoCount
,
474 HTMLMimeTypesCollection_GetTypeInfo
,
475 HTMLMimeTypesCollection_GetIDsOfNames
,
476 HTMLMimeTypesCollection_Invoke
,
477 HTMLMimeTypesCollection_get_length
480 static const tid_t HTMLMimeTypesCollection_iface_tids
[] = {
481 IHTMLMimeTypesCollection_tid
,
484 static dispex_static_data_t HTMLMimeTypesCollection_dispex
= {
486 IHTMLMimeTypesCollection_tid
,
488 HTMLMimeTypesCollection_iface_tids
491 static HRESULT
create_mime_types_collection(OmNavigator
*navigator
, HTMLMimeTypesCollection
**ret
)
493 HTMLMimeTypesCollection
*col
;
495 col
= heap_alloc_zero(sizeof(*col
));
497 return E_OUTOFMEMORY
;
499 col
->IHTMLMimeTypesCollection_iface
.lpVtbl
= &HTMLMimeTypesCollectionVtbl
;
501 col
->navigator
= navigator
;
503 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLMimeTypesCollection_iface
,
504 &HTMLMimeTypesCollection_dispex
);
510 static inline OmNavigator
*impl_from_IOmNavigator(IOmNavigator
*iface
)
512 return CONTAINING_RECORD(iface
, OmNavigator
, IOmNavigator_iface
);
515 static HRESULT WINAPI
OmNavigator_QueryInterface(IOmNavigator
*iface
, REFIID riid
, void **ppv
)
517 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
521 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
522 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
523 *ppv
= &This
->IOmNavigator_iface
;
524 }else if(IsEqualGUID(&IID_IOmNavigator
, riid
)) {
525 TRACE("(%p)->(IID_IOmNavigator %p)\n", This
, ppv
);
526 *ppv
= &This
->IOmNavigator_iface
;
527 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
528 return *ppv
? S_OK
: E_NOINTERFACE
;
532 IUnknown_AddRef((IUnknown
*)*ppv
);
536 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
537 return E_NOINTERFACE
;
540 static ULONG WINAPI
OmNavigator_AddRef(IOmNavigator
*iface
)
542 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
543 LONG ref
= InterlockedIncrement(&This
->ref
);
545 TRACE("(%p) ref=%d\n", This
, ref
);
550 static ULONG WINAPI
OmNavigator_Release(IOmNavigator
*iface
)
552 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
553 LONG ref
= InterlockedDecrement(&This
->ref
);
555 TRACE("(%p) ref=%d\n", This
, ref
);
559 This
->plugins
->navigator
= NULL
;
561 This
->mime_types
->navigator
= NULL
;
562 release_dispex(&This
->dispex
);
569 static HRESULT WINAPI
OmNavigator_GetTypeInfoCount(IOmNavigator
*iface
, UINT
*pctinfo
)
571 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
572 FIXME("(%p)->(%p)\n", This
, pctinfo
);
576 static HRESULT WINAPI
OmNavigator_GetTypeInfo(IOmNavigator
*iface
, UINT iTInfo
,
577 LCID lcid
, ITypeInfo
**ppTInfo
)
579 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
581 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
584 static HRESULT WINAPI
OmNavigator_GetIDsOfNames(IOmNavigator
*iface
, REFIID riid
,
585 LPOLESTR
*rgszNames
, UINT cNames
,
586 LCID lcid
, DISPID
*rgDispId
)
588 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
590 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
594 static HRESULT WINAPI
OmNavigator_Invoke(IOmNavigator
*iface
, DISPID dispIdMember
,
595 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
596 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
598 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
600 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
601 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
604 static HRESULT WINAPI
OmNavigator_get_appCodeName(IOmNavigator
*iface
, BSTR
*p
)
606 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
608 static const WCHAR mozillaW
[] = {'M','o','z','i','l','l','a',0};
610 TRACE("(%p)->(%p)\n", This
, p
);
612 *p
= SysAllocString(mozillaW
);
616 static HRESULT WINAPI
OmNavigator_get_appName(IOmNavigator
*iface
, BSTR
*p
)
618 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
620 static const WCHAR app_nameW
[] =
621 {'M','i','c','r','o','s','o','f','t',' ',
622 'I','n','t','e','r','n','e','t',' ',
623 'E','x','p','l','o','r','e','r',0};
625 TRACE("(%p)->(%p)\n", This
, p
);
627 *p
= SysAllocString(app_nameW
);
629 return E_OUTOFMEMORY
;
634 static HRESULT WINAPI
OmNavigator_get_appVersion(IOmNavigator
*iface
, BSTR
*p
)
636 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
638 char user_agent
[512];
642 TRACE("(%p)->(%p)\n", This
, p
);
644 size
= sizeof(user_agent
);
645 hres
= ObtainUserAgentString(0, user_agent
, &size
);
649 if(strncmp(user_agent
, "Mozilla/", 8)) {
650 FIXME("Unsupported user agent\n");
654 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, NULL
, 0);
655 *p
= SysAllocStringLen(NULL
, size
-1);
657 return E_OUTOFMEMORY
;
659 MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, *p
, size
);
663 static HRESULT WINAPI
OmNavigator_get_userAgent(IOmNavigator
*iface
, BSTR
*p
)
665 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
666 char user_agent
[512];
670 TRACE("(%p)->(%p)\n", This
, p
);
672 size
= sizeof(user_agent
);
673 hres
= ObtainUserAgentString(0, user_agent
, &size
);
677 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, NULL
, 0);
678 *p
= SysAllocStringLen(NULL
, size
-1);
680 return E_OUTOFMEMORY
;
682 MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, *p
, size
);
686 static HRESULT WINAPI
OmNavigator_javaEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
688 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
690 FIXME("(%p)->(%p) semi-stub\n", This
, enabled
);
692 *enabled
= VARIANT_TRUE
;
696 static HRESULT WINAPI
OmNavigator_taintEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
698 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
699 FIXME("(%p)->(%p)\n", This
, enabled
);
703 static HRESULT WINAPI
OmNavigator_get_mimeTypes(IOmNavigator
*iface
, IHTMLMimeTypesCollection
**p
)
705 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
707 TRACE("(%p)->(%p)\n", This
, p
);
709 if(!This
->mime_types
) {
712 hres
= create_mime_types_collection(This
, &This
->mime_types
);
716 IHTMLMimeTypesCollection_AddRef(&This
->mime_types
->IHTMLMimeTypesCollection_iface
);
719 *p
= &This
->mime_types
->IHTMLMimeTypesCollection_iface
;
723 static HRESULT WINAPI
OmNavigator_get_plugins(IOmNavigator
*iface
, IHTMLPluginsCollection
**p
)
725 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
727 TRACE("(%p)->(%p)\n", This
, p
);
732 hres
= create_plugins_collection(This
, &This
->plugins
);
736 IHTMLPluginsCollection_AddRef(&This
->plugins
->IHTMLPluginsCollection_iface
);
739 *p
= &This
->plugins
->IHTMLPluginsCollection_iface
;
743 static HRESULT WINAPI
OmNavigator_get_cookieEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
745 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
747 WARN("(%p)->(%p) semi-stub\n", This
, p
);
753 static HRESULT WINAPI
OmNavigator_get_opsProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
755 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
756 FIXME("(%p)->(%p)\n", This
, p
);
760 static HRESULT WINAPI
OmNavigator_toString(IOmNavigator
*iface
, BSTR
*String
)
762 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
764 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
766 TRACE("(%p)->(%p)\n", This
, String
);
771 *String
= SysAllocString(objectW
);
772 return *String
? S_OK
: E_OUTOFMEMORY
;
775 static HRESULT WINAPI
OmNavigator_get_cpuClass(IOmNavigator
*iface
, BSTR
*p
)
777 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
779 static const WCHAR cpu_classW
[] =
786 TRACE("(%p)->(%p)\n", This
, p
);
788 *p
= SysAllocString(cpu_classW
);
789 return *p
? S_OK
: E_OUTOFMEMORY
;
792 static HRESULT
get_language_string(LCID lcid
, BSTR
*p
)
797 len
= LCIDToLocaleName(lcid
, NULL
, 0, 0);
799 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
803 ret
= SysAllocStringLen(NULL
, len
-1);
805 return E_OUTOFMEMORY
;
807 len
= LCIDToLocaleName(lcid
, ret
, len
, 0);
809 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
818 static HRESULT WINAPI
OmNavigator_get_systemLanguage(IOmNavigator
*iface
, BSTR
*p
)
820 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
822 TRACE("(%p)->(%p)\n", This
, p
);
824 return get_language_string(LOCALE_SYSTEM_DEFAULT
, p
);
827 static HRESULT WINAPI
OmNavigator_get_browserLanguage(IOmNavigator
*iface
, BSTR
*p
)
829 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
831 TRACE("(%p)->(%p)\n", This
, p
);
833 return get_language_string(GetUserDefaultUILanguage(), p
);
836 static HRESULT WINAPI
OmNavigator_get_userLanguage(IOmNavigator
*iface
, BSTR
*p
)
838 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
840 TRACE("(%p)->(%p)\n", This
, p
);
842 return get_language_string(LOCALE_USER_DEFAULT
, p
);
845 static HRESULT WINAPI
OmNavigator_get_platform(IOmNavigator
*iface
, BSTR
*p
)
847 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
850 static const WCHAR platformW
[] = {'W','i','n','6','4',0};
852 static const WCHAR platformW
[] = {'W','i','n','3','2',0};
855 TRACE("(%p)->(%p)\n", This
, p
);
857 *p
= SysAllocString(platformW
);
861 static HRESULT WINAPI
OmNavigator_get_appMinorVersion(IOmNavigator
*iface
, BSTR
*p
)
863 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
865 static const WCHAR zeroW
[] = {'0',0};
867 TRACE("(%p)->(%p)\n", This
, p
);
869 /* NOTE: MSIE returns "0" or values like ";SP2;". Returning "0" should be enough. */
870 *p
= SysAllocString(zeroW
);
874 static HRESULT WINAPI
OmNavigator_get_connectionSpeed(IOmNavigator
*iface
, LONG
*p
)
876 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
877 FIXME("(%p)->(%p)\n", This
, p
);
881 static HRESULT WINAPI
OmNavigator_get_onLine(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
883 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
884 FIXME("(%p)->(%p)\n", This
, p
);
888 static HRESULT WINAPI
OmNavigator_get_userProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
890 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
891 FIXME("(%p)->(%p)\n", This
, p
);
895 static const IOmNavigatorVtbl OmNavigatorVtbl
= {
896 OmNavigator_QueryInterface
,
899 OmNavigator_GetTypeInfoCount
,
900 OmNavigator_GetTypeInfo
,
901 OmNavigator_GetIDsOfNames
,
903 OmNavigator_get_appCodeName
,
904 OmNavigator_get_appName
,
905 OmNavigator_get_appVersion
,
906 OmNavigator_get_userAgent
,
907 OmNavigator_javaEnabled
,
908 OmNavigator_taintEnabled
,
909 OmNavigator_get_mimeTypes
,
910 OmNavigator_get_plugins
,
911 OmNavigator_get_cookieEnabled
,
912 OmNavigator_get_opsProfile
,
913 OmNavigator_toString
,
914 OmNavigator_get_cpuClass
,
915 OmNavigator_get_systemLanguage
,
916 OmNavigator_get_browserLanguage
,
917 OmNavigator_get_userLanguage
,
918 OmNavigator_get_platform
,
919 OmNavigator_get_appMinorVersion
,
920 OmNavigator_get_connectionSpeed
,
921 OmNavigator_get_onLine
,
922 OmNavigator_get_userProfile
925 static const tid_t OmNavigator_iface_tids
[] = {
929 static dispex_static_data_t OmNavigator_dispex
= {
931 DispHTMLNavigator_tid
,
933 OmNavigator_iface_tids
936 IOmNavigator
*OmNavigator_Create(void)
940 ret
= heap_alloc_zero(sizeof(*ret
));
941 ret
->IOmNavigator_iface
.lpVtbl
= &OmNavigatorVtbl
;
944 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IOmNavigator_iface
, &OmNavigator_dispex
);
946 return &ret
->IOmNavigator_iface
;