windows.devices.enumeration/tests: Make test handlers structure static.
[wine.git] / dlls / sapi / automation.c
blob8a0e0203198553c9c3fbdf2b41ac0b6820f9fc9a
1 /*
2 * Speech API (SAPI) automation implementation.
4 * Copyright 2019 Jactry Zeng for CodeWeavers
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"
29 #include "sapiddk.h"
31 #include "wine/debug.h"
33 #include "sapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(sapi);
37 struct file_stream
39 ISpeechFileStream ISpeechFileStream_iface;
40 ISpStream ISpStream_iface;
41 LONG ref;
44 static inline struct file_stream *impl_from_ISpeechFileStream(ISpeechFileStream *iface)
46 return CONTAINING_RECORD(iface, struct file_stream, ISpeechFileStream_iface);
49 static inline struct file_stream *impl_from_ISpStream(ISpStream *iface)
51 return CONTAINING_RECORD(iface, struct file_stream, ISpStream_iface);
54 /* ISpeechFileStream interface */
55 static HRESULT WINAPI file_stream_QueryInterface(ISpeechFileStream *iface, REFIID iid, void **obj)
57 struct file_stream *This = impl_from_ISpeechFileStream(iface);
59 TRACE("(%p, %s, %p).\n", iface, debugstr_guid(iid), obj);
61 if (IsEqualIID(iid, &IID_IUnknown) ||
62 IsEqualIID(iid, &IID_IDispatch) ||
63 IsEqualIID(iid, &IID_ISpeechBaseStream) ||
64 IsEqualIID(iid, &IID_ISpeechFileStream))
65 *obj = &This->ISpeechFileStream_iface;
66 else if (IsEqualIID(iid, &IID_ISpStream))
67 *obj = &This->ISpStream_iface;
68 else
70 *obj = NULL;
71 FIXME("interface %s not implemented.\n", debugstr_guid(iid));
72 return E_NOINTERFACE;
75 IUnknown_AddRef((IUnknown *)*obj);
76 return S_OK;
79 static ULONG WINAPI file_stream_AddRef(ISpeechFileStream *iface)
81 struct file_stream *This = impl_from_ISpeechFileStream(iface);
82 ULONG ref = InterlockedIncrement(&This->ref);
84 TRACE("(%p): ref=%lu.\n", iface, ref);
86 return ref;
89 static ULONG WINAPI file_stream_Release(ISpeechFileStream *iface)
91 struct file_stream *This = impl_from_ISpeechFileStream(iface);
92 ULONG ref = InterlockedDecrement(&This->ref);
94 TRACE("(%p): ref=%lu.\n", iface, ref);
96 if (!ref)
98 heap_free(This);
101 return ref;
104 static HRESULT WINAPI file_stream_GetTypeInfoCount(ISpeechFileStream *iface, UINT *info)
106 FIXME("(%p, %p): stub.\n", iface, info);
108 return E_NOTIMPL;
111 static HRESULT WINAPI file_stream_GetTypeInfo(ISpeechFileStream *iface, UINT info, LCID lcid,
112 ITypeInfo **type_info)
114 FIXME("(%p, %u, %lu, %p): stub.\n", iface, info, lcid, type_info);
116 return E_NOTIMPL;
119 static HRESULT WINAPI file_stream_GetIDsOfNames(ISpeechFileStream *iface, REFIID riid, LPOLESTR *names,
120 UINT count, LCID lcid, DISPID *dispid)
122 FIXME("(%p, %s, %p, %u, %lu, %p): stub.\n", iface, debugstr_guid(riid), names, count, lcid, dispid);
124 return E_NOTIMPL;
127 static HRESULT WINAPI file_stream_Invoke(ISpeechFileStream *iface, DISPID dispid, REFIID riid, LCID lcid,
128 WORD flags, DISPPARAMS *params, VARIANT *result,
129 EXCEPINFO *excepinfo, UINT *argerr)
131 FIXME("(%p, %ld, %s, %#lx, %#x, %p, %p, %p, %p): stub.\n", iface, dispid, debugstr_guid(riid),
132 lcid, flags, params, result, excepinfo, argerr);
134 return E_NOTIMPL;
137 static HRESULT WINAPI file_stream_get_Format(ISpeechFileStream *iface, ISpeechAudioFormat **format)
139 FIXME("(%p, %p): stub.\n", iface, format);
141 return E_NOTIMPL;
144 static HRESULT WINAPI file_stream_putref_Format(ISpeechFileStream *iface, ISpeechAudioFormat *format)
146 FIXME("(%p, %p): stub.\n", iface, format);
148 return E_NOTIMPL;
151 static HRESULT WINAPI file_stream_Read(ISpeechFileStream *iface, VARIANT *buffer, LONG written, LONG *read)
153 FIXME("(%p, %p, %ld, %p): stub.\n", iface, buffer, written, read);
155 return E_NOTIMPL;
158 static HRESULT WINAPI file_stream_Write(ISpeechFileStream *iface, VARIANT buffer, LONG *written)
160 FIXME("(%p, %s, %p): stub.\n", iface, debugstr_variant(&buffer), written);
162 return E_NOTIMPL;
165 static HRESULT WINAPI file_stream_Seek(ISpeechFileStream *iface, VARIANT position, SpeechStreamSeekPositionType origin,
166 VARIANT *pos)
168 FIXME("(%p, %s, %d, %p): stub.\n", iface, debugstr_variant(&position), origin, pos);
170 return E_NOTIMPL;
173 static HRESULT WINAPI file_stream_Open(ISpeechFileStream *iface, BSTR filename, SpeechStreamFileMode mode, VARIANT_BOOL events)
175 FIXME("(%p, %s, %d, %d): stub.\n", iface, debugstr_w(filename), mode, events);
177 return E_NOTIMPL;
180 static HRESULT WINAPI file_stream_Close(ISpeechFileStream *iface)
182 FIXME("(%p): stub.\n", iface);
184 return E_NOTIMPL;
187 const static ISpeechFileStreamVtbl file_stream_vtbl =
189 file_stream_QueryInterface,
190 file_stream_AddRef,
191 file_stream_Release,
192 file_stream_GetTypeInfoCount,
193 file_stream_GetTypeInfo,
194 file_stream_GetIDsOfNames,
195 file_stream_Invoke,
196 file_stream_get_Format,
197 file_stream_putref_Format,
198 file_stream_Read,
199 file_stream_Write,
200 file_stream_Seek,
201 file_stream_Open,
202 file_stream_Close
205 /* ISpStream interface */
206 static HRESULT WINAPI spstream_QueryInterface(ISpStream *iface, REFIID iid, void **obj)
208 struct file_stream *This = impl_from_ISpStream(iface);
210 TRACE("(%p, %s, %p).\n", iface, debugstr_guid(iid), obj);
212 return ISpeechFileStream_QueryInterface(&This->ISpeechFileStream_iface, iid, obj);
215 static ULONG WINAPI spstream_AddRef(ISpStream *iface)
217 struct file_stream *This = impl_from_ISpStream(iface);
219 TRACE("(%p).\n", iface);
221 return ISpeechFileStream_AddRef(&This->ISpeechFileStream_iface);
224 static ULONG WINAPI spstream_Release(ISpStream *iface)
226 struct file_stream *This = impl_from_ISpStream(iface);
228 TRACE("(%p).\n", iface);
230 return ISpeechFileStream_Release(&This->ISpeechFileStream_iface);
233 static HRESULT WINAPI spstream_Read(ISpStream *iface, void *pv, ULONG cb, ULONG *read)
235 FIXME("(%p, %p, %ld, %p): stub.\n", iface, pv, cb, read);
237 return E_NOTIMPL;
240 static HRESULT WINAPI spstream_Write(ISpStream *iface, const void *pv, ULONG cb, ULONG *written)
242 FIXME("(%p, %p, %ld, %p): stub.\n", iface, pv, cb, written);
244 return E_NOTIMPL;
247 static HRESULT WINAPI spstream_Seek(ISpStream *iface, LARGE_INTEGER mode, DWORD origin, ULARGE_INTEGER *position)
249 FIXME("(%p, %s, %ld, %p): stub.\n", iface, wine_dbgstr_longlong(mode.QuadPart), origin, position);
251 return E_NOTIMPL;
254 static HRESULT WINAPI spstream_SetSize(ISpStream *iface, ULARGE_INTEGER size)
256 FIXME("(%p, %s): stub.\n", iface, wine_dbgstr_longlong(size.QuadPart));
258 return E_NOTIMPL;
261 static HRESULT WINAPI spstream_CopyTo(ISpStream *iface, IStream *stream, ULARGE_INTEGER cb,
262 ULARGE_INTEGER *read, ULARGE_INTEGER *written)
264 FIXME("(%p, %p, %s, %p, %p): stub.\n", iface, stream, wine_dbgstr_longlong(cb.QuadPart),
265 read, written);
267 return E_NOTIMPL;
270 static HRESULT WINAPI spstream_Commit(ISpStream *iface, DWORD flag)
272 FIXME("(%p, %ld): stub.\n", iface, flag);
274 return E_NOTIMPL;
277 static HRESULT WINAPI spstream_Revert(ISpStream *iface)
279 FIXME("(%p): stub.\n", iface);
281 return E_NOTIMPL;
284 static HRESULT WINAPI spstream_LockRegion(ISpStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER cb, DWORD type)
286 FIXME("(%p, %s, %s, %ld): stub.\n", iface, wine_dbgstr_longlong(offset.QuadPart),
287 wine_dbgstr_longlong(cb.QuadPart), type);
289 return E_NOTIMPL;
292 static HRESULT WINAPI spstream_UnlockRegion(ISpStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER cb, DWORD type)
294 FIXME("(%p, %s, %s, %ld): stub.\n", iface, wine_dbgstr_longlong(offset.QuadPart),
295 wine_dbgstr_longlong(cb.QuadPart), type);
297 return E_NOTIMPL;
300 static HRESULT WINAPI spstream_Stat(ISpStream *iface, STATSTG *statstg, DWORD flag)
302 FIXME("(%p, %p, %ld): stub.\n", iface, statstg, flag);
304 return E_NOTIMPL;
307 static HRESULT WINAPI spstream_Clone(ISpStream *iface, IStream **stream)
309 FIXME("(%p, %p): stub.\n", iface, stream);
311 return E_NOTIMPL;
314 static HRESULT WINAPI spstream_GetFormat(ISpStream *iface, GUID *format, WAVEFORMATEX **wave)
316 FIXME("(%p, %p, %p): stub.\n", iface, format, wave);
318 return E_NOTIMPL;
321 static HRESULT WINAPI spstream_SetBaseStream(ISpStream *iface, IStream *stream, REFGUID format,
322 const WAVEFORMATEX *wave)
324 FIXME("(%p, %p, %s, %p): stub.\n", iface, stream, debugstr_guid(format), wave);
326 return E_NOTIMPL;
329 static HRESULT WINAPI spstream_GetBaseStream(ISpStream *iface, IStream **stream)
331 FIXME("(%p, %p): stub.\n", iface, stream);
333 return E_NOTIMPL;
336 static HRESULT WINAPI spstream_BindToFile(ISpStream *iface, LPCWSTR filename, SPFILEMODE mode,
337 const GUID *format, const WAVEFORMATEX* wave,
338 ULONGLONG interest)
340 FIXME("(%p, %s, %d, %s, %p, %s): stub.\n", iface, debugstr_w(filename), mode, debugstr_guid(format),
341 wave, wine_dbgstr_longlong(interest));
343 return E_NOTIMPL;
346 static HRESULT WINAPI spstream_Close(ISpStream *iface)
348 FIXME("(%p): stub.\n", iface);
350 return E_NOTIMPL;
353 const static ISpStreamVtbl spstream_vtbl =
355 spstream_QueryInterface,
356 spstream_AddRef,
357 spstream_Release,
358 spstream_Read,
359 spstream_Write,
360 spstream_Seek,
361 spstream_SetSize,
362 spstream_CopyTo,
363 spstream_Commit,
364 spstream_Revert,
365 spstream_LockRegion,
366 spstream_UnlockRegion,
367 spstream_Stat,
368 spstream_Clone,
369 spstream_GetFormat,
370 spstream_SetBaseStream,
371 spstream_GetBaseStream,
372 spstream_BindToFile,
373 spstream_Close
376 HRESULT file_stream_create(IUnknown *outer, REFIID iid, void **obj)
378 struct file_stream *This = heap_alloc(sizeof(*This));
379 HRESULT hr;
381 if (!This) return E_OUTOFMEMORY;
382 This->ISpeechFileStream_iface.lpVtbl = &file_stream_vtbl;
383 This->ISpStream_iface.lpVtbl = &spstream_vtbl;
384 This->ref = 1;
386 hr = ISpeechFileStream_QueryInterface(&This->ISpeechFileStream_iface, iid, obj);
388 ISpeechFileStream_Release(&This->ISpeechFileStream_iface);
389 return hr;