makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / activeds / pathname.c
blob52a94cbb18c10c47272e469dd576777f70f67302
1 /*
2 * Copyright 2020 Dmitry Timoshkov
4 * This file contains only stubs to get the printui.dll up and running
5 * activeds.dll is much much more than this
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdarg.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "iads.h"
30 #include "wine/heap.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(activeds);
35 #include "initguid.h"
36 DEFINE_GUID(CLSID_Pathname,0x080d0d78,0xf421,0x11d0,0xa3,0x6e,0x00,0xc0,0x4f,0xb9,0x50,0xdc);
38 typedef struct
40 IADsPathname IADsPathname_iface;
41 LONG ref;
42 BSTR adspath;
43 } Pathname;
45 static inline Pathname *impl_from_IADsPathname(IADsPathname *iface)
47 return CONTAINING_RECORD(iface, Pathname, IADsPathname_iface);
50 static HRESULT WINAPI path_QueryInterface(IADsPathname *iface, REFIID riid, void **obj)
52 TRACE("%p,%s,%p\n", iface, debugstr_guid(riid), obj);
54 if (!riid || !obj) return E_INVALIDARG;
56 if (IsEqualGUID(riid, &IID_IUnknown) ||
57 IsEqualGUID(riid, &IID_IDispatch) ||
58 IsEqualGUID(riid, &IID_IADsPathname))
60 IADsPathname_AddRef(iface);
61 *obj = iface;
62 return S_OK;
65 FIXME("interface %s is not implemented\n", debugstr_guid(riid));
66 return E_NOINTERFACE;
69 static ULONG WINAPI path_AddRef(IADsPathname *iface)
71 Pathname *path = impl_from_IADsPathname(iface);
72 return InterlockedIncrement(&path->ref);
75 static ULONG WINAPI path_Release(IADsPathname *iface)
77 Pathname *path = impl_from_IADsPathname(iface);
78 LONG ref = InterlockedDecrement(&path->ref);
80 if (!ref)
82 TRACE("destroying %p\n", iface);
83 heap_free(path);
86 return ref;
89 static HRESULT WINAPI path_GetTypeInfoCount(IADsPathname *iface, UINT *count)
91 FIXME("%p,%p: stub\n", iface, count);
92 return E_NOTIMPL;
95 static HRESULT WINAPI path_GetTypeInfo(IADsPathname *iface, UINT index, LCID lcid, ITypeInfo **info)
97 FIXME("%p,%u,%#x,%p: stub\n", iface, index, lcid, info);
98 return E_NOTIMPL;
101 static HRESULT WINAPI path_GetIDsOfNames(IADsPathname *iface, REFIID riid, LPOLESTR *names,
102 UINT count, LCID lcid, DISPID *dispid)
104 FIXME("%p,%s,%p,%u,%u,%p: stub\n", iface, debugstr_guid(riid), names, count, lcid, dispid);
105 return E_NOTIMPL;
108 static HRESULT WINAPI path_Invoke(IADsPathname *iface, DISPID dispid, REFIID riid, LCID lcid, WORD flags,
109 DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *argerr)
111 FIXME("%p,%d,%s,%04x,%04x,%p,%p,%p,%p: stub\n", iface, dispid, debugstr_guid(riid), lcid, flags,
112 params, result, excepinfo, argerr);
113 return E_NOTIMPL;
116 static HRESULT WINAPI path_Set(IADsPathname *iface, BSTR adspath, LONG type)
118 Pathname *path = impl_from_IADsPathname(iface);
120 FIXME("%p,%s,%d: stub\n", iface, debugstr_w(adspath), type);
122 if (!adspath) return E_INVALIDARG;
124 path->adspath = SysAllocString(adspath);
125 return path->adspath ? S_OK : E_OUTOFMEMORY;
128 static HRESULT WINAPI path_SetDisplayType(IADsPathname *iface, LONG type)
130 FIXME("%p,%d: stub\n", iface, type);
131 return E_NOTIMPL;
134 static HRESULT WINAPI path_Retrieve(IADsPathname *iface, LONG type, BSTR *adspath)
136 Pathname *path = impl_from_IADsPathname(iface);
138 FIXME("%p,%d,%p: stub\n", iface, type, adspath);
140 if (!adspath) return E_INVALIDARG;
142 *adspath = SysAllocString(path->adspath);
143 return *adspath ? S_OK : E_OUTOFMEMORY;
146 static HRESULT WINAPI path_GetNumElements(IADsPathname *iface, LONG *count)
148 FIXME("%p,%p: stub\n", iface, count);
149 return E_NOTIMPL;
152 static HRESULT WINAPI path_GetElement(IADsPathname *iface, LONG index, BSTR *element)
154 FIXME("%p,%d,%p: stub\n", iface, index, element);
155 return E_NOTIMPL;
158 static HRESULT WINAPI path_AddLeafElement(IADsPathname *iface, BSTR element)
160 FIXME("%p,%s: stub\n", iface, debugstr_w(element));
161 return E_NOTIMPL;
164 static HRESULT WINAPI path_RemoveLeafElement(IADsPathname *iface)
166 FIXME("%p: stub\n", iface);
167 return E_NOTIMPL;
170 static HRESULT WINAPI path_CopyPath(IADsPathname *iface, IDispatch **path)
172 FIXME("%p,%p: stub\n", iface, path);
173 return E_NOTIMPL;
176 static HRESULT WINAPI path_GetEscapedElement(IADsPathname *iface, LONG reserved, BSTR element, BSTR *str)
178 FIXME("%p,%d,%s,%p: stub\n", iface, reserved, debugstr_w(element), str);
179 return E_NOTIMPL;
182 static HRESULT WINAPI path_get_EscapedMode(IADsPathname *iface, LONG *mode)
184 FIXME("%p,%p: stub\n", iface, mode);
185 return E_NOTIMPL;
188 static HRESULT WINAPI path_put_EscapedMode(IADsPathname *iface, LONG mode)
190 FIXME("%p,%d: stub\n", iface, mode);
191 return E_NOTIMPL;
194 static const IADsPathnameVtbl IADsPathname_vtbl =
196 path_QueryInterface,
197 path_AddRef,
198 path_Release,
199 path_GetTypeInfoCount,
200 path_GetTypeInfo,
201 path_GetIDsOfNames,
202 path_Invoke,
203 path_Set,
204 path_SetDisplayType,
205 path_Retrieve,
206 path_GetNumElements,
207 path_GetElement,
208 path_AddLeafElement,
209 path_RemoveLeafElement,
210 path_CopyPath,
211 path_GetEscapedElement,
212 path_get_EscapedMode,
213 path_put_EscapedMode
216 static HRESULT Pathname_create(REFIID riid, void **obj)
218 Pathname *path;
219 HRESULT hr;
221 path = heap_alloc(sizeof(*path));
222 if (!path) return E_OUTOFMEMORY;
224 path->IADsPathname_iface.lpVtbl = &IADsPathname_vtbl;
225 path->ref = 1;
226 path->adspath = NULL;
228 hr = IADsPathname_QueryInterface(&path->IADsPathname_iface, riid, obj);
229 IADsPathname_Release(&path->IADsPathname_iface);
231 return hr;
234 static const struct class_info
236 const CLSID *clsid;
237 HRESULT (*constructor)(REFIID, void **);
238 } class_info[] =
240 { &CLSID_Pathname, Pathname_create }
243 typedef struct
245 IClassFactory IClassFactory_iface;
246 LONG ref;
247 const struct class_info *info;
248 } class_factory;
250 static inline class_factory *impl_from_IClassFactory(IClassFactory *iface)
252 return CONTAINING_RECORD(iface, class_factory, IClassFactory_iface);
255 static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *obj)
257 TRACE("%p,%s,%p\n", iface, debugstr_guid(riid), obj);
259 if (!riid || !obj) return E_INVALIDARG;
261 if (IsEqualIID(riid, &IID_IUnknown) ||
262 IsEqualIID(riid, &IID_IClassFactory))
264 IClassFactory_AddRef(iface);
265 *obj = iface;
266 return S_OK;
269 *obj = NULL;
270 FIXME("interface %s is not implemented\n", debugstr_guid(riid));
271 return E_NOINTERFACE;
274 static ULONG WINAPI factory_AddRef(IClassFactory *iface)
276 class_factory *factory = impl_from_IClassFactory(iface);
277 ULONG ref = InterlockedIncrement(&factory->ref);
279 TRACE("(%p) ref %u\n", iface, ref);
281 return ref;
284 static ULONG WINAPI factory_Release(IClassFactory *iface)
286 class_factory *factory = impl_from_IClassFactory(iface);
287 ULONG ref = InterlockedDecrement(&factory->ref);
289 TRACE("(%p) ref %u\n", iface, ref);
291 if (!ref)
292 heap_free(factory);
294 return ref;
297 static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
299 class_factory *factory = impl_from_IClassFactory(iface);
301 TRACE("%p,%s,%p\n", outer, debugstr_guid(riid), obj);
303 if (!riid || !obj) return E_INVALIDARG;
305 *obj = NULL;
306 if (outer) return CLASS_E_NOAGGREGATION;
308 return factory->info->constructor(riid, obj);
311 static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock)
313 FIXME("%p,%d: stub\n", iface, lock);
314 return S_OK;
317 static const struct IClassFactoryVtbl factory_vtbl =
319 factory_QueryInterface,
320 factory_AddRef,
321 factory_Release,
322 factory_CreateInstance,
323 factory_LockServer
326 static HRESULT factory_constructor(const struct class_info *info, REFIID riid, void **obj)
328 class_factory *factory;
329 HRESULT hr;
331 factory = heap_alloc(sizeof(*factory));
332 if (!factory) return E_OUTOFMEMORY;
334 factory->IClassFactory_iface.lpVtbl = &factory_vtbl;
335 factory->ref = 1;
336 factory->info = info;
338 hr = IClassFactory_QueryInterface(&factory->IClassFactory_iface, riid, obj);
339 IClassFactory_Release(&factory->IClassFactory_iface);
341 return hr;
344 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *obj)
346 int i;
348 TRACE("%s,%s,%p\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
350 if (!clsid || !iid || !obj) return E_INVALIDARG;
352 *obj = NULL;
354 for (i = 0; i < ARRAY_SIZE(class_info); i++)
356 if (IsEqualCLSID(class_info[i].clsid, clsid))
357 return factory_constructor(&class_info[i], iid, obj);
360 FIXME("class %s/%s is not implemented\n", debugstr_guid(clsid), debugstr_guid(iid));
361 return CLASS_E_CLASSNOTAVAILABLE;