[PATCH] dsound: IDirectSoundNotify is only available when DSBCAPS_CTRLPOSITIONNOTIFY is specified.

Andrew Eikum aeikum at codeweavers.com
Tue Feb 12 08:31:51 CST 2019


On Mon, Feb 11, 2019 at 09:38:27PM +0000, Alistair Leslie-Hughes wrote:
> diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
> index 5262628..e54ba57 100644
> --- a/dlls/dsound/buffer.c
> +++ b/dlls/dsound/buffer.c
> @@ -923,11 +923,17 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8
>                  return S_OK;
>  	}
>  
> -	if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
> -                IDirectSoundNotify_AddRef(&This->IDirectSoundNotify_iface);
> -                *ppobj = &This->IDirectSoundNotify_iface;
> -                return S_OK;
> -	}
> +    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){

I know it's already a mess, but please try to match the existing
formatting a little closer (initial indent is 8 characters wide,
braces on same line as if-statement).

>  static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
> @@ -1638,6 +1684,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
>          test_duplicate(lpGuid);
>          test_invalid_fmts(lpGuid);
>          test_notifications(lpGuid);
> +        test_notifications_interface(lpGuid);

Instead of making a new function, I think this could be moved to the
beginning of test_notifications().

Otherwise it all looks fine to me.

Thanks,
Andrew



More information about the wine-devel mailing list