dinput: Check for DIEFFECT_DX6 size when DIEP_STARTDELAY is set.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-11-08 09:35:01 +01:00 committed by Alexandre Julliard
parent e04cfc0b0a
commit 869a0ddaca
2 changed files with 9 additions and 3 deletions

View File

@ -1357,7 +1357,7 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c
IUnknown *outer )
{
struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface );
DWORD flags = DIEP_ALLPARAMS;
DWORD flags;
HRESULT hr;
TRACE( "iface %p, guid %s, params %p, out %p, outer %p\n", iface, debugstr_guid( guid ),
@ -1372,8 +1372,9 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c
hr = IDirectInputEffect_Initialize( *out, DINPUT_instance, impl->dinput->dwVersion, guid );
if (FAILED(hr)) goto failed;
if (!params) return DI_OK;
flags = params->dwSize == sizeof(DIEFFECT_DX6) ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5;
if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) flags |= DIEP_NODOWNLOAD;
hr = IDirectInputEffect_SetParameters( *out, params, flags );
if (FAILED(hr)) goto failed;

View File

@ -2149,7 +2149,11 @@ static HRESULT WINAPI hid_joystick_effect_GetParameters( IDirectInputEffect *ifa
if (flags & DIEP_DURATION) params->dwDuration = impl->params.dwDuration;
if (flags & DIEP_GAIN) params->dwGain = impl->params.dwGain;
if (flags & DIEP_SAMPLEPERIOD) params->dwSamplePeriod = impl->params.dwSamplePeriod;
if (flags & DIEP_STARTDELAY) params->dwStartDelay = impl->params.dwStartDelay;
if (flags & DIEP_STARTDELAY)
{
if (params->dwSize != sizeof(DIEFFECT_DX6)) return DIERR_INVALIDPARAM;
params->dwStartDelay = impl->params.dwStartDelay;
}
if (flags & DIEP_TRIGGERREPEATINTERVAL) params->dwTriggerRepeatInterval = impl->params.dwTriggerRepeatInterval;
if (flags & DIEP_TRIGGERBUTTON)
@ -2336,6 +2340,7 @@ static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *ifa
}
if (flags & DIEP_STARTDELAY)
{
if (params->dwSize != sizeof(DIEFFECT_DX6)) return DIERR_INVALIDPARAM;
if (impl->params.dwStartDelay != params->dwStartDelay) impl->modified = TRUE;
impl->params.dwStartDelay = params->dwStartDelay;
}