[PATCH 4/4] dmusic: Fail in CreatePort() if SetDirectSound() wasn't called

Michael Stefaniuc mstefani at winehq.org
Fri May 12 09:11:25 CDT 2017


Signed-off-by: Michael Stefaniuc <mstefani 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);
-- 
2.9.3




More information about the wine-patches mailing list