mmdevapi: SetEventHandle is allowed only once.

This commit is contained in:
Jörg Höhle 2012-12-09 21:39:16 +01:00 committed by Alexandre Julliard
parent c38d5ce73c
commit b18c5e811f
4 changed files with 19 additions and 1 deletions

View File

@ -634,7 +634,7 @@ static void test_event(void)
ok(hr == S_OK, "SetEventHandle failed: %08x\n", hr);
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);
ok(r == WAIT_TIMEOUT, "Wait(event) before Start gave %x\n", r);

View File

@ -2284,6 +2284,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface,
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;
LeaveCriticalSection(&This->lock);

View File

@ -1816,6 +1816,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface,
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;
OSSpinLockUnlock(&This->lock);

View File

@ -1620,6 +1620,12 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient *iface,
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;
LeaveCriticalSection(&This->lock);