Alistair Leslie-Hughes : dsound: IDirectSoundNotify is only available when DSBCAPS_CTRLPOSITIONNOTIFY is specified.

Alexandre Julliard julliard at winehq.org
Wed Feb 13 15:30:41 CST 2019


Module: wine
Branch: master
Commit: 9a258c5dd7e45fb37e15a6ba69734544318303f2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9a258c5dd7e45fb37e15a6ba69734544318303f2

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Wed Feb 13 01:56:16 2019 +0000

dsound: IDirectSoundNotify is only available when DSBCAPS_CTRLPOSITIONNOTIFY is specified.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45473
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dsound/buffer.c       |  9 +++++++--
 dlls/dsound/tests/dsound.c | 13 +++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 5262628..2a328ed 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -923,11 +923,16 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8
                 return S_OK;
 	}
 
-	if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
+        if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
+            if(This->dsbd.dwFlags & DSBCAPS_CTRLPOSITIONNOTIFY) {
                 IDirectSoundNotify_AddRef(&This->IDirectSoundNotify_iface);
                 *ppobj = &This->IDirectSoundNotify_iface;
                 return S_OK;
-	}
+            }
+
+            TRACE( "App requested IDirectSoundNotify without DSBCAPS_CTRLPOSITIONNOTIFY flag.\n");
+            return E_NOINTERFACE;
+        }
 
 	if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) {
             if(This->dsbd.dwFlags & DSBCAPS_CTRL3D){
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 89f0aa0..41818de 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -1563,6 +1563,19 @@ static void test_notifications(LPGUID lpGuid)
 
     ZeroMemory(&bufdesc, sizeof(bufdesc));
     bufdesc.dwSize = sizeof(bufdesc);
+    bufdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
+    bufdesc.dwBufferBytes = wfx.nSamplesPerSec * wfx.nBlockAlign / 2; /* 0.5s */
+    bufdesc.lpwfxFormat = &wfx;
+    rc = IDirectSound_CreateSoundBuffer(dso, &bufdesc, &buf, NULL);
+    ok(rc == DS_OK && buf != NULL, "IDirectSound_CreateSoundBuffer() failed "
+           "to create a buffer %08x\n", rc);
+
+    rc = IDirectSoundBuffer_QueryInterface(buf, &IID_IDirectSoundNotify, (void**)&buf_notif);
+    ok(rc == E_NOINTERFACE, "QueryInterface(IID_IDirectSoundNotify): %08x\n", rc);
+    IDirectSoundBuffer_Release(buf);
+
+    ZeroMemory(&bufdesc, sizeof(bufdesc));
+    bufdesc.dwSize = sizeof(bufdesc);
     bufdesc.dwFlags = DSBCAPS_CTRLPOSITIONNOTIFY;
     bufdesc.dwBufferBytes = wfx.nSamplesPerSec * wfx.nBlockAlign / 2; /* 0.5s */
     bufdesc.lpwfxFormat = &wfx;




More information about the wine-cvs mailing list