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

This commit is contained in:
Andrew Eikum 2012-06-14 09:25:48 -05:00 committed by Alexandre Julliard
parent 06b5732798
commit bf263a347d
2 changed files with 13 additions and 1 deletions

View File

@ -764,10 +764,14 @@ 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 ) ) {
ERR("app requested IDirectSound3DListener on secondary buffer\n");

View File

@ -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;