• Arkadiusz Hiler's avatar
    hidclass.sys: Calculate correct bitCount for vendor-specific 1 bit repeated elements. · 5a32339d
    Arkadiusz Hiler authored
    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: 's avatarArkadiusz Hiler <ahiler@codeweavers.com>
    Signed-off-by: 's avatarAric Stewart <aric@codeweavers.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    5a32339d
descriptor.c 37.5 KB