dmime: Free list when Tempo track is destroyed.
[wine.git] / dlls / sapi / main.c
blobf86fee25cab2e24a607e3368aafec492f4fd8423
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 static HINSTANCE hinstance;
43 struct class_factory
45 IClassFactory IClassFactory_iface;
46 HRESULT (*create_instance)(IUnknown *, REFIID, void **);
49 static inline struct class_factory *impl_from_IClassFactory( IClassFactory *iface )
51 return CONTAINING_RECORD( iface, struct class_factory, IClassFactory_iface );
54 static HRESULT WINAPI class_factory_QueryInterface( IClassFactory *iface,
55 REFIID iid, void **obj )
57 if (IsEqualIID( iid, &IID_IUnknown ) ||
58 IsEqualIID( iid, &IID_IClassFactory ))
60 IClassFactory_AddRef( iface );
61 *obj = iface;
62 return S_OK;
65 FIXME( "interface %s not implemented\n", debugstr_guid( iid ) );
66 *obj = NULL;
67 return E_NOINTERFACE;
70 static ULONG WINAPI class_factory_AddRef( IClassFactory *iface )
72 return 2;
75 static ULONG WINAPI class_factory_Release( IClassFactory *iface )
77 return 1;
80 static HRESULT WINAPI class_factory_CreateInstance( IClassFactory *iface,
81 IUnknown *outer, REFIID iid,
82 void **obj )
84 struct class_factory *This = impl_from_IClassFactory( iface );
86 TRACE( "%p %s %p\n", outer, debugstr_guid( iid ), obj );
88 *obj = NULL;
89 return This->create_instance( outer, iid, obj );
92 static HRESULT WINAPI class_factory_LockServer( IClassFactory *iface,
93 BOOL lock )
95 FIXME( "%d: stub!\n", lock );
96 return S_OK;
99 static const struct IClassFactoryVtbl class_factory_vtbl =
101 class_factory_QueryInterface,
102 class_factory_AddRef,
103 class_factory_Release,
104 class_factory_CreateInstance,
105 class_factory_LockServer
108 static struct class_factory data_key_cf = { { &class_factory_vtbl }, data_key_create };
109 static struct class_factory token_category_cf = { { &class_factory_vtbl }, token_category_create };
110 static struct class_factory token_enum_cf = { { &class_factory_vtbl }, token_enum_create };
112 /******************************************************************
113 * DllGetClassObject
115 HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **obj )
117 IClassFactory *cf = NULL;
119 TRACE( "(%s %s %p)\n", debugstr_guid( clsid ), debugstr_guid( iid ), obj );
121 if (IsEqualCLSID( clsid, &CLSID_SpDataKey ))
122 cf = &data_key_cf.IClassFactory_iface;
123 else if (IsEqualCLSID( clsid, &CLSID_SpObjectTokenCategory ))
124 cf = &token_category_cf.IClassFactory_iface;
125 else if (IsEqualCLSID( clsid, &CLSID_SpObjectTokenEnum ))
126 cf = &token_enum_cf.IClassFactory_iface;
128 if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
130 return IClassFactory_QueryInterface( cf, iid, obj );
133 BOOL WINAPI DllMain( HINSTANCE dll, DWORD reason, LPVOID reserved )
135 switch (reason)
137 case DLL_PROCESS_ATTACH:
138 hinstance = dll;
139 DisableThreadLibraryCalls( dll );
140 break;
142 return TRUE;
145 /******************************************************************
146 * DllCanUnloadNow
148 HRESULT WINAPI DllCanUnloadNow( void )
150 TRACE( "()\n" );
151 return S_FALSE;
154 /***********************************************************************
155 * DllRegisterServer
157 HRESULT WINAPI DllRegisterServer( void )
159 return __wine_register_resources( hinstance );
162 /***********************************************************************
163 * DllUnregisterServer
165 HRESULT WINAPI DllUnregisterServer( void )
167 return __wine_unregister_resources( hinstance );