Commit bf263a34 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

dsound: Fail if app requests 3D buffer interface on a non-3D buffer.

parent 06b57327
......@@ -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 ) ) {
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment