Michael Stefaniuc : dmusic: Fail in CreatePort() if SetDirectSound() wasn' t called.

Alexandre Julliard julliard at winehq.org
Fri May 12 11:48:07 CDT 2017


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Fri May 12 16:11:25 2017 +0200

dmusic: Fail in CreatePort() if SetDirectSound() wasn't called.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dmusic/dmusic.c       | 6 +++---
 dlls/dmusic/tests/dmusic.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c
index 4199da4..58dcd9d 100644
--- a/dlls/dmusic/dmusic.c
+++ b/dlls/dmusic/dmusic.c
@@ -129,14 +129,14 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSI
 
     TRACE("(%p)->(%s, %p, %p, %p)\n", This, debugstr_dmguid(rclsid_port), port_params, port, unkouter);
 
-    if (!rclsid_port)
+    if (!rclsid_port || !port)
         return E_POINTER;
     if (!port_params)
         return E_INVALIDARG;
-    if (!port)
-        return E_POINTER;
     if (unkouter)
         return CLASS_E_NOAGGREGATION;
+    if (!This->dsound)
+        return DMUS_E_DSOUND_NOT_SET;
 
     if (TRACE_ON(dmusic))
         dump_DMUS_PORTPARAMS(port_params);
diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c
index 288a741..7da8aab 100644
--- a/dlls/dmusic/tests/dmusic.c
+++ b/dlls/dmusic/tests/dmusic.c
@@ -68,7 +68,7 @@ static void test_dmusic(void)
 
     /* No port can be created before SetDirectSound is called */
     hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, &port, NULL);
-    todo_wine ok(hr == DMUS_E_DSOUND_NOT_SET, "IDirectMusic_CreatePort returned: %x\n", hr);
+    ok(hr == DMUS_E_DSOUND_NOT_SET, "IDirectMusic_CreatePort returned: %x\n", hr);
 
     hr = IDirectMusic_SetDirectSound(dmusic, NULL, NULL);
     ok(hr == S_OK, "IDirectMusic_SetDirectSound returned: %x\n", hr);




More information about the wine-cvs mailing list