Module: wine Branch: master Commit: 7a2d59fb24ae6c6458339f1e8be1a7d160fc5d3c URL: https://gitlab.winehq.org/wine/wine/-/commit/7a2d59fb24ae6c6458339f1e8be1a7d...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Feb 15 13:43:26 2023 +0100
dinput: Forbid acquiring for other process windows.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
---
dlls/dinput/device.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index c7b29da9271..c001d1ef29a 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -546,6 +546,7 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) { struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_OK; + DWORD pid;
TRACE( "iface %p.\n", iface );
@@ -556,6 +557,8 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) hr = DIERR_INVALIDPARAM; else if ((impl->dwCoopLevel & DISCL_FOREGROUND) && impl->win != GetForegroundWindow()) hr = DIERR_OTHERAPPHASPRIO; + else if ((impl->dwCoopLevel & DISCL_FOREGROUND) && (!GetWindowThreadProcessId( impl->win, &pid ) || pid != GetCurrentProcessId())) + hr = DIERR_INVALIDPARAM; else { impl->status = STATUS_ACQUIRED;