From 1235ad1932e717486e1af3e360d0f12043ebf860 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Wed, 5 Jun 2019 00:53:48 +0300 Subject: [PATCH] dinput/tests: Check path format of DIPROP_GUIDANDPATH property. Signed-off-by: Alexey Prokhin Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/dinput/tests/joystick.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index f35b07e90bf..f009ef347b4 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -404,6 +404,22 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_GUIDANDPATH, &dpg.diph); ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_GUIDANDPATH failed: %08x\n", hr); + { + static const WCHAR formatW[] = {'\\','\\','?','\\','%','*','[','^','#',']','#','v','i','d','_', + '%','0','4','x','&','p','i','d','_','%','0','4','x',0}; + static const WCHAR miW[] = {'m','i','_',0}; + static const WCHAR igW[] = {'i','g','_',0}; + int vid, pid; + + _wcslwr(dpg.wszPath); + count = swscanf(dpg.wszPath, formatW, &vid, &pid); + ok(count == 2, "DIPROP_GUIDANDPATH path has wrong format. Expected count: 2 Got: %i Path: %s\n", + count, wine_dbgstr_w(dpg.wszPath)); + ok(wcsstr(dpg.wszPath, miW) != 0 || wcsstr(dpg.wszPath, igW) != 0, + "DIPROP_GUIDANDPATH path should contain either 'ig_' or 'mi_' substring. Path: %s\n", + wine_dbgstr_w(dpg.wszPath)); + } + hr = IDirectInputDevice_SetDataFormat(pJoystick, NULL); ok(hr==E_POINTER,"IDirectInputDevice_SetDataFormat() should have returned " "E_POINTER, returned: %08x\n", hr);