Ivo Ivanov : dinput: Pass buffer byte length to HidD_GetProductString.

Alexandre Julliard julliard at winehq.org
Fri Nov 12 16:16:04 CST 2021


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

Author: Ivo Ivanov <logos128 at gmail.com>
Date:   Fri Nov 12 09:49:46 2021 +0100

dinput: Pass buffer byte length to HidD_GetProductString.

Instead of then number of WCHAR.

Signed-off-by: Ivo Ivanov <logos128 at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/joystick_hid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index efb90b4e2e9..a5fbfb81332 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -1239,8 +1239,8 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND
     if (caps->UsagePage != HID_USAGE_PAGE_GENERIC) goto failed;
     if (caps->Usage != HID_USAGE_GENERIC_GAMEPAD && caps->Usage != HID_USAGE_GENERIC_JOYSTICK) goto failed;
 
-    if (!HidD_GetProductString( device_file, instance->tszInstanceName, MAX_PATH )) goto failed;
-    if (!HidD_GetProductString( device_file, instance->tszProductName, MAX_PATH )) goto failed;
+    if (!HidD_GetProductString( device_file, instance->tszInstanceName, MAX_PATH * sizeof(WCHAR) )) goto failed;
+    if (!HidD_GetProductString( device_file, instance->tszProductName, MAX_PATH * sizeof(WCHAR) )) goto failed;
 
     instance->guidInstance = hid_joystick_guid;
     instance->guidInstance.Data1 ^= handle;




More information about the wine-cvs mailing list