mshtml: Use heap_alloc_zero to allocate OmNavigator.
[wine/gsoc_dplay.git] / dlls / mshtml / omnavigator.c
blob9a6d537b9fcca9a1c7f6c9a91a70d23ad82dcbc9
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_IDispatch, riid)) {
55 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
56 *ppv = DISPATCHEX(&This->dispex);
57 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
58 TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
59 *ppv = DISPATCHEX(&This->dispex);
60 }else if(IsEqualGUID(&IID_IOmNavigator, riid)) {
61 TRACE("(%p)->(IID_IOmNavigator %p)\n", This, ppv);
62 *ppv = OMNAVIGATOR(This);
65 if(*ppv) {
66 IUnknown_AddRef((IUnknown*)*ppv);
67 return S_OK;
70 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
71 return E_NOINTERFACE;
74 static ULONG WINAPI OmNavigator_AddRef(IOmNavigator *iface)
76 OmNavigator *This = OMNAVIGATOR_THIS(iface);
77 LONG ref = InterlockedIncrement(&This->ref);
79 TRACE("(%p) ref=%d\n", This, ref);
81 return ref;
84 static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
86 OmNavigator *This = OMNAVIGATOR_THIS(iface);
87 LONG ref = InterlockedDecrement(&This->ref);
89 TRACE("(%p) ref=%d\n", This, ref);
91 if(!ref)
92 heap_free(This);
94 return ref;
97 static HRESULT WINAPI OmNavigator_GetTypeInfoCount(IOmNavigator *iface, UINT *pctinfo)
99 OmNavigator *This = OMNAVIGATOR_THIS(iface);
100 FIXME("(%p)->(%p)\n", This, pctinfo);
101 return E_NOTIMPL;
104 static HRESULT WINAPI OmNavigator_GetTypeInfo(IOmNavigator *iface, UINT iTInfo,
105 LCID lcid, ITypeInfo **ppTInfo)
107 OmNavigator *This = OMNAVIGATOR_THIS(iface);
109 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
112 static HRESULT WINAPI OmNavigator_GetIDsOfNames(IOmNavigator *iface, REFIID riid,
113 LPOLESTR *rgszNames, UINT cNames,
114 LCID lcid, DISPID *rgDispId)
116 OmNavigator *This = OMNAVIGATOR_THIS(iface);
118 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
121 static HRESULT WINAPI OmNavigator_Invoke(IOmNavigator *iface, DISPID dispIdMember,
122 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
123 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
125 OmNavigator *This = OMNAVIGATOR_THIS(iface);
127 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
128 pVarResult, pExcepInfo, puArgErr);
131 static HRESULT WINAPI OmNavigator_get_appCodeName(IOmNavigator *iface, BSTR *p)
133 OmNavigator *This = OMNAVIGATOR_THIS(iface);
134 FIXME("(%p)->(%p)\n", This, p);
135 return E_NOTIMPL;
138 static HRESULT WINAPI OmNavigator_get_appName(IOmNavigator *iface, BSTR *p)
140 OmNavigator *This = OMNAVIGATOR_THIS(iface);
141 FIXME("(%p)->(%p)\n", This, p);
142 return E_NOTIMPL;
145 static HRESULT WINAPI OmNavigator_get_appVersion(IOmNavigator *iface, BSTR *p)
147 OmNavigator *This = OMNAVIGATOR_THIS(iface);
148 FIXME("(%p)->(%p)\n", This, p);
149 return E_NOTIMPL;
152 static HRESULT WINAPI OmNavigator_get_userAgent(IOmNavigator *iface, BSTR *p)
154 OmNavigator *This = OMNAVIGATOR_THIS(iface);
155 FIXME("(%p)->(%p)\n", This, p);
156 return E_NOTIMPL;
159 static HRESULT WINAPI OmNavigator_javaEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
161 OmNavigator *This = OMNAVIGATOR_THIS(iface);
162 FIXME("(%p)->(%p)\n", This, enabled);
163 return E_NOTIMPL;
166 static HRESULT WINAPI OmNavigator_taintEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
168 OmNavigator *This = OMNAVIGATOR_THIS(iface);
169 FIXME("(%p)->(%p)\n", This, enabled);
170 return E_NOTIMPL;
173 static HRESULT WINAPI OmNavigator_get_mimeTypes(IOmNavigator *iface, IHTMLMimeTypesCollection **p)
175 OmNavigator *This = OMNAVIGATOR_THIS(iface);
176 FIXME("(%p)->(%p)\n", This, p);
177 return E_NOTIMPL;
180 static HRESULT WINAPI OmNavigator_get_plugins(IOmNavigator *iface, IHTMLPluginsCollection **p)
182 OmNavigator *This = OMNAVIGATOR_THIS(iface);
183 FIXME("(%p)->(%p)\n", This, p);
184 return E_NOTIMPL;
187 static HRESULT WINAPI OmNavigator_get_cookieEnabled(IOmNavigator *iface, VARIANT_BOOL *p)
189 OmNavigator *This = OMNAVIGATOR_THIS(iface);
190 FIXME("(%p)->(%p)\n", This, p);
191 return E_NOTIMPL;
194 static HRESULT WINAPI OmNavigator_get_opsProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
196 OmNavigator *This = OMNAVIGATOR_THIS(iface);
197 FIXME("(%p)->(%p)\n", This, p);
198 return E_NOTIMPL;
201 static HRESULT WINAPI OmNavigator_toString(IOmNavigator *iface, BSTR *String)
203 OmNavigator *This = OMNAVIGATOR_THIS(iface);
204 FIXME("(%p)->(%p)\n", This, String);
205 return E_NOTIMPL;
208 static HRESULT WINAPI OmNavigator_get_cpuClass(IOmNavigator *iface, BSTR *p)
210 OmNavigator *This = OMNAVIGATOR_THIS(iface);
211 FIXME("(%p)->(%p)\n", This, p);
212 return E_NOTIMPL;
215 static HRESULT WINAPI OmNavigator_get_systemLanguage(IOmNavigator *iface, BSTR *p)
217 OmNavigator *This = OMNAVIGATOR_THIS(iface);
218 FIXME("(%p)->(%p)\n", This, p);
219 return E_NOTIMPL;
222 static HRESULT WINAPI OmNavigator_get_browserLanguage(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_userLanguage(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_platform(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_appMinorVersion(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_connectionSpeed(IOmNavigator *iface, long *p)
252 OmNavigator *This = OMNAVIGATOR_THIS(iface);
253 FIXME("(%p)->(%p)\n", This, p);
254 return E_NOTIMPL;
257 static HRESULT WINAPI OmNavigator_get_onLine(IOmNavigator *iface, VARIANT_BOOL *p)
259 OmNavigator *This = OMNAVIGATOR_THIS(iface);
260 FIXME("(%p)->(%p)\n", This, p);
261 return E_NOTIMPL;
264 static HRESULT WINAPI OmNavigator_get_userProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
266 OmNavigator *This = OMNAVIGATOR_THIS(iface);
267 FIXME("(%p)->(%p)\n", This, p);
268 return E_NOTIMPL;
271 #undef OMNAVIGATOR_THIS
273 static const IOmNavigatorVtbl OmNavigatorVtbl = {
274 OmNavigator_QueryInterface,
275 OmNavigator_AddRef,
276 OmNavigator_Release,
277 OmNavigator_GetTypeInfoCount,
278 OmNavigator_GetTypeInfo,
279 OmNavigator_GetIDsOfNames,
280 OmNavigator_Invoke,
281 OmNavigator_get_appCodeName,
282 OmNavigator_get_appName,
283 OmNavigator_get_appVersion,
284 OmNavigator_get_userAgent,
285 OmNavigator_javaEnabled,
286 OmNavigator_taintEnabled,
287 OmNavigator_get_mimeTypes,
288 OmNavigator_get_plugins,
289 OmNavigator_get_cookieEnabled,
290 OmNavigator_get_opsProfile,
291 OmNavigator_toString,
292 OmNavigator_get_cpuClass,
293 OmNavigator_get_systemLanguage,
294 OmNavigator_get_browserLanguage,
295 OmNavigator_get_userLanguage,
296 OmNavigator_get_platform,
297 OmNavigator_get_appMinorVersion,
298 OmNavigator_get_connectionSpeed,
299 OmNavigator_get_onLine,
300 OmNavigator_get_userProfile
303 static const tid_t OmNavigator_iface_tids[] = {
304 IOmNavigator_tid,
307 static dispex_static_data_t OmNavigator_dispex = {
308 NULL,
309 IOmNavigator_tid,
310 NULL,
311 OmNavigator_iface_tids
314 IOmNavigator *OmNavigator_Create(void)
316 OmNavigator *ret;
318 ret = heap_alloc_zero(sizeof(*ret));
319 ret->lpIOmNavigatorVtbl = &OmNavigatorVtbl;
320 ret->ref = 1;
322 init_dispex(&ret->dispex, (IUnknown*)OMNAVIGATOR(ret), &OmNavigator_dispex);
324 return OMNAVIGATOR(ret);