Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/hidclass.sys/device.c | 14 ++++++++++++++ include/ddk/hidclass.h | 5 +++++ 2 files changed, 19 insertions(+)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 9d917bbc674..db645495987 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -655,6 +655,20 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp) case IOCTL_HID_SET_OUTPUT_REPORT: status = hid_device_xfer_report( ext, code, irp ); break; + + case IOCTL_HID_GET_RAWINPUT_HANDLE: + if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) + { + status = STATUS_BUFFER_OVERFLOW; + } + else + { + *(ULONG *)irp->AssociatedIrp.SystemBuffer = ext->u.pdo.rawinput_handle; + irp->IoStatus.Information = sizeof(ULONG); + status = STATUS_SUCCESS; + } + break; + default: { ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode; diff --git a/include/ddk/hidclass.h b/include/ddk/hidclass.h index f5439ac8e95..253f309474d 100644 --- a/include/ddk/hidclass.h +++ b/include/ddk/hidclass.h @@ -58,6 +58,11 @@ DEFINE_GUID (GUID_DEVINTERFACE_HID, \ #define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101) #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
+/* Wine extension */ +#ifdef __WINESRC__ +#define IOCTL_HID_GET_RAWINPUT_HANDLE HID_BUFFER_CTL_CODE(300) +#endif + typedef struct _HID_COLLECTION_INFORMATION { ULONG DescriptorSize; BOOLEAN Polled;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/dinput/joystick_hid.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 1f4b300be74..0ddedc1a491 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -30,7 +30,9 @@ #include "winuser.h" #include "winerror.h" #include "winreg.h" +#include "winioctl.h"
+#include "ddk/hidclass.h" #include "ddk/hidsdi.h" #include "setupapi.h" #include "devguid.h" @@ -41,7 +43,6 @@ #include "device_private.h"
#include "initguid.h" -#include "devpkey.h"
#include "wine/debug.h" #include "wine/hid.h" @@ -51,7 +52,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); DEFINE_GUID( GUID_DEVINTERFACE_WINEXINPUT,0x6c53d5fd,0x6480,0x440f,0xb6,0x18,0x47,0x67,0x50,0xc5,0xe1,0xa6 ); DEFINE_GUID( hid_joystick_guid, 0x9e573edb, 0x7734, 0x11d2, 0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7 ); DEFINE_GUID( device_path_guid, 0x00000000, 0x0000, 0x0000, 0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf8 ); -DEFINE_DEVPROPKEY( DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2 );
struct pid_control_report { @@ -1413,19 +1413,20 @@ static DWORD device_type_for_version( DWORD type, DWORD version ) } }
-static HRESULT hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HANDLE *device, +static HRESULT hid_joystick_device_try_open( const WCHAR *path, HANDLE *device, PHIDP_PREPARSED_DATA *preparsed, HIDD_ATTRIBUTES *attrs, HIDP_CAPS *caps, DIDEVICEINSTANCEW *instance, DWORD version ) { BOOL has_accelerator, has_brake, has_clutch, has_z, has_pov; PHIDP_PREPARSED_DATA preparsed_data = NULL; HIDP_LINK_COLLECTION_NODE nodes[256]; - DWORD type, button_count = 0; + DWORD type, size, button_count = 0; HIDP_BUTTON_CAPS buttons[10]; HIDP_VALUE_CAPS value; HANDLE device_file; ULONG node_count; NTSTATUS status; + UINT32 handle; USHORT count;
device_file = CreateFileW( path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -1448,6 +1449,12 @@ static HRESULT hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, H 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;
+ if (!DeviceIoControl( device_file, IOCTL_HID_GET_RAWINPUT_HANDLE, NULL, 0, &handle, sizeof(handle), &size, NULL )) + { + ERR( "failed to get raw input handle, error %lu\n", GetLastError() ); + goto failed; + } + instance->guidInstance = hid_joystick_guid; instance->guidInstance.Data1 ^= handle; instance->guidProduct = dinput_pidvid_guid; @@ -1574,9 +1581,8 @@ static HRESULT hid_joystick_device_open( int index, const GUID *guid, DIDEVICEIN SP_DEVINFO_DATA devinfo = {.cbSize = sizeof(devinfo)}; WCHAR device_id[MAX_PATH], *tmp; HDEVINFO set, xi_set; - UINT32 i = 0, handle; BOOL override; - DWORD type; + UINT32 i = 0; GUID hid;
TRACE( "index %d, guid %s\n", index, debugstr_guid( guid ) ); @@ -1594,11 +1600,7 @@ static HRESULT hid_joystick_device_open( int index, const GUID *guid, DIDEVICEIN detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W); if (!SetupDiGetDeviceInterfaceDetailW( set, &iface, detail, sizeof(buffer), NULL, &devinfo )) continue; - if (!SetupDiGetDevicePropertyW( set, &devinfo, &DEVPROPKEY_HID_HANDLE, &type, - (BYTE *)&handle, sizeof(handle), NULL, 0 ) || - type != DEVPROP_TYPE_UINT32) - continue; - if (FAILED(hid_joystick_device_try_open( handle, detail->DevicePath, device, preparsed, + if (FAILED(hid_joystick_device_try_open( detail->DevicePath, device, preparsed, attrs, caps, instance, version ))) continue;
@@ -1618,7 +1620,7 @@ static HRESULT hid_joystick_device_open( int index, const GUID *guid, DIDEVICEIN
CloseHandle( *device ); HidD_FreePreparsedData( *preparsed ); - if (FAILED(hid_joystick_device_try_open( handle, detail->DevicePath, device, preparsed, + if (FAILED(hid_joystick_device_try_open( detail->DevicePath, device, preparsed, attrs, caps, instance, version ))) continue; } @@ -2040,7 +2042,7 @@ HRESULT hid_joystick_create_device( struct dinput *dinput, const GUID *guid, IDi else { wcscpy( impl->device_path, *(const WCHAR **)guid ); - hr = hid_joystick_device_try_open( 0, impl->device_path, &impl->device, &impl->preparsed, &attrs, + hr = hid_joystick_device_try_open( impl->device_path, &impl->device, &impl->preparsed, &attrs, &impl->caps, &impl->base.instance, dinput->dwVersion ); } if (hr != DI_OK) goto failed;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/user32/rawinput.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index 4dc240b58b3..807c4ad89dd 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -39,14 +39,11 @@
#include "initguid.h" #include "ddk/hidclass.h" -#include "devpkey.h" #include "ntddmou.h" #include "ntddkbd.h"
WINE_DEFAULT_DEBUG_CHANNEL(rawinput);
-DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2); - struct device { SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail; @@ -119,13 +116,6 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, return FALSE; }
- if (!SetupDiGetDevicePropertyW(set, &device_data, &DEVPROPKEY_HID_HANDLE, &type, (BYTE *)&handle, sizeof(handle), NULL, 0) || - type != DEVPROP_TYPE_UINT32) - { - ERR("Failed to get device handle, error %#lx.\n", GetLastError()); - return NULL; - } - if (!(detail = malloc(size))) { ERR("Failed to allocate memory.\n"); @@ -146,6 +136,14 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface, return NULL; }
+ status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io, IOCTL_HID_GET_RAWINPUT_HANDLE, + NULL, 0, &handle, sizeof(handle) ); + if (status) + { + ERR( "Failed to get raw input handle, status %#lx.\n", status ); + goto fail; + } + memset( &info, 0, sizeof(info) ); info.cbSize = sizeof(info); info.dwType = type;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116331
Your paranoid android.
=== debian11 (32 bit report) ===
user32: menu.c:2324: Test failed: test 25
=== debian11 (32 bit Chinese:China report) ===
user32: win.c:11770: Test succeeded inside todo block: child should be topmost win.c:11773: Test failed: grandchild should be topmost win.c:11781: Test failed: child should NOT be topmost win.c:11784: Test succeeded inside todo block: grandchild should NOT be topmost win.c:11787: Test failed: 007200BE: expected NOT topmost win.c:11606: Test succeeded inside todo block: 5: hwnd 01420056 is still topmost
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/hidclass.sys/pnp.c | 11 ----------- 1 file changed, 11 deletions(-)
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index cc4e3b96c82..873c55c4a67 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -24,7 +24,6 @@ #include "initguid.h" #include "hid.h" #include "devguid.h" -#include "devpkey.h" #include "ntddmou.h" #include "ntddkbd.h" #include "ddk/hidtypes.h" @@ -37,7 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(hid);
-DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2); DEFINE_GUID(GUID_DEVINTERFACE_WINEXINPUT, 0x6c53d5fd, 0x6480, 0x440f, 0xb6, 0x18, 0x47, 0x67, 0x50, 0xc5, 0xe1, 0xa6);
#ifdef __ASM_USE_FASTCALL_WRAPPER @@ -286,15 +284,6 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
IoInvalidateDeviceRelations(fdo_ext->u.fdo.hid_ext.PhysicalDeviceObject, BusRelations);
- if ((status = IoSetDevicePropertyData(child_pdo, &DEVPROPKEY_HID_HANDLE, LOCALE_NEUTRAL, - PLUGPLAY_PROPERTY_PERSISTENT, DEVPROP_TYPE_UINT32, - sizeof(pdo_ext->u.pdo.rawinput_handle), &pdo_ext->u.pdo.rawinput_handle))) - { - ERR( "Failed to set device handle property, status %#lx\n", status ); - IoDeleteDevice(child_pdo); - return; - } - pdo_ext->u.pdo.poll_interval = DEFAULT_POLL_INTERVAL;
HID_StartDeviceThread(child_pdo);