wined3d: Make the device parameter to wined3d_surface_depth_blt_fbo() const.
[wine] / dlls / wiaservc / factory.c
1 /*
2  * Class factory interface for WiaServc
3  *
4  * Copyright (C) 2009 Damjan Jovanovic
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #define COBJMACROS
22
23 #include "objbase.h"
24 #include "winuser.h"
25 #include "winreg.h"
26 #include "initguid.h"
27 #include "wia_lh.h"
28
29 #include "wiaservc_private.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(wia);
34
35 static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
36 {
37     return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
38 }
39
40 static ULONG WINAPI
41 WIASERVC_IClassFactory_AddRef(LPCLASSFACTORY iface)
42 {
43     return 2;
44 }
45
46 static HRESULT WINAPI
47 WIASERVC_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid,
48                                       LPVOID *ppvObj)
49 {
50     ClassFactoryImpl *This = impl_from_IClassFactory(iface);
51
52     if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory))
53     {
54         *ppvObj = &This->IClassFactory_iface;
55         return S_OK;
56     }
57
58     *ppvObj = NULL;
59     return E_NOINTERFACE;
60 }
61
62 static ULONG WINAPI
63 WIASERVC_IClassFactory_Release(LPCLASSFACTORY iface)
64 {
65     return 1;
66 }
67
68 static HRESULT WINAPI
69 WIASERVC_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter,
70                                       REFIID riid, LPVOID *ppvObj)
71 {
72     HRESULT res;
73     IUnknown *punk = NULL;
74
75     TRACE("IID: %s\n", debugstr_guid(riid));
76
77     if (pUnkOuter)
78         return CLASS_E_NOAGGREGATION;
79
80     res = wiadevmgr_Constructor(pUnkOuter, (LPVOID*) &punk);
81     if (FAILED(res))
82         return res;
83
84     res = IUnknown_QueryInterface(punk, riid, ppvObj);
85     IUnknown_Release(punk);
86     return res;
87 }
88
89 static HRESULT WINAPI
90 WIASERVC_IClassFactory_LockServer(LPCLASSFACTORY iface, BOOL fLock)
91 {
92     FIXME("Not implemented\n");
93     return E_NOTIMPL;
94 }
95
96 static const IClassFactoryVtbl WIASERVC_IClassFactory_Vtbl =
97 {
98     WIASERVC_IClassFactory_QueryInterface,
99     WIASERVC_IClassFactory_AddRef,
100     WIASERVC_IClassFactory_Release,
101     WIASERVC_IClassFactory_CreateInstance,
102     WIASERVC_IClassFactory_LockServer
103 };
104
105 ClassFactoryImpl WIASERVC_ClassFactory =
106 {
107     { &WIASERVC_IClassFactory_Vtbl }
108 };