diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 77548045702..921253b62c2 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -994,7 +994,7 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, HANDLE event) { ACImpl *This = impl_from_IAudioClient3(iface); - struct oss_stream *stream = This->stream; + struct set_event_handle_params params; TRACE("(%p)->(%p)\n", This, event); @@ -1004,24 +1004,11 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, if(!This->stream) return AUDCLNT_E_NOT_INITIALIZED; - oss_lock(stream); + params.stream = This->stream; + params.event = event; + OSS_CALL(set_event_handle, ¶ms); - if(!(stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)){ - oss_unlock(stream); - return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; - } - - if (stream->event){ - oss_unlock(stream); - FIXME("called twice\n"); - return HRESULT_FROM_WIN32(ERROR_INVALID_NAME); - } - - stream->event = event; - - oss_unlock(stream); - - return S_OK; + return params.result; } static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 72e917dfd76..3ea0ab42e3e 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1043,6 +1043,26 @@ static NTSTATUS get_current_padding(void *args) return oss_unlock_result(stream, ¶ms->result, S_OK); } +static NTSTATUS set_event_handle(void *args) +{ + struct set_event_handle_params *params = args; + struct oss_stream *stream = params->stream; + + oss_lock(stream); + + if(!(stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)) + return oss_unlock_result(stream, ¶ms->result, AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED); + + if (stream->event){ + FIXME("called twice\n"); + return oss_unlock_result(stream, ¶ms->result, HRESULT_FROM_WIN32(ERROR_INVALID_NAME)); + } + + stream->event = params->event; + + return oss_unlock_result(stream, ¶ms->result, S_OK); +} + unixlib_entry_t __wine_unix_call_funcs[] = { test_connect, @@ -1058,4 +1078,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_buffer_size, get_latency, get_current_padding, + set_event_handle, }; diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index bd4b065c61e..73963b1871b 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -152,6 +152,13 @@ struct get_current_padding_params UINT32 *padding; }; +struct set_event_handle_params +{ + struct oss_stream *stream; + HANDLE event; + HRESULT result; +}; + enum oss_funcs { oss_test_connect, @@ -167,6 +174,7 @@ enum oss_funcs oss_get_buffer_size, oss_get_latency, oss_get_current_padding, + oss_set_event_handle, }; extern unixlib_handle_t oss_handle;