mfplat: Remove duplicated GUID entry from attribute tracing.
[wine/zf.git] / dlls / dsuiext / dsuiext.c
blob1978a8dd4ec4b16529ccab4b65ea90ab05819950
1 /*
2 * Copyright 2020 Dmitry Timoshkov
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "objbase.h"
26 #include "rpcproxy.h"
27 #include "initguid.h"
28 #include "iads.h"
29 #include "dsclient.h"
31 #include "wine/heap.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dsuiext);
36 typedef struct
38 IDsDisplaySpecifier IDsDisplaySpecifier_iface;
39 LONG ref;
40 } DisplaySpec;
42 static inline DisplaySpec *impl_from_IDsDisplaySpecifier(IDsDisplaySpecifier *iface)
44 return CONTAINING_RECORD(iface, DisplaySpec, IDsDisplaySpecifier_iface);
47 static HRESULT WINAPI dispspec_QueryInterface(IDsDisplaySpecifier *iface, REFIID iid, void **obj)
49 TRACE("%p,%s,%p\n", iface, debugstr_guid(iid), obj);
51 if (!iid || !obj) return E_INVALIDARG;
53 if (IsEqualGUID(iid, &IID_IUnknown) ||
54 IsEqualGUID(iid, &IID_IDsDisplaySpecifier))
56 iface->lpVtbl->AddRef(iface);
57 *obj = iface;
58 return S_OK;
61 FIXME("interface %s is not implemented\n", debugstr_guid(iid));
62 return E_NOINTERFACE;
65 static ULONG WINAPI dispspec_AddRef(IDsDisplaySpecifier *iface)
67 DisplaySpec *dispspec = impl_from_IDsDisplaySpecifier(iface);
68 return InterlockedIncrement(&dispspec->ref);
71 static ULONG WINAPI dispspec_Release(IDsDisplaySpecifier *iface)
73 DisplaySpec *dispspec = impl_from_IDsDisplaySpecifier(iface);
74 LONG ref = InterlockedDecrement(&dispspec->ref);
76 if (!ref)
78 TRACE("destroying %p\n", iface);
79 heap_free(dispspec);
82 return ref;
85 static HRESULT WINAPI dispspec_SetServer(IDsDisplaySpecifier *iface, LPCWSTR server, LPCWSTR user,
86 LPCWSTR password, DWORD flags)
88 FIXME("%p,%s,%s,%p,%08x: stub\n", iface, debugstr_w(server), debugstr_w(user), password, flags);
89 return E_NOTIMPL;
92 static HRESULT WINAPI dispspec_SetLanguageID(IDsDisplaySpecifier *iface, LANGID lang)
94 FIXME("%p,%08x: stub\n", iface, lang);
95 return E_NOTIMPL;
98 static HRESULT WINAPI dispspec_GetDisplaySpecifier(IDsDisplaySpecifier *iface, LPCWSTR object,
99 REFIID iid, void **obj)
101 FIXME("%p,%s,%s,%p: stub\n", iface, debugstr_w(object), debugstr_guid(iid), obj);
102 return E_NOTIMPL;
105 static HRESULT WINAPI dispspec_GetIconLocation(IDsDisplaySpecifier *iface, LPCWSTR object,
106 DWORD flags, LPWSTR buffer, INT size, INT *id)
108 FIXME("%p,%s,%08x,%p,%d,%p: stub\n", iface, debugstr_w(object), flags, buffer, size, id);
109 return E_NOTIMPL;
112 static HICON WINAPI dispspec_GetIcon(IDsDisplaySpecifier *iface, LPCWSTR object,
113 DWORD flags, INT cx, INT cy)
115 FIXME("%p,%s,%08x,%dx%d: stub\n", iface, debugstr_w(object), flags, cx, cy);
116 return 0;
119 static HRESULT WINAPI dispspec_GetFriendlyClassName(IDsDisplaySpecifier *iface, LPCWSTR object,
120 LPWSTR buffer, INT size)
122 FIXME("%p,%s,%p,%d: stub\n", iface, debugstr_w(object), buffer, size);
123 return E_NOTIMPL;
126 static HRESULT WINAPI dispspec_GetFriendlyAttributeName(IDsDisplaySpecifier *iface, LPCWSTR object,
127 LPCWSTR name, LPWSTR buffer, UINT size)
129 FIXME("%p,%s,%s,%p,%d: stub\n", iface, debugstr_w(object), debugstr_w(name), buffer, size);
130 return E_NOTIMPL;
133 static BOOL WINAPI dispspec_IsClassContainer(IDsDisplaySpecifier *iface, LPCWSTR object,
134 LPCWSTR path, DWORD flags)
136 FIXME("%p,%s,%s,%08x: stub\n", iface, debugstr_w(object), debugstr_w(path), flags);
137 return FALSE;
140 static HRESULT WINAPI dispspec_GetClassCreationInfo(IDsDisplaySpecifier *iface, LPCWSTR object,
141 LPDSCLASSCREATIONINFO *info)
143 FIXME("%p,%s,%p: stub\n", iface, debugstr_w(object), info);
144 return E_NOTIMPL;
147 static HRESULT WINAPI dispspec_EnumClassAttributes(IDsDisplaySpecifier *iface, LPCWSTR object,
148 LPDSENUMATTRIBUTES cb, LPARAM param)
150 FIXME("%p,%s,%p,%08lx: stub\n", iface, debugstr_w(object), cb, param);
151 return E_NOTIMPL;
154 static ADSTYPE WINAPI dispspec_GetAttributeADsType(IDsDisplaySpecifier *iface, LPCWSTR name)
156 FIXME("%p,%s: stub\n", iface, debugstr_w(name));
157 return ADSTYPE_INVALID;
160 static const IDsDisplaySpecifierVtbl IDsDisplaySpecifier_vtbl =
162 dispspec_QueryInterface,
163 dispspec_AddRef,
164 dispspec_Release,
165 dispspec_SetServer,
166 dispspec_SetLanguageID,
167 dispspec_GetDisplaySpecifier,
168 dispspec_GetIconLocation,
169 dispspec_GetIcon,
170 dispspec_GetFriendlyClassName,
171 dispspec_GetFriendlyAttributeName,
172 dispspec_IsClassContainer,
173 dispspec_GetClassCreationInfo,
174 dispspec_EnumClassAttributes,
175 dispspec_GetAttributeADsType
178 static HRESULT DsDisplaySpecifier_create(REFIID iid, void **obj)
180 DisplaySpec *dispspec;
181 HRESULT hr;
183 dispspec = heap_alloc(sizeof(*dispspec));
184 if (!dispspec) return E_OUTOFMEMORY;
186 dispspec->IDsDisplaySpecifier_iface.lpVtbl = &IDsDisplaySpecifier_vtbl;
187 dispspec->ref = 1;
189 hr = dispspec->IDsDisplaySpecifier_iface.lpVtbl->QueryInterface(&dispspec->IDsDisplaySpecifier_iface, iid, obj);
190 dispspec->IDsDisplaySpecifier_iface.lpVtbl->Release(&dispspec->IDsDisplaySpecifier_iface);
192 return hr;
195 static const struct class_info
197 const CLSID *clsid;
198 HRESULT (*constructor)(REFIID, void **);
199 } class_info[] =
201 { &CLSID_DsDisplaySpecifier, DsDisplaySpecifier_create }
204 typedef struct
206 IClassFactory IClassFactory_iface;
207 LONG ref;
208 const struct class_info *info;
209 } class_factory;
211 static inline class_factory *impl_from_IClassFactory(IClassFactory *iface)
213 return CONTAINING_RECORD(iface, class_factory, IClassFactory_iface);
216 static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, REFIID iid, LPVOID *obj)
218 TRACE("%p,%s,%p\n", iface, debugstr_guid(iid), obj);
220 if (!iid || !obj) return E_INVALIDARG;
222 if (IsEqualIID(iid, &IID_IUnknown) ||
223 IsEqualIID(iid, &IID_IClassFactory))
225 IClassFactory_AddRef(iface);
226 *obj = iface;
227 return S_OK;
230 *obj = NULL;
231 FIXME("interface %s is not implemented\n", debugstr_guid(iid));
232 return E_NOINTERFACE;
235 static ULONG WINAPI factory_AddRef(IClassFactory *iface)
237 class_factory *factory = impl_from_IClassFactory(iface);
238 ULONG ref = InterlockedIncrement(&factory->ref);
240 TRACE("(%p) ref %u\n", iface, ref);
242 return ref;
245 static ULONG WINAPI factory_Release(IClassFactory *iface)
247 class_factory *factory = impl_from_IClassFactory(iface);
248 ULONG ref = InterlockedDecrement(&factory->ref);
250 TRACE("(%p) ref %u\n", iface, ref);
252 if (!ref)
253 heap_free(factory);
255 return ref;
258 static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **obj)
260 class_factory *factory = impl_from_IClassFactory(iface);
262 TRACE("%p,%s,%p\n", outer, debugstr_guid(iid), obj);
264 if (!iid || !obj) return E_INVALIDARG;
266 *obj = NULL;
267 if (outer) return CLASS_E_NOAGGREGATION;
269 return factory->info->constructor(iid, obj);
272 static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock)
274 FIXME("%p,%d: stub\n", iface, lock);
275 return S_OK;
278 static const struct IClassFactoryVtbl factory_vtbl =
280 factory_QueryInterface,
281 factory_AddRef,
282 factory_Release,
283 factory_CreateInstance,
284 factory_LockServer
287 static HRESULT factory_constructor(const struct class_info *info, REFIID riid, void **obj)
289 class_factory *factory;
290 HRESULT hr;
292 factory = heap_alloc(sizeof(*factory));
293 if (!factory) return E_OUTOFMEMORY;
295 factory->IClassFactory_iface.lpVtbl = &factory_vtbl;
296 factory->ref = 1;
297 factory->info = info;
299 hr = IClassFactory_QueryInterface(&factory->IClassFactory_iface, riid, obj);
300 IClassFactory_Release(&factory->IClassFactory_iface);
302 return hr;
305 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *obj)
307 int i;
309 TRACE("%s,%s,%p\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
311 if (!clsid || !iid || !obj) return E_INVALIDARG;
313 *obj = NULL;
315 for (i = 0; i < ARRAY_SIZE(class_info); i++)
317 if (IsEqualCLSID(class_info[i].clsid, clsid))
318 return factory_constructor(&class_info[i], iid, obj);
321 FIXME("class %s/%s is not implemented\n", debugstr_guid(clsid), debugstr_guid(iid));
322 return CLASS_E_CLASSNOTAVAILABLE;
325 HRESULT WINAPI DllCanUnloadNow(void)
327 return S_FALSE;