dinput: Implement DIPROP_PRODUCTNAME in GetProperty.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2016-08-18 16:40:22 -03:00 committed by Alexandre Julliard
parent aab54da669
commit 44303b6625
2 changed files with 13 additions and 1 deletions

View File

@ -583,6 +583,7 @@ HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF
} }
break; break;
} }
case (DWORD_PTR) DIPROP_PRODUCTNAME:
case (DWORD_PTR) DIPROP_INSTANCENAME: { case (DWORD_PTR) DIPROP_INSTANCENAME: {
DIPROPSTRING *ps = (DIPROPSTRING*) pdiph; DIPROPSTRING *ps = (DIPROPSTRING*) pdiph;
DIDEVICEINSTANCEW didev; DIDEVICEINSTANCEW didev;
@ -590,6 +591,9 @@ HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF
didev.dwSize = sizeof(didev); didev.dwSize = sizeof(didev);
IDirectInputDevice_GetDeviceInfo(iface, &didev); IDirectInputDevice_GetDeviceInfo(iface, &didev);
if (LOWORD(rguid) == (DWORD_PTR) DIPROP_PRODUCTNAME)
lstrcpynW(ps->wsz, didev.tszProductName, MAX_PATH);
else
lstrcpynW(ps->wsz, didev.tszInstanceName, MAX_PATH); lstrcpynW(ps->wsz, didev.tszInstanceName, MAX_PATH);
return DI_OK; return DI_OK;

View File

@ -253,6 +253,14 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
ok(!lstrcmpW(nameBuffer, dps.wsz), "DIPROP_INSTANCENAME returned is wrong. Expected: %s Got: %s\n", ok(!lstrcmpW(nameBuffer, dps.wsz), "DIPROP_INSTANCENAME returned is wrong. Expected: %s Got: %s\n",
wine_dbgstr_w(nameBuffer), wine_dbgstr_w(dps.wsz)); wine_dbgstr_w(nameBuffer), wine_dbgstr_w(dps.wsz));
hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_PRODUCTNAME, &dps.diph);
ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_PRODUCTNAME failed: %08x\n", hr);
/* Test if product name is the same as present in DIDEVICEINSTANCE */
MultiByteToWideChar(CP_ACP, 0, lpddi->tszProductName, -1, nameBuffer, MAX_PATH);
ok(!lstrcmpW(nameBuffer, dps.wsz), "DIPROP_PRODUCTNAME returned is wrong. Expected: %s Got: %s\n",
wine_dbgstr_w(nameBuffer), wine_dbgstr_w(dps.wsz));
/* Test for GUIDPATH properties */ /* Test for GUIDPATH properties */
memset(&dpg, 0, sizeof(dpg)); memset(&dpg, 0, sizeof(dpg));
dpg.diph.dwSize = sizeof(DIPROPGUIDANDPATH); dpg.diph.dwSize = sizeof(DIPROPGUIDANDPATH);