Small fix for IDirectSound.GetCaps

Francois Gouget fgouget at codeweavers.com
Tue Dec 3 18:20:32 CST 2002


I wrote a small DSound test that shows IDirectSound.GetCaps returns an 
error if dwSize is not set. It might accept the size of older versions 
of the structure which this patch does not do. Just let me know if 
that's the case.

Changelog:

    Francois Gouget <fgouget at codeweavers.com>

  * dlls/dsound/dsound_main.c

    Return an error if dwSize is not valid
    No need to dump dwFlags before it is initialized


-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/dsound/dsound_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.66
diff -u -r1.66 dsound_main.c
--- dlls/dsound/dsound_main.c	29 Sep 2002 18:01:33 -0000	1.66
+++ dlls/dsound/dsound_main.c	3 Dec 2002 23:44:30 -0000
@@ -401,15 +401,12 @@
 static HRESULT WINAPI IDirectSoundImpl_GetCaps(LPDIRECTSOUND8 iface,LPDSCAPS caps) {
 	ICOM_THIS(IDirectSoundImpl,iface);
 	TRACE("(%p,%p)\n",This,caps);
-	TRACE("(flags=0x%08lx)\n",caps->dwFlags);
 
-	if (caps == NULL)
+	if (caps == NULL || caps->dwSize!=sizeof(*caps))
 		return DSERR_INVALIDPARAM;
 
-	/* We should check this value, not set it. See Inside DirectX, p215. */
-	caps->dwSize = sizeof(*caps);
-
 	caps->dwFlags = This->drvcaps.dwFlags;
+	TRACE("(flags=0x%08lx)\n",caps->dwFlags);
 
 	/* FIXME: copy caps from This->drvcaps */
 	caps->dwMinSecondarySampleRate		= DSBFREQUENCY_MIN;


More information about the wine-patches mailing list