include: Add event trace flags and guid to evntrace.h.
[wine.git] / dlls / wiaservc / factory.c
blob9a607d5d7e32ace5dd08f6a5c316f2a4c7ea8f91
1 /*
2 * Class factory interface for WiaServc
4 * Copyright (C) 2009 Damjan Jovanovic
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "objbase.h"
24 #include "winuser.h"
25 #include "winreg.h"
26 #include "initguid.h"
27 #include "wia_lh.h"
29 #include "wiaservc_private.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(wia);
35 static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
37 return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
40 static ULONG WINAPI
41 WIASERVC_IClassFactory_AddRef(LPCLASSFACTORY iface)
43 return 2;
46 static HRESULT WINAPI
47 WIASERVC_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid,
48 LPVOID *ppvObj)
50 ClassFactoryImpl *This = impl_from_IClassFactory(iface);
52 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory))
54 *ppvObj = &This->IClassFactory_iface;
55 return S_OK;
58 *ppvObj = NULL;
59 return E_NOINTERFACE;
62 static ULONG WINAPI
63 WIASERVC_IClassFactory_Release(LPCLASSFACTORY iface)
65 return 1;
68 static HRESULT WINAPI
69 WIASERVC_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter,
70 REFIID riid, LPVOID *ppvObj)
72 HRESULT res;
73 IWiaDevMgr *devmgr = NULL;
75 TRACE("IID: %s\n", debugstr_guid(riid));
77 if (pUnkOuter)
78 return CLASS_E_NOAGGREGATION;
80 res = wiadevmgr_Constructor(&devmgr);
81 if (FAILED(res))
82 return res;
84 res = IWiaDevMgr_QueryInterface(devmgr, riid, ppvObj);
85 IWiaDevMgr_Release(devmgr);
86 return res;
89 static HRESULT WINAPI
90 WIASERVC_IClassFactory_LockServer(LPCLASSFACTORY iface, BOOL fLock)
92 FIXME("Not implemented\n");
93 return E_NOTIMPL;
96 static const IClassFactoryVtbl WIASERVC_IClassFactory_Vtbl =
98 WIASERVC_IClassFactory_QueryInterface,
99 WIASERVC_IClassFactory_AddRef,
100 WIASERVC_IClassFactory_Release,
101 WIASERVC_IClassFactory_CreateInstance,
102 WIASERVC_IClassFactory_LockServer
105 ClassFactoryImpl WIASERVC_ClassFactory =
107 { &WIASERVC_IClassFactory_Vtbl }