winex11: Always create XIC preedit and status attributes.
[wine.git] / dlls / devenum / devenum_main.c
blob879397491212eb69f3d3e27e33de20ce6b3eacd3
1 /*
2 * Device Enumeration
4 * Copyright (C) 2002 John K. Hohm
5 * Copyright (C) 2002 Robert Shearman
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 "devenum_private.h"
23 #include "rpcproxy.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(devenum);
28 struct class_factory
30 IClassFactory IClassFactory_iface;
31 IUnknown *obj;
34 static inline struct class_factory *impl_from_IClassFactory( IClassFactory *iface )
36 return CONTAINING_RECORD( iface, struct class_factory, IClassFactory_iface );
39 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **obj)
41 TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), obj);
43 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
45 IClassFactory_AddRef(iface);
46 *obj = iface;
47 return S_OK;
50 *obj = NULL;
51 WARN("no interface for %s\n", debugstr_guid(iid));
52 return E_NOINTERFACE;
55 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
57 return 2;
60 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
62 return 1;
65 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface,
66 IUnknown *outer, REFIID iid, void **obj)
68 struct class_factory *This = impl_from_IClassFactory( iface );
70 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(iid), obj);
72 if (!obj) return E_POINTER;
74 if (outer) return CLASS_E_NOAGGREGATION;
76 return IUnknown_QueryInterface(This->obj, iid, obj);
79 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
81 TRACE("iface %p, lock %d.\n", iface, lock);
82 return S_OK;
85 static const IClassFactoryVtbl ClassFactory_vtbl = {
86 ClassFactory_QueryInterface,
87 ClassFactory_AddRef,
88 ClassFactory_Release,
89 ClassFactory_CreateInstance,
90 ClassFactory_LockServer
93 static struct class_factory create_devenum_cf = { { &ClassFactory_vtbl }, (IUnknown *)&devenum_factory };
94 static struct class_factory device_moniker_cf = { { &ClassFactory_vtbl }, (IUnknown *)&devenum_parser };
96 /***********************************************************************
97 * DllGetClassObject (DEVENUM.@)
99 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **obj)
101 TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
103 *obj = NULL;
105 if (IsEqualGUID(clsid, &CLSID_SystemDeviceEnum))
106 return IClassFactory_QueryInterface(&create_devenum_cf.IClassFactory_iface, iid, obj);
107 else if (IsEqualGUID(clsid, &CLSID_CDeviceMoniker))
108 return IClassFactory_QueryInterface(&device_moniker_cf.IClassFactory_iface, iid, obj);
110 FIXME("class %s not available\n", debugstr_guid(clsid));
111 return CLASS_E_CLASSNOTAVAILABLE;
114 /***********************************************************************
115 * DllRegisterServer (DEVENUM.@)
117 HRESULT WINAPI DllRegisterServer(void)
119 HRESULT res;
120 IFilterMapper2 * pMapper = NULL;
121 LPVOID mapvptr;
123 TRACE("\n");
125 res = __wine_register_resources();
126 if (FAILED(res))
127 return res;
129 res = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC,
130 &IID_IFilterMapper2, &mapvptr);
131 if (SUCCEEDED(res))
133 pMapper = mapvptr;
135 IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioCompressorCategory, MERIT_DO_NOT_USE, L"Audio Compressors");
136 IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioInputDeviceCategory, MERIT_DO_NOT_USE, L"Audio Capture Sources");
137 IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioRendererCategory, MERIT_NORMAL, L"Audio Renderers");
138 IFilterMapper2_CreateCategory(pMapper, &CLSID_DeviceControlCategory, MERIT_DO_NOT_USE, L"Device Control Filters");
139 IFilterMapper2_CreateCategory(pMapper, &CLSID_LegacyAmFilterCategory, MERIT_NORMAL, L"DirectShow Filters");
140 IFilterMapper2_CreateCategory(pMapper, &CLSID_MidiRendererCategory, MERIT_NORMAL, L"Midi Renderers");
141 IFilterMapper2_CreateCategory(pMapper, &CLSID_TransmitCategory, MERIT_DO_NOT_USE, L"External Renderers");
142 IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoInputDeviceCategory, MERIT_DO_NOT_USE, L"Video Capture Sources");
143 IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoCompressorCategory, MERIT_DO_NOT_USE, L"Video Compressors");
145 IFilterMapper2_Release(pMapper);
148 return res;
151 /***********************************************************************
152 * DllUnregisterServer (DEVENUM.@)
154 HRESULT WINAPI DllUnregisterServer(void)
156 FIXME("stub!\n");
157 return __wine_unregister_resources();