From f00b59f597b047577d7542d0743701890a8f3b78 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 25 Mar 2020 16:31:29 -0700 Subject: [PATCH] dinput/tests: Test IDirectInputEffect::SetParameters() with NULL effect parameters. Signed-off-by: Brendan Shanks Signed-off-by: Alexandre Julliard --- dlls/dinput/tests/joystick.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index f009ef347b4..fb777e71ae3 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -598,11 +598,34 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) { DWORD effect_status; struct DIPROPDWORD diprop_word; + void *tmp; GUID guid = {0}; hr = IDirectInputEffect_Initialize(effect, hInstance, data->version, &effect_data.guid); ok(hr==DI_OK,"IDirectInputEffect_Initialize failed: %08x\n", hr); + + /* Test SetParameters with NULL pointers */ + todo_wine { + tmp = effect_data.eff.rgdwAxes; + effect_data.eff.rgdwAxes = NULL; + hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_AXES); + ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %08x\n", hr); + effect_data.eff.rgdwAxes = tmp; + + tmp = effect_data.eff.rglDirection; + effect_data.eff.rglDirection = NULL; + hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_DIRECTION); + ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %08x\n", hr); + effect_data.eff.rglDirection = tmp; + + tmp = effect_data.eff.lpvTypeSpecificParams; + effect_data.eff.lpvTypeSpecificParams = NULL; + hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_TYPESPECIFICPARAMS); + ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %08x\n", hr); + effect_data.eff.lpvTypeSpecificParams = tmp; + } + hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_AXES | DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS); ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr);