Return an error if dwSize is not valid.

No need to dump dwFlags before it is initialized.
This commit is contained in:
Francois Gouget 2002-12-05 19:00:56 +00:00 committed by Alexandre Julliard
parent 6ae2a1f16f
commit ee4d9c5e29
1 changed files with 2 additions and 5 deletions

View File

@ -401,15 +401,12 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer(
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;