Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hidclass.sys/device.c | 9 ++------- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 6e82608aa2e..ed59a7794a3 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -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: diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 50e381c8983..f11dce1cc93 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -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 100\n", poll_freq); + ok(poll_freq == 500, "got poll_freq %u, expected 500\n", poll_freq); }
test_hidp(file, async_file, report_id, polled);