Alexey Prokhin : dinput/tests: Check path format of DIPROP_GUIDANDPATH property.

Alexandre Julliard julliard at winehq.org
Mon Jun 10 13:43:55 CDT 2019


Module: wine
Branch: master
Commit: 1235ad1932e717486e1af3e360d0f12043ebf860
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1235ad1932e717486e1af3e360d0f12043ebf860

Author: Alexey Prokhin <alexey at prokhin.ru>
Date:   Wed Jun  5 00:53:48 2019 +0300

dinput/tests: Check path format of DIPROP_GUIDANDPATH property.

Signed-off-by: Alexey Prokhin <alexey at prokhin.ru>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 f35b07e..f009ef3 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);




More information about the wine-cvs mailing list