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
28 #include "scrrun_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(scrrun
);
36 IDictionary IDictionary_iface
;
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
);
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");
65 else if ( IsEqualGUID( riid
, &IID_IObjectWithSite
))
67 TRACE("Interface IObjectWithSite not supported - returning NULL\n");
73 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
77 IDictionary_AddRef(iface
);
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
);
94 TRACE("(%p)\n", This
);
96 ref
= InterlockedDecrement(&This
->ref
);
99 HeapFree(GetProcessHeap(), 0, This
);
105 static HRESULT WINAPI
dictionary_GetTypeInfoCount(IDictionary
*iface
, UINT
*pctinfo
)
107 dictionary
*This
= impl_from_IDictionary(iface
);
109 TRACE("(%p)->()\n", This
);
115 static HRESULT WINAPI
dictionary_GetTypeInfo(IDictionary
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
117 dictionary
*This
= impl_from_IDictionary(iface
);
119 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
120 return get_typeinfo(IDictionary_tid
, ppTInfo
);
123 static HRESULT WINAPI
dictionary_GetIDsOfNames(IDictionary
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
124 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
126 dictionary
*This
= impl_from_IDictionary(iface
);
130 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
132 hr
= get_typeinfo(IDictionary_tid
, &typeinfo
);
135 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
136 ITypeInfo_Release(typeinfo
);
142 static HRESULT WINAPI
dictionary_Invoke(IDictionary
*iface
, DISPID dispIdMember
, REFIID riid
,
143 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
144 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
146 dictionary
*This
= impl_from_IDictionary(iface
);
150 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
151 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
153 hr
= get_typeinfo(IDictionary_tid
, &typeinfo
);
156 hr
= ITypeInfo_Invoke(typeinfo
, &iface
, dispIdMember
, wFlags
,
157 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
158 ITypeInfo_Release(typeinfo
);
164 static HRESULT WINAPI
dictionary_putref_Item(IDictionary
*iface
, VARIANT
*Key
, VARIANT
*pRetItem
)
166 dictionary
*This
= impl_from_IDictionary(iface
);
168 FIXME("(%p)->(%p %p)\n", This
, Key
, pRetItem
);
173 static HRESULT WINAPI
dictionary_put_Item(IDictionary
*iface
, VARIANT
*Key
, VARIANT
*pRetItem
)
175 dictionary
*This
= impl_from_IDictionary(iface
);
177 FIXME("(%p)->(%p %p)\n", This
, Key
, pRetItem
);
182 static HRESULT WINAPI
dictionary_get_Item(IDictionary
*iface
, VARIANT
*Key
, VARIANT
*pRetItem
)
184 dictionary
*This
= impl_from_IDictionary(iface
);
186 FIXME("(%p)->(%p %p)\n", This
, Key
, pRetItem
);
191 static HRESULT WINAPI
dictionary_Add(IDictionary
*iface
, VARIANT
*Key
, VARIANT
*Item
)
193 dictionary
*This
= impl_from_IDictionary(iface
);
195 FIXME("(%p)->(%p %p)\n", This
, Key
, Item
);
200 static HRESULT WINAPI
dictionary_get_Count(IDictionary
*iface
, LONG
*pCount
)
202 dictionary
*This
= impl_from_IDictionary(iface
);
204 FIXME("(%p)->(%p)\n", This
, pCount
);
211 static HRESULT WINAPI
dictionary_Exists(IDictionary
*iface
, VARIANT
*Key
, VARIANT_BOOL
*pExists
)
213 dictionary
*This
= impl_from_IDictionary(iface
);
215 FIXME("(%p)->(%p %p)\n", This
, Key
, pExists
);
220 static HRESULT WINAPI
dictionary_Items(IDictionary
*iface
, VARIANT
*pItemsArray
)
222 dictionary
*This
= impl_from_IDictionary(iface
);
224 FIXME("(%p)->(%p)\n", This
, pItemsArray
);
229 static HRESULT WINAPI
dictionary_put_Key(IDictionary
*iface
, VARIANT
*Key
, VARIANT
*rhs
)
231 dictionary
*This
= impl_from_IDictionary(iface
);
233 FIXME("(%p)->(%p %p)\n", This
, Key
, rhs
);
238 static HRESULT WINAPI
dictionary_Keys(IDictionary
*iface
, VARIANT
*pKeysArray
)
240 dictionary
*This
= impl_from_IDictionary(iface
);
242 FIXME("(%p)->(%p)\n", This
, pKeysArray
);
247 static HRESULT WINAPI
dictionary_Remove(IDictionary
*iface
, VARIANT
*Key
)
249 dictionary
*This
= impl_from_IDictionary(iface
);
251 FIXME("(%p)->(%p)\n", This
, Key
);
256 static HRESULT WINAPI
dictionary_RemoveAll(IDictionary
*iface
)
258 dictionary
*This
= impl_from_IDictionary(iface
);
260 FIXME("(%p)->()\n", This
);
265 static HRESULT WINAPI
dictionary_put_CompareMode(IDictionary
*iface
, CompareMethod pcomp
)
267 dictionary
*This
= impl_from_IDictionary(iface
);
269 FIXME("(%p)->()\n", This
);
274 static HRESULT WINAPI
dictionary_get_CompareMode(IDictionary
*iface
, CompareMethod
*pcomp
)
276 dictionary
*This
= impl_from_IDictionary(iface
);
278 FIXME("(%p)->(%p)\n", This
, pcomp
);
283 static HRESULT WINAPI
dictionary__NewEnum(IDictionary
*iface
, IUnknown
**ppunk
)
285 dictionary
*This
= impl_from_IDictionary(iface
);
287 FIXME("(%p)->(%p)\n", This
, ppunk
);
292 static HRESULT WINAPI
dictionary_get_HashVal(IDictionary
*iface
, VARIANT
*Key
, VARIANT
*HashVal
)
294 dictionary
*This
= impl_from_IDictionary(iface
);
296 FIXME("(%p)->(%p %p)\n", This
, Key
, HashVal
);
302 static const struct IDictionaryVtbl dictionary_vtbl
=
304 dictionary_QueryInterface
,
307 dictionary_GetTypeInfoCount
,
308 dictionary_GetTypeInfo
,
309 dictionary_GetIDsOfNames
,
311 dictionary_putref_Item
,
315 dictionary_get_Count
,
321 dictionary_RemoveAll
,
322 dictionary_put_CompareMode
,
323 dictionary_get_CompareMode
,
325 dictionary_get_HashVal
328 HRESULT WINAPI
Dictionary_CreateInstance(IClassFactory
*factory
,IUnknown
*outer
,REFIID riid
, void **obj
)
332 TRACE("(%p)\n", obj
);
336 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
337 if(!This
) return E_OUTOFMEMORY
;
339 This
->IDictionary_iface
.lpVtbl
= &dictionary_vtbl
;
342 *obj
= &This
->IDictionary_iface
;