2 * standard IPropertyStore implementation
4 * Copyright 2012 Vincent Povirk for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
34 #include "propsys_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(propsys);
39 IPropertyStoreCache IPropertyStoreCache_iface;
43 static inline PropertyStore *impl_from_IPropertyStoreCache(IPropertyStoreCache *iface)
45 return CONTAINING_RECORD(iface, PropertyStore, IPropertyStoreCache_iface);
48 static HRESULT WINAPI PropertyStore_QueryInterface(IPropertyStoreCache *iface, REFIID iid,
51 PropertyStore *This = impl_from_IPropertyStoreCache(iface);
52 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
54 if (!ppv) return E_INVALIDARG;
56 if (IsEqualIID(&IID_IUnknown, iid) || IsEqualIID(&IID_IPropertyStore, iid) ||
57 IsEqualIID(&IID_IPropertyStoreCache, iid))
59 *ppv = &This->IPropertyStoreCache_iface;
63 FIXME("No interface for %s\n", debugstr_guid(iid));
68 IUnknown_AddRef((IUnknown*)*ppv);
72 static ULONG WINAPI PropertyStore_AddRef(IPropertyStoreCache *iface)
74 PropertyStore *This = impl_from_IPropertyStoreCache(iface);
75 ULONG ref = InterlockedIncrement(&This->ref);
77 TRACE("(%p) refcount=%u\n", iface, ref);
82 static ULONG WINAPI PropertyStore_Release(IPropertyStoreCache *iface)
84 PropertyStore *This = impl_from_IPropertyStoreCache(iface);
85 ULONG ref = InterlockedDecrement(&This->ref);
87 TRACE("(%p) refcount=%u\n", iface, ref);
90 HeapFree(GetProcessHeap(), 0, This);
95 static HRESULT WINAPI PropertyStore_GetCount(IPropertyStoreCache *iface,
98 FIXME("%p,%p: stub\n", iface, cProps);
102 static HRESULT WINAPI PropertyStore_GetAt(IPropertyStoreCache *iface,
103 DWORD iProp, PROPERTYKEY *pkey)
105 FIXME("%p,%d,%p: stub\n", iface, iProp, pkey);
109 static HRESULT WINAPI PropertyStore_GetValue(IPropertyStoreCache *iface,
110 REFPROPERTYKEY key, PROPVARIANT *pv)
112 FIXME("%p,%p,%p: stub\n", iface, key, pv);
116 static HRESULT WINAPI PropertyStore_SetValue(IPropertyStoreCache *iface,
117 REFPROPERTYKEY key, REFPROPVARIANT propvar)
119 FIXME("%p,%p,%p: stub\n", iface, key, propvar);
123 static HRESULT WINAPI PropertyStore_Commit(IPropertyStoreCache *iface)
125 FIXME("%p: stub\n", iface);
129 static HRESULT WINAPI PropertyStore_GetState(IPropertyStoreCache *iface,
130 REFPROPERTYKEY key, PSC_STATE *pstate)
132 FIXME("%p,%p,%p: stub\n", iface, key, pstate);
136 static HRESULT WINAPI PropertyStore_GetValueAndState(IPropertyStoreCache *iface,
137 REFPROPERTYKEY key, PROPVARIANT *ppropvar, PSC_STATE *pstate)
139 FIXME("%p,%p,%p,%p: stub\n", iface, key, ppropvar, pstate);
143 static HRESULT WINAPI PropertyStore_SetState(IPropertyStoreCache *iface,
144 REFPROPERTYKEY key, PSC_STATE pstate)
146 FIXME("%p,%p,%d: stub\n", iface, key, pstate);
150 static HRESULT WINAPI PropertyStore_SetValueAndState(IPropertyStoreCache *iface,
151 REFPROPERTYKEY key, const PROPVARIANT *ppropvar, PSC_STATE state)
153 FIXME("%p,%p,%p,%d: stub\n", iface, key, ppropvar, state);
157 static const IPropertyStoreCacheVtbl PropertyStore_Vtbl = {
158 PropertyStore_QueryInterface,
159 PropertyStore_AddRef,
160 PropertyStore_Release,
161 PropertyStore_GetCount,
163 PropertyStore_GetValue,
164 PropertyStore_SetValue,
165 PropertyStore_Commit,
166 PropertyStore_GetState,
167 PropertyStore_GetValueAndState,
168 PropertyStore_SetState,
169 PropertyStore_SetValueAndState
172 HRESULT PropertyStore_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
177 TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
181 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
183 This = HeapAlloc(GetProcessHeap(), 0, sizeof(PropertyStore));
184 if (!This) return E_OUTOFMEMORY;
186 This->IPropertyStoreCache_iface.lpVtbl = &PropertyStore_Vtbl;
189 ret = IPropertyStoreCache_QueryInterface(&This->IPropertyStoreCache_iface, iid, ppv);
190 IPropertyStoreCache_Release(&This->IPropertyStoreCache_iface);