Rémi Bernon : windows.media.speech: Return E_ILLEGAL_METHOD_CALL from get_ErrorCode.
Alexandre Julliard
julliard at winehq.org
Wed Apr 27 16:12:14 CDT 2022
Module: wine
Branch: master
Commit: 77632af839a75254faf613ac460ce230db623888
URL: https://source.winehq.org/git/wine.git/?a=commit;h=77632af839a75254faf613ac460ce230db623888
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Apr 25 17:31:44 2022 +0200
windows.media.speech: Return E_ILLEGAL_METHOD_CALL from get_ErrorCode.
When async operation status is Closed.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/windows.media.speech/async.c | 9 +++++++--
dlls/windows.media.speech/tests/speech.c | 12 +++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/windows.media.speech/async.c b/dlls/windows.media.speech/async.c
index 3d3db840fa0..bc5d4fa40ed 100644
--- a/dlls/windows.media.speech/async.c
+++ b/dlls/windows.media.speech/async.c
@@ -268,13 +268,18 @@ static HRESULT WINAPI async_operation_info_get_Status( IAsyncInfo *iface, AsyncS
static HRESULT WINAPI async_operation_info_get_ErrorCode( IAsyncInfo *iface, HRESULT *error_code )
{
struct async_operation *impl = impl_from_IAsyncInfo(iface);
+ HRESULT hr = S_OK;
+
TRACE("iface %p, error_code %p.\n", iface, error_code);
EnterCriticalSection(&impl->cs);
- *error_code = impl->hr;
+ if (impl->status == Closed)
+ *error_code = hr = E_ILLEGAL_METHOD_CALL;
+ else
+ *error_code = impl->hr;
LeaveCriticalSection(&impl->cs);
- return S_OK;
+ return hr;
}
static HRESULT WINAPI async_operation_info_Cancel( IAsyncInfo *iface )
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c
index e6120afdad0..9ef49b160cd 100644
--- a/dlls/windows.media.speech/tests/speech.c
+++ b/dlls/windows.media.speech/tests/speech.c
@@ -858,7 +858,7 @@ static void test_SpeechRecognizer(void)
AsyncStatus async_status;
HSTRING hstr, hstr_lang;
HANDLE blocked_thread;
- HRESULT hr;
+ HRESULT hr, error_code;
UINT32 id;
LONG ref;
@@ -1032,6 +1032,11 @@ static void test_SpeechRecognizer(void)
ok(hr == S_OK, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr);
ok(async_status == Completed, "Status was %#x.\n", async_status);
+ error_code = 0xdeadbeef;
+ hr = IAsyncInfo_get_ErrorCode(info, &error_code);
+ ok(hr == S_OK, "IAsyncInfo_get_ErrorCode failed, hr %#lx.\n", hr);
+ ok(error_code == S_OK, "ErrorCode was %#lx.\n", error_code);
+
hr = IAsyncInfo_Cancel(info);
ok(hr == S_OK, "IAsyncInfo_Cancel failed, hr %#lx.\n", hr);
@@ -1050,6 +1055,11 @@ static void test_SpeechRecognizer(void)
ok(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr);
ok(async_status == AsyncStatus_Closed, "Status was %#x.\n", async_status);
+ error_code = 0xdeadbeef;
+ hr = IAsyncInfo_get_ErrorCode(info, &error_code);
+ ok(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_ErrorCode failed, hr %#lx.\n", hr);
+ ok(error_code == E_ILLEGAL_METHOD_CALL, "ErrorCode was %#lx.\n", error_code);
+
ref = IAsyncInfo_Release(info);
ok(ref == 1, "Got unexpected ref %lu.\n", ref);
More information about the wine-cvs
mailing list