Commit b18c5e81 authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

mmdevapi: SetEventHandle is allowed only once.

parent c38d5ce7
...@@ -634,7 +634,7 @@ static void test_event(void) ...@@ -634,7 +634,7 @@ static void test_event(void)
ok(hr == S_OK, "SetEventHandle failed: %08x\n", hr); ok(hr == S_OK, "SetEventHandle failed: %08x\n", hr);
hr = IAudioClient_SetEventHandle(ac, event); hr = IAudioClient_SetEventHandle(ac, event);
todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "SetEventHandle returns %08x\n", hr); ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "SetEventHandle returns %08x\n", hr);
r = WaitForSingleObject(event, 40); r = WaitForSingleObject(event, 40);
ok(r == WAIT_TIMEOUT, "Wait(event) before Start gave %x\n", r); ok(r == WAIT_TIMEOUT, "Wait(event) before Start gave %x\n", r);
......
...@@ -2284,6 +2284,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface, ...@@ -2284,6 +2284,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface,
return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED;
} }
if (This->event){
LeaveCriticalSection(&This->lock);
FIXME("called twice\n");
return HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
}
This->event = event; This->event = event;
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
......
...@@ -1816,6 +1816,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface, ...@@ -1816,6 +1816,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface,
return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED;
} }
if (This->event){
OSSpinLockUnlock(&This->lock);
FIXME("called twice\n");
return HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
}
This->event = event; This->event = event;
OSSpinLockUnlock(&This->lock); OSSpinLockUnlock(&This->lock);
......
...@@ -1620,6 +1620,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface, ...@@ -1620,6 +1620,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface,
return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED; return AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED;
} }
if (This->event){
LeaveCriticalSection(&This->lock);
FIXME("called twice\n");
return HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
}
This->event = event; This->event = event;
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
......
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