d3d9: Fix Reset() with system memory buffers.
[wine.git] / dlls / browseui / aclsource.c
blob0ade9cce5514872842a7edb3eae4d3f750c235c8
1 /*
2 * Shell AutoComplete list
4 * Copyright 2008 CodeWeavers, Aric Stewart
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
21 #include "config.h"
23 #include <stdarg.h>
25 #define COBJMACROS
27 #include "wine/debug.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "winuser.h"
32 #include "shlwapi.h"
33 #include "winerror.h"
34 #include "objbase.h"
36 #include "shlguid.h"
37 #include "shlobj.h"
39 #include "wine/heap.h"
40 #include "wine/unicode.h"
42 #include "browseui.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
46 typedef struct tagACLShellSource {
47 IEnumString IEnumString_iface;
48 IACList2 IACList2_iface;
49 LONG refCount;
50 DWORD dwOptions;
51 } ACLShellSource;
53 static inline ACLShellSource *impl_from_IACList2(IACList2 *iface)
55 return CONTAINING_RECORD(iface, ACLShellSource, IACList2_iface);
58 static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface)
60 return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface);
63 static void ACLShellSource_Destructor(ACLShellSource *This)
65 TRACE("destroying %p\n", This);
66 heap_free(This);
69 static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
71 ACLShellSource *This = impl_from_IEnumString(iface);
73 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), ppvOut);
75 *ppvOut = NULL;
77 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString))
79 *ppvOut = &This->IEnumString_iface;
81 else if (IsEqualIID(iid, &IID_IACList2) || IsEqualIID(iid, &IID_IACList))
83 *ppvOut = &This->IACList2_iface;
86 if (*ppvOut)
88 IEnumString_AddRef(iface);
89 return S_OK;
92 WARN("unsupported interface: %s\n", debugstr_guid(iid));
93 return E_NOINTERFACE;
96 static ULONG WINAPI ACLShellSource_AddRef(IEnumString *iface)
98 ACLShellSource *This = impl_from_IEnumString(iface);
99 ULONG ref = InterlockedIncrement(&This->refCount);
100 TRACE("(%p)->(%u)\n", This, ref);
101 return ref;
104 static ULONG WINAPI ACLShellSource_Release(IEnumString *iface)
106 ACLShellSource *This = impl_from_IEnumString(iface);
107 ULONG ref = InterlockedDecrement(&This->refCount);
109 TRACE("(%p)->(%u)\n", This, ref);
111 if (ref == 0)
112 ACLShellSource_Destructor(This);
113 return ref;
116 static HRESULT WINAPI ACLShellSource_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt,
117 ULONG *fetched)
119 ACLShellSource *This = impl_from_IEnumString(iface);
120 FIXME("(%p)->(%u %p %p): stub\n", This, celt, rgelt, fetched);
121 return E_NOTIMPL;
124 static HRESULT WINAPI ACLShellSource_Skip(IEnumString *iface, ULONG celt)
126 ACLShellSource *This = impl_from_IEnumString(iface);
127 FIXME("(%p)->(%u): stub\n", This, celt);
128 return E_NOTIMPL;
131 static HRESULT WINAPI ACLShellSource_Reset(IEnumString *iface)
133 ACLShellSource *This = impl_from_IEnumString(iface);
134 FIXME("(%p): stub\n", This);
135 return E_NOTIMPL;
138 static HRESULT WINAPI ACLShellSource_Clone(IEnumString *iface, IEnumString **ppenum)
140 ACLShellSource *This = impl_from_IEnumString(iface);
141 FIXME("(%p)->(%p): stub\n", This, ppenum);
142 return E_NOTIMPL;
145 static const IEnumStringVtbl ACLShellSourceVtbl = {
146 ACLShellSource_QueryInterface,
147 ACLShellSource_AddRef,
148 ACLShellSource_Release,
149 ACLShellSource_Next,
150 ACLShellSource_Skip,
151 ACLShellSource_Reset,
152 ACLShellSource_Clone
155 static HRESULT WINAPI ACList_QueryInterface(IACList2 *iface, REFIID iid, void **ppvOut)
157 ACLShellSource *This = impl_from_IACList2(iface);
158 return IEnumString_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
161 static ULONG WINAPI ACList_AddRef(IACList2 *iface)
163 ACLShellSource *This = impl_from_IACList2(iface);
164 return IEnumString_AddRef(&This->IEnumString_iface);
167 static ULONG WINAPI ACList_Release(IACList2 *iface)
169 ACLShellSource *This = impl_from_IACList2(iface);
170 return IEnumString_Release(&This->IEnumString_iface);
173 static HRESULT WINAPI ACList_Expand(IACList2 *iface, LPCWSTR wstr)
175 ACLShellSource *This = impl_from_IACList2(iface);
176 FIXME("STUB:(%p) %s\n",This,debugstr_w(wstr));
177 return E_NOTIMPL;
180 static HRESULT WINAPI ACList_GetOptions(IACList2 *iface, DWORD *pdwFlag)
182 ACLShellSource *This = impl_from_IACList2(iface);
183 *pdwFlag = This->dwOptions;
184 return S_OK;
187 static HRESULT WINAPI ACList_SetOptions(IACList2 *iface,
188 DWORD dwFlag)
190 ACLShellSource *This = impl_from_IACList2(iface);
191 This->dwOptions = dwFlag;
192 return S_OK;
195 static const IACList2Vtbl ACListVtbl =
197 ACList_QueryInterface,
198 ACList_AddRef,
199 ACList_Release,
200 ACList_Expand,
201 ACList_SetOptions,
202 ACList_GetOptions
205 HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
207 ACLShellSource *This;
208 if (pUnkOuter)
209 return CLASS_E_NOAGGREGATION;
211 This = heap_alloc_zero(sizeof(ACLShellSource));
212 if (This == NULL)
213 return E_OUTOFMEMORY;
215 This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl;
216 This->IACList2_iface.lpVtbl = &ACListVtbl;
217 This->refCount = 1;
219 TRACE("returning %p\n", This);
220 *ppOut = (IUnknown *)&This->IEnumString_iface;
221 return S_OK;