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/heap.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dsuiext
);
38 IDsDisplaySpecifier IDsDisplaySpecifier_iface
;
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
);
61 FIXME("interface %s is not implemented\n", debugstr_guid(iid
));
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
);
78 TRACE("destroying %p\n", iface
);
85 static HRESULT WINAPI
dispspec_SetServer(IDsDisplaySpecifier
*iface
, LPCWSTR server
, LPCWSTR user
,
86 LPCWSTR password
, DWORD flags
)
88 FIXME("%p,%s,%s,%p,%08lx: stub\n", iface
, debugstr_w(server
), debugstr_w(user
), password
, flags
);
92 static HRESULT WINAPI
dispspec_SetLanguageID(IDsDisplaySpecifier
*iface
, LANGID lang
)
94 FIXME("%p,%08x: stub\n", iface
, lang
);
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
);
105 static HRESULT WINAPI
dispspec_GetIconLocation(IDsDisplaySpecifier
*iface
, LPCWSTR object
,
106 DWORD flags
, LPWSTR buffer
, INT size
, INT
*id
)
108 FIXME("%p,%s,%08lx,%p,%d,%p: stub\n", iface
, debugstr_w(object
), flags
, buffer
, size
, id
);
112 static HICON WINAPI
dispspec_GetIcon(IDsDisplaySpecifier
*iface
, LPCWSTR object
,
113 DWORD flags
, INT cx
, INT cy
)
115 FIXME("%p,%s,%08lx,%dx%d: stub\n", iface
, debugstr_w(object
), flags
, cx
, cy
);
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
);
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
);
133 static BOOL WINAPI
dispspec_IsClassContainer(IDsDisplaySpecifier
*iface
, LPCWSTR object
,
134 LPCWSTR path
, DWORD flags
)
136 FIXME("%p,%s,%s,%08lx: stub\n", iface
, debugstr_w(object
), debugstr_w(path
), flags
);
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
);
147 static HRESULT WINAPI
dispspec_EnumClassAttributes(IDsDisplaySpecifier
*iface
, LPCWSTR object
,
148 LPDSENUMATTRIBUTES cb
, LPARAM param
)
150 FIXME("%p,%s,%p,%08Ix: stub\n", iface
, debugstr_w(object
), cb
, param
);
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
,
166 dispspec_SetLanguageID
,
167 dispspec_GetDisplaySpecifier
,
168 dispspec_GetIconLocation
,
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
;
183 dispspec
= heap_alloc(sizeof(*dispspec
));
184 if (!dispspec
) return E_OUTOFMEMORY
;
186 dispspec
->IDsDisplaySpecifier_iface
.lpVtbl
= &IDsDisplaySpecifier_vtbl
;
189 hr
= dispspec
->IDsDisplaySpecifier_iface
.lpVtbl
->QueryInterface(&dispspec
->IDsDisplaySpecifier_iface
, iid
, obj
);
190 dispspec
->IDsDisplaySpecifier_iface
.lpVtbl
->Release(&dispspec
->IDsDisplaySpecifier_iface
);
195 static const struct class_info
198 HRESULT (*constructor
)(REFIID
, void **);
201 { &CLSID_DsDisplaySpecifier
, DsDisplaySpecifier_create
}
206 IClassFactory IClassFactory_iface
;
208 const struct class_info
*info
;
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
);
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 %lu\n", iface
, 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 %lu\n", iface
, 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
;
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
);
278 static const struct IClassFactoryVtbl factory_vtbl
=
280 factory_QueryInterface
,
283 factory_CreateInstance
,
287 static HRESULT
factory_constructor(const struct class_info
*info
, REFIID riid
, void **obj
)
289 class_factory
*factory
;
292 factory
= heap_alloc(sizeof(*factory
));
293 if (!factory
) return E_OUTOFMEMORY
;
295 factory
->IClassFactory_iface
.lpVtbl
= &factory_vtbl
;
297 factory
->info
= info
;
299 hr
= IClassFactory_QueryInterface(&factory
->IClassFactory_iface
, riid
, obj
);
300 IClassFactory_Release(&factory
->IClassFactory_iface
);
305 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID iid
, LPVOID
*obj
)
309 TRACE("%s,%s,%p\n", debugstr_guid(clsid
), debugstr_guid(iid
), obj
);
311 if (!clsid
|| !iid
|| !obj
) return E_INVALIDARG
;
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
;