=?UTF-8?Q?J=C3=B6rg=20H=C3=B6hle=20?=: mmdevapi: SetEventHandle is allowed only once.

Alexandre Julliard julliard at winehq.org
Tue Dec 18 13:49:06 CST 2012


Module: wine
Branch: master
Commit: b18c5e811f6569c8acb373b529e931dd7505281e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b18c5e811f6569c8acb373b529e931dd7505281e

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Sun Dec  9 21:39:16 2012 +0100

mmdevapi: SetEventHandle is allowed only once.

---

 dlls/mmdevapi/tests/render.c      |    2 +-
 dlls/winealsa.drv/mmdevdrv.c      |    6 ++++++
 dlls/winecoreaudio.drv/mmdevdrv.c |    6 ++++++
 dlls/wineoss.drv/mmdevdrv.c       |    6 ++++++
 4 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c
index 9d9478a..e753299 100644
--- a/dlls/mmdevapi/tests/render.c
+++ b/dlls/mmdevapi/tests/render.c
@@ -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);
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 416f1ba..e903b9e 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -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);
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index 8ee0dec..ee965e7 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -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);
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index 9fc6f02..4de5ae6 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -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);




More information about the wine-cvs mailing list