dmime/tests: Check more notification / dirty messages fields.
[wine.git] / dlls / dsuiext / dsuiext.c
blob5867c677f68c9af4e48dcef724e86f4168c0f6b2
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/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(dsuiext);
35 typedef struct
37 IDsDisplaySpecifier IDsDisplaySpecifier_iface;
38 LONG ref;
39 } DisplaySpec;
41 static inline DisplaySpec *impl_from_IDsDisplaySpecifier(IDsDisplaySpecifier *iface)
43 return CONTAINING_RECORD(iface, DisplaySpec, IDsDisplaySpecifier_iface);
46 static HRESULT WINAPI dispspec_QueryInterface(IDsDisplaySpecifier *iface, REFIID iid, void **obj)
48 TRACE("%p,%s,%p\n", iface, debugstr_guid(iid), obj);
50 if (!iid || !obj) return E_INVALIDARG;
52 if (IsEqualGUID(iid, &IID_IUnknown) ||
53 IsEqualGUID(iid, &IID_IDsDisplaySpecifier))
55 iface->lpVtbl->AddRef(iface);
56 *obj = iface;
57 return S_OK;
60 FIXME("interface %s is not implemented\n", debugstr_guid(iid));
61 return E_NOINTERFACE;
64 static ULONG WINAPI dispspec_AddRef(IDsDisplaySpecifier *iface)
66 DisplaySpec *dispspec = impl_from_IDsDisplaySpecifier(iface);
67 return InterlockedIncrement(&dispspec->ref);
70 static ULONG WINAPI dispspec_Release(IDsDisplaySpecifier *iface)
72 DisplaySpec *dispspec = impl_from_IDsDisplaySpecifier(iface);
73 LONG ref = InterlockedDecrement(&dispspec->ref);
75 if (!ref)
77 TRACE("destroying %p\n", iface);
78 free(dispspec);
81 return ref;
84 static HRESULT WINAPI dispspec_SetServer(IDsDisplaySpecifier *iface, LPCWSTR server, LPCWSTR user,
85 LPCWSTR password, DWORD flags)
87 FIXME("%p,%s,%s,%p,%08lx: stub\n", iface, debugstr_w(server), debugstr_w(user), password, flags);
88 return E_NOTIMPL;
91 static HRESULT WINAPI dispspec_SetLanguageID(IDsDisplaySpecifier *iface, LANGID lang)
93 FIXME("%p,%08x: stub\n", iface, lang);
94 return E_NOTIMPL;
97 static HRESULT WINAPI dispspec_GetDisplaySpecifier(IDsDisplaySpecifier *iface, LPCWSTR object,
98 REFIID iid, void **obj)
100 FIXME("%p,%s,%s,%p: stub\n", iface, debugstr_w(object), debugstr_guid(iid), obj);
101 return E_NOTIMPL;
104 static HRESULT WINAPI dispspec_GetIconLocation(IDsDisplaySpecifier *iface, LPCWSTR object,
105 DWORD flags, LPWSTR buffer, INT size, INT *id)
107 FIXME("%p,%s,%08lx,%p,%d,%p: stub\n", iface, debugstr_w(object), flags, buffer, size, id);
108 return E_NOTIMPL;
111 static HICON WINAPI dispspec_GetIcon(IDsDisplaySpecifier *iface, LPCWSTR object,
112 DWORD flags, INT cx, INT cy)
114 FIXME("%p,%s,%08lx,%dx%d: stub\n", iface, debugstr_w(object), flags, cx, cy);
115 return 0;
118 static HRESULT WINAPI dispspec_GetFriendlyClassName(IDsDisplaySpecifier *iface, LPCWSTR object,
119 LPWSTR buffer, INT size)
121 FIXME("%p,%s,%p,%d: stub\n", iface, debugstr_w(object), buffer, size);
122 return E_NOTIMPL;
125 static HRESULT WINAPI dispspec_GetFriendlyAttributeName(IDsDisplaySpecifier *iface, LPCWSTR object,
126 LPCWSTR name, LPWSTR buffer, UINT size)
128 FIXME("%p,%s,%s,%p,%d: stub\n", iface, debugstr_w(object), debugstr_w(name), buffer, size);
129 return E_NOTIMPL;
132 static BOOL WINAPI dispspec_IsClassContainer(IDsDisplaySpecifier *iface, LPCWSTR object,
133 LPCWSTR path, DWORD flags)
135 FIXME("%p,%s,%s,%08lx: stub\n", iface, debugstr_w(object), debugstr_w(path), flags);
136 return FALSE;
139 static HRESULT WINAPI dispspec_GetClassCreationInfo(IDsDisplaySpecifier *iface, LPCWSTR object,
140 LPDSCLASSCREATIONINFO *info)
142 FIXME("%p,%s,%p: stub\n", iface, debugstr_w(object), info);
143 return E_NOTIMPL;
146 static HRESULT WINAPI dispspec_EnumClassAttributes(IDsDisplaySpecifier *iface, LPCWSTR object,
147 LPDSENUMATTRIBUTES cb, LPARAM param)
149 FIXME("%p,%s,%p,%08Ix: stub\n", iface, debugstr_w(object), cb, param);
150 return E_NOTIMPL;
153 static ADSTYPE WINAPI dispspec_GetAttributeADsType(IDsDisplaySpecifier *iface, LPCWSTR name)
155 FIXME("%p,%s: stub\n", iface, debugstr_w(name));
156 return ADSTYPE_INVALID;
159 static const IDsDisplaySpecifierVtbl IDsDisplaySpecifier_vtbl =
161 dispspec_QueryInterface,
162 dispspec_AddRef,
163 dispspec_Release,
164 dispspec_SetServer,
165 dispspec_SetLanguageID,
166 dispspec_GetDisplaySpecifier,
167 dispspec_GetIconLocation,
168 dispspec_GetIcon,
169 dispspec_GetFriendlyClassName,
170 dispspec_GetFriendlyAttributeName,
171 dispspec_IsClassContainer,
172 dispspec_GetClassCreationInfo,
173 dispspec_EnumClassAttributes,
174 dispspec_GetAttributeADsType
177 static HRESULT DsDisplaySpecifier_create(REFIID iid, void **obj)
179 DisplaySpec *dispspec;
180 HRESULT hr;
182 dispspec = malloc(sizeof(*dispspec));
183 if (!dispspec) return E_OUTOFMEMORY;
185 dispspec->IDsDisplaySpecifier_iface.lpVtbl = &IDsDisplaySpecifier_vtbl;
186 dispspec->ref = 1;
188 hr = dispspec->IDsDisplaySpecifier_iface.lpVtbl->QueryInterface(&dispspec->IDsDisplaySpecifier_iface, iid, obj);
189 dispspec->IDsDisplaySpecifier_iface.lpVtbl->Release(&dispspec->IDsDisplaySpecifier_iface);
191 return hr;
194 static const struct class_info
196 const CLSID *clsid;
197 HRESULT (*constructor)(REFIID, void **);
198 } class_info[] =
200 { &CLSID_DsDisplaySpecifier, DsDisplaySpecifier_create }
203 typedef struct
205 IClassFactory IClassFactory_iface;
206 LONG ref;
207 const struct class_info *info;
208 } class_factory;
210 static inline class_factory *impl_from_IClassFactory(IClassFactory *iface)
212 return CONTAINING_RECORD(iface, class_factory, IClassFactory_iface);
215 static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, REFIID iid, LPVOID *obj)
217 TRACE("%p,%s,%p\n", iface, debugstr_guid(iid), obj);
219 if (!iid || !obj) return E_INVALIDARG;
221 if (IsEqualIID(iid, &IID_IUnknown) ||
222 IsEqualIID(iid, &IID_IClassFactory))
224 IClassFactory_AddRef(iface);
225 *obj = iface;
226 return S_OK;
229 *obj = NULL;
230 FIXME("interface %s is not implemented\n", debugstr_guid(iid));
231 return E_NOINTERFACE;
234 static ULONG WINAPI factory_AddRef(IClassFactory *iface)
236 class_factory *factory = impl_from_IClassFactory(iface);
237 ULONG ref = InterlockedIncrement(&factory->ref);
239 TRACE("(%p) ref %lu\n", iface, ref);
241 return ref;
244 static ULONG WINAPI factory_Release(IClassFactory *iface)
246 class_factory *factory = impl_from_IClassFactory(iface);
247 ULONG ref = InterlockedDecrement(&factory->ref);
249 TRACE("(%p) ref %lu\n", iface, ref);
251 if (!ref)
252 free(factory);
254 return ref;
257 static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **obj)
259 class_factory *factory = impl_from_IClassFactory(iface);
261 TRACE("%p,%s,%p\n", outer, debugstr_guid(iid), obj);
263 if (!iid || !obj) return E_INVALIDARG;
265 *obj = NULL;
266 if (outer) return CLASS_E_NOAGGREGATION;
268 return factory->info->constructor(iid, obj);
271 static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock)
273 FIXME("%p,%d: stub\n", iface, lock);
274 return S_OK;
277 static const struct IClassFactoryVtbl factory_vtbl =
279 factory_QueryInterface,
280 factory_AddRef,
281 factory_Release,
282 factory_CreateInstance,
283 factory_LockServer
286 static HRESULT factory_constructor(const struct class_info *info, REFIID riid, void **obj)
288 class_factory *factory;
289 HRESULT hr;
291 factory = malloc(sizeof(*factory));
292 if (!factory) return E_OUTOFMEMORY;
294 factory->IClassFactory_iface.lpVtbl = &factory_vtbl;
295 factory->ref = 1;
296 factory->info = info;
298 hr = IClassFactory_QueryInterface(&factory->IClassFactory_iface, riid, obj);
299 IClassFactory_Release(&factory->IClassFactory_iface);
301 return hr;
304 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *obj)
306 int i;
308 TRACE("%s,%s,%p\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
310 if (!clsid || !iid || !obj) return E_INVALIDARG;
312 *obj = NULL;
314 for (i = 0; i < ARRAY_SIZE(class_info); i++)
316 if (IsEqualCLSID(class_info[i].clsid, clsid))
317 return factory_constructor(&class_info[i], iid, obj);
320 FIXME("class %s/%s is not implemented\n", debugstr_guid(clsid), debugstr_guid(iid));
321 return CLASS_E_CLASSNOTAVAILABLE;