Andrew Eikum : dsound: Fail if app requests 3D buffer interface on a non-3D buffer.
Alexandre Julliard
julliard at winehq.org
Thu Jun 14 15:31:30 CDT 2012
Module: wine
Branch: master
Commit: bf263a347d904b01673ab19cd35927881255544d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bf263a347d904b01673ab19cd35927881255544d
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Thu Jun 14 09:25:48 2012 -0500
dsound: Fail if app requests 3D buffer interface on a non-3D buffer.
---
dlls/dsound/buffer.c | 4 ++++
dlls/dsound/tests/ds3d.c | 10 +++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 08f4ba7..caf1f86 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -764,9 +764,13 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8
}
if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) {
+ if(This->dsbd.dwFlags & DSBCAPS_CTRL3D){
IDirectSound3DBuffer_AddRef(&This->IDirectSound3DBuffer_iface);
*ppobj = &This->IDirectSound3DBuffer_iface;
return S_OK;
+ }
+ TRACE("app requested IDirectSound3DBuffer on non-3D secondary buffer\n");
+ return E_NOINTERFACE;
}
if ( IsEqualGUID( &IID_IDirectSound3DListener, riid ) ) {
diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c
index 0fbbfe8..86099bf 100644
--- a/dlls/dsound/tests/ds3d.c
+++ b/dlls/dsound/tests/ds3d.c
@@ -801,7 +801,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
- if (has_3d)
+ if (has_3dbuffer)
bufdesc.dwFlags|=DSBCAPS_CTRL3D;
else
bufdesc.dwFlags|=
@@ -833,6 +833,14 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
getDSBCAPS(bufdesc.dwFlags),rc);
if (rc==DS_OK && secondary!=NULL) {
+ IDirectSound3DBuffer *ds3d;
+
+ rc=IDirectSoundBuffer_QueryInterface(secondary, &IID_IDirectSound3DBuffer, (void**)&ds3d);
+ ok((has_3dbuffer && rc==DS_OK) || (!has_3dbuffer && rc==E_NOINTERFACE),
+ "Wrong return trying to get 3D buffer on %s3D secondary interface: %08x\n", has_3dbuffer ? "" : "non-", rc);
+ if(rc==DS_OK)
+ IDirectSound3DBuffer_Release(ds3d);
+
if (!has_3d) {
LONG refvol,vol,refpan,pan;
More information about the wine-cvs
mailing list