Commit 4a7ebca3 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

windows.media.speech: Return operation error from IAsyncOperation_GetResults.

And E_ILLEGAL_METHOD_CALL if called when status isn't Completed or Error. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d84fb829
...@@ -201,16 +201,16 @@ static HRESULT WINAPI async_operation_GetResults( IAsyncOperation_IInspectable * ...@@ -201,16 +201,16 @@ static HRESULT WINAPI async_operation_GetResults( IAsyncOperation_IInspectable *
TRACE("iface %p, results %p.\n", iface, results); TRACE("iface %p, results %p.\n", iface, results);
EnterCriticalSection(&impl->cs); EnterCriticalSection(&impl->cs);
if (impl->status == Closed) if (impl->status != Completed && impl->status != Error)
hr = E_ILLEGAL_METHOD_CALL; hr = E_ILLEGAL_METHOD_CALL;
else if (impl->status > Started && impl->result) else if (!impl->result)
hr = E_UNEXPECTED;
else
{ {
*results = impl->result; *results = impl->result;
impl->result = NULL; /* NOTE: AsyncOperation gives up it's reference to result here! */ 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); LeaveCriticalSection(&impl->cs);
return hr; return hr;
......
...@@ -988,7 +988,7 @@ static void test_SpeechRecognizer(void) ...@@ -988,7 +988,7 @@ static void test_SpeechRecognizer(void)
compilation_result = (void*)0xdeadbeef; compilation_result = (void*)0xdeadbeef;
hr = IAsyncOperation_SpeechRecognitionCompilationResult_GetResults(operation, &compilation_result); 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); ok(compilation_result == (void*)0xdeadbeef, "Compilation result had value %p.\n", compilation_result);
hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(operation, &compilation_handler.IAsyncHandler_Compilation_iface); hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(operation, &compilation_handler.IAsyncHandler_Compilation_iface);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment