Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
wine
wine-winehq
Commits
286999a9
Commit
286999a9
authored
Aug 16, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hidclass.sys: Enforce POLL_FREQUENCY_MSEC value range.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f68923dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
device.c
dlls/hidclass.sys/device.c
+2
-7
ntoskrnl.c
dlls/ntoskrnl.exe/tests/ntoskrnl.c
+24
-3
No files found.
dlls/hidclass.sys/device.c
View file @
286999a9
...
...
@@ -535,13 +535,8 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp)
break
;
}
poll_interval
=
*
(
ULONG
*
)
irp
->
AssociatedIrp
.
SystemBuffer
;
if
(
poll_interval
<=
MAX_POLL_INTERVAL_MSEC
)
{
ext
->
u
.
pdo
.
poll_interval
=
poll_interval
;
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
}
else
irp
->
IoStatus
.
Status
=
STATUS_INVALID_PARAMETER
;
if
(
poll_interval
)
ext
->
u
.
pdo
.
poll_interval
=
min
(
poll_interval
,
MAX_POLL_INTERVAL_MSEC
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
break
;
}
case
IOCTL_HID_GET_PRODUCT_STRING
:
...
...
dlls/ntoskrnl.exe/tests/ntoskrnl.c
View file @
286999a9
...
...
@@ -2833,7 +2833,21 @@ static void test_hid_device(DWORD report_id, DWORD polled)
poll_freq
=
500
;
SetLastError
(
0xdeadbeef
);
ret
=
sync_ioctl
(
file
,
IOCTL_HID_SET_POLL_FREQUENCY_MSEC
,
&
poll_freq
,
sizeof
(
ULONG
),
NULL
,
&
out_len
);
ok
(
ret
,
"IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u
\n
"
,
GetLastError
());
ok
(
out_len
==
0
,
"got out_len %u, expected 0
\n
"
,
out_len
);
out_len
=
0
;
poll_freq
=
10001
;
SetLastError
(
0xdeadbeef
);
ret
=
sync_ioctl
(
file
,
IOCTL_HID_SET_POLL_FREQUENCY_MSEC
,
&
poll_freq
,
sizeof
(
ULONG
),
NULL
,
&
out_len
);
ok
(
ret
,
"IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u
\n
"
,
GetLastError
());
ok
(
out_len
==
0
,
"got out_len %u, expected 0
\n
"
,
out_len
);
out_len
=
0
;
poll_freq
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
sync_ioctl
(
file
,
IOCTL_HID_SET_POLL_FREQUENCY_MSEC
,
&
poll_freq
,
sizeof
(
ULONG
),
NULL
,
&
out_len
);
ok
(
ret
,
"IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u
\n
"
,
GetLastError
());
ok
(
out_len
==
0
,
"got out_len %u, expected 0
\n
"
,
out_len
);
out_len
=
sizeof
(
ULONG
);
...
...
@@ -2841,14 +2855,21 @@ static void test_hid_device(DWORD report_id, DWORD polled)
ret
=
sync_ioctl
(
file
,
IOCTL_HID_GET_POLL_FREQUENCY_MSEC
,
NULL
,
0
,
&
poll_freq
,
&
out_len
);
ok
(
ret
,
"IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u
\n
"
,
GetLastError
());
ok
(
out_len
==
sizeof
(
ULONG
),
"got out_len %u, expected sizeof(ULONG)
\n
"
,
out_len
);
ok
(
poll_freq
==
500
,
"got poll_freq %u, expected 100
\n
"
,
poll_freq
);
ok
(
poll_freq
==
10000
,
"got poll_freq %u, expected 10000
\n
"
,
poll_freq
);
out_len
=
0
;
poll_freq
=
500
;
SetLastError
(
0xdeadbeef
);
ret
=
sync_ioctl
(
file
,
IOCTL_HID_SET_POLL_FREQUENCY_MSEC
,
&
poll_freq
,
sizeof
(
ULONG
),
NULL
,
&
out_len
);
ok
(
ret
,
"IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u
\n
"
,
GetLastError
());
ok
(
out_len
==
0
,
"got out_len %u, expected 0
\n
"
,
out_len
);
out_len
=
sizeof
(
ULONG
);
SetLastError
(
0xdeadbeef
);
ret
=
sync_ioctl
(
async_file
,
IOCTL_HID_GET_POLL_FREQUENCY_MSEC
,
NULL
,
0
,
&
poll_freq
,
&
out_len
);
ok
(
ret
,
"IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u
\n
"
,
GetLastError
());
ok
(
out_len
==
sizeof
(
ULONG
),
"got out_len %u, expected sizeof(ULONG)
\n
"
,
out_len
);
ok
(
poll_freq
==
500
,
"got poll_freq %u, expected
1
00
\n
"
,
poll_freq
);
ok
(
poll_freq
==
500
,
"got poll_freq %u, expected
5
00
\n
"
,
poll_freq
);
}
test_hidp
(
file
,
async_file
,
report_id
,
polled
);
...
...
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