hidclass.sys: Calculate correct bitCount for vendor-specific 1 bit repeated elements.
commit5a32339dc858d898ac2fa1c948306a2ec271c68b
authorArkadiusz Hiler <ahiler@codeweavers.com>
Thu, 21 Jan 2021 16:11:13 +0000 (21 18:11 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 21 Jan 2021 19:46:13 +0000 (21 20:46 +0100)
tree26854d618e9ef0cd167706bbbd77878f000c214c
parent4c5dee872be0c6a5d5df089bcf15e49edfd00d43
hidclass.sys: Calculate correct bitCount for vendor-specific 1 bit repeated elements.

DualSense controller's report descriptor comes with a 1 bit vendor specific
(Usage Page & Usage) element repeated through 'report count'.

Those were correctly interpreted as non-ranged buttons (exposed as button caps
with appropriate usage values) but their size was incorrectly assumed to be 1
ignoring the 'report count'.

Because of that the InputReportByteLength is miscalculated as 63 instead of
64. If the buffer passed to HidD_GetInputReport() is allocated using that
value the call will fail with ERROR_INSUFFICIENT_BUFFER.

This change fixes the above and cleans up the code a bit so the size for each
case is calculated directly from the count and size instead of using the
values that were derived from them.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/hidclass.sys/descriptor.c