Commit Graph

131 Commits

Author SHA1 Message Date
Eric Pouech bb1fc33570 include/msvcrt: Add attribute((format)) to printf and scanf -like APIs.
Fix a bunch of warnings generated by this patch and the migration of
GUID.Data1 to long in ae2693e2c4

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-31 18:38:55 +01:00
Rémi Bernon 3bb0e2e5e5 winebus.sys: Fix warnings with long integer types.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-31 18:38:54 +01:00
Rémi Bernon 6d3b3aab25 winebus.sys: Initialize last_report length and buffer.
Fixes a regression from e9c3c494fd where
although we use the last report length, it was only initialized after
the first corresponding report was received. Calling HidD_GetInputReport
before that could cause a buffer overlow and report invalid data.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52068
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Rémi Bernon e9c3c494fd winebus.sys: Use last report length in IOCTL_HID_GET_INPUT_REPORT.
Instead of packet length, which may be larger than the last report
buffer.

Based on a patch from Ivo Ivanov <logos128@gmail.com>.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:31:38 +01:00
Rémi Bernon 5b735572c1 winebus.sys: Use +hid debug channel.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 11:16:55 +01:00
Rémi Bernon 13453bb9a0 winebus.sys: Consistently trace HID reports.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:49 +02:00
Rémi Bernon 3ad0c002da winebus.sys: Drop the hid_report channel.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:49 +02:00
Simon McVittie ab3416c61f winebus.sys: Add code path to bypass udevd and use inotify.
In a container with a non-trivial user namespace, we cannot rely on
libudev communicating with udevd as a way to monitor device nodes,
for the following reasons:

* If uid 0 from the host is not mapped to uid 0 in the container, libudev
  cannot authenticate netlink messages from the host, because their sender
  uid appears to be the overflowuid. Resolving this by mapping uid 0 into
  the container is not allowed when creating user namespaces as an
  unprivileged user, and even when running as a privileged user, it might
  be desirable for the real uid 0 to not be mapped as a way to harden the
  security boundary between container and host.

* Depending on the container configuration, initial enumeration might
  not be able to read /run/udev from the host system. If it can't, sysfs
  attributes will still work because those are read directly from the
  kernel via sysfs, but udev properties coming from user-space rules
  (in particular ID_INPUT_JOYSTICK and friends) will appear to be missing.

* The protocols between udevd and libudev (netlink messages for monitoring,
  and /run/udev for initial enumeration) are considered to be private to
  a particular version of udev, and are not a stable API; but in a
  container, we cannot expect that our copy of libudev is at exactly the
  same version as udevd on the host system.

Sidestep this by adding a code path that continues to use libudev for
the parts that work regardless of whether udevd is running or can be
communicated with.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02: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
Rémi Bernon c9003fab66 winebus.sys: Queue HID reports instead of overwritting the last one.
If the hidclass.sys read requests aren't done fast enough.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 068511f8cb winebus.sys: Keep a separate report buffer for each input report id.
And use them for IOCTL_HID_GET_INPUT_REPORT ioctls.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 9132979000 winebus.sys: Query and parse device report descriptor on device start.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon bd780ba618 winebus.sys: Only keep a single read pending.
The design of hidclass.sys prevents any concurrent irps, there's no
need to queue more.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51824
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 2c0da82050 winebus.sys: Don't enter critical section in bus_find_unix_device.
Callers are already holding it.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Huw Davies 43cd5d8a2d winebus.sys: Convert the product strings to Unicode on the Unix-side.
This avoids keeping two copies of each string.

