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
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(dsuiext
);
37 IDsDisplaySpecifier IDsDisplaySpecifier_iface
;
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
);
60 FIXME("interface %s is not implemented\n", debugstr_guid(iid
));
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
);
77 TRACE("destroying %p\n", iface
);
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
);
91 static HRESULT WINAPI
dispspec_SetLanguageID(IDsDisplaySpecifier
*iface
, LANGID lang
)
93 FIXME("%p,%08x: stub\n", iface
, lang
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
,
165 dispspec_SetLanguageID
,
166 dispspec_GetDisplaySpecifier
,
167 dispspec_GetIconLocation
,
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
;
182 dispspec
= malloc(sizeof(*dispspec
));
183 if (!dispspec
) return E_OUTOFMEMORY
;
185 dispspec
->IDsDisplaySpecifier_iface
.lpVtbl
= &IDsDisplaySpecifier_vtbl
;
188 hr
= dispspec
->IDsDisplaySpecifier_iface
.lpVtbl
->QueryInterface(&dispspec
->IDsDisplaySpecifier_iface
, iid
, obj
);
189 dispspec
->IDsDisplaySpecifier_iface
.lpVtbl
->Release(&dispspec
->IDsDisplaySpecifier_iface
);
194 static const struct class_info
197 HRESULT (*constructor
)(REFIID
, void **);
200 { &CLSID_DsDisplaySpecifier
, DsDisplaySpecifier_create
}
205 IClassFactory IClassFactory_iface
;
207 const struct class_info
*info
;
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
);
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
);
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
);
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
;
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
);
277 static const struct IClassFactoryVtbl factory_vtbl
=
279 factory_QueryInterface
,
282 factory_CreateInstance
,
286 static HRESULT
factory_constructor(const struct class_info
*info
, REFIID riid
, void **obj
)
288 class_factory
*factory
;
291 factory
= malloc(sizeof(*factory
));
292 if (!factory
) return E_OUTOFMEMORY
;
294 factory
->IClassFactory_iface
.lpVtbl
= &factory_vtbl
;
296 factory
->info
= info
;
298 hr
= IClassFactory_QueryInterface(&factory
->IClassFactory_iface
, riid
, obj
);
299 IClassFactory_Release(&factory
->IClassFactory_iface
);
304 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID iid
, LPVOID
*obj
)
308 TRACE("%s,%s,%p\n", debugstr_guid(clsid
), debugstr_guid(iid
), obj
);
310 if (!clsid
|| !iid
|| !obj
) return E_INVALIDARG
;
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
;