[PATCH] xaudio2: Don't return XAudio28 interface for XAudio2[0..7] objects in QueryInterface()

Andrew Eikum aeikum at codeweavers.com
Fri Oct 12 12:52:40 CDT 2018


Thanks, Roger. Could you add a test for this? I think it could go
right after the CoCreateInstance in <dlls/xaudio2_7/tests/xaudio2.c>.

Andrew

On Fri, Oct 12, 2018 at 07:36:48PM +0200, Roger Zoellner wrote:
> Fixes bug
> https://bugs.winehq.org/show_bug.cgi?id=43660
> (DOS2 classic client is affected as well)
> 
> In this specific case, the bug is caused by a call to QueryInterface inside bink2w64.dll, which then
> will treat a precreated XAudio27 object as XAudio28. This leads to a crash.
> 
> This fix may affect other games, that use BINK2, too.
> 
> Signed-off-by: Roger Zoellner <zoellner.roger at gmail.com>
> ---
>  dlls/xaudio2_7/xaudio_dll.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c
> index 28cf98565b..461ac56ffe 100644
> --- a/dlls/xaudio2_7/xaudio_dll.c
> +++ b/dlls/xaudio2_7/xaudio_dll.c
> @@ -1262,7 +1262,9 @@ static HRESULT WINAPI IXAudio2Impl_QueryInterface(IXAudio2 *iface, REFIID riid,
>      TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject);
>  
>      if(IsEqualGUID(riid, &IID_IUnknown) ||
> +#if XAUDIO2_VER == 8
>              IsEqualGUID(riid, &IID_IXAudio28) ||
> +#endif
>              IsEqualGUID(riid, &IID_IXAudio2))
>          *ppvObject = &This->IXAudio2_iface;
>      else if(IsEqualGUID(riid, &IID_IXAudio27)){
> -- 
> 2.19.0
> 
> 
> 



More information about the wine-devel mailing list