gitlab: Run tests on Debian after the daily commit round.
[wine.git] / dlls / sapi / main.c
blobd83d22571861900b5f7db257845c67eec350171d
1 /*
2 * Speech API (SAPI) main file.
4 * Copyright (C) 2017 Huw Davies
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 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "objbase.h"
28 #include "rpcproxy.h"
29 #include "oaidl.h"
30 #include "ocidl.h"
32 #include "initguid.h"
33 #include "sapiddk.h"
35 #include "wine/debug.h"
37 #include "sapi_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(sapi);
41 struct class_factory
43 IClassFactory IClassFactory_iface;
44 HRESULT (*create_instance)(IUnknown *, REFIID, void **);
47 static inline struct class_factory *impl_from_IClassFactory( IClassFactory *iface )
49 return CONTAINING_RECORD( iface, struct class_factory, IClassFactory_iface );
52 static HRESULT WINAPI class_factory_QueryInterface( IClassFactory *iface,
53 REFIID iid, void **obj )
55 if (IsEqualIID( iid, &IID_IUnknown ) ||
56 IsEqualIID( iid, &IID_IClassFactory ))
58 IClassFactory_AddRef( iface );
59 *obj = iface;
60 return S_OK;
63 FIXME( "interface %s not implemented\n", debugstr_guid( iid ) );
64 *obj = NULL;
65 return E_NOINTERFACE;
68 static ULONG WINAPI class_factory_AddRef( IClassFactory *iface )
70 return 2;
73 static ULONG WINAPI class_factory_Release( IClassFactory *iface )
75 return 1;
78 static HRESULT WINAPI class_factory_CreateInstance( IClassFactory *iface,
79 IUnknown *outer, REFIID iid,
80 void **obj )
82 struct class_factory *This = impl_from_IClassFactory( iface );
84 TRACE( "%p %s %p\n", outer, debugstr_guid( iid ), obj );
86 *obj = NULL;
87 return This->create_instance( outer, iid, obj );
90 static HRESULT WINAPI class_factory_LockServer( IClassFactory *iface,
91 BOOL lock )
93 FIXME( "%d: stub!\n", lock );
94 return S_OK;
97 static const struct IClassFactoryVtbl class_factory_vtbl =
99 class_factory_QueryInterface,
100 class_factory_AddRef,
101 class_factory_Release,
102 class_factory_CreateInstance,
103 class_factory_LockServer
106 static struct class_factory data_key_cf = { { &class_factory_vtbl }, data_key_create };
107 static struct class_factory file_stream_cf = { { &class_factory_vtbl }, file_stream_create };
108 static struct class_factory resource_mgr_cf = { { &class_factory_vtbl }, resource_manager_create };
109 static struct class_factory speech_stream_cf = { { &class_factory_vtbl }, speech_stream_create };
110 static struct class_factory speech_voice_cf = { { &class_factory_vtbl }, speech_voice_create };
111 static struct class_factory token_category_cf = { { &class_factory_vtbl }, token_category_create };
112 static struct class_factory token_enum_cf = { { &class_factory_vtbl }, token_enum_create };
113 static struct class_factory token_cf = { { &class_factory_vtbl }, token_create };
115 /******************************************************************
116 * DllGetClassObject
118 HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **obj )
120 IClassFactory *cf = NULL;
122 TRACE( "(%s %s %p)\n", debugstr_guid( clsid ), debugstr_guid( iid ), obj );
124 if (IsEqualCLSID( clsid, &CLSID_SpDataKey ))
125 cf = &data_key_cf.IClassFactory_iface;
126 else if (IsEqualCLSID( clsid, &CLSID_SpFileStream ))
127 cf = &file_stream_cf.IClassFactory_iface;
128 else if (IsEqualCLSID( clsid, &CLSID_SpObjectTokenCategory ))
129 cf = &token_category_cf.IClassFactory_iface;
130 else if (IsEqualCLSID( clsid, &CLSID_SpObjectTokenEnum ))
131 cf = &token_enum_cf.IClassFactory_iface;
132 else if (IsEqualCLSID( clsid, &CLSID_SpObjectToken ))
133 cf = &token_cf.IClassFactory_iface;
134 else if (IsEqualCLSID( clsid, &CLSID_SpResourceManager ))
135 cf = &resource_mgr_cf.IClassFactory_iface;
136 else if (IsEqualCLSID( clsid, &CLSID_SpStream ))
137 cf = &speech_stream_cf.IClassFactory_iface;
138 else if (IsEqualCLSID( clsid, &CLSID_SpVoice ))
139 cf = &speech_voice_cf.IClassFactory_iface;
141 if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
143 return IClassFactory_QueryInterface( cf, iid, obj );