server: Use server_get_file_info for all info classes not implemented on client side.
[wine.git] / dlls / devenum / devenum_main.c
blobb17bc93291b570cd1d413f1d7c335d23cd4bae5e
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 DECLSPEC_HIDDEN LONG dll_refs;
29 static HINSTANCE devenum_instance;
31 /***********************************************************************
32 * DllEntryPoint
34 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
36 TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, fImpLoad);
38 switch(fdwReason) {
39 case DLL_PROCESS_ATTACH:
40 devenum_instance = hinstDLL;
41 DisableThreadLibraryCalls(hinstDLL);
42 break;
44 return TRUE;
47 struct class_factory
49 IClassFactory IClassFactory_iface;
50 IUnknown *obj;
53 static inline struct class_factory *impl_from_IClassFactory( IClassFactory *iface )
55 return CONTAINING_RECORD( iface, struct class_factory, IClassFactory_iface );
58 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **obj)
60 TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), obj);
62 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory))
64 IClassFactory_AddRef(iface);
65 *obj = iface;
66 return S_OK;
69 *obj = NULL;
70 WARN("no interface for %s\n", debugstr_guid(iid));
71 return E_NOINTERFACE;
74 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
76 DEVENUM_LockModule();
77 return 2;
80 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
82 DEVENUM_UnlockModule();
83 return 1;
86 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface,
87 IUnknown *outer, REFIID iid, void **obj)
89 struct class_factory *This = impl_from_IClassFactory( iface );
91 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(iid), obj);
93 if (!obj) return E_POINTER;
95 if (outer) return CLASS_E_NOAGGREGATION;
97 return IUnknown_QueryInterface(This->obj, iid, obj);
100 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
102 if (lock)
103 DEVENUM_LockModule();
104 else
105 DEVENUM_UnlockModule();
106 return S_OK;
109 static const IClassFactoryVtbl ClassFactory_vtbl = {
110 ClassFactory_QueryInterface,
111 ClassFactory_AddRef,
112 ClassFactory_Release,
113 ClassFactory_CreateInstance,
114 ClassFactory_LockServer
117 static struct class_factory create_devenum_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_CreateDevEnum };
118 static struct class_factory device_moniker_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_ParseDisplayName };
120 /***********************************************************************
121 * DllGetClassObject (DEVENUM.@)
123 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **obj)
125 TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), obj);
127 *obj = NULL;
129 if (IsEqualGUID(clsid, &CLSID_SystemDeviceEnum))
130 return IClassFactory_QueryInterface(&create_devenum_cf.IClassFactory_iface, iid, obj);
131 else if (IsEqualGUID(clsid, &CLSID_CDeviceMoniker))
132 return IClassFactory_QueryInterface(&device_moniker_cf.IClassFactory_iface, iid, obj);
134 FIXME("class %s not available\n", debugstr_guid(clsid));
135 return CLASS_E_CLASSNOTAVAILABLE;
138 /***********************************************************************
139 * DllCanUnloadNow (DEVENUM.@)
141 HRESULT WINAPI DllCanUnloadNow(void)
143 return dll_refs != 0 ? S_FALSE : S_OK;
146 /***********************************************************************
147 * DllRegisterServer (DEVENUM.@)
149 HRESULT WINAPI DllRegisterServer(void)
151 HRESULT res;
152 IFilterMapper2 * pMapper = NULL;
153 LPVOID mapvptr;
155 TRACE("\n");
157 res = __wine_register_resources( devenum_instance );
158 if (FAILED(res))
159 return res;
161 /*** ActiveMovieFilter Categories ***/
163 CoInitialize(NULL);
165 res = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC,
166 &IID_IFilterMapper2, &mapvptr);
167 if (SUCCEEDED(res))
169 static const WCHAR friendlyvidcap[] = {'V','i','d','e','o',' ','C','a','p','t','u','r','e',' ','S','o','u','r','c','e','s',0};
170 static const WCHAR friendlydshow[] = {'D','i','r','e','c','t','S','h','o','w',' ','F','i','l','t','e','r','s',0};
171 static const WCHAR friendlyvidcomp[] = {'V','i','d','e','o',' ','C','o','m','p','r','e','s','s','o','r','s',0};
172 static const WCHAR friendlyaudcap[] = {'A','u','d','i','o',' ','C','a','p','t','u','r','e',' ','S','o','u','r','c','e','s',0};
173 static const WCHAR friendlyaudcomp[] = {'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','o','r','s',0};
174 static const WCHAR friendlyaudrend[] = {'A','u','d','i','o',' ','R','e','n','d','e','r','e','r','s',0};
175 static const WCHAR friendlymidirend[] = {'M','i','d','i',' ','R','e','n','d','e','r','e','r','s',0};
176 static const WCHAR friendlyextrend[] = {'E','x','t','e','r','n','a','l',' ','R','e','n','d','e','r','e','r','s',0};
177 static const WCHAR friendlydevctrl[] = {'D','e','v','i','c','e',' ','C','o','n','t','r','o','l',' ','F','i','l','t','e','r','s',0};
179 pMapper = mapvptr;
181 IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoInputDeviceCategory, MERIT_DO_NOT_USE, friendlyvidcap);
182 IFilterMapper2_CreateCategory(pMapper, &CLSID_LegacyAmFilterCategory, MERIT_NORMAL, friendlydshow);
183 IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoCompressorCategory, MERIT_DO_NOT_USE, friendlyvidcomp);
184 IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioInputDeviceCategory, MERIT_DO_NOT_USE, friendlyaudcap);
185 IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioCompressorCategory, MERIT_DO_NOT_USE, friendlyaudcomp);
186 IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioRendererCategory, MERIT_NORMAL, friendlyaudrend);
187 IFilterMapper2_CreateCategory(pMapper, &CLSID_MidiRendererCategory, MERIT_NORMAL, friendlymidirend);
188 IFilterMapper2_CreateCategory(pMapper, &CLSID_TransmitCategory, MERIT_DO_NOT_USE, friendlyextrend);
189 IFilterMapper2_CreateCategory(pMapper, &CLSID_DeviceControlCategory, MERIT_DO_NOT_USE, friendlydevctrl);
191 IFilterMapper2_Release(pMapper);
194 CoUninitialize();
196 return res;
199 /***********************************************************************
200 * DllUnregisterServer (DEVENUM.@)
202 HRESULT WINAPI DllUnregisterServer(void)
204 FIXME("stub!\n");
205 return __wine_unregister_resources( devenum_instance );