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 IHTMLDOMImplementation IHTMLDOMImplementation_iface
;
52 } HTMLDOMImplementation
;
54 static inline HTMLDOMImplementation
*impl_from_IHTMLDOMImplementation(IHTMLDOMImplementation
*iface
)
56 return CONTAINING_RECORD(iface
, HTMLDOMImplementation
, IHTMLDOMImplementation_iface
);
59 static HRESULT WINAPI
HTMLDOMImplementation_QueryInterface(IHTMLDOMImplementation
*iface
, REFIID riid
, void **ppv
)
61 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
63 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
65 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IHTMLDOMImplementation
, riid
)) {
66 *ppv
= &This
->IHTMLDOMImplementation_iface
;
67 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
68 return *ppv
? S_OK
: E_NOINTERFACE
;
70 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid
));
75 IUnknown_AddRef((IUnknown
*)*ppv
);
79 static ULONG WINAPI
HTMLDOMImplementation_AddRef(IHTMLDOMImplementation
*iface
)
81 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
82 LONG ref
= InterlockedIncrement(&This
->ref
);
84 TRACE("(%p) ref=%d\n", This
, ref
);
89 static ULONG WINAPI
HTMLDOMImplementation_Release(IHTMLDOMImplementation
*iface
)
91 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
92 LONG ref
= InterlockedDecrement(&This
->ref
);
94 TRACE("(%p) ref=%d\n", This
, ref
);
97 release_dispex(&This
->dispex
);
104 static HRESULT WINAPI
HTMLDOMImplementation_GetTypeInfoCount(IHTMLDOMImplementation
*iface
, UINT
*pctinfo
)
106 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
108 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
111 static HRESULT WINAPI
HTMLDOMImplementation_GetTypeInfo(IHTMLDOMImplementation
*iface
, UINT iTInfo
,
112 LCID lcid
, ITypeInfo
**ppTInfo
)
114 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
116 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
119 static HRESULT WINAPI
HTMLDOMImplementation_GetIDsOfNames(IHTMLDOMImplementation
*iface
, REFIID riid
,
120 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
122 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
124 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
,
125 cNames
, lcid
, rgDispId
);
128 static HRESULT WINAPI
HTMLDOMImplementation_Invoke(IHTMLDOMImplementation
*iface
, DISPID dispIdMember
,
129 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
130 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
132 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
134 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
135 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
138 static HRESULT WINAPI
HTMLDOMImplementation_hasFeature(IHTMLDOMImplementation
*iface
, BSTR feature
,
139 VARIANT version
, VARIANT_BOOL
*pfHasFeature
)
141 HTMLDOMImplementation
*This
= impl_from_IHTMLDOMImplementation(iface
);
143 FIXME("(%p)->(%s %s %p) returning false\n", This
, debugstr_w(feature
), debugstr_variant(&version
), pfHasFeature
);
145 *pfHasFeature
= VARIANT_FALSE
;
149 static const IHTMLDOMImplementationVtbl HTMLDOMImplementationVtbl
= {
150 HTMLDOMImplementation_QueryInterface
,
151 HTMLDOMImplementation_AddRef
,
152 HTMLDOMImplementation_Release
,
153 HTMLDOMImplementation_GetTypeInfoCount
,
154 HTMLDOMImplementation_GetTypeInfo
,
155 HTMLDOMImplementation_GetIDsOfNames
,
156 HTMLDOMImplementation_Invoke
,
157 HTMLDOMImplementation_hasFeature
160 static const tid_t HTMLDOMImplementation_iface_tids
[] = {
161 IHTMLDOMImplementation_tid
,
164 static dispex_static_data_t HTMLDOMImplementation_dispex
= {
166 IHTMLDOMImplementation_tid
,
168 HTMLDOMImplementation_iface_tids
171 HRESULT
create_dom_implementation(IHTMLDOMImplementation
**ret
)
173 HTMLDOMImplementation
*dom_implementation
;
175 dom_implementation
= heap_alloc_zero(sizeof(*dom_implementation
));
176 if(!dom_implementation
)
177 return E_OUTOFMEMORY
;
179 dom_implementation
->IHTMLDOMImplementation_iface
.lpVtbl
= &HTMLDOMImplementationVtbl
;
180 dom_implementation
->ref
= 1;
182 init_dispex(&dom_implementation
->dispex
, (IUnknown
*)&dom_implementation
->IHTMLDOMImplementation_iface
,
183 &HTMLDOMImplementation_dispex
);
185 *ret
= &dom_implementation
->IHTMLDOMImplementation_iface
;
189 static inline OmHistory
*impl_from_IOmHistory(IOmHistory
*iface
)
191 return CONTAINING_RECORD(iface
, OmHistory
, IOmHistory_iface
);
194 static HRESULT WINAPI
OmHistory_QueryInterface(IOmHistory
*iface
, REFIID riid
, void **ppv
)
196 OmHistory
*This
= impl_from_IOmHistory(iface
);
200 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
201 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
202 *ppv
= &This
->IOmHistory_iface
;
203 }else if(IsEqualGUID(&IID_IOmHistory
, riid
)) {
204 TRACE("(%p)->(IID_IOmHistory %p)\n", This
, ppv
);
205 *ppv
= &This
->IOmHistory_iface
;
206 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
207 return *ppv
? S_OK
: E_NOINTERFACE
;
211 IUnknown_AddRef((IUnknown
*)*ppv
);
215 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
216 return E_NOINTERFACE
;
219 static ULONG WINAPI
OmHistory_AddRef(IOmHistory
*iface
)
221 OmHistory
*This
= impl_from_IOmHistory(iface
);
222 LONG ref
= InterlockedIncrement(&This
->ref
);
224 TRACE("(%p) ref=%d\n", This
, ref
);
229 static ULONG WINAPI
OmHistory_Release(IOmHistory
*iface
)
231 OmHistory
*This
= impl_from_IOmHistory(iface
);
232 LONG ref
= InterlockedDecrement(&This
->ref
);
234 TRACE("(%p) ref=%d\n", This
, ref
);
237 release_dispex(&This
->dispex
);
244 static HRESULT WINAPI
OmHistory_GetTypeInfoCount(IOmHistory
*iface
, UINT
*pctinfo
)
246 OmHistory
*This
= impl_from_IOmHistory(iface
);
247 FIXME("(%p)->(%p)\n", This
, pctinfo
);
251 static HRESULT WINAPI
OmHistory_GetTypeInfo(IOmHistory
*iface
, UINT iTInfo
,
252 LCID lcid
, ITypeInfo
**ppTInfo
)
254 OmHistory
*This
= impl_from_IOmHistory(iface
);
256 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
259 static HRESULT WINAPI
OmHistory_GetIDsOfNames(IOmHistory
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
260 LCID lcid
, DISPID
*rgDispId
)
262 OmHistory
*This
= impl_from_IOmHistory(iface
);
264 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
268 static HRESULT WINAPI
OmHistory_Invoke(IOmHistory
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
269 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
271 OmHistory
*This
= impl_from_IOmHistory(iface
);
273 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
274 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
277 static HRESULT WINAPI
OmHistory_get_length(IOmHistory
*iface
, short *p
)
279 OmHistory
*This
= impl_from_IOmHistory(iface
);
281 TRACE("(%p)->(%p)\n", This
, p
);
283 if(!This
->window
|| !This
->window
->base
.outer_window
->doc_obj
284 || !This
->window
->base
.outer_window
->doc_obj
->travel_log
) {
287 *p
= ITravelLog_CountEntries(This
->window
->base
.outer_window
->doc_obj
->travel_log
,
288 This
->window
->base
.outer_window
->doc_obj
->browser_service
);
293 static HRESULT WINAPI
OmHistory_back(IOmHistory
*iface
, VARIANT
*pvargdistance
)
295 OmHistory
*This
= impl_from_IOmHistory(iface
);
296 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
300 static HRESULT WINAPI
OmHistory_forward(IOmHistory
*iface
, VARIANT
*pvargdistance
)
302 OmHistory
*This
= impl_from_IOmHistory(iface
);
303 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
307 static HRESULT WINAPI
OmHistory_go(IOmHistory
*iface
, VARIANT
*pvargdistance
)
309 OmHistory
*This
= impl_from_IOmHistory(iface
);
310 FIXME("(%p)->(%s)\n", This
, debugstr_variant(pvargdistance
));
314 static const IOmHistoryVtbl OmHistoryVtbl
= {
315 OmHistory_QueryInterface
,
318 OmHistory_GetTypeInfoCount
,
319 OmHistory_GetTypeInfo
,
320 OmHistory_GetIDsOfNames
,
322 OmHistory_get_length
,
328 static const tid_t OmHistory_iface_tids
[] = {
332 static dispex_static_data_t OmHistory_dispex
= {
340 HRESULT
create_history(HTMLInnerWindow
*window
, OmHistory
**ret
)
344 history
= heap_alloc_zero(sizeof(*history
));
346 return E_OUTOFMEMORY
;
348 init_dispex(&history
->dispex
, (IUnknown
*)&history
->IOmHistory_iface
, &OmHistory_dispex
);
349 history
->IOmHistory_iface
.lpVtbl
= &OmHistoryVtbl
;
352 history
->window
= window
;
358 struct HTMLPluginsCollection
{
360 IHTMLPluginsCollection IHTMLPluginsCollection_iface
;
364 OmNavigator
*navigator
;
367 static inline HTMLPluginsCollection
*impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection
*iface
)
369 return CONTAINING_RECORD(iface
, HTMLPluginsCollection
, IHTMLPluginsCollection_iface
);
372 static HRESULT WINAPI
HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection
*iface
, REFIID riid
, void **ppv
)
374 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
376 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
377 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
378 *ppv
= &This
->IHTMLPluginsCollection_iface
;
379 }else if(IsEqualGUID(&IID_IHTMLPluginsCollection
, riid
)) {
380 TRACE("(%p)->(IID_IHTMLPluginCollection %p)\n", This
, ppv
);
381 *ppv
= &This
->IHTMLPluginsCollection_iface
;
382 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
383 return *ppv
? S_OK
: E_NOINTERFACE
;
386 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
387 return E_NOINTERFACE
;
390 IUnknown_AddRef((IUnknown
*)*ppv
);
394 static ULONG WINAPI
HTMLPluginsCollection_AddRef(IHTMLPluginsCollection
*iface
)
396 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
397 LONG ref
= InterlockedIncrement(&This
->ref
);
399 TRACE("(%p) ref=%d\n", This
, ref
);
404 static ULONG WINAPI
HTMLPluginsCollection_Release(IHTMLPluginsCollection
*iface
)
406 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
407 LONG ref
= InterlockedDecrement(&This
->ref
);
409 TRACE("(%p) ref=%d\n", This
, ref
);
413 This
->navigator
->plugins
= NULL
;
414 release_dispex(&This
->dispex
);
421 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection
*iface
, UINT
*pctinfo
)
423 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
424 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
427 static HRESULT WINAPI
HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection
*iface
, UINT iTInfo
,
428 LCID lcid
, ITypeInfo
**ppTInfo
)
430 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
431 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
434 static HRESULT WINAPI
HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection
*iface
, REFIID riid
,
435 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
437 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
438 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
442 static HRESULT WINAPI
HTMLPluginsCollection_Invoke(IHTMLPluginsCollection
*iface
, DISPID dispIdMember
,
443 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
444 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
446 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
447 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
448 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
451 static HRESULT WINAPI
HTMLPluginsCollection_get_length(IHTMLPluginsCollection
*iface
, LONG
*p
)
453 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
455 TRACE("(%p)->(%p)\n", This
, p
);
457 /* IE always returns 0 here */
462 static HRESULT WINAPI
HTMLPluginsCollection_refresh(IHTMLPluginsCollection
*iface
, VARIANT_BOOL reload
)
464 HTMLPluginsCollection
*This
= impl_from_IHTMLPluginsCollection(iface
);
465 FIXME("(%p)->(%x)\n", This
, reload
);
469 static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl
= {
470 HTMLPluginsCollection_QueryInterface
,
471 HTMLPluginsCollection_AddRef
,
472 HTMLPluginsCollection_Release
,
473 HTMLPluginsCollection_GetTypeInfoCount
,
474 HTMLPluginsCollection_GetTypeInfo
,
475 HTMLPluginsCollection_GetIDsOfNames
,
476 HTMLPluginsCollection_Invoke
,
477 HTMLPluginsCollection_get_length
,
478 HTMLPluginsCollection_refresh
481 static const tid_t HTMLPluginsCollection_iface_tids
[] = {
482 IHTMLPluginsCollection_tid
,
485 static dispex_static_data_t HTMLPluginsCollection_dispex
= {
489 HTMLPluginsCollection_iface_tids
492 static HRESULT
create_plugins_collection(OmNavigator
*navigator
, HTMLPluginsCollection
**ret
)
494 HTMLPluginsCollection
*col
;
496 col
= heap_alloc_zero(sizeof(*col
));
498 return E_OUTOFMEMORY
;
500 col
->IHTMLPluginsCollection_iface
.lpVtbl
= &HTMLPluginsCollectionVtbl
;
502 col
->navigator
= navigator
;
504 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLPluginsCollection_iface
,
505 &HTMLPluginsCollection_dispex
);
511 struct HTMLMimeTypesCollection
{
513 IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface
;
517 OmNavigator
*navigator
;
520 static inline HTMLMimeTypesCollection
*impl_from_IHTMLMimeTypesCollection(IHTMLMimeTypesCollection
*iface
)
522 return CONTAINING_RECORD(iface
, HTMLMimeTypesCollection
, IHTMLMimeTypesCollection_iface
);
525 static HRESULT WINAPI
HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesCollection
*iface
, REFIID riid
, void **ppv
)
527 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
529 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
530 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
531 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
532 }else if(IsEqualGUID(&IID_IHTMLMimeTypesCollection
, riid
)) {
533 TRACE("(%p)->(IID_IHTMLMimeTypesCollection %p)\n", This
, ppv
);
534 *ppv
= &This
->IHTMLMimeTypesCollection_iface
;
535 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
536 return *ppv
? S_OK
: E_NOINTERFACE
;
539 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
540 return E_NOINTERFACE
;
543 IUnknown_AddRef((IUnknown
*)*ppv
);
547 static ULONG WINAPI
HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection
*iface
)
549 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
550 LONG ref
= InterlockedIncrement(&This
->ref
);
552 TRACE("(%p) ref=%d\n", This
, ref
);
557 static ULONG WINAPI
HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection
*iface
)
559 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
560 LONG ref
= InterlockedDecrement(&This
->ref
);
562 TRACE("(%p) ref=%d\n", This
, ref
);
566 This
->navigator
->mime_types
= NULL
;
567 release_dispex(&This
->dispex
);
574 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfoCount(IHTMLMimeTypesCollection
*iface
, UINT
*pctinfo
)
576 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
577 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
580 static HRESULT WINAPI
HTMLMimeTypesCollection_GetTypeInfo(IHTMLMimeTypesCollection
*iface
, UINT iTInfo
,
581 LCID lcid
, ITypeInfo
**ppTInfo
)
583 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
584 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
587 static HRESULT WINAPI
HTMLMimeTypesCollection_GetIDsOfNames(IHTMLMimeTypesCollection
*iface
, REFIID riid
,
588 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
590 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
591 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
595 static HRESULT WINAPI
HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection
*iface
, DISPID dispIdMember
,
596 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
597 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
599 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
600 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
601 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
604 static HRESULT WINAPI
HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection
*iface
, LONG
*p
)
606 HTMLMimeTypesCollection
*This
= impl_from_IHTMLMimeTypesCollection(iface
);
608 TRACE("(%p)->(%p)\n", This
, p
);
610 /* This is just a stub for compatibility with other browser in IE */
615 static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl
= {
616 HTMLMimeTypesCollection_QueryInterface
,
617 HTMLMimeTypesCollection_AddRef
,
618 HTMLMimeTypesCollection_Release
,
619 HTMLMimeTypesCollection_GetTypeInfoCount
,
620 HTMLMimeTypesCollection_GetTypeInfo
,
621 HTMLMimeTypesCollection_GetIDsOfNames
,
622 HTMLMimeTypesCollection_Invoke
,
623 HTMLMimeTypesCollection_get_length
626 static const tid_t HTMLMimeTypesCollection_iface_tids
[] = {
627 IHTMLMimeTypesCollection_tid
,
630 static dispex_static_data_t HTMLMimeTypesCollection_dispex
= {
632 IHTMLMimeTypesCollection_tid
,
634 HTMLMimeTypesCollection_iface_tids
637 static HRESULT
create_mime_types_collection(OmNavigator
*navigator
, HTMLMimeTypesCollection
**ret
)
639 HTMLMimeTypesCollection
*col
;
641 col
= heap_alloc_zero(sizeof(*col
));
643 return E_OUTOFMEMORY
;
645 col
->IHTMLMimeTypesCollection_iface
.lpVtbl
= &HTMLMimeTypesCollectionVtbl
;
647 col
->navigator
= navigator
;
649 init_dispex(&col
->dispex
, (IUnknown
*)&col
->IHTMLMimeTypesCollection_iface
,
650 &HTMLMimeTypesCollection_dispex
);
656 static inline OmNavigator
*impl_from_IOmNavigator(IOmNavigator
*iface
)
658 return CONTAINING_RECORD(iface
, OmNavigator
, IOmNavigator_iface
);
661 static HRESULT WINAPI
OmNavigator_QueryInterface(IOmNavigator
*iface
, REFIID riid
, void **ppv
)
663 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
667 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
668 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
669 *ppv
= &This
->IOmNavigator_iface
;
670 }else if(IsEqualGUID(&IID_IOmNavigator
, riid
)) {
671 TRACE("(%p)->(IID_IOmNavigator %p)\n", This
, ppv
);
672 *ppv
= &This
->IOmNavigator_iface
;
673 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
674 return *ppv
? S_OK
: E_NOINTERFACE
;
678 IUnknown_AddRef((IUnknown
*)*ppv
);
682 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
683 return E_NOINTERFACE
;
686 static ULONG WINAPI
OmNavigator_AddRef(IOmNavigator
*iface
)
688 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
689 LONG ref
= InterlockedIncrement(&This
->ref
);
691 TRACE("(%p) ref=%d\n", This
, ref
);
696 static ULONG WINAPI
OmNavigator_Release(IOmNavigator
*iface
)
698 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
699 LONG ref
= InterlockedDecrement(&This
->ref
);
701 TRACE("(%p) ref=%d\n", This
, ref
);
705 This
->plugins
->navigator
= NULL
;
707 This
->mime_types
->navigator
= NULL
;
708 release_dispex(&This
->dispex
);
715 static HRESULT WINAPI
OmNavigator_GetTypeInfoCount(IOmNavigator
*iface
, UINT
*pctinfo
)
717 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
718 FIXME("(%p)->(%p)\n", This
, pctinfo
);
722 static HRESULT WINAPI
OmNavigator_GetTypeInfo(IOmNavigator
*iface
, UINT iTInfo
,
723 LCID lcid
, ITypeInfo
**ppTInfo
)
725 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
727 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
730 static HRESULT WINAPI
OmNavigator_GetIDsOfNames(IOmNavigator
*iface
, REFIID riid
,
731 LPOLESTR
*rgszNames
, UINT cNames
,
732 LCID lcid
, DISPID
*rgDispId
)
734 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
736 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
740 static HRESULT WINAPI
OmNavigator_Invoke(IOmNavigator
*iface
, DISPID dispIdMember
,
741 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
742 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
744 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
746 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
747 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
750 static HRESULT WINAPI
OmNavigator_get_appCodeName(IOmNavigator
*iface
, BSTR
*p
)
752 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
754 static const WCHAR mozillaW
[] = {'M','o','z','i','l','l','a',0};
756 TRACE("(%p)->(%p)\n", This
, p
);
758 *p
= SysAllocString(mozillaW
);
762 static HRESULT WINAPI
OmNavigator_get_appName(IOmNavigator
*iface
, BSTR
*p
)
764 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
766 static const WCHAR app_nameW
[] =
767 {'M','i','c','r','o','s','o','f','t',' ',
768 'I','n','t','e','r','n','e','t',' ',
769 'E','x','p','l','o','r','e','r',0};
771 TRACE("(%p)->(%p)\n", This
, p
);
773 *p
= SysAllocString(app_nameW
);
775 return E_OUTOFMEMORY
;
780 static HRESULT WINAPI
OmNavigator_get_appVersion(IOmNavigator
*iface
, BSTR
*p
)
782 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
784 char user_agent
[512];
788 TRACE("(%p)->(%p)\n", This
, p
);
790 size
= sizeof(user_agent
);
791 hres
= ObtainUserAgentString(0, user_agent
, &size
);
795 if(strncmp(user_agent
, "Mozilla/", 8)) {
796 FIXME("Unsupported user agent\n");
800 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, NULL
, 0);
801 *p
= SysAllocStringLen(NULL
, size
-1);
803 return E_OUTOFMEMORY
;
805 MultiByteToWideChar(CP_ACP
, 0, user_agent
+8, -1, *p
, size
);
809 static HRESULT WINAPI
OmNavigator_get_userAgent(IOmNavigator
*iface
, BSTR
*p
)
811 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
812 char user_agent
[512];
816 TRACE("(%p)->(%p)\n", This
, p
);
818 size
= sizeof(user_agent
);
819 hres
= ObtainUserAgentString(0, user_agent
, &size
);
823 size
= MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, NULL
, 0);
824 *p
= SysAllocStringLen(NULL
, size
-1);
826 return E_OUTOFMEMORY
;
828 MultiByteToWideChar(CP_ACP
, 0, user_agent
, -1, *p
, size
);
832 static HRESULT WINAPI
OmNavigator_javaEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
834 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
836 FIXME("(%p)->(%p) semi-stub\n", This
, enabled
);
838 *enabled
= VARIANT_TRUE
;
842 static HRESULT WINAPI
OmNavigator_taintEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*enabled
)
844 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
845 FIXME("(%p)->(%p)\n", This
, enabled
);
849 static HRESULT WINAPI
OmNavigator_get_mimeTypes(IOmNavigator
*iface
, IHTMLMimeTypesCollection
**p
)
851 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
853 TRACE("(%p)->(%p)\n", This
, p
);
855 if(!This
->mime_types
) {
858 hres
= create_mime_types_collection(This
, &This
->mime_types
);
862 IHTMLMimeTypesCollection_AddRef(&This
->mime_types
->IHTMLMimeTypesCollection_iface
);
865 *p
= &This
->mime_types
->IHTMLMimeTypesCollection_iface
;
869 static HRESULT WINAPI
OmNavigator_get_plugins(IOmNavigator
*iface
, IHTMLPluginsCollection
**p
)
871 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
873 TRACE("(%p)->(%p)\n", This
, p
);
878 hres
= create_plugins_collection(This
, &This
->plugins
);
882 IHTMLPluginsCollection_AddRef(&This
->plugins
->IHTMLPluginsCollection_iface
);
885 *p
= &This
->plugins
->IHTMLPluginsCollection_iface
;
889 static HRESULT WINAPI
OmNavigator_get_cookieEnabled(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
891 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
893 WARN("(%p)->(%p) semi-stub\n", This
, p
);
899 static HRESULT WINAPI
OmNavigator_get_opsProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
901 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
902 FIXME("(%p)->(%p)\n", This
, p
);
906 static HRESULT WINAPI
OmNavigator_toString(IOmNavigator
*iface
, BSTR
*String
)
908 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
910 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
912 TRACE("(%p)->(%p)\n", This
, String
);
917 *String
= SysAllocString(objectW
);
918 return *String
? S_OK
: E_OUTOFMEMORY
;
921 static HRESULT WINAPI
OmNavigator_get_cpuClass(IOmNavigator
*iface
, BSTR
*p
)
923 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
925 static const WCHAR cpu_classW
[] =
932 TRACE("(%p)->(%p)\n", This
, p
);
934 *p
= SysAllocString(cpu_classW
);
935 return *p
? S_OK
: E_OUTOFMEMORY
;
938 static HRESULT
get_language_string(LCID lcid
, BSTR
*p
)
943 len
= LCIDToLocaleName(lcid
, NULL
, 0, 0);
945 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
949 ret
= SysAllocStringLen(NULL
, len
-1);
951 return E_OUTOFMEMORY
;
953 len
= LCIDToLocaleName(lcid
, ret
, len
, 0);
955 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
964 static HRESULT WINAPI
OmNavigator_get_systemLanguage(IOmNavigator
*iface
, BSTR
*p
)
966 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
968 TRACE("(%p)->(%p)\n", This
, p
);
970 return get_language_string(LOCALE_SYSTEM_DEFAULT
, p
);
973 static HRESULT WINAPI
OmNavigator_get_browserLanguage(IOmNavigator
*iface
, BSTR
*p
)
975 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
977 TRACE("(%p)->(%p)\n", This
, p
);
979 return get_language_string(GetUserDefaultUILanguage(), p
);
982 static HRESULT WINAPI
OmNavigator_get_userLanguage(IOmNavigator
*iface
, BSTR
*p
)
984 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
986 TRACE("(%p)->(%p)\n", This
, p
);
988 return get_language_string(LOCALE_USER_DEFAULT
, p
);
991 static HRESULT WINAPI
OmNavigator_get_platform(IOmNavigator
*iface
, BSTR
*p
)
993 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
996 static const WCHAR platformW
[] = {'W','i','n','6','4',0};
998 static const WCHAR platformW
[] = {'W','i','n','3','2',0};
1001 TRACE("(%p)->(%p)\n", This
, p
);
1003 *p
= SysAllocString(platformW
);
1007 static HRESULT WINAPI
OmNavigator_get_appMinorVersion(IOmNavigator
*iface
, BSTR
*p
)
1009 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1011 static const WCHAR zeroW
[] = {'0',0};
1013 TRACE("(%p)->(%p)\n", This
, p
);
1015 /* NOTE: MSIE returns "0" or values like ";SP2;". Returning "0" should be enough. */
1016 *p
= SysAllocString(zeroW
);
1020 static HRESULT WINAPI
OmNavigator_get_connectionSpeed(IOmNavigator
*iface
, LONG
*p
)
1022 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1023 FIXME("(%p)->(%p)\n", This
, p
);
1027 static HRESULT WINAPI
OmNavigator_get_onLine(IOmNavigator
*iface
, VARIANT_BOOL
*p
)
1029 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1031 WARN("(%p)->(%p) semi-stub, returning true\n", This
, p
);
1037 static HRESULT WINAPI
OmNavigator_get_userProfile(IOmNavigator
*iface
, IHTMLOpsProfile
**p
)
1039 OmNavigator
*This
= impl_from_IOmNavigator(iface
);
1040 FIXME("(%p)->(%p)\n", This
, p
);
1044 static const IOmNavigatorVtbl OmNavigatorVtbl
= {
1045 OmNavigator_QueryInterface
,
1047 OmNavigator_Release
,
1048 OmNavigator_GetTypeInfoCount
,
1049 OmNavigator_GetTypeInfo
,
1050 OmNavigator_GetIDsOfNames
,
1052 OmNavigator_get_appCodeName
,
1053 OmNavigator_get_appName
,
1054 OmNavigator_get_appVersion
,
1055 OmNavigator_get_userAgent
,
1056 OmNavigator_javaEnabled
,
1057 OmNavigator_taintEnabled
,
1058 OmNavigator_get_mimeTypes
,
1059 OmNavigator_get_plugins
,
1060 OmNavigator_get_cookieEnabled
,
1061 OmNavigator_get_opsProfile
,
1062 OmNavigator_toString
,
1063 OmNavigator_get_cpuClass
,
1064 OmNavigator_get_systemLanguage
,
1065 OmNavigator_get_browserLanguage
,
1066 OmNavigator_get_userLanguage
,
1067 OmNavigator_get_platform
,
1068 OmNavigator_get_appMinorVersion
,
1069 OmNavigator_get_connectionSpeed
,
1070 OmNavigator_get_onLine
,
1071 OmNavigator_get_userProfile
1074 static const tid_t OmNavigator_iface_tids
[] = {
1078 static dispex_static_data_t OmNavigator_dispex
= {
1080 DispHTMLNavigator_tid
,
1082 OmNavigator_iface_tids
1085 IOmNavigator
*OmNavigator_Create(void)
1089 ret
= heap_alloc_zero(sizeof(*ret
));
1093 ret
->IOmNavigator_iface
.lpVtbl
= &OmNavigatorVtbl
;
1096 init_dispex(&ret
->dispex
, (IUnknown
*)&ret
->IOmNavigator_iface
, &OmNavigator_dispex
);
1098 return &ret
->IOmNavigator_iface
;