wined3d: Don't bother with glGetError() if we have ARB_DEBUG_OUTPUT.
[wine.git] / dlls / browseui / aclsource.c
blob71e9d39a71af4f052e25e9b0829b9ad07e2e4031
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/unicode.h"
41 #include "browseui.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
45 typedef struct tagACLShellSource {
46 IEnumString IEnumString_iface;
47 IACList2 IACList2_iface;
48 LONG refCount;
49 DWORD dwOptions;
50 } ACLShellSource;
52 static inline ACLShellSource *impl_from_IACList2(IACList2 *iface)
54 return CONTAINING_RECORD(iface, ACLShellSource, IACList2_iface);
57 static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface)
59 return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface);
62 static void ACLShellSource_Destructor(ACLShellSource *This)
64 TRACE("destroying %p\n", This);
65 heap_free(This);
68 static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
70 ACLShellSource *This = impl_from_IEnumString(iface);
72 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), ppvOut);
74 *ppvOut = NULL;
76 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString))
78 *ppvOut = &This->IEnumString_iface;
80 else if (IsEqualIID(iid, &IID_IACList2) || IsEqualIID(iid, &IID_IACList))
82 *ppvOut = &This->IACList2_iface;
85 if (*ppvOut)
87 IEnumString_AddRef(iface);
88 return S_OK;
91 WARN("unsupported interface: %s\n", debugstr_guid(iid));
92 return E_NOINTERFACE;
95 static ULONG WINAPI ACLShellSource_AddRef(IEnumString *iface)
97 ACLShellSource *This = impl_from_IEnumString(iface);
98 ULONG ref = InterlockedIncrement(&This->refCount);
99 TRACE("(%p)->(%u)\n", This, ref);
100 return ref;
103 static ULONG WINAPI ACLShellSource_Release(IEnumString *iface)
105 ACLShellSource *This = impl_from_IEnumString(iface);
106 ULONG ref = InterlockedDecrement(&This->refCount);
108 TRACE("(%p)->(%u)\n", This, ref);
110 if (ref == 0)
111 ACLShellSource_Destructor(This);
112 return ref;
115 static HRESULT WINAPI ACLShellSource_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt,
116 ULONG *fetched)
118 ACLShellSource *This = impl_from_IEnumString(iface);
119 FIXME("(%p)->(%u %p %p): stub\n", This, celt, rgelt, fetched);
120 return E_NOTIMPL;
123 static HRESULT WINAPI ACLShellSource_Skip(IEnumString *iface, ULONG celt)
125 ACLShellSource *This = impl_from_IEnumString(iface);
126 FIXME("(%p)->(%u): stub\n", This, celt);
127 return E_NOTIMPL;
130 static HRESULT WINAPI ACLShellSource_Reset(IEnumString *iface)
132 ACLShellSource *This = impl_from_IEnumString(iface);
133 FIXME("(%p): stub\n", This);
134 return E_NOTIMPL;
137 static HRESULT WINAPI ACLShellSource_Clone(IEnumString *iface, IEnumString **ppenum)
139 ACLShellSource *This = impl_from_IEnumString(iface);
140 FIXME("(%p)->(%p): stub\n", This, ppenum);
141 return E_NOTIMPL;
144 static const IEnumStringVtbl ACLShellSourceVtbl = {
145 ACLShellSource_QueryInterface,
146 ACLShellSource_AddRef,
147 ACLShellSource_Release,
148 ACLShellSource_Next,
149 ACLShellSource_Skip,
150 ACLShellSource_Reset,
151 ACLShellSource_Clone
154 static HRESULT WINAPI ACList_QueryInterface(IACList2 *iface, REFIID iid, void **ppvOut)
156 ACLShellSource *This = impl_from_IACList2(iface);
157 return IEnumString_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
160 static ULONG WINAPI ACList_AddRef(IACList2 *iface)
162 ACLShellSource *This = impl_from_IACList2(iface);
163 return IEnumString_AddRef(&This->IEnumString_iface);
166 static ULONG WINAPI ACList_Release(IACList2 *iface)
168 ACLShellSource *This = impl_from_IACList2(iface);
169 return IEnumString_Release(&This->IEnumString_iface);
172 static HRESULT WINAPI ACList_Expand(IACList2 *iface, LPCWSTR wstr)
174 ACLShellSource *This = impl_from_IACList2(iface);
175 FIXME("STUB:(%p) %s\n",This,debugstr_w(wstr));
176 return E_NOTIMPL;
179 static HRESULT WINAPI ACList_GetOptions(IACList2 *iface, DWORD *pdwFlag)
181 ACLShellSource *This = impl_from_IACList2(iface);
182 *pdwFlag = This->dwOptions;
183 return S_OK;
186 static HRESULT WINAPI ACList_SetOptions(IACList2 *iface,
187 DWORD dwFlag)
189 ACLShellSource *This = impl_from_IACList2(iface);
190 This->dwOptions = dwFlag;
191 return S_OK;
194 static const IACList2Vtbl ACListVtbl =
196 ACList_QueryInterface,
197 ACList_AddRef,
198 ACList_Release,
199 ACList_Expand,
200 ACList_SetOptions,
201 ACList_GetOptions
204 HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
206 ACLShellSource *This;
207 if (pUnkOuter)
208 return CLASS_E_NOAGGREGATION;
210 This = heap_alloc_zero(sizeof(ACLShellSource));
211 if (This == NULL)
212 return E_OUTOFMEMORY;
214 This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl;
215 This->IACList2_iface.lpVtbl = &ACListVtbl;
216 This->refCount = 1;
218 TRACE("returning %p\n", This);
219 *ppOut = (IUnknown *)&This->IEnumString_iface;
220 return S_OK;