Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
88a8e824
Commit
88a8e824
authored
Sep 13, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hidclass.sys: Enforce output packet lengths to match report lengths.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
29b90620
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
18 deletions
+6
-18
driver_hid.c
dlls/dinput8/tests/driver_hid.c
+0
-3
driver_hid.h
dlls/dinput8/tests/driver_hid.h
+0
-1
hid.c
dlls/dinput8/tests/hid.c
+0
-3
device.c
dlls/hidclass.sys/device.c
+6
-11
No files found.
dlls/dinput8/tests/driver_hid.c
View file @
88a8e824
...
...
@@ -389,7 +389,6 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
winetest_push_context
(
"%s expect[%d]"
,
expect
.
context
,
index
);
ok
(
expect
.
code
==
code
,
"got %#x, expected %#x
\n
"
,
expect
.
code
,
code
);
ok
(
packet
->
reportId
==
expect
.
report_id
,
"got id %u
\n
"
,
packet
->
reportId
);
todo_wine_if
(
expect
.
todo_report_len
)
ok
(
packet
->
reportBufferLen
==
expect
.
report_len
,
"got len %u
\n
"
,
packet
->
reportBufferLen
);
ok
(
RtlCompareMemory
(
packet
->
reportBuffer
,
expect
.
report_buf
,
expect
.
report_len
)
==
expect
.
report_len
,
"unexpected data
\n
"
);
...
...
@@ -439,7 +438,6 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
winetest_push_context
(
"%s expect[%d]"
,
expect
.
context
,
index
);
ok
(
expect
.
code
==
code
,
"got %#x, expected %#x
\n
"
,
expect
.
code
,
code
);
ok
(
packet
->
reportId
==
expect
.
report_id
,
"got id %u
\n
"
,
packet
->
reportId
);
todo_wine_if
(
expect
.
todo_report_len
)
ok
(
packet
->
reportBufferLen
==
expect
.
report_len
,
"got len %u
\n
"
,
packet
->
reportBufferLen
);
ok
(
RtlCompareMemory
(
packet
->
reportBuffer
,
expect
.
report_buf
,
expect
.
report_len
)
==
expect
.
report_len
,
"unexpected data
\n
"
);
...
...
@@ -489,7 +487,6 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
winetest_push_context
(
"%s expect[%d]"
,
expect
.
context
,
index
);
ok
(
expect
.
code
==
code
,
"got %#x, expected %#x
\n
"
,
expect
.
code
,
code
);
ok
(
packet
->
reportId
==
expect
.
report_id
,
"got id %u
\n
"
,
packet
->
reportId
);
todo_wine_if
(
expect
.
todo_report_len
)
ok
(
packet
->
reportBufferLen
==
expect
.
report_len
,
"got len %u
\n
"
,
packet
->
reportBufferLen
);
ok
(
RtlCompareMemory
(
packet
->
reportBuffer
,
expect
.
report_buf
,
expect
.
report_len
)
==
expect
.
report_len
,
"unexpected data
\n
"
);
...
...
dlls/dinput8/tests/driver_hid.h
View file @
88a8e824
...
...
@@ -48,7 +48,6 @@ struct hid_expect
DWORD
ret_status
;
BYTE
broken
;
/* missing on some win versions */
BYTE
report_id
;
BYTE
todo_report_len
;
BYTE
report_len
;
BYTE
report_buf
[
128
];
char
context
[
64
];
...
...
dlls/dinput8/tests/hid.c
View file @
88a8e824
...
...
@@ -946,7 +946,6 @@ static void test_hidp_set_feature( HANDLE file, int report_id, ULONG report_len,
{
.
code
=
IOCTL_HID_SET_FEATURE
,
.
report_id
=
report_id
,
.
todo_report_len
=
TRUE
,
.
report_len
=
report_len
-
(
report_id
?
0
:
1
),
.
report_buf
=
{
...
...
@@ -1048,7 +1047,6 @@ static void test_hidp_set_output( HANDLE file, int report_id, ULONG report_len,
{
.
code
=
IOCTL_HID_SET_OUTPUT_REPORT
,
.
report_id
=
report_id
,
.
todo_report_len
=
TRUE
,
.
report_len
=
report_len
-
(
report_id
?
0
:
1
),
.
report_buf
=
{
report_id
,
0
,
0xcd
,
0xcd
,
0xcd
},
.
ret_length
=
3
,
...
...
@@ -1135,7 +1133,6 @@ static void test_write_file( HANDLE file, int report_id, ULONG report_len )
{
.
code
=
IOCTL_HID_WRITE_REPORT
,
.
report_id
=
report_id
,
.
todo_report_len
=
report_id
==
0
,
.
report_len
=
report_len
-
(
report_id
?
0
:
1
),
.
report_buf
=
{
report_id
?
report_id
:
0xcd
,
0xcd
,
0xcd
,
0xcd
,
0xcd
},
.
ret_length
=
3
,
...
...
dlls/hidclass.sys/device.c
View file @
88a8e824
...
...
@@ -365,7 +365,7 @@ static void hid_device_xfer_report( BASE_DEVICE_EXTENSION *ext, ULONG code, IRP
HIDP_REPORT_IDS
*
reports
=
ext
->
u
.
pdo
.
device_desc
.
ReportIDs
;
ULONG
report_count
=
ext
->
u
.
pdo
.
device_desc
.
ReportIDsLength
;
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
ULONG
i
,
report_len
=
0
,
buffer_len
=
0
;
ULONG
i
,
offset
=
0
,
report_len
=
0
,
buffer_len
=
0
;
HID_XFER_PACKET
packet
;
BYTE
*
buffer
=
NULL
;
...
...
@@ -402,6 +402,7 @@ static void hid_device_xfer_report( BASE_DEVICE_EXTENSION *ext, ULONG code, IRP
irp
->
IoStatus
.
Status
=
STATUS_INVALID_PARAMETER
;
return
;
}
if
(
!
reports
[
i
].
ReportID
)
offset
=
1
;
switch
(
code
)
{
...
...
@@ -423,26 +424,20 @@ static void hid_device_xfer_report( BASE_DEVICE_EXTENSION *ext, ULONG code, IRP
return
;
}
packet
.
reportId
=
buffer
[
0
];
packet
.
reportBuffer
=
buffer
;
packet
.
reportBufferLen
=
buffer_len
;
if
(
!
reports
[
i
].
ReportID
)
{
packet
.
reportId
=
0
;
packet
.
reportBuffer
++
;
packet
.
reportBufferLen
--
;
}
packet
.
reportId
=
reports
[
i
].
ReportID
;
packet
.
reportBuffer
=
buffer
+
offset
;
switch
(
code
)
{
case
IOCTL_HID_GET_FEATURE
:
case
IOCTL_HID_GET_INPUT_REPORT
:
packet
.
reportBufferLen
=
buffer_len
-
offset
;
call_minidriver
(
code
,
ext
->
u
.
pdo
.
parent_fdo
,
NULL
,
0
,
&
packet
,
sizeof
(
packet
),
&
irp
->
IoStatus
);
break
;
case
IOCTL_HID_SET_FEATURE
:
case
IOCTL_HID_SET_OUTPUT_REPORT
:
case
IOCTL_HID_WRITE_REPORT
:
packet
.
reportBufferLen
=
report_len
-
offset
;
call_minidriver
(
code
,
ext
->
u
.
pdo
.
parent_fdo
,
NULL
,
sizeof
(
packet
),
&
packet
,
0
,
&
irp
->
IoStatus
);
if
(
code
==
IOCTL_HID_WRITE_REPORT
&&
packet
.
reportId
)
irp
->
IoStatus
.
Information
--
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment