[PATCH 5/5] dinput/tests: check path format of DIPROP_GUIDANDPATH property

Alexey Prokhin alexey at prokhin.ru
Tue Jun 4 16:53:48 CDT 2019


Signed-off-by: Alexey Prokhin <alexey at prokhin.ru>
---
I have split the patch from the previous one mainly because I am not
sure about it. The whole patchset is basicaly a semi-stub to treak
some Ubisoft games (such as AC: Unity, Far Cry 5) into exclusively
using xinput. This is the only half-way useful test I am able to come
up with the fake implementation could pass.
---
 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 f35b07e90b..f009ef347b 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);
-- 
2.17.2 (Apple Git-113)




More information about the wine-devel mailing list