push ac694015ba9a1d7cf8fc6346c6e51d4c35a62962
[wine/hacks.git] / dlls / mshtml / omnavigator.c
bloba3eed8bce3b5406edaf23a49de2e433238d891f0
1 /*
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
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"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 DispatchEx dispex;
36 const IOmNavigatorVtbl *lpIOmNavigatorVtbl;
38 LONG ref;
39 } OmNavigator;
41 #define OMNAVIGATOR(x) ((IOmNavigator*) &(x)->lpIOmNavigatorVtbl)
43 #define OMNAVIGATOR_THIS(iface) DEFINE_THIS(OmNavigator, IOmNavigator, iface)
45 static HRESULT WINAPI OmNavigator_QueryInterface(IOmNavigator *iface, REFIID riid, void **ppv)
47 OmNavigator *This = OMNAVIGATOR_THIS(iface);
49 *ppv = NULL;
51 if(IsEqualGUID(&IID_IUnknown, riid)) {
52 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
53 *ppv = OMNAVIGATOR(This);
54 }else if(IsEqualGUID(&IID_IOmNavigator, riid)) {
55 TRACE("(%p)->(IID_IOmNavigator %p)\n", This, ppv);
56 *ppv = OMNAVIGATOR(This);
57 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
58 return *ppv ? S_OK : E_NOINTERFACE;
61 if(*ppv) {
62 IUnknown_AddRef((IUnknown*)*ppv);
63 return S_OK;
66 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
67 return E_NOINTERFACE;
70 static ULONG WINAPI OmNavigator_AddRef(IOmNavigator *iface)
72 OmNavigator *This = OMNAVIGATOR_THIS(iface);
73 LONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) ref=%d\n", This, ref);
77 return ref;
80 static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
82 OmNavigator *This = OMNAVIGATOR_THIS(iface);
83 LONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) ref=%d\n", This, ref);
87 if(!ref)
88 heap_free(This);
90 return ref;
93 static HRESULT WINAPI OmNavigator_GetTypeInfoCount(IOmNavigator *iface, UINT *pctinfo)
95 OmNavigator *This = OMNAVIGATOR_THIS(iface);
96 FIXME("(%p)->(%p)\n", This, pctinfo);
97 return E_NOTIMPL;
100 static HRESULT WINAPI OmNavigator_GetTypeInfo(IOmNavigator *iface, UINT iTInfo,
101 LCID lcid, ITypeInfo **ppTInfo)
103 OmNavigator *This = OMNAVIGATOR_THIS(iface);
105 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
108 static HRESULT WINAPI OmNavigator_GetIDsOfNames(IOmNavigator *iface, REFIID riid,
109 LPOLESTR *rgszNames, UINT cNames,
110 LCID lcid, DISPID *rgDispId)
112 OmNavigator *This = OMNAVIGATOR_THIS(iface);
114 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
117 static HRESULT WINAPI OmNavigator_Invoke(IOmNavigator *iface, DISPID dispIdMember,
118 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
119 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
121 OmNavigator *This = OMNAVIGATOR_THIS(iface);
123 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
124 pVarResult, pExcepInfo, puArgErr);
127 static HRESULT WINAPI OmNavigator_get_appCodeName(IOmNavigator *iface, BSTR *p)
129 OmNavigator *This = OMNAVIGATOR_THIS(iface);
131 static const WCHAR mozillaW[] = {'M','o','z','i','l','l','a',0};
133 TRACE("(%p)->(%p)\n", This, p);
135 *p = SysAllocString(mozillaW);
136 return S_OK;
139 static HRESULT WINAPI OmNavigator_get_appName(IOmNavigator *iface, BSTR *p)
141 OmNavigator *This = OMNAVIGATOR_THIS(iface);
142 FIXME("(%p)->(%p)\n", This, p);
143 return E_NOTIMPL;
146 static HRESULT WINAPI OmNavigator_get_appVersion(IOmNavigator *iface, BSTR *p)
148 OmNavigator *This = OMNAVIGATOR_THIS(iface);
150 /* FIXME: Should we return something smarter? */
151 static const WCHAR app_verW[] =
152 {'4','.','0',' ','(','c','o','m','p','a','t','i','b','l','e',';',
153 ' ','M','S','I','E',' ','7','.','0',';',
154 ' ','W','i','n','d','o','w','s',' ','N','T',' ','5','.','1',';',
155 ' ','M','o','z','i','l','l','a','/','4','.','0',')',0};
157 TRACE("(%p)->(%p)\n", This, p);
159 *p = SysAllocString(app_verW);
160 if(!*p)
161 return E_OUTOFMEMORY;
163 return S_OK;
166 static HRESULT WINAPI OmNavigator_get_userAgent(IOmNavigator *iface, BSTR *p)
168 OmNavigator *This = OMNAVIGATOR_THIS(iface);
169 FIXME("(%p)->(%p)\n", This, p);
170 return E_NOTIMPL;
173 static HRESULT WINAPI OmNavigator_javaEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
175 OmNavigator *This = OMNAVIGATOR_THIS(iface);
176 FIXME("(%p)->(%p)\n", This, enabled);
177 return E_NOTIMPL;
180 static HRESULT WINAPI OmNavigator_taintEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
182 OmNavigator *This = OMNAVIGATOR_THIS(iface);
183 FIXME("(%p)->(%p)\n", This, enabled);
184 return E_NOTIMPL;
187 static HRESULT WINAPI OmNavigator_get_mimeTypes(IOmNavigator *iface, IHTMLMimeTypesCollection **p)
189 OmNavigator *This = OMNAVIGATOR_THIS(iface);
190 FIXME("(%p)->(%p)\n", This, p);
191 return E_NOTIMPL;
194 static HRESULT WINAPI OmNavigator_get_plugins(IOmNavigator *iface, IHTMLPluginsCollection **p)
196 OmNavigator *This = OMNAVIGATOR_THIS(iface);
197 FIXME("(%p)->(%p)\n", This, p);
198 return E_NOTIMPL;
201 static HRESULT WINAPI OmNavigator_get_cookieEnabled(IOmNavigator *iface, VARIANT_BOOL *p)
203 OmNavigator *This = OMNAVIGATOR_THIS(iface);
204 FIXME("(%p)->(%p)\n", This, p);
205 return E_NOTIMPL;
208 static HRESULT WINAPI OmNavigator_get_opsProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
210 OmNavigator *This = OMNAVIGATOR_THIS(iface);
211 FIXME("(%p)->(%p)\n", This, p);
212 return E_NOTIMPL;
215 static HRESULT WINAPI OmNavigator_toString(IOmNavigator *iface, BSTR *String)
217 OmNavigator *This = OMNAVIGATOR_THIS(iface);
218 FIXME("(%p)->(%p)\n", This, String);
219 return E_NOTIMPL;
222 static HRESULT WINAPI OmNavigator_get_cpuClass(IOmNavigator *iface, BSTR *p)
224 OmNavigator *This = OMNAVIGATOR_THIS(iface);
225 FIXME("(%p)->(%p)\n", This, p);
226 return E_NOTIMPL;
229 static HRESULT WINAPI OmNavigator_get_systemLanguage(IOmNavigator *iface, BSTR *p)
231 OmNavigator *This = OMNAVIGATOR_THIS(iface);
232 FIXME("(%p)->(%p)\n", This, p);
233 return E_NOTIMPL;
236 static HRESULT WINAPI OmNavigator_get_browserLanguage(IOmNavigator *iface, BSTR *p)
238 OmNavigator *This = OMNAVIGATOR_THIS(iface);
239 FIXME("(%p)->(%p)\n", This, p);
240 return E_NOTIMPL;
243 static HRESULT WINAPI OmNavigator_get_userLanguage(IOmNavigator *iface, BSTR *p)
245 OmNavigator *This = OMNAVIGATOR_THIS(iface);
246 FIXME("(%p)->(%p)\n", This, p);
247 return E_NOTIMPL;
250 static HRESULT WINAPI OmNavigator_get_platform(IOmNavigator *iface, BSTR *p)
252 OmNavigator *This = OMNAVIGATOR_THIS(iface);
254 #ifdef _WIN64
255 static const WCHAR platformW[] = {'W','i','n','6','4',0};
256 #else
257 static const WCHAR platformW[] = {'W','i','n','3','2',0};
258 #endif
260 TRACE("(%p)->(%p)\n", This, p);
262 *p = SysAllocString(platformW);
263 return S_OK;
266 static HRESULT WINAPI OmNavigator_get_appMinorVersion(IOmNavigator *iface, BSTR *p)
268 OmNavigator *This = OMNAVIGATOR_THIS(iface);
269 FIXME("(%p)->(%p)\n", This, p);
270 return E_NOTIMPL;
273 static HRESULT WINAPI OmNavigator_get_connectionSpeed(IOmNavigator *iface, LONG *p)
275 OmNavigator *This = OMNAVIGATOR_THIS(iface);
276 FIXME("(%p)->(%p)\n", This, p);
277 return E_NOTIMPL;
280 static HRESULT WINAPI OmNavigator_get_onLine(IOmNavigator *iface, VARIANT_BOOL *p)
282 OmNavigator *This = OMNAVIGATOR_THIS(iface);
283 FIXME("(%p)->(%p)\n", This, p);
284 return E_NOTIMPL;
287 static HRESULT WINAPI OmNavigator_get_userProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
289 OmNavigator *This = OMNAVIGATOR_THIS(iface);
290 FIXME("(%p)->(%p)\n", This, p);
291 return E_NOTIMPL;
294 #undef OMNAVIGATOR_THIS
296 static const IOmNavigatorVtbl OmNavigatorVtbl = {
297 OmNavigator_QueryInterface,
298 OmNavigator_AddRef,
299 OmNavigator_Release,
300 OmNavigator_GetTypeInfoCount,
301 OmNavigator_GetTypeInfo,
302 OmNavigator_GetIDsOfNames,
303 OmNavigator_Invoke,
304 OmNavigator_get_appCodeName,
305 OmNavigator_get_appName,
306 OmNavigator_get_appVersion,
307 OmNavigator_get_userAgent,
308 OmNavigator_javaEnabled,
309 OmNavigator_taintEnabled,
310 OmNavigator_get_mimeTypes,
311 OmNavigator_get_plugins,
312 OmNavigator_get_cookieEnabled,
313 OmNavigator_get_opsProfile,
314 OmNavigator_toString,
315 OmNavigator_get_cpuClass,
316 OmNavigator_get_systemLanguage,
317 OmNavigator_get_browserLanguage,
318 OmNavigator_get_userLanguage,
319 OmNavigator_get_platform,
320 OmNavigator_get_appMinorVersion,
321 OmNavigator_get_connectionSpeed,
322 OmNavigator_get_onLine,
323 OmNavigator_get_userProfile
326 static const tid_t OmNavigator_iface_tids[] = {
327 IOmNavigator_tid,
330 static dispex_static_data_t OmNavigator_dispex = {
331 NULL,
332 IOmNavigator_tid,
333 NULL,
334 OmNavigator_iface_tids
337 IOmNavigator *OmNavigator_Create(void)
339 OmNavigator *ret;
341 ret = heap_alloc_zero(sizeof(*ret));
342 ret->lpIOmNavigatorVtbl = &OmNavigatorVtbl;
343 ret->ref = 1;
345 init_dispex(&ret->dispex, (IUnknown*)OMNAVIGATOR(ret), &OmNavigator_dispex);
347 return OMNAVIGATOR(ret);