Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/browseui/aclsource.c
5968 views
1
/*
2
* Shell AutoComplete list
3
*
4
* Copyright 2008 CodeWeavers, Aric Stewart
5
*
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.
10
*
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.
15
*
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
19
*/
20
21
#include <stdarg.h>
22
23
#define COBJMACROS
24
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"
33
34
#include "shlguid.h"
35
#include "shlobj.h"
36
37
#include "browseui.h"
38
39
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
40
41
typedef struct tagACLShellSource {
42
IEnumString IEnumString_iface;
43
IACList2 IACList2_iface;
44
LONG refCount;
45
DWORD dwOptions;
46
} ACLShellSource;
47
48
static inline ACLShellSource *impl_from_IACList2(IACList2 *iface)
49
{
50
return CONTAINING_RECORD(iface, ACLShellSource, IACList2_iface);
51
}
52
53
static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface)
54
{
55
return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface);
56
}
57
58
static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
59
{
60
ACLShellSource *This = impl_from_IEnumString(iface);
61
62
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), ppvOut);
63
64
*ppvOut = NULL;
65
66
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString))
67
{
68
*ppvOut = &This->IEnumString_iface;
69
}
70
else if (IsEqualIID(iid, &IID_IACList2) || IsEqualIID(iid, &IID_IACList))
71
{
72
*ppvOut = &This->IACList2_iface;
73
}
74
75
if (*ppvOut)
76
{
77
IEnumString_AddRef(iface);
78
return S_OK;
79
}
80
81
WARN("unsupported interface: %s\n", debugstr_guid(iid));
82
return E_NOINTERFACE;
83
}
84
85
static ULONG WINAPI ACLShellSource_AddRef(IEnumString *iface)
86
{
87
ACLShellSource *This = impl_from_IEnumString(iface);
88
ULONG ref = InterlockedIncrement(&This->refCount);
89
TRACE("(%p)->(%lu)\n", This, ref);
90
return ref;
91
}
92
93
static ULONG WINAPI ACLShellSource_Release(IEnumString *iface)
94
{
95
ACLShellSource *This = impl_from_IEnumString(iface);
96
ULONG ref = InterlockedDecrement(&This->refCount);
97
98
TRACE("(%p)->(%lu)\n", This, ref);
99
100
if (ref == 0)
101
free(This);
102
return ref;
103
}
104
105
static HRESULT WINAPI ACLShellSource_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt,
106
ULONG *fetched)
107
{
108
ACLShellSource *This = impl_from_IEnumString(iface);
109
FIXME("(%p)->(%lu %p %p): stub\n", This, celt, rgelt, fetched);
110
return E_NOTIMPL;
111
}
112
113
static HRESULT WINAPI ACLShellSource_Skip(IEnumString *iface, ULONG celt)
114
{
115
ACLShellSource *This = impl_from_IEnumString(iface);
116
FIXME("(%p)->(%lu): stub\n", This, celt);
117
return E_NOTIMPL;
118
}
119
120
static HRESULT WINAPI ACLShellSource_Reset(IEnumString *iface)
121
{
122
ACLShellSource *This = impl_from_IEnumString(iface);
123
FIXME("(%p): stub\n", This);
124
return E_NOTIMPL;
125
}
126
127
static HRESULT WINAPI ACLShellSource_Clone(IEnumString *iface, IEnumString **ppenum)
128
{
129
ACLShellSource *This = impl_from_IEnumString(iface);
130
FIXME("(%p)->(%p): stub\n", This, ppenum);
131
return E_NOTIMPL;
132
}
133
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
142
};
143
144
static HRESULT WINAPI ACList_QueryInterface(IACList2 *iface, REFIID iid, void **ppvOut)
145
{
146
ACLShellSource *This = impl_from_IACList2(iface);
147
return IEnumString_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
148
}
149
150
static ULONG WINAPI ACList_AddRef(IACList2 *iface)
151
{
152
ACLShellSource *This = impl_from_IACList2(iface);
153
return IEnumString_AddRef(&This->IEnumString_iface);
154
}
155
156
static ULONG WINAPI ACList_Release(IACList2 *iface)
157
{
158
ACLShellSource *This = impl_from_IACList2(iface);
159
return IEnumString_Release(&This->IEnumString_iface);
160
}
161
162
static HRESULT WINAPI ACList_Expand(IACList2 *iface, LPCWSTR wstr)
163
{
164
ACLShellSource *This = impl_from_IACList2(iface);
165
FIXME("STUB:(%p) %s\n",This,debugstr_w(wstr));
166
return E_NOTIMPL;
167
}
168
169
static HRESULT WINAPI ACList_GetOptions(IACList2 *iface, DWORD *pdwFlag)
170
{
171
ACLShellSource *This = impl_from_IACList2(iface);
172
*pdwFlag = This->dwOptions;
173
return S_OK;
174
}
175
176
static HRESULT WINAPI ACList_SetOptions(IACList2 *iface,
177
DWORD dwFlag)
178
{
179
ACLShellSource *This = impl_from_IACList2(iface);
180
This->dwOptions = dwFlag;
181
return S_OK;
182
}
183
184
static const IACList2Vtbl ACListVtbl =
185
{
186
ACList_QueryInterface,
187
ACList_AddRef,
188
ACList_Release,
189
ACList_Expand,
190
ACList_SetOptions,
191
ACList_GetOptions
192
};
193
194
HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
195
{
196
ACLShellSource *This;
197
if (pUnkOuter)
198
return CLASS_E_NOAGGREGATION;
199
200
if (!(This = calloc(1, sizeof(*This))))
201
return E_OUTOFMEMORY;
202
203
This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl;
204
This->IACList2_iface.lpVtbl = &ACListVtbl;
205
This->refCount = 1;
206
207
TRACE("returning %p\n", This);
208
*ppOut = (IUnknown *)&This->IEnumString_iface;
209
return S_OK;
210
}
211
212