diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index dff1f3426d3..85392c6b30b 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -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; diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 610a75871f1..20a10bde6ae 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -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; }