[PATCH 4/5] windows.media.speech: Add SpeechRecognitionListConstraint statics stub.
Bernhard Kölbl
besentv at gmail.com
Sun Mar 13 11:10:53 CDT 2022
Signed-off-by: Bernhard Kölbl <besentv at gmail.com>
---
dlls/windows.media.speech/Makefile.in | 1 +
dlls/windows.media.speech/listconstraint.c | 183 +++++++++++++++++++++
dlls/windows.media.speech/main.c | 2 +
dlls/windows.media.speech/private.h | 1 +
dlls/windows.media.speech/tests/speech.c | 18 +-
5 files changed, 197 insertions(+), 8 deletions(-)
create mode 100644 dlls/windows.media.speech/listconstraint.c
diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in
index 079578fb37f..2f9ca159e2a 100644
--- a/dlls/windows.media.speech/Makefile.in
+++ b/dlls/windows.media.speech/Makefile.in
@@ -2,6 +2,7 @@ MODULE = windows.media.speech.dll
IMPORTS = combase uuid
C_SRCS = \
+ listconstraint.c \
main.c \
recognizer.c \
synthesizer.c
diff --git a/dlls/windows.media.speech/listconstraint.c b/dlls/windows.media.speech/listconstraint.c
new file mode 100644
index 00000000000..107f9f4a3a8
--- /dev/null
+++ b/dlls/windows.media.speech/listconstraint.c
@@ -0,0 +1,183 @@
+/* WinRT Windows.Media.SpeechRecognition implementation
+ *
+ * Copyright 2022 Bernhard Kölbl
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(speech);
+
+/*
+ *
+ * Statics for SpeechRecognitionListConstraint
+ *
+ */
+
+struct listconstraint_statics
+{
+ IActivationFactory IActivationFactory_iface;
+ ISpeechRecognitionListConstraintFactory ISpeechRecognitionListConstraintFactory_iface;
+ LONG ref;
+};
+
+/*
+ *
+ * IActivationFactory
+ *
+ */
+
+static inline struct listconstraint_statics *impl_from_IActivationFactory( IActivationFactory *iface )
+{
+ return CONTAINING_RECORD(iface, struct listconstraint_statics, IActivationFactory_iface);
+}
+
+static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out )
+{
+ struct listconstraint_statics *impl = impl_from_IActivationFactory(iface);
+
+ TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_IUnknown) ||
+ IsEqualGUID(iid, &IID_IInspectable) ||
+ IsEqualGUID(iid, &IID_IAgileObject) ||
+ IsEqualGUID(iid, &IID_IActivationFactory))
+ {
+ IInspectable_AddRef((*out = &impl->IActivationFactory_iface));
+ return S_OK;
+ }
+
+ if (IsEqualGUID(iid, &IID_ISpeechRecognitionListConstraintFactory))
+ {
+ IInspectable_AddRef((*out = &impl->ISpeechRecognitionListConstraintFactory_iface));
+ return S_OK;
+ }
+
+ FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
+ *out = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI factory_AddRef( IActivationFactory *iface )
+{
+ struct listconstraint_statics *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedIncrement(&impl->ref);
+ TRACE("iface %p, ref %lu.\n", iface, ref);
+ return ref;
+}
+
+static ULONG WINAPI factory_Release( IActivationFactory *iface )
+{
+ struct listconstraint_statics *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedDecrement(&impl->ref);
+ TRACE("iface %p, ref %lu.\n", iface, ref);
+ return ref;
+}
+
+static HRESULT WINAPI factory_GetIids( IActivationFactory *iface, ULONG *iid_count, IID **iids )
+{
+ FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name )
+{
+ FIXME("iface %p, class_name %p stub!\n", iface, class_name);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level )
+{
+ FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance )
+{
+ TRACE("iface %p, instance %p\n", iface, instance);
+ return E_NOTIMPL;
+}
+
+static const struct IActivationFactoryVtbl activation_factory_vtbl =
+{
+ /* IUnknown methods */
+ factory_QueryInterface,
+ factory_AddRef,
+ factory_Release,
+ /* IInspectable methods */
+ factory_GetIids,
+ factory_GetRuntimeClassName,
+ factory_GetTrustLevel,
+ /* IActivationFactory methods */
+ factory_ActivateInstance,
+};
+
+/*
+ *
+ * ISpeechRecognitionListConstraintFactory
+ *
+ */
+
+DEFINE_IINSPECTABLE(constraint_factory, ISpeechRecognitionListConstraintFactory, struct listconstraint_statics, IActivationFactory_iface)
+
+static HRESULT WINAPI constraint_factory_Create( ISpeechRecognitionListConstraintFactory *iface,
+ IIterable_HSTRING *commands,
+ ISpeechRecognitionListConstraint** listconstraint )
+{
+ TRACE("iface %p, commands %p, listconstraint %p.\n", iface, commands, listconstraint);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI constraint_factory_CreateWithTag( ISpeechRecognitionListConstraintFactory *iface,
+ IIterable_HSTRING *commands,
+ HSTRING tag,
+ ISpeechRecognitionListConstraint** listconstraint )
+{
+ TRACE("iface %p, commands %p, tag %p, listconstraint %p.\n", iface, commands, tag, listconstraint);
+ return E_NOTIMPL;
+}
+
+static const struct ISpeechRecognitionListConstraintFactoryVtbl speech_recognition_list_constraint_factory_vtbl =
+{
+ /* IUnknown methods */
+ constraint_factory_QueryInterface,
+ constraint_factory_AddRef,
+ constraint_factory_Release,
+ /* IInspectable methods */
+ constraint_factory_GetIids,
+ constraint_factory_GetRuntimeClassName,
+ constraint_factory_GetTrustLevel,
+ /* ISpeechRecognitionListConstraintFactory methods */
+ constraint_factory_Create,
+ constraint_factory_CreateWithTag,
+};
+
+/*
+ *
+ * ActivationFactory instances
+ *
+ */
+
+static struct listconstraint_statics listconstraint_statics =
+{
+ .IActivationFactory_iface = {&activation_factory_vtbl},
+ .ISpeechRecognitionListConstraintFactory_iface = {&speech_recognition_list_constraint_factory_vtbl},
+ .ref = 1
+};
+
+IActivationFactory *listconstraint_factory = &listconstraint_statics.IActivationFactory_iface;
diff --git a/dlls/windows.media.speech/main.c b/dlls/windows.media.speech/main.c
index 295af6ea135..e772a791588 100644
--- a/dlls/windows.media.speech/main.c
+++ b/dlls/windows.media.speech/main.c
@@ -40,6 +40,8 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac
if (!wcscmp(buffer, L"Windows.Media.SpeechRecognition.SpeechRecognizer"))
IActivationFactory_AddRef((*factory = recognizer_factory));
+ if (!wcscmp(buffer, L"Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint"))
+ IActivationFactory_AddRef((*factory = listconstraint_factory));
if (!wcscmp(buffer, L"Windows.Media.SpeechSynthesis.SpeechSynthesizer"))
IActivationFactory_AddRef((*factory = synthesizer_factory));
diff --git a/dlls/windows.media.speech/private.h b/dlls/windows.media.speech/private.h
index ece2a0934f2..c31b8825c74 100644
--- a/dlls/windows.media.speech/private.h
+++ b/dlls/windows.media.speech/private.h
@@ -46,6 +46,7 @@
*
*/
+extern IActivationFactory *listconstraint_factory;
extern IActivationFactory *recognizer_factory;
/*
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c
index 8c22e19cf3d..48e2719dba6 100644
--- a/dlls/windows.media.speech/tests/speech.c
+++ b/dlls/windows.media.speech/tests/speech.c
@@ -710,21 +710,20 @@ static void test_SpeechRecognitionListConstraint(void)
}
hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
- todo_wine ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#lx.\n", hr);
+ ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#lx.\n", hr);
if (hr == REGDB_E_CLASSNOTREG) /* Win 8 and 8.1 */
{
win_skip("SpeechRecognitionListConstraint activation factory not available!\n");
goto done;
}
- else if (!SUCCEEDED(hr)) goto done;
hr = IActivationFactory_ActivateInstance(factory, &inspectable);
- todo_wine ok(hr == E_NOTIMPL, "IActivationFactory_ActivateInstance failed, hr %#lx.\n", hr);
+ ok(hr == E_NOTIMPL, "IActivationFactory_ActivateInstance failed, hr %#lx.\n", hr);
- todo_wine check_refcount(factory, 2);
- todo_wine check_interface(factory, &IID_IInspectable, TRUE);
- todo_wine check_interface(factory, &IID_IAgileObject, TRUE);
+ check_refcount(factory, 2);
+ check_interface(factory, &IID_IInspectable, TRUE);
+ check_interface(factory, &IID_IAgileObject, TRUE);
hr = IActivationFactory_QueryInterface(factory, &IID_ISpeechRecognitionListConstraintFactory, (void **)&listconstraint_factory);
ok(hr == S_OK, "IActivationFactory_QueryInterface IID_ISpeechRecognitionListConstraintFactory failed, hr %#lx.\n", hr);
@@ -748,6 +747,9 @@ static void test_SpeechRecognitionListConstraint(void)
hr = ISpeechRecognitionListConstraintFactory_CreateWithTag(listconstraint_factory, &iterable_hstring.IIterable_HSTRING_iface, NULL, &listconstraint);
todo_wine ok(hr == S_OK, "ISpeechRecognitionListConstraintFactory_Create failed, hr %#lx.\n", hr);
+ if (!SUCCEEDED(hr))
+ goto skip_create;
+
ref = ISpeechRecognitionListConstraint_Release(listconstraint);
todo_wine ok(ref == 0, "Got unexpected ref %lu.\n", ref);
@@ -809,10 +811,10 @@ static void test_SpeechRecognitionListConstraint(void)
skip_create:
ref = ISpeechRecognitionListConstraintFactory_Release(listconstraint_factory);
- todo_wine ok(ref == 2, "Got unexpected ref %lu.\n", ref);
+ ok(ref == 2, "Got unexpected ref %lu.\n", ref);
ref = IActivationFactory_Release(factory);
- todo_wine ok(ref == 1, "Got unexpected ref %lu.\n", ref);
+ ok(ref == 1, "Got unexpected ref %lu.\n", ref);
done:
WindowsDeleteString(str);
--
2.35.1
More information about the wine-devel
mailing list