msxml4/tests: Copy namespaces as attributes tests.
[wine.git] / dlls / mfsrcsnk / factory.c
blob2e03451a52398780b23f882ed5b861eb3ff3fb75
1 /*
2 * Copyright 2022 Nikolay Sivov for CodeWeavers
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 #define COBJMACROS
21 #include "mfidl.h"
22 #include "wine/mfinternal.h"
24 #include "mfsrcsnk_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
30 struct class_factory
32 IClassFactory IClassFactory_iface;
33 HRESULT (*create_instance)(REFIID riid, void **out);
36 static inline struct class_factory *impl_from_IClassFactory(IClassFactory *iface)
38 return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface);
41 static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out)
43 if (IsEqualGUID(riid, &IID_IClassFactory) ||
44 IsEqualGUID(riid, &IID_IUnknown))
46 IClassFactory_AddRef(iface);
47 *out = iface;
48 return S_OK;
51 *out = NULL;
52 WARN("Interface %s is not supported.\n", debugstr_guid(riid));
53 return E_NOINTERFACE;
56 static ULONG WINAPI class_factory_AddRef(IClassFactory *iface)
58 return 2;
61 static ULONG WINAPI class_factory_Release(IClassFactory *iface)
63 return 1;
66 static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer,
67 REFIID riid, void **out)
69 struct class_factory *factory = impl_from_IClassFactory(iface);
71 TRACE("%p, %s, %p.\n", outer, debugstr_guid(riid), out);
73 *out = NULL;
75 if (outer)
76 return CLASS_E_NOAGGREGATION;
78 return factory->create_instance(riid, out);
81 static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock)
83 FIXME("%p, %d.\n", iface, dolock);
85 return S_OK;
88 static const IClassFactoryVtbl class_factory_vtbl =
90 class_factory_QueryInterface,
91 class_factory_AddRef,
92 class_factory_Release,
93 class_factory_CreateInstance,
94 class_factory_LockServer,
97 static struct class_factory wave_sink_factory = { { &class_factory_vtbl }, wave_sink_factory_create };
99 /***********************************************************************
100 * DllGetClassObject (mfsrcsnk.@)
102 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
104 *out = NULL;
106 if (IsEqualGUID(clsid, &CLSID_MFWAVESinkClassFactory))
108 return IClassFactory_QueryInterface(&wave_sink_factory.IClassFactory_iface, riid, out);
110 else
112 FIXME("Unknown clsid %s.\n", debugstr_guid(clsid));
113 return CLASS_E_CLASSNOTAVAILABLE;