wininet/tests: Update test data to match the new certificate on winehq.org.
[wine.git] / dlls / scrrun / dictionary.c
blob4fcaedd6cfcd766e48793d346f4cd1ba77c17838
1 /*
2 * Copyright (C) 2012 Alistair Leslie-Hughes
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
18 #define COBJMACROS
20 #include "config.h"
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "ole2.h"
26 #include "dispex.h"
27 #include "scrrun.h"
28 #include "scrrun_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(scrrun);
34 typedef struct
36 IDictionary IDictionary_iface;
38 LONG ref;
39 } dictionary;
41 static inline dictionary *impl_from_IDictionary(IDictionary *iface)
43 return CONTAINING_RECORD(iface, dictionary, IDictionary_iface);
46 static HRESULT WINAPI dictionary_QueryInterface(IDictionary *iface, REFIID riid, void **obj)
48 dictionary *This = impl_from_IDictionary(iface);
49 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
51 *obj = NULL;
53 if(IsEqualIID(riid, &IID_IUnknown) ||
54 IsEqualIID(riid, &IID_IDispatch) ||
55 IsEqualIID(riid, &IID_IDictionary))
57 *obj = &This->IDictionary_iface;
59 else if ( IsEqualGUID( riid, &IID_IDispatchEx ))
61 TRACE("Interface IDispatchEx not supported - returning NULL\n");
62 *obj = NULL;
63 return E_NOINTERFACE;
65 else if ( IsEqualGUID( riid, &IID_IObjectWithSite ))
67 TRACE("Interface IObjectWithSite not supported - returning NULL\n");
68 *obj = NULL;
69 return E_NOINTERFACE;
71 else
73 WARN("interface %s not implemented\n", debugstr_guid(riid));
74 return E_NOINTERFACE;
77 IDictionary_AddRef(iface);
78 return S_OK;
81 static ULONG WINAPI dictionary_AddRef(IDictionary *iface)
83 dictionary *This = impl_from_IDictionary(iface);
84 TRACE("(%p)\n", This);
86 return InterlockedIncrement(&This->ref);
89 static ULONG WINAPI dictionary_Release(IDictionary *iface)
91 dictionary *This = impl_from_IDictionary(iface);
92 LONG ref;
94 TRACE("(%p)\n", This);
96 ref = InterlockedDecrement(&This->ref);
97 if(ref == 0)
98 heap_free(This);
100 return ref;
103 static HRESULT WINAPI dictionary_GetTypeInfoCount(IDictionary *iface, UINT *pctinfo)
105 dictionary *This = impl_from_IDictionary(iface);
107 TRACE("(%p)->()\n", This);
109 *pctinfo = 1;
110 return S_OK;
113 static HRESULT WINAPI dictionary_GetTypeInfo(IDictionary *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
115 dictionary *This = impl_from_IDictionary(iface);
117 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
118 return get_typeinfo(IDictionary_tid, ppTInfo);
121 static HRESULT WINAPI dictionary_GetIDsOfNames(IDictionary *iface, REFIID riid, LPOLESTR *rgszNames,
122 UINT cNames, LCID lcid, DISPID *rgDispId)
124 dictionary *This = impl_from_IDictionary(iface);
125 ITypeInfo *typeinfo;
126 HRESULT hr;
128 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
130 hr = get_typeinfo(IDictionary_tid, &typeinfo);
131 if(SUCCEEDED(hr))
133 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
134 ITypeInfo_Release(typeinfo);
137 return hr;
140 static HRESULT WINAPI dictionary_Invoke(IDictionary *iface, DISPID dispIdMember, REFIID riid,
141 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
142 EXCEPINFO *pExcepInfo, UINT *puArgErr)
144 dictionary *This = impl_from_IDictionary(iface);
145 ITypeInfo *typeinfo;
146 HRESULT hr;
148 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
149 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
151 hr = get_typeinfo(IDictionary_tid, &typeinfo);
152 if(SUCCEEDED(hr))
154 hr = ITypeInfo_Invoke(typeinfo, &This->IDictionary_iface, dispIdMember, wFlags,
155 pDispParams, pVarResult, pExcepInfo, puArgErr);
156 ITypeInfo_Release(typeinfo);
159 return hr;
162 static HRESULT WINAPI dictionary_putref_Item(IDictionary *iface, VARIANT *Key, VARIANT *pRetItem)
164 dictionary *This = impl_from_IDictionary(iface);
166 FIXME("(%p)->(%p %p)\n", This, Key, pRetItem);
168 return E_NOTIMPL;
171 static HRESULT WINAPI dictionary_put_Item(IDictionary *iface, VARIANT *Key, VARIANT *pRetItem)
173 dictionary *This = impl_from_IDictionary(iface);
175 FIXME("(%p)->(%p %p)\n", This, Key, pRetItem);
177 return E_NOTIMPL;
180 static HRESULT WINAPI dictionary_get_Item(IDictionary *iface, VARIANT *Key, VARIANT *pRetItem)
182 dictionary *This = impl_from_IDictionary(iface);
184 FIXME("(%p)->(%p %p)\n", This, Key, pRetItem );
186 return E_NOTIMPL;
189 static HRESULT WINAPI dictionary_Add(IDictionary *iface, VARIANT *Key, VARIANT *Item)
191 dictionary *This = impl_from_IDictionary(iface);
193 FIXME("(%p)->(%p %p)\n", This, Key, Item);
195 return E_NOTIMPL;
198 static HRESULT WINAPI dictionary_get_Count(IDictionary *iface, LONG *pCount)
200 dictionary *This = impl_from_IDictionary(iface);
202 FIXME("(%p)->(%p)\n", This, pCount);
204 *pCount = 0;
206 return S_OK;
209 static HRESULT WINAPI dictionary_Exists(IDictionary *iface, VARIANT *Key, VARIANT_BOOL *pExists)
211 dictionary *This = impl_from_IDictionary(iface);
213 FIXME("(%p)->(%p %p)\n", This, Key, pExists);
215 return E_NOTIMPL;
218 static HRESULT WINAPI dictionary_Items(IDictionary *iface, VARIANT *pItemsArray)
220 dictionary *This = impl_from_IDictionary(iface);
222 FIXME("(%p)->(%p)\n", This, pItemsArray);
224 return E_NOTIMPL;
227 static HRESULT WINAPI dictionary_put_Key(IDictionary *iface, VARIANT *Key, VARIANT *rhs)
229 dictionary *This = impl_from_IDictionary(iface);
231 FIXME("(%p)->(%p %p)\n", This, Key, rhs);
233 return E_NOTIMPL;
236 static HRESULT WINAPI dictionary_Keys(IDictionary *iface, VARIANT *pKeysArray)
238 dictionary *This = impl_from_IDictionary(iface);
240 FIXME("(%p)->(%p)\n", This, pKeysArray);
242 return E_NOTIMPL;
245 static HRESULT WINAPI dictionary_Remove(IDictionary *iface, VARIANT *Key)
247 dictionary *This = impl_from_IDictionary(iface);
249 FIXME("(%p)->(%p)\n", This, Key);
251 return E_NOTIMPL;
254 static HRESULT WINAPI dictionary_RemoveAll(IDictionary *iface)
256 dictionary *This = impl_from_IDictionary(iface);
258 FIXME("(%p)->()\n", This);
260 return E_NOTIMPL;
263 static HRESULT WINAPI dictionary_put_CompareMode(IDictionary *iface, CompareMethod pcomp)
265 dictionary *This = impl_from_IDictionary(iface);
267 FIXME("(%p)->()\n", This);
269 return E_NOTIMPL;
272 static HRESULT WINAPI dictionary_get_CompareMode(IDictionary *iface, CompareMethod *pcomp)
274 dictionary *This = impl_from_IDictionary(iface);
276 FIXME("(%p)->(%p)\n", This, pcomp);
278 return E_NOTIMPL;
281 static HRESULT WINAPI dictionary__NewEnum(IDictionary *iface, IUnknown **ppunk)
283 dictionary *This = impl_from_IDictionary(iface);
285 FIXME("(%p)->(%p)\n", This, ppunk);
287 return E_NOTIMPL;
290 static HRESULT WINAPI dictionary_get_HashVal(IDictionary *iface, VARIANT *Key, VARIANT *HashVal)
292 dictionary *This = impl_from_IDictionary(iface);
294 FIXME("(%p)->(%p %p)\n", This, Key, HashVal);
296 return E_NOTIMPL;
300 static const struct IDictionaryVtbl dictionary_vtbl =
302 dictionary_QueryInterface,
303 dictionary_AddRef,
304 dictionary_Release,
305 dictionary_GetTypeInfoCount,
306 dictionary_GetTypeInfo,
307 dictionary_GetIDsOfNames,
308 dictionary_Invoke,
309 dictionary_putref_Item,
310 dictionary_put_Item,
311 dictionary_get_Item,
312 dictionary_Add,
313 dictionary_get_Count,
314 dictionary_Exists,
315 dictionary_Items,
316 dictionary_put_Key,
317 dictionary_Keys,
318 dictionary_Remove,
319 dictionary_RemoveAll,
320 dictionary_put_CompareMode,
321 dictionary_get_CompareMode,
322 dictionary__NewEnum,
323 dictionary_get_HashVal
326 HRESULT WINAPI Dictionary_CreateInstance(IClassFactory *factory,IUnknown *outer,REFIID riid, void **obj)
328 dictionary *This;
330 TRACE("(%p)\n", obj);
332 *obj = NULL;
334 This = heap_alloc(sizeof(*This));
335 if(!This) return E_OUTOFMEMORY;
337 This->IDictionary_iface.lpVtbl = &dictionary_vtbl;
338 This->ref = 1;
340 *obj = &This->IDictionary_iface;
342 return S_OK;