It also fixes a regression on macOS from commit 9d4b70473c
that incorrectly treated a CFStringRef as a char ptr.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:51:04 +02:00
Rémi Bernon 65403bb067 winebus.sys: Move fastcall wrapper together with the functions.
The .text directive sometimes makes the global variables go in the
wrong section.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47751
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:49 +02:00
Rémi Bernon 7608538b40 winebus.sys: Remove unnecessary internal bus ids.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:49 +02:00
Rémi Bernon 9e3f9408b0 winebus.sys: Use WINEBUS\ as a common hardware ids prefix.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:49 +02:00
Rémi Bernon f37ae29b49 winebus.sys: Use WINEBUS\ as device id prefix for all buses.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Rémi Bernon 334d89a253 winebus.sys: Use wide character strings literals.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-17 10:45:48 +02:00
Rémi Bernon 5bbf1d1095 winebus.sys: Use new unixlib subsystem.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-17 10:45:46 +02:00
Rémi Bernon e54ff70e5d winebus.sys: Build with msvcrt.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-17 10:45:38 +02:00
Rémi Bernon 39ca4de665 winebus.sys: Use Rtl CS functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 10:50:39 +02:00
Rémi Bernon 35a6148acf winebus.sys: Use Rtl heap functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 10:50:37 +02:00
Rémi Bernon 0017b5eb63 winebus.sys: Load SDL bus mappings before calling bus_init.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 10:50:36 +02:00
Rémi Bernon 7032b41747 winebus.sys: Move is_xbox_gamepad to unixlib.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 10:50:34 +02:00
Rémi Bernon 421a6f53ad winebus.sys: Pass a unix_device pointer in every bus event.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 10:50:30 +02:00
Rémi Bernon cdaf1d9a7f winebus.sys: Remove the DEVICE_OBJECT arg on device_start.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 22:03:41 +02:00
Rémi Bernon 5f8ebe7a60 winebus.sys: Remove the now useless get_unix_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 22:03:32 +02:00
Rémi Bernon bc0ad0e13b winebus.sys: Return an event from IOHID bus wait on input report.
Instead of calling process_hid_report.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 22:03:11 +02:00
Rémi Bernon 8b434bdc7f winebus.sys: Return an event from SDL bus wait on input report.
Instead of calling process_hid_report.

This adds a reference count on unix devices to make sure they are kept
alive until all their input report events have been processed.

This also uses a bus-specific device list, to be able to find devices
from joystick ids without having to call back to the win32 side.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 22:03:03 +02:00
Rémi Bernon 5380167ca0 winebus.sys: Move process_hid_report helper around.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 22:02:51 +02:00
Rémi Bernon 56a4aaf419 winebus.sys: Remove the now useless get_string callback.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:39 +02:00
Rémi Bernon ff0d402efa winebus.sys: Query serialnumber string on device creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:36 +02:00
Rémi Bernon 093c13e333 winebus.sys: Query product string on device creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:34 +02:00
Rémi Bernon 9d4b70473c winebus.sys: Query manufacturer string on device creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:32 +02:00
Rémi Bernon e4f0b4ab8a winebus.sys: Remove the now useless native product strings.
This should now be handled by winexinput.sys.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:30 +02:00
Rémi Bernon 83f0de4487 winebus.sys: Return an event from IOHID bus wait on device creation.
Instead of calling bus_create_hid_device.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-08 20:40:56 +02:00
Rémi Bernon 507a3076de winebus.sys: Return an event from SDL bus wait on device creation.
Instead of calling bus_create_hid_device.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-08 20:40:48 +02:00
Rémi Bernon 60740e8745 winebus.sys: Remove the now useless bus_enumerate_hid_devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 21:43:04 +02:00
Rémi Bernon 4366cba6e6 winebus.sys: Move device vtable to the struct unix_device side.
And name the callbacks a bit more consistently.

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 08f943b595 winebus.sys: Create devices using a struct device_desc descriptor.
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 5e0c1ce443 winebus.sys: Move mouse and keyboard devices to unixlib.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon 2457113970 winebus.sys: Return an event from IOHID bus wait on device removal.
Instead of calling bus_unlink_hid_device or IoInvalidateDeviceRelations.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon 6006758ca8 winebus.sys: Return an event from SDL bus wait on device removal.
Instead of calling bus_unlink_hid_device or IoInvalidateDeviceRelations.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon f6d567d3e3 winebus.sys: Pass a struct bus_event pointer to bus_wait.
Allocated on the caller side.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon d22ece4c58 winebus.sys: Stop enforcing input and IG suffix on gamepads.
The &IG_00 suffix is now automatically added by winexinput.sys.

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-09-02 21:57:38 +02:00
Rémi Bernon 7b4b48a774 winebus.sys: Report WINEBUS\WINE_COMP_XINPUT compatible id for gamepads.
In addition, and before WINEBUS\WINE_COMP_HID, so that winexinput.sys
will match first as soon as it is introduced.

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-09-02 10:30:24 +02:00
Rémi Bernon 06ab0d5405 winebus.sys: Report WINEBUS\WINE_COMP_HID compatible id.
And match it in winehid.sys instead of individual bus ids.

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-09-02 10:30:20 +02:00
Michael Stefaniuc 079c47a38e winebus.sys: Print the debug string and not the pointer to it.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 10:40:09 +02:00