Commit Graph

65 Commits

Author SHA1 Message Date
Rémi Bernon 0dd6bc9db0 hidclass.sys: Fix printf format warnings with long types.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 18:23:18 +01:00
Alexandre Julliard d5a7d08f63 include: Add a define to enable fastcall wrappers, similar to the thiscall one.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 21:57:11 +02:00
Arkadiusz Hiler ac6f176441 hidclass.sys: Don't send WM_INPUT_DEVICE_CHANGE for WINEXINPUT devices.
For the same reason we don't send WM_INPUT messages.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 11:22:48 +02:00
Rémi Bernon 08b01d8271 hidclass.sys: Rename hid_report_queue into hid_queue.
As it now also queues IRPs.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon 561e722a46 hidclass.sys: Keep pending IRPs with the report queues.
Since d15358518b83384b137e81b71729c4f47fac0665 we only complete one
pending IRP per HID report, but there may be more than one IRP queued,
from different readers.

This causes trouble and report interleaving when more than one reader
accesses a device at a time. We need to complete only one for each
report queue instead.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon 9421dd2b3c hidclass.sys: Don't leak report queues on device removal.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:13 +02:00
Rémi Bernon ed63e1bcf0 hidclass.sys: Use a separate class for devices matching WINEXINPUT\*&XI_*.
Although these devices will be HID compatible we need to not have them
listed on the HID class, as they should only be used internally by Wine
XInput implementation.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 21:43:03 +02:00
Rémi Bernon de0fb2adfd hidclass.sys: Use hidparse.sys instead of internal parser.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-16 23:28:45 +02:00
Rémi Bernon 3a3e0ed2e9 hidclass.sys: Create separate report queue for each opened handle.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-10 17:53:55 +02:00
Rémi Bernon 2e3a0dac84 hidclass.sys: Rename WINE_HIDP_PREPARSED_DATA to struct hid_preparsed_data.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-10 17:53:55 +02:00
Rémi Bernon a5e2d821e2 hidclass.sys: Merge parse_descriptor and ParseDescriptor.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:42:05 +02:00
Rémi Bernon 00008c9d48 hidclass.sys: Pass IO_STATUS_BLOCK parameter to call_minidriver.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-04 21:48:28 +02:00
Rémi Bernon fb7a5e660e hidclass.sys: Stop accepting IRPs after device removal.
Handle IRP_MN_SURPRISE_REMOVAL and notify device thread to stop it, but
only wait for it in IRP_MN_REMOVE_DEVICE, as it's probably waiting for
an IRP sent to the lower driver, which needs to be notified of removal
too first.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Rémi Bernon 9a56ba0336 hidclass.sys: Disable the keyboard device interface on removal.
Instead of enabling it.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-30 20:01:20 +02:00
Rémi Bernon 975e33c7e7 hidclass.sys: Use nameless unions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-04 20:00:30 +02:00
Rémi Bernon 1c5e57fc75 hidclass.sys: Use msvcrt allocation functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-04 20:00:30 +02:00
Rémi Bernon c0fc89991b hidclass.sys: Use __wine_send_input to send device notifications.
When INPUT type is INPUT_HARDWARE and hi.uMsg is WM_INPUT_DEVICE_CHANGE,
the RAWINPUT structure usage is a non-standard extension for Wine
internal usage:

* header.wParam contains the message GIDC_ARRIVAL / GIDC_REMOVAL wparam,

* hid.bRawData contains two words, which are the HID device UsagePage
  and Usage words, instead of a real HID report.

This will let us use the same entry point and structures to send device
notifications as for the HID reports in the future (which will be sent
with INPUT_HARDWARE type / WM_INPUT uMsg instead).

This currently does nothing, because the INPUT_HARDWARE messages are
currently dropped, and because winedevice.exe desktop is different from
the default desktop.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 22:02:09 +02:00
Rémi Bernon af2b2d0433 hidclass.sys: Call IoInvalidateDeviceRelations before IoSetDevicePropertyData.
Otherwise setupapi may fail to find the device on which to set the
property. This triggers messages like the following the first time a
device is created (on prefix creation for mouse and keyboard devices):

  IoSetDevicePropertyData Failed to open device, error 0xe000020b.

