include: Add new LCMAP constants.
[wine.git] / dlls / browseui / aclsource.c
blob5ac7cb10761ce444503d1b643776eb8f9220e38b
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 "wine/heap.h"
39 #include "browseui.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
43 typedef struct tagACLShellSource {
44 IEnumString IEnumString_iface;
45 IACList2 IACList2_iface;
46 LONG refCount;
47 DWORD dwOptions;
48 } ACLShellSource;
50 static inline ACLShellSource *impl_from_IACList2(IACList2 *iface)
52 return CONTAINING_RECORD(iface, ACLShellSource, IACList2_iface);
55 static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface)
57 return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface);
60 static void ACLShellSource_Destructor(ACLShellSource *This)
62 TRACE("destroying %p\n", This);
63 heap_free(This);
66 static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
68 ACLShellSource *This = impl_from_IEnumString(iface);
70 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), ppvOut);
72 *ppvOut = NULL;
74 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString))
76 *ppvOut = &This->IEnumString_iface;
78 else if (IsEqualIID(iid, &IID_IACList2) || IsEqualIID(iid, &IID_IACList))
80 *ppvOut = &This->IACList2_iface;
83 if (*ppvOut)
85 IEnumString_AddRef(iface);
86 return S_OK;
89 WARN("unsupported interface: %s\n", debugstr_guid(iid));
90 return E_NOINTERFACE;
93 static ULONG WINAPI ACLShellSource_AddRef(IEnumString *iface)
95 ACLShellSource *This = impl_from_IEnumString(iface);
96 ULONG ref = InterlockedIncrement(&This->refCount);
97 TRACE("(%p)->(%u)\n", This, ref);
98 return ref;
101 static ULONG WINAPI ACLShellSource_Release(IEnumString *iface)
103 ACLShellSource *This = impl_from_IEnumString(iface);
104 ULONG ref = InterlockedDecrement(&This->refCount);
106 TRACE("(%p)->(%u)\n", This, ref);
108 if (ref == 0)
109 ACLShellSource_Destructor(This);
110 return ref;
113 static HRESULT WINAPI ACLShellSource_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt,
114 ULONG *fetched)
116 ACLShellSource *This = impl_from_IEnumString(iface);
117 FIXME("(%p)->(%u %p %p): stub\n", This, celt, rgelt, fetched);
118 return E_NOTIMPL;
121 static HRESULT WINAPI ACLShellSource_Skip(IEnumString *iface, ULONG celt)
123 ACLShellSource *This = impl_from_IEnumString(iface);
124 FIXME("(%p)->(%u): stub\n", This, celt);
125 return E_NOTIMPL;
128 static HRESULT WINAPI ACLShellSource_Reset(IEnumString *iface)
130 ACLShellSource *This = impl_from_IEnumString(iface);
131 FIXME("(%p): stub\n", This);
132 return E_NOTIMPL;
135 static HRESULT WINAPI ACLShellSource_Clone(IEnumString *iface, IEnumString **ppenum)
137 ACLShellSource *This = impl_from_IEnumString(iface);
138 FIXME("(%p)->(%p): stub\n", This, ppenum);
139 return E_NOTIMPL;
142 static const IEnumStringVtbl ACLShellSourceVtbl = {
143 ACLShellSource_QueryInterface,
144 ACLShellSource_AddRef,
145 ACLShellSource_Release,
146 ACLShellSource_Next,
147 ACLShellSource_Skip,
148 ACLShellSource_Reset,
149 ACLShellSource_Clone
152 static HRESULT WINAPI ACList_QueryInterface(IACList2 *iface, REFIID iid, void **ppvOut)
154 ACLShellSource *This = impl_from_IACList2(iface);
155 return IEnumString_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
158 static ULONG WINAPI ACList_AddRef(IACList2 *iface)
160 ACLShellSource *This = impl_from_IACList2(iface);
161 return IEnumString_AddRef(&This->IEnumString_iface);
164 static ULONG WINAPI ACList_Release(IACList2 *iface)
166 ACLShellSource *This = impl_from_IACList2(iface);
167 return IEnumString_Release(&This->IEnumString_iface);
170 static HRESULT WINAPI ACList_Expand(IACList2 *iface, LPCWSTR wstr)
172 ACLShellSource *This = impl_from_IACList2(iface);
173 FIXME("STUB:(%p) %s\n",This,debugstr_w(wstr));
174 return E_NOTIMPL;
177 static HRESULT WINAPI ACList_GetOptions(IACList2 *iface, DWORD *pdwFlag)
179 ACLShellSource *This = impl_from_IACList2(iface);
180 *pdwFlag = This->dwOptions;
181 return S_OK;
184 static HRESULT WINAPI ACList_SetOptions(IACList2 *iface,
185 DWORD dwFlag)
187 ACLShellSource *This = impl_from_IACList2(iface);
188 This->dwOptions = dwFlag;
189 return S_OK;
192 static const IACList2Vtbl ACListVtbl =
194 ACList_QueryInterface,
195 ACList_AddRef,
196 ACList_Release,
197 ACList_Expand,
198 ACList_SetOptions,
199 ACList_GetOptions
202 HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
204 ACLShellSource *This;
205 if (pUnkOuter)
206 return CLASS_E_NOAGGREGATION;
208 This = heap_alloc_zero(sizeof(ACLShellSource));
209 if (This == NULL)
210 return E_OUTOFMEMORY;
212 This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl;
213 This->IACList2_iface.lpVtbl = &ACListVtbl;
214 This->refCount = 1;
216 TRACE("returning %p\n", This);
217 *ppOut = (IUnknown *)&This->IEnumString_iface;
218 return S_OK;