mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Added patch to implement dinput device property DIPROP_USERNAME.
This commit is contained in:
parent
e60b8d144b
commit
c28bcab311
@ -34,7 +34,7 @@ Wine. All those differences are also documented on the
|
||||
Included bug fixes and improvements
|
||||
-----------------------------------
|
||||
|
||||
**Bug fixes and features included in the next upcoming release [9]:**
|
||||
**Bug fixes and features included in the next upcoming release [10]:**
|
||||
|
||||
* Add information for delayed end of DST in Europe/Istanbul
|
||||
* Allow to set debug registers separately in NtSetContextThread ([Wine Bug #39454](https://bugs.winehq.org/show_bug.cgi?id=39454))
|
||||
@ -42,6 +42,7 @@ Included bug fixes and improvements
|
||||
* Check handle type for HSPFILEQ handles ([Wine Bug #12332](https://bugs.winehq.org/show_bug.cgi?id=12332))
|
||||
* Fix font loading in Capella ([Wine Bug #12377](https://bugs.winehq.org/show_bug.cgi?id=12377))
|
||||
* Ignore socket type for protocol IPPROTO_IPV6 in getaddrinfo
|
||||
* Implement dinput device property DIPROP_USERNAME ([Wine Bug #39667](https://bugs.winehq.org/show_bug.cgi?id=39667))
|
||||
* Silence repeated FIXME message in surface_cpu_blt
|
||||
* Skip invalid entries in GetPrivateProfileString16 ([Wine Bug #9919](https://bugs.winehq.org/show_bug.cgi?id=9919))
|
||||
* Start SERVICE_FILE_SYSTEM_DRIVER services with winedevice ([Wine Bug #35824](https://bugs.winehq.org/show_bug.cgi?id=35824))
|
||||
|
@ -0,0 +1,177 @@
|
||||
From 4eb926239cec9c6dfa489056bb30d698039926a1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu@vr-web.de>
|
||||
Date: Tue, 24 Nov 2015 21:13:50 +0100
|
||||
Subject: dinput: Implement device property DIPROP_USERNAME.
|
||||
|
||||
https://bugs.winehq.org/show_bug.cgi?id=39667
|
||||
|
||||
Probably same issue as in https://bugs.winehq.org/show_bug.cgi?id=12432 .
|
||||
(Attached backtrace seems equal.)
|
||||
|
||||
Steps to reproduce:
|
||||
- start launcher
|
||||
- "Configure Controller"
|
||||
- leave dialog with "Cancel"
|
||||
- crash
|
||||
|
||||
MotoGP 3 demo launcher uses ConfigureDevices for the key mapping.
|
||||
This seems because the result of a GetProperty(DIPROP_USERNAME) is used
|
||||
without checking.
|
||||
---
|
||||
dlls/dinput/device.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
dlls/dinput/device_private.h | 1 +
|
||||
dlls/dinput8/tests/device.c | 29 +++++++++++++++++++++++++++--
|
||||
3 files changed, 67 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
|
||||
index e525f01..41fb2c4 100644
|
||||
--- a/dlls/dinput/device.c
|
||||
+++ b/dlls/dinput/device.c
|
||||
@@ -778,11 +778,13 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||
|
||||
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
|
||||
{
|
||||
+ static const WCHAR emptyW[] = { 0 };
|
||||
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
||||
DIDATAFORMAT data_format;
|
||||
DIOBJECTDATAFORMAT *obj_df = NULL;
|
||||
DIPROPDWORD dp;
|
||||
DIPROPRANGE dpr;
|
||||
+ DIPROPSTRING dps;
|
||||
WCHAR username[MAX_PATH];
|
||||
DWORD username_size = MAX_PATH;
|
||||
int i, action = 0, num_actions = 0;
|
||||
@@ -863,6 +865,13 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||
else
|
||||
lstrcpynW(username, lpszUserName, MAX_PATH);
|
||||
|
||||
+ dps.diph.dwSize = sizeof(dps);
|
||||
+ dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
+ dps.diph.dwObj = 0;
|
||||
+ dps.diph.dwHow = DIPH_DEVICE;
|
||||
+ lstrcpynW(dps.wsz, (dwFlags & DIDSAM_NOUSER) ? emptyW : username, sizeof(dps.wsz)/sizeof(WCHAR));
|
||||
+ IDirectInputDevice8_SetProperty(iface, DIPROP_USERNAME, &dps.diph);
|
||||
+
|
||||
/* Save the settings to disk */
|
||||
save_mapping_settings(iface, lpdiaf, username);
|
||||
|
||||
@@ -1100,6 +1109,9 @@ ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
|
||||
/* Free action mapping */
|
||||
HeapFree(GetProcessHeap(), 0, This->action_map);
|
||||
|
||||
+ /* Free username */
|
||||
+ HeapFree(GetProcessHeap(), 0, This->username);
|
||||
+
|
||||
EnterCriticalSection( &This->dinput->crit );
|
||||
list_remove( &This->entry );
|
||||
LeaveCriticalSection( &This->dinput->crit );
|
||||
@@ -1251,6 +1263,17 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
|
||||
TRACE("buffersize = %d\n", pd->dwData);
|
||||
break;
|
||||
}
|
||||
+ case (DWORD_PTR) DIPROP_USERNAME:
|
||||
+ {
|
||||
+ LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph;
|
||||
+
|
||||
+ if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
|
||||
+
|
||||
+ ps->wsz[0] = 0;
|
||||
+ if (This->username)
|
||||
+ lstrcpynW(ps->wsz, This->username, sizeof(ps->wsz)/sizeof(WCHAR));
|
||||
+ break;
|
||||
+ }
|
||||
case (DWORD_PTR) DIPROP_VIDPID:
|
||||
FIXME("DIPROP_VIDPID not implemented\n");
|
||||
return DIERR_UNSUPPORTED;
|
||||
@@ -1324,6 +1347,22 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(
|
||||
LeaveCriticalSection(&This->crit);
|
||||
break;
|
||||
}
|
||||
+ case (DWORD_PTR) DIPROP_USERNAME:
|
||||
+ {
|
||||
+ LPCDIPROPSTRING ps = (LPCDIPROPSTRING)pdiph;
|
||||
+
|
||||
+ if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
|
||||
+
|
||||
+ if (!This->username)
|
||||
+ This->username = HeapAlloc(GetProcessHeap(), 0, sizeof(ps->wsz));
|
||||
+ if (!This->username)
|
||||
+ return DIERR_OUTOFMEMORY;
|
||||
+
|
||||
+ This->username[0] = 0;
|
||||
+ if (ps->wsz)
|
||||
+ lstrcpynW(This->username, ps->wsz, sizeof(ps->wsz)/sizeof(WCHAR));
|
||||
+ break;
|
||||
+ }
|
||||
default:
|
||||
WARN("Unknown property %s\n", debugstr_guid(rguid));
|
||||
return DIERR_UNSUPPORTED;
|
||||
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
|
||||
index 52bbec4..44fa46a 100644
|
||||
--- a/dlls/dinput/device_private.h
|
||||
+++ b/dlls/dinput/device_private.h
|
||||
@@ -81,6 +81,7 @@ struct IDirectInputDeviceImpl
|
||||
/* Action mapping */
|
||||
int num_actions; /* number of actions mapped */
|
||||
ActionMap *action_map; /* array of mappings */
|
||||
+ WCHAR *username; /* set by 'SetActionMap' */
|
||||
};
|
||||
|
||||
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index 6495559..b5e27ad 100644
|
||||
--- a/dlls/dinput8/tests/device.c
|
||||
+++ b/dlls/dinput8/tests/device.c
|
||||
@@ -223,8 +223,8 @@ static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirec
|
||||
dps.wsz[0] = '\0';
|
||||
|
||||
hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_USERNAME, &dps.diph);
|
||||
- todo_wine ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
|
||||
- todo_wine ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_wn(usernameW, -1), wine_dbgstr_wn(dps.wsz, -1));
|
||||
+ ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
|
||||
+ ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_wn(usernameW, -1), wine_dbgstr_wn(dps.wsz, -1));
|
||||
|
||||
/* Test buffer size */
|
||||
memset(&dp, 0, sizeof(dp));
|
||||
@@ -275,6 +275,7 @@ static void test_action_mapping(void)
|
||||
HINSTANCE hinst = GetModuleHandleA(NULL);
|
||||
IDirectInput8A *pDI = NULL;
|
||||
DIACTIONFORMATA af;
|
||||
+ DIPROPSTRING dps;
|
||||
struct enum_data data = {pDI, &af, NULL, NULL, NULL, 0};
|
||||
HWND hwnd;
|
||||
|
||||
@@ -342,6 +343,30 @@ static void test_action_mapping(void)
|
||||
|
||||
af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]);
|
||||
af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
|
||||
+
|
||||
+ /* test DIDSAM_NOUSER */
|
||||
+ dps.diph.dwSize = sizeof(dps);
|
||||
+ dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
+ dps.diph.dwObj = 0;
|
||||
+ dps.diph.dwHow = DIPH_DEVICE;
|
||||
+ dps.wsz[0] = '\0';
|
||||
+
|
||||
+ hr = IDirectInputDevice_GetProperty(data.keyboard, DIPROP_USERNAME, &dps.diph);
|
||||
+ ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
|
||||
+ ok (dps.wsz[0] != 0, "Expected any username, got=%s\n", wine_dbgstr_wn(dps.wsz, -1));
|
||||
+
|
||||
+ hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, DIDSAM_NOUSER);
|
||||
+ ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
|
||||
+
|
||||
+ dps.diph.dwSize = sizeof(dps);
|
||||
+ dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
+ dps.diph.dwObj = 0;
|
||||
+ dps.diph.dwHow = DIPH_DEVICE;
|
||||
+ dps.wsz[0] = '\0';
|
||||
+
|
||||
+ hr = IDirectInputDevice_GetProperty(data.keyboard, DIPROP_USERNAME, &dps.diph);
|
||||
+ ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
|
||||
+ ok (dps.wsz[0] == 0, "Expected empty username, got=%s\n", wine_dbgstr_wn(dps.wsz, -1));
|
||||
}
|
||||
|
||||
if (data.mouse != NULL)
|
||||
--
|
||||
2.6.2
|
||||
|
1
patches/dinput-DIPROP_USERNAME/definition
Normal file
1
patches/dinput-DIPROP_USERNAME/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [39667] Implement dinput device property DIPROP_USERNAME
|
@ -127,6 +127,7 @@ patch_enable_all ()
|
||||
enable_ddraw_Write_Vtable="$1"
|
||||
enable_ddraw_ZBufferBitDepths="$1"
|
||||
enable_ddraw_d3d_execute_buffer="$1"
|
||||
enable_dinput_DIPROP_USERNAME="$1"
|
||||
enable_dinput_Initialize="$1"
|
||||
enable_dsound_EAX="$1"
|
||||
enable_dsound_Fast_Mixer="$1"
|
||||
@ -494,6 +495,9 @@ patch_enable ()
|
||||
ddraw-d3d_execute_buffer)
|
||||
enable_ddraw_d3d_execute_buffer="$2"
|
||||
;;
|
||||
dinput-DIPROP_USERNAME)
|
||||
enable_dinput_DIPROP_USERNAME="$2"
|
||||
;;
|
||||
dinput-Initialize)
|
||||
enable_dinput_Initialize="$2"
|
||||
;;
|
||||
@ -2894,6 +2898,21 @@ if test "$enable_ddraw_d3d_execute_buffer" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset dinput-DIPROP_USERNAME
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#39667] Implement dinput device property DIPROP_USERNAME
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/dinput/device.c, dlls/dinput/device_private.h, dlls/dinput8/tests/device.c
|
||||
# |
|
||||
if test "$enable_dinput_DIPROP_USERNAME" -eq 1; then
|
||||
patch_apply dinput-DIPROP_USERNAME/0001-dinput-Implement-device-property-DIPROP_USERNAME.patch
|
||||
(
|
||||
echo '+ { "Bernhard Übelacker", "dinput: Implement device property DIPROP_USERNAME.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset dinput-Initialize
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -20,6 +20,7 @@ wine-staging (1.8~rc2) UNRELEASED; urgency=low
|
||||
* Added patch to allow to set debug registers separately in
|
||||
NtSetContextThread.
|
||||
* Added patch to ignore socket type for protocol IPPROTO_IPV6 in getaddrinfo.
|
||||
* Added patch to implement dinput device property DIPROP_USERNAME.
|
||||
-- Sebastian Lackner <sebastian@fds-team.de> Wed, 25 Nov 2015 20:21:46 +0100
|
||||
|
||||
wine-staging (1.8~rc1) unstable; urgency=low
|
||||
|
Loading…
x
Reference in New Issue
Block a user