Some IoSetDevicePropertyData implementation detail makes it always
return successfully but it's not doing anything and user32 will then
ignore the device when it enumerates rawinput devices.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-05 21:52:23 +02:00
Rémi Bernon 3532d666b9 hidclass.sys: Assign rawinput handles through device properties.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 23:19:54 +02:00
Rémi Bernon 8e4d668e34 hidclass.sys: Register GUID_DEVINTERFACE_KEYBOARD interface.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-23 20:02:06 +02:00
Zebediah Figura c5565a74c3 hidclass.sys: Defer creating a child device until IRP_MN_START_DEVICE.
This is necessary to allow the Hauppauge CIR receiver driver for cx2310x drivers
(hcw10cir.sys) to start.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-20 21:07:09 +02:00
Zebediah Figura 06ab067758 hidclass.sys: Set PhysicalDeviceObject to the bus PDO.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-19 22:06:56 +02:00
Zebediah Figura a173672911 hidclass.sys: Stop creating a setupapi device.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-19 22:06:56 +02:00
Zebediah Figura aff72f2253 hidclass.sys: Pass a KEVENT to IoBuildSynchronousFsdRequest() in get_device_id().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-19 22:06:56 +02:00
Zebediah Figura f34b735eba hidclass.sys: Create separate parent FDO and child PDO objects.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 22:39:45 +02:00
Zebediah Figura e30a14525e hidclass.sys: Merge main.c into pnp.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 12:16:49 +02:00
Zebediah Figura 8c87a2618e hidclass.sys: Zero-initialize the HID_DEVICE_ATTRIBUTES structure.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 20:51:13 +02:00
Zebediah Figura 5e63c849b4 ntoskrnl/tests: Test child device enumeration.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-12 19:32:15 +02:00
Rémi Bernon 75dd9b9236 hidclass.sys: Fix parsed report descriptor length index.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-24 20:46:22 +01:00
Zebediah Figura 5294ebc9a0 hidclass.sys: No longer track devices in a list.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-12 14:41:43 +01:00
Zebediah Figura 76daa6b70c hidclass.sys: Do not manually clean up devices on unload.
We can rely on ntoskrnl to do this for us.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-12 14:41:33 +01:00
Michael Stefaniuc f073d9a9d3 hidclass.sys: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-16 11:25:18 +01:00
Sven Baars 1413f577c5 hidclass.sys: Fix some memory leaks on error path (Coverity).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-10 23:20:41 +02:00
Zebediah Figura 6a6081fc93 hidclass.sys: Avoid freeing pool memory with HeapFree().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-22 09:50:16 +02:00
Zebediah Figura b84334d2bd hidclass.sys: Create a mouse device interface for HID mouse devices.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-04 21:14:54 +02:00
Zebediah Figura 3d011fcdff hidclass.sys: Get rid of unused minidriver parameter to HID_DeleteDevice().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-06 17:41:27 +02:00
Zebediah Figura 6c6aeea8a8 ntoskrnl.exe: Correctly handle instance IDs.
The instance ID is only the third part of the "A\B\C" form, and must be
combined with the device ID to form the whole name for setupapi (the "device
instance ID").

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-05 16:46:20 +02:00
Zebediah Figura 1e05e96c47 hidclass.sys: Allocate IRP return buffers from paged pool.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-05 16:44:52 +02:00
Alexandre Julliard af0e0d9b62 hidclass.sys: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-05 08:36:39 +02:00
Jacek Caban 85082e8bd3 hidclass.sys: Make read IRP queue thread safe.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 08:14:31 -05:00
Aric Stewart 7229893493 hidclass.sys: Move IoSetDeviceInterfaceState to PNP_RemoveDevice.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-20 17:05:08 +01:00
Aric Stewart ec2234102a hidclass.sys: Use IoRegisterDeviceInterface.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-13 09:56:18 +01:00
Zebediah Figura 91ac8eb00a hidclass.sys: Update the interface state when a device is added or removed.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-19 17:46:39 +02:00
Aric Stewart f97bbef0e5 hidclass.sys: Unload all devices before unloading a minidriver.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-15 20:55:09 +02:00
Aric Stewart 0e6d749a0e hidclass: Properly NULL terminate device_deviceid_fmtW.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-21 23:07:05 +01:00
Aric Stewart 3af89f1d96 hidclass.sys: Do not use device after free.
Spotted by Marcus Meissner (Coverity issue 1372459).

Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-19 11:06:40 +01:00
Aric Stewart b53846b60b hidclass.sys: Watch return for STATUS_PENDING not IRP status.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-23 18:32:17 +02:00
Aric Stewart c5dde63b19 hidclass.sys: Use IoSetCompletionRoutine.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-19 08:10:34 -07:00
Aric Stewart 4163642b99 hidclass.sys: Minidriver handling for IRP_MN_REMOVE_DEVICE finished the IRP.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-04 16:01:32 +02:00
Nikolay Sivov 026353bf7b hidclass: Fix handle leak on error path (Coverity).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-24 12:04:43 +09:00