winegstreamer: Set 'max_threads' to 4 for 32-bit processors.
[wine.git] / dlls / browseui / aclsource.c
blob72bf323c62eb157a007c5f2a64eff3023fab572e
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 <stdarg.h>
23 #define COBJMACROS
25 #include "wine/debug.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winreg.h"
29 #include "winuser.h"
30 #include "shlwapi.h"
31 #include "winerror.h"
32 #include "objbase.h"
34 #include "shlguid.h"
35 #include "shlobj.h"
37 #include "browseui.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
41 typedef struct tagACLShellSource {
42 IEnumString IEnumString_iface;
43 IACList2 IACList2_iface;
44 LONG refCount;
45 DWORD dwOptions;
46 } ACLShellSource;
48 static inline ACLShellSource *impl_from_IACList2(IACList2 *iface)
50 return CONTAINING_RECORD(iface, ACLShellSource, IACList2_iface);
53 static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface)
55 return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface);
58 static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
60 ACLShellSource *This = impl_from_IEnumString(iface);
62 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), ppvOut);
64 *ppvOut = NULL;
66 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString))
68 *ppvOut = &This->IEnumString_iface;
70 else if (IsEqualIID(iid, &IID_IACList2) || IsEqualIID(iid, &IID_IACList))
72 *ppvOut = &This->IACList2_iface;
75 if (*ppvOut)
77 IEnumString_AddRef(iface);
78 return S_OK;
81 WARN("unsupported interface: %s\n", debugstr_guid(iid));
82 return E_NOINTERFACE;
85 static ULONG WINAPI ACLShellSource_AddRef(IEnumString *iface)
87 ACLShellSource *This = impl_from_IEnumString(iface);
88 ULONG ref = InterlockedIncrement(&This->refCount);
89 TRACE("(%p)->(%lu)\n", This, ref);
90 return ref;
93 static ULONG WINAPI ACLShellSource_Release(IEnumString *iface)
95 ACLShellSource *This = impl_from_IEnumString(iface);
96 ULONG ref = InterlockedDecrement(&This->refCount);
98 TRACE("(%p)->(%lu)\n", This, ref);
100 if (ref == 0)
101 free(This);
102 return ref;
105 static HRESULT WINAPI ACLShellSource_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt,
106 ULONG *fetched)
108 ACLShellSource *This = impl_from_IEnumString(iface);
109 FIXME("(%p)->(%lu %p %p): stub\n", This, celt, rgelt, fetched);
110 return E_NOTIMPL;
113 static HRESULT WINAPI ACLShellSource_Skip(IEnumString *iface, ULONG celt)
115 ACLShellSource *This = impl_from_IEnumString(iface);
116 FIXME("(%p)->(%lu): stub\n", This, celt);
117 return E_NOTIMPL;
120 static HRESULT WINAPI ACLShellSource_Reset(IEnumString *iface)
122 ACLShellSource *This = impl_from_IEnumString(iface);
123 FIXME("(%p): stub\n", This);
124 return E_NOTIMPL;
127 static HRESULT WINAPI ACLShellSource_Clone(IEnumString *iface, IEnumString **ppenum)
129 ACLShellSource *This = impl_from_IEnumString(iface);
130 FIXME("(%p)->(%p): stub\n", This, ppenum);
131 return E_NOTIMPL;
134 static const IEnumStringVtbl ACLShellSourceVtbl = {
135 ACLShellSource_QueryInterface,
136 ACLShellSource_AddRef,
137 ACLShellSource_Release,
138 ACLShellSource_Next,
139 ACLShellSource_Skip,
140 ACLShellSource_Reset,
141 ACLShellSource_Clone
144 static HRESULT WINAPI ACList_QueryInterface(IACList2 *iface, REFIID iid, void **ppvOut)
146 ACLShellSource *This = impl_from_IACList2(iface);
147 return IEnumString_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
150 static ULONG WINAPI ACList_AddRef(IACList2 *iface)
152 ACLShellSource *This = impl_from_IACList2(iface);
153 return IEnumString_AddRef(&This->IEnumString_iface);
156 static ULONG WINAPI ACList_Release(IACList2 *iface)
158 ACLShellSource *This = impl_from_IACList2(iface);
159 return IEnumString_Release(&This->IEnumString_iface);
162 static HRESULT WINAPI ACList_Expand(IACList2 *iface, LPCWSTR wstr)
164 ACLShellSource *This = impl_from_IACList2(iface);
165 FIXME("STUB:(%p) %s\n",This,debugstr_w(wstr));
166 return E_NOTIMPL;
169 static HRESULT WINAPI ACList_GetOptions(IACList2 *iface, DWORD *pdwFlag)
171 ACLShellSource *This = impl_from_IACList2(iface);
172 *pdwFlag = This->dwOptions;
173 return S_OK;
176 static HRESULT WINAPI ACList_SetOptions(IACList2 *iface,
177 DWORD dwFlag)
179 ACLShellSource *This = impl_from_IACList2(iface);
180 This->dwOptions = dwFlag;
181 return S_OK;
184 static const IACList2Vtbl ACListVtbl =
186 ACList_QueryInterface,
187 ACList_AddRef,
188 ACList_Release,
189 ACList_Expand,
190 ACList_SetOptions,
191 ACList_GetOptions
194 HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
196 ACLShellSource *This;
197 if (pUnkOuter)
198 return CLASS_E_NOAGGREGATION;
200 if (!(This = calloc(1, sizeof(*This))))
201 return E_OUTOFMEMORY;
203 This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl;
204 This->IACList2_iface.lpVtbl = &ACListVtbl;
205 This->refCount = 1;
207 TRACE("returning %p\n", This);
208 *ppOut = (IUnknown *)&This->IEnumString_iface;
209 return S_OK;