cryptui: Add German translation.
[wine] / dlls / devenum / factory.c
CommitLineData
d38cce8d
RS
1/*
2 * ClassFactory implementation for DEVENUM.dll
3 *
4 * Copyright (C) 2002 John K. Hohm
5 * Copyright (C) 2002 Robert Shearman
6 *
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.
11 *
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.
16 *
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
360a3f91 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
d38cce8d
RS
20 */
21
22#include "devenum_private.h"
23
24#include "wine/debug.h"
25
26WINE_DEFAULT_DEBUG_CHANNEL(devenum);
27
28/**********************************************************************
29 * DEVENUM_IClassFactory_QueryInterface (also IUnknown)
30 */
31static HRESULT WINAPI DEVENUM_IClassFactory_QueryInterface(
32 LPCLASSFACTORY iface,
33 REFIID riid,
34 LPVOID *ppvObj)
35{
d38cce8d
RS
36 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
37
e7110f09 38 if (ppvObj == NULL) return E_POINTER;
d38cce8d
RS
39
40 if (IsEqualGUID(riid, &IID_IUnknown) ||
41 IsEqualGUID(riid, &IID_IClassFactory))
42 {
f7c13328 43 *ppvObj = iface;
d38cce8d
RS
44 IClassFactory_AddRef(iface);
45 return S_OK;
46 }
47 else if (IsEqualGUID(riid, &IID_IParseDisplayName))
48 {
49 return IClassFactory_CreateInstance(iface, NULL, riid, ppvObj);
50 }
51
52 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
53 return E_NOINTERFACE;
54}
55
56/**********************************************************************
57 * DEVENUM_IClassFactory_AddRef (also IUnknown)
58 */
59static ULONG WINAPI DEVENUM_IClassFactory_AddRef(LPCLASSFACTORY iface)
60{
d38cce8d
RS
61 TRACE("\n");
62
e7110f09 63 DEVENUM_LockModule();
d38cce8d 64
e7110f09 65 return 2; /* non-heap based object */
d38cce8d
RS
66}
67
68/**********************************************************************
69 * DEVENUM_IClassFactory_Release (also IUnknown)
70 */
71static ULONG WINAPI DEVENUM_IClassFactory_Release(LPCLASSFACTORY iface)
72{
d38cce8d
RS
73 TRACE("\n");
74
e7110f09 75 DEVENUM_UnlockModule();
d38cce8d 76
e7110f09 77 return 1; /* non-heap based object */
d38cce8d
RS
78}
79
80/**********************************************************************
81 * DEVENUM_IClassFactory_CreateInstance
82 */
83static HRESULT WINAPI DEVENUM_IClassFactory_CreateInstance(
84 LPCLASSFACTORY iface,
85 LPUNKNOWN pUnkOuter,
86 REFIID riid,
87 LPVOID *ppvObj)
88{
d38cce8d
RS
89 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
90
e7110f09 91 if (ppvObj == NULL) return E_POINTER;
d38cce8d
RS
92
93 /* Don't support aggregation (Windows doesn't) */
94 if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
95
96 if (IsEqualGUID(&IID_ICreateDevEnum, riid))
97 {
98 *ppvObj = &DEVENUM_CreateDevEnum;
99 return S_OK;
100 }
101 if (IsEqualGUID(&IID_IParseDisplayName, riid))
102 {
103 *ppvObj = &DEVENUM_ParseDisplayName;
104 return S_OK;
105 }
106
107 return CLASS_E_CLASSNOTAVAILABLE;
108}
109
110/**********************************************************************
111 * DEVENUM_IClassFactory_LockServer
112 */
113static HRESULT WINAPI DEVENUM_IClassFactory_LockServer(
114 LPCLASSFACTORY iface,
115 BOOL fLock)
116{
117 TRACE("\n");
118
e7110f09
RS
119 if (fLock)
120 DEVENUM_LockModule();
121 else
122 DEVENUM_UnlockModule();
d38cce8d
RS
123 return S_OK;
124}
125
126/**********************************************************************
127 * IClassFactory_Vtbl
128 */
247246ed 129static const IClassFactoryVtbl IClassFactory_Vtbl =
d38cce8d 130{
d38cce8d
RS
131 DEVENUM_IClassFactory_QueryInterface,
132 DEVENUM_IClassFactory_AddRef,
133 DEVENUM_IClassFactory_Release,
134 DEVENUM_IClassFactory_CreateInstance,
135 DEVENUM_IClassFactory_LockServer
136};
137
138/**********************************************************************
139 * static ClassFactory instance
140 */
e7110f09 141ClassFactoryImpl DEVENUM_ClassFactory = { &IClassFactory_Vtbl };