From 4a7ebca3193c093b4cb9e5ae07a65fde60228fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 25 Apr 2022 17:29:13 +0200 Subject: [PATCH] windows.media.speech: Return operation error from IAsyncOperation_GetResults. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And E_ILLEGAL_METHOD_CALL if called when status isn't Completed or Error. Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/windows.media.speech/async.c | 10 +++++----- dlls/windows.media.speech/tests/speech.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/windows.media.speech/async.c b/dlls/windows.media.speech/async.c index 1e6dd336c84..3d3db840fa0 100644 --- a/dlls/windows.media.speech/async.c +++ b/dlls/windows.media.speech/async.c @@ -201,16 +201,16 @@ static HRESULT WINAPI async_operation_GetResults( IAsyncOperation_IInspectable * TRACE("iface %p, results %p.\n", iface, results); EnterCriticalSection(&impl->cs); - if (impl->status == Closed) + if (impl->status != Completed && impl->status != Error) hr = E_ILLEGAL_METHOD_CALL; - else if (impl->status > Started && impl->result) + else if (!impl->result) + hr = E_UNEXPECTED; + else { *results = impl->result; impl->result = NULL; /* NOTE: AsyncOperation gives up it's reference to result here! */ - hr = S_OK; + hr = impl->hr; } - else - hr = E_UNEXPECTED; LeaveCriticalSection(&impl->cs); return hr; diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 051b38ce0f9..e6120afdad0 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -988,7 +988,7 @@ static void test_SpeechRecognizer(void) compilation_result = (void*)0xdeadbeef; hr = IAsyncOperation_SpeechRecognitionCompilationResult_GetResults(operation, &compilation_result); - todo_wine ok(hr == E_ILLEGAL_METHOD_CALL, "Got unexpected hr %#lx.\n", hr); + ok(hr == E_ILLEGAL_METHOD_CALL, "Got unexpected hr %#lx.\n", hr); ok(compilation_result == (void*)0xdeadbeef, "Compilation result had value %p.\n", compilation_result); hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(operation, &compilation_handler.IAsyncHandler_Compilation_iface);