dpwsockx: Implementation of SPInit
[wine/gsoc_dplay.git] / dlls / mshtml / omnavigator.c
blob7479180f80e12c454fb685653536b805826615b1
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);
143 static const WCHAR app_nameW[] =
144 {'M','i','c','r','o','s','o','f','t',' ',
145 'I','n','t','e','r','n','e','t',' ',
146 'E','x','p','l','o','r','e','r',0};
148 TRACE("(%p)->(%p)\n", This, p);
150 *p = SysAllocString(app_nameW);
151 if(!*p)
152 return E_OUTOFMEMORY;
154 return S_OK;
157 static HRESULT WINAPI OmNavigator_get_appVersion(IOmNavigator *iface, BSTR *p)
159 OmNavigator *This = OMNAVIGATOR_THIS(iface);
161 /* FIXME: Should we return something smarter? */
162 static const WCHAR app_verW[] =
163 {'4','.','0',' ','(','c','o','m','p','a','t','i','b','l','e',';',
164 ' ','M','S','I','E',' ','7','.','0',';',
165 ' ','W','i','n','d','o','w','s',' ','N','T',' ','5','.','1',';',
166 ' ','M','o','z','i','l','l','a','/','4','.','0',')',0};
168 TRACE("(%p)->(%p)\n", This, p);
170 *p = SysAllocString(app_verW);
171 if(!*p)
172 return E_OUTOFMEMORY;
174 return S_OK;
177 static HRESULT WINAPI OmNavigator_get_userAgent(IOmNavigator *iface, BSTR *p)
179 OmNavigator *This = OMNAVIGATOR_THIS(iface);
180 FIXME("(%p)->(%p)\n", This, p);
181 return E_NOTIMPL;
184 static HRESULT WINAPI OmNavigator_javaEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
186 OmNavigator *This = OMNAVIGATOR_THIS(iface);
187 FIXME("(%p)->(%p)\n", This, enabled);
188 return E_NOTIMPL;
191 static HRESULT WINAPI OmNavigator_taintEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
193 OmNavigator *This = OMNAVIGATOR_THIS(iface);
194 FIXME("(%p)->(%p)\n", This, enabled);
195 return E_NOTIMPL;
198 static HRESULT WINAPI OmNavigator_get_mimeTypes(IOmNavigator *iface, IHTMLMimeTypesCollection **p)
200 OmNavigator *This = OMNAVIGATOR_THIS(iface);
201 FIXME("(%p)->(%p)\n", This, p);
202 return E_NOTIMPL;
205 static HRESULT WINAPI OmNavigator_get_plugins(IOmNavigator *iface, IHTMLPluginsCollection **p)
207 OmNavigator *This = OMNAVIGATOR_THIS(iface);
208 FIXME("(%p)->(%p)\n", This, p);
209 return E_NOTIMPL;
212 static HRESULT WINAPI OmNavigator_get_cookieEnabled(IOmNavigator *iface, VARIANT_BOOL *p)
214 OmNavigator *This = OMNAVIGATOR_THIS(iface);
215 FIXME("(%p)->(%p)\n", This, p);
216 return E_NOTIMPL;
219 static HRESULT WINAPI OmNavigator_get_opsProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
221 OmNavigator *This = OMNAVIGATOR_THIS(iface);
222 FIXME("(%p)->(%p)\n", This, p);
223 return E_NOTIMPL;
226 static HRESULT WINAPI OmNavigator_toString(IOmNavigator *iface, BSTR *String)
228 OmNavigator *This = OMNAVIGATOR_THIS(iface);
229 FIXME("(%p)->(%p)\n", This, String);
230 return E_NOTIMPL;
233 static HRESULT WINAPI OmNavigator_get_cpuClass(IOmNavigator *iface, BSTR *p)
235 OmNavigator *This = OMNAVIGATOR_THIS(iface);
236 FIXME("(%p)->(%p)\n", This, p);
237 return E_NOTIMPL;
240 static HRESULT WINAPI OmNavigator_get_systemLanguage(IOmNavigator *iface, BSTR *p)
242 OmNavigator *This = OMNAVIGATOR_THIS(iface);
243 FIXME("(%p)->(%p)\n", This, p);
244 return E_NOTIMPL;
247 static HRESULT WINAPI OmNavigator_get_browserLanguage(IOmNavigator *iface, BSTR *p)
249 OmNavigator *This = OMNAVIGATOR_THIS(iface);
250 FIXME("(%p)->(%p)\n", This, p);
251 return E_NOTIMPL;
254 static HRESULT WINAPI OmNavigator_get_userLanguage(IOmNavigator *iface, BSTR *p)
256 OmNavigator *This = OMNAVIGATOR_THIS(iface);
257 FIXME("(%p)->(%p)\n", This, p);
258 return E_NOTIMPL;
261 static HRESULT WINAPI OmNavigator_get_platform(IOmNavigator *iface, BSTR *p)
263 OmNavigator *This = OMNAVIGATOR_THIS(iface);
265 #ifdef _WIN64
266 static const WCHAR platformW[] = {'W','i','n','6','4',0};
267 #else
268 static const WCHAR platformW[] = {'W','i','n','3','2',0};
269 #endif
271 TRACE("(%p)->(%p)\n", This, p);
273 *p = SysAllocString(platformW);
274 return S_OK;
277 static HRESULT WINAPI OmNavigator_get_appMinorVersion(IOmNavigator *iface, BSTR *p)
279 OmNavigator *This = OMNAVIGATOR_THIS(iface);
280 FIXME("(%p)->(%p)\n", This, p);
281 return E_NOTIMPL;
284 static HRESULT WINAPI OmNavigator_get_connectionSpeed(IOmNavigator *iface, LONG *p)
286 OmNavigator *This = OMNAVIGATOR_THIS(iface);
287 FIXME("(%p)->(%p)\n", This, p);
288 return E_NOTIMPL;
291 static HRESULT WINAPI OmNavigator_get_onLine(IOmNavigator *iface, VARIANT_BOOL *p)
293 OmNavigator *This = OMNAVIGATOR_THIS(iface);
294 FIXME("(%p)->(%p)\n", This, p);
295 return E_NOTIMPL;
298 static HRESULT WINAPI OmNavigator_get_userProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
300 OmNavigator *This = OMNAVIGATOR_THIS(iface);
301 FIXME("(%p)->(%p)\n", This, p);
302 return E_NOTIMPL;
305 #undef OMNAVIGATOR_THIS
307 static const IOmNavigatorVtbl OmNavigatorVtbl = {
308 OmNavigator_QueryInterface,
309 OmNavigator_AddRef,
310 OmNavigator_Release,
311 OmNavigator_GetTypeInfoCount,
312 OmNavigator_GetTypeInfo,
313 OmNavigator_GetIDsOfNames,
314 OmNavigator_Invoke,
315 OmNavigator_get_appCodeName,
316 OmNavigator_get_appName,
317 OmNavigator_get_appVersion,
318 OmNavigator_get_userAgent,
319 OmNavigator_javaEnabled,
320 OmNavigator_taintEnabled,
321 OmNavigator_get_mimeTypes,
322 OmNavigator_get_plugins,
323 OmNavigator_get_cookieEnabled,
324 OmNavigator_get_opsProfile,
325 OmNavigator_toString,
326 OmNavigator_get_cpuClass,
327 OmNavigator_get_systemLanguage,
328 OmNavigator_get_browserLanguage,
329 OmNavigator_get_userLanguage,
330 OmNavigator_get_platform,
331 OmNavigator_get_appMinorVersion,
332 OmNavigator_get_connectionSpeed,
333 OmNavigator_get_onLine,
334 OmNavigator_get_userProfile
337 static const tid_t OmNavigator_iface_tids[] = {
338 IOmNavigator_tid,
341 static dispex_static_data_t OmNavigator_dispex = {
342 NULL,
343 DispHTMLNavigator_tid,
344 NULL,
345 OmNavigator_iface_tids
348 IOmNavigator *OmNavigator_Create(void)
350 OmNavigator *ret;
352 ret = heap_alloc_zero(sizeof(*ret));
353 ret->lpIOmNavigatorVtbl = &OmNavigatorVtbl;
354 ret->ref = 1;
356 init_dispex(&ret->dispex, (IUnknown*)OMNAVIGATOR(ret), &OmNavigator_dispex);
358 return OMNAVIGATOR(ret);