Reducing the failure message and mute driver todos after first failure.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 38 ++++++++++------------------ dlls/ntoskrnl.exe/tests/ntoskrnl.c | 2 +- dlls/ntoskrnl.exe/tests/utils.h | 2 +- 3 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index 1d5f7563e3f..1a2971a8956 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -388,7 +388,6 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) #undef REPORT_ID_OR_USAGE_PAGE #include "pop_hid_macros.h"
- static BOOL test_failed; IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); HID_DEVICE_EXTENSION *ext = device->DeviceExtension; struct hid_device *impl = ext->MiniDeviceExtension; @@ -479,12 +478,8 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) { ULONG expected_size = 23; ok(!in_size, "got input size %u\n", in_size); - if (!test_failed) - { - todo_wine_if(!report_id) - ok(out_size == expected_size, "got output size %u\n", out_size); - } - if (out_size != expected_size) test_failed = TRUE; + todo_wine_if(!report_id) + ok(out_size == expected_size, "got output size %u\n", out_size);
if (polled) { @@ -537,12 +532,10 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) ok(out_size == sizeof(*packet), "got output size %u\n", out_size);
todo_wine_if(packet->reportId == 0x5a || (polled && report_id && packet->reportId == 0)) - ok(packet->reportId == report_id, "report %d, polled %d got packet report id %u\n", - report_id, polled, packet->reportId); + ok(packet->reportId == report_id, "got id %u\n", packet->reportId); todo_wine_if(packet->reportBufferLen == 21 || packet->reportBufferLen == 22) - ok(packet->reportBufferLen >= expected_size, "got packet buffer len %u, expected %d or more\n", - packet->reportBufferLen, expected_size); - ok(!!packet->reportBuffer, "got packet buffer %p\n", packet->reportBuffer); + ok(packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen); + ok(!!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer);
memset(packet->reportBuffer, 0xa5, 3); if (report_id) ((char *)packet->reportBuffer)[0] = report_id; @@ -559,11 +552,10 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) todo_wine ok(!out_size, "got output size %u\n", out_size);
todo_wine_if(packet->reportId != report_id) - ok(packet->reportId == report_id, "got packet report id %u\n", packet->reportId); + ok(packet->reportId == report_id, "got id %u\n", packet->reportId); todo_wine_if(packet->reportBufferLen == 0 || packet->reportBufferLen == 1) - ok(packet->reportBufferLen >= expected_size, "got packet buffer len %u, expected %d or more\n", - packet->reportBufferLen, expected_size); - ok(!!packet->reportBuffer, "got packet buffer %p\n", packet->reportBuffer); + ok(packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen); + ok(!!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer);
irp->IoStatus.Information = 3; ret = STATUS_SUCCESS; @@ -578,11 +570,10 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) ok(out_size == sizeof(*packet), "got output size %u\n", out_size);
todo_wine_if(packet->reportId == 0x5a || packet->reportId == 0xa5) - ok(packet->reportId == report_id, "got packet report id %u\n", packet->reportId); + ok(packet->reportId == report_id, "got id %u\n", packet->reportId); todo_wine_if(packet->reportBufferLen == 16) - ok(packet->reportBufferLen >= expected_size, "got packet buffer len %u, expected %d or more\n", - packet->reportBufferLen, expected_size); - ok(!!packet->reportBuffer, "got packet buffer %p\n", packet->reportBuffer); + ok(packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen); + ok(!!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer);
memset(packet->reportBuffer, 0xa5, 3); if (report_id) ((char *)packet->reportBuffer)[0] = report_id; @@ -599,11 +590,10 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) todo_wine ok(!out_size, "got output size %u\n", out_size);
todo_wine_if(packet->reportId != report_id) - ok(packet->reportId == report_id, "got packet report id %u\n", packet->reportId); + ok(packet->reportId == report_id, "got id %u\n", packet->reportId); todo_wine_if(packet->reportBufferLen == 0 || packet->reportBufferLen == 16) - ok(packet->reportBufferLen >= expected_size, "got packet buffer len %u, expected %d or more\n", - packet->reportBufferLen, expected_size); - ok(!!packet->reportBuffer, "got packet buffer %p\n", packet->reportBuffer); + ok(packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen); + ok(!!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer);
irp->IoStatus.Information = 3; ret = STATUS_SUCCESS; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 1eab88311ab..148de3b1a6c 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2714,7 +2714,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) HDEVINFO set; HANDLE file;
- winetest_push_context("report %d, polled %d", report_id, polled); + winetest_push_context("id %d%s", report_id, polled ? " poll" : "");
set = SetupDiGetClassDevsA(&GUID_DEVINTERFACE_HID, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError()); diff --git a/dlls/ntoskrnl.exe/tests/utils.h b/dlls/ntoskrnl.exe/tests/utils.h index f73f6f938ca..aa84890f6af 100644 --- a/dlls/ntoskrnl.exe/tests/utils.h +++ b/dlls/ntoskrnl.exe/tests/utils.h @@ -51,7 +51,7 @@ static int winetest_debug; static int winetest_report_success;
/* silence todos and skips above this threshold */ -static int winetest_mute_threshold = 42; +static int winetest_mute_threshold = 1;
/* counts how many times a given line printed a message */ static LONG line_counters[16384];
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index 1a2971a8956..cfbffd3843c 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -604,7 +604,9 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) ok(!in_size, "got input size %u\n", in_size); ok(out_size == 128, "got output size %u\n", out_size);
- ret = STATUS_NOT_IMPLEMENTED; + memcpy(irp->UserBuffer, L"Wine Test", sizeof(L"Wine Test")); + irp->IoStatus.Information = sizeof(L"Wine Test"); + ret = STATUS_SUCCESS; break;
default:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 148de3b1a6c..2ec7c913465 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2696,7 +2696,6 @@ static void test_hidp(HANDLE file, int report_id, BOOL polled)
HidD_FreePreparsedData(preparsed_data); - CloseHandle(file); }
static void test_hid_device(DWORD report_id, DWORD polled)
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 55 +++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 2ec7c913465..a37697f4a69 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2704,6 +2704,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) SP_DEVICE_INTERFACE_DETAIL_DATA_A *iface_detail = (void *)buffer; SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; SP_DEVINFO_DATA device = {sizeof(device)}; + HANDLE file, async_file; BOOL ret, found = FALSE; OBJECT_ATTRIBUTES attr; UNICODE_STRING string; @@ -2711,7 +2712,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) NTSTATUS status; unsigned int i; HDEVINFO set; - HANDLE file; + ULONG count;
winetest_push_context("id %d%s", report_id, polled ? " poll" : "");
@@ -2745,8 +2746,60 @@ static void test_hid_device(DWORD report_id, DWORD polled) FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+ count = 0xdeadbeef; + SetLastError(0xdeadbeef); + ret = HidD_GetNumInputBuffers(file, &count); + ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); + todo_wine ok(count == 32, "HidD_GetNumInputBuffers returned %u\n", count); + + SetLastError(0xdeadbeef); + ret = HidD_SetNumInputBuffers(file, 1); + ok(!ret, "HidD_SetNumInputBuffers succeeded\n"); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "HidD_SetNumInputBuffers returned error %u\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = HidD_SetNumInputBuffers(file, 513); + ok(!ret, "HidD_SetNumInputBuffers succeeded\n"); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "HidD_SetNumInputBuffers returned error %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = HidD_SetNumInputBuffers(file, 16); + ok(ret, "HidD_SetNumInputBuffers failed last error %u\n", GetLastError()); + + count = 0xdeadbeef; + SetLastError(0xdeadbeef); + ret = HidD_GetNumInputBuffers(file, &count); + ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); + todo_wine ok(count == 16, "HidD_GetNumInputBuffers returned %u\n", count); + + async_file = CreateFileA(iface_detail->DevicePath, FILE_READ_ACCESS | FILE_WRITE_ACCESS, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); + ok(async_file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError()); + + count = 0xdeadbeef; + SetLastError(0xdeadbeef); + ret = HidD_GetNumInputBuffers(async_file, &count); + ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); + todo_wine ok(count == 32, "HidD_GetNumInputBuffers returned %u\n", count); + + SetLastError(0xdeadbeef); + ret = HidD_SetNumInputBuffers(async_file, 2); + ok(ret, "HidD_SetNumInputBuffers failed last error %u\n", GetLastError()); + + count = 0xdeadbeef; + SetLastError(0xdeadbeef); + ret = HidD_GetNumInputBuffers(async_file, &count); + ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); + todo_wine ok(count == 2, "HidD_GetNumInputBuffers returned %u\n", count); + count = 0xdeadbeef; + SetLastError(0xdeadbeef); + ret = HidD_GetNumInputBuffers(file, &count); + ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); + todo_wine ok(count == 16, "HidD_GetNumInputBuffers returned %u\n", count); + test_hidp(file, report_id, polled);
+ CloseHandle(async_file); CloseHandle(file);
RtlInitUnicodeString(&string, L"\??\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}");
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hidclass.sys/device.c | 2 ++ dlls/ntoskrnl.exe/tests/ntoskrnl.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index da1814587c7..73a8428ad22 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -560,11 +560,13 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp) { if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) { + irp->IoStatus.Information = 0; irp->IoStatus.Status = rc = STATUS_BUFFER_TOO_SMALL; } else { *(ULONG *)irp->AssociatedIrp.SystemBuffer = RingBuffer_GetSize(ext->u.pdo.ring_buffer); + irp->IoStatus.Information = sizeof(ULONG); rc = irp->IoStatus.Status = STATUS_SUCCESS; } break; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index a37697f4a69..8eaf8ee4888 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2750,7 +2750,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) SetLastError(0xdeadbeef); ret = HidD_GetNumInputBuffers(file, &count); ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); - todo_wine ok(count == 32, "HidD_GetNumInputBuffers returned %u\n", count); + ok(count == 32, "HidD_GetNumInputBuffers returned %u\n", count);
SetLastError(0xdeadbeef); ret = HidD_SetNumInputBuffers(file, 1); @@ -2769,7 +2769,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) SetLastError(0xdeadbeef); ret = HidD_GetNumInputBuffers(file, &count); ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); - todo_wine ok(count == 16, "HidD_GetNumInputBuffers returned %u\n", count); + ok(count == 16, "HidD_GetNumInputBuffers returned %u\n", count);
async_file = CreateFileA(iface_detail->DevicePath, FILE_READ_ACCESS | FILE_WRITE_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, @@ -2790,7 +2790,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) SetLastError(0xdeadbeef); ret = HidD_GetNumInputBuffers(async_file, &count); ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); - todo_wine ok(count == 2, "HidD_GetNumInputBuffers returned %u\n", count); + ok(count == 2, "HidD_GetNumInputBuffers returned %u\n", count); count = 0xdeadbeef; SetLastError(0xdeadbeef); ret = HidD_GetNumInputBuffers(file, &count);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 33 +++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 8eaf8ee4888..92c6c4ed3eb 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -2704,6 +2704,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) SP_DEVICE_INTERFACE_DETAIL_DATA_A *iface_detail = (void *)buffer; SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; SP_DEVINFO_DATA device = {sizeof(device)}; + ULONG count, poll_freq, out_len; HANDLE file, async_file; BOOL ret, found = FALSE; OBJECT_ATTRIBUTES attr; @@ -2712,7 +2713,6 @@ static void test_hid_device(DWORD report_id, DWORD polled) NTSTATUS status; unsigned int i; HDEVINFO set; - ULONG count;
winetest_push_context("id %d%s", report_id, polled ? " poll" : "");
@@ -2797,6 +2797,37 @@ static void test_hid_device(DWORD report_id, DWORD polled) ok(ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError()); todo_wine ok(count == 16, "HidD_GetNumInputBuffers returned %u\n", count);
+ if (polled) + { + out_len = sizeof(ULONG); + SetLastError(0xdeadbeef); + 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); + todo_wine ok(poll_freq == 5, "got poll_freq %u, expected 5\n", poll_freq); + + out_len = 0; + poll_freq = 50; + 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(out_len == 0, "got out_len %u, expected 0\n", out_len); + + out_len = sizeof(ULONG); + SetLastError(0xdeadbeef); + 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 == 50, "got poll_freq %u, expected 100\n", poll_freq); + + 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 == 50, "got poll_freq %u, expected 100\n", poll_freq); + } + test_hidp(file, report_id, polled);
CloseHandle(async_file);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=94830
Your paranoid android.
=== w7u_el (32 bit report) ===
ntoskrnl.exe: ntoskrnl: Timeout
On 8/2/21 6:14 AM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=94830
Your paranoid android.
=== w7u_el (32 bit report) ===
ntoskrnl.exe: ntoskrnl: Timeout
I think this may not be spurious, because I'm consistently getting timeouts on my Windows 7 box too, whereas it works fine with the previous commit.
It doesn't hang in any of the POLL_FREQUENCY ioctls, but instead it hangs inside the ReadFile() call at the end of test_hidp(). Do you have any intuition as to why this would occur?
For reference, this was committed as 80fa6850d62714000580238009b1b92f0f760a23.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 3 ++ dlls/ntoskrnl.exe/tests/ntoskrnl.c | 45 ++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index cfbffd3843c..f1289b8a1bb 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -394,6 +394,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) const ULONG in_size = stack->Parameters.DeviceIoControl.InputBufferLength; const ULONG out_size = stack->Parameters.DeviceIoControl.OutputBufferLength; const ULONG code = stack->Parameters.DeviceIoControl.IoControlCode; + static BYTE seq = 0; NTSTATUS ret; BOOL removed; KIRQL irql; @@ -485,6 +486,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) { memset(irp->UserBuffer, 0xa5, expected_size); if (report_id) ((char *)irp->UserBuffer)[0] = report_id; + ((char *)irp->UserBuffer)[1] = seq++; irp->IoStatus.Information = 3; ret = STATUS_SUCCESS; } @@ -539,6 +541,7 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
memset(packet->reportBuffer, 0xa5, 3); if (report_id) ((char *)packet->reportBuffer)[0] = report_id; + ((char *)packet->reportBuffer)[1] = seq++; irp->IoStatus.Information = 3; ret = STATUS_SUCCESS; break; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 92c6c4ed3eb..401401bbffe 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -1676,7 +1676,7 @@ static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void return ret; }
-static void test_hidp(HANDLE file, int report_id, BOOL polled) +static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled) { const HIDP_CAPS expect_hidp_caps[] = { @@ -1868,6 +1868,7 @@ static void test_hidp(HANDLE file, int report_id, BOOL polled) { .DataIndex = 39, .RawValue = 1, }, };
+ OVERLAPPED overlapped = {0}, overlapped2 = {0}; HIDP_LINK_COLLECTION_NODE collections[16]; PHIDP_PREPARSED_DATA preparsed_data; USAGE_AND_PAGE usage_and_pages[16]; @@ -2692,6 +2693,46 @@ static void test_hidp(HANDLE file, int report_id, BOOL polled) todo_wine ok(ret, "ReadFile failed, last error %u\n", GetLastError()); todo_wine ok(value == (report_id ? 3 : 4), "ReadFile returned %x\n", value); todo_wine ok(report[0] == report_id, "unexpected report data\n"); + + overlapped.hEvent = CreateEventA(NULL, FALSE, FALSE, NULL); + overlapped2.hEvent = CreateEventA(NULL, FALSE, FALSE, NULL); + + /* drain available input reports */ + SetLastError(0xdeadbeef); + while (ReadFile(async_file, report, caps.InputReportByteLength, NULL, &overlapped)) + ResetEvent(overlapped.hEvent); + todo_wine ok(GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError()); + ret = GetOverlappedResult(async_file, &overlapped, &value, TRUE); + todo_wine ok(ret, "GetOverlappedResult failed, last error %u\n", GetLastError()); + todo_wine ok(value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected 3\n", value); + ResetEvent(overlapped.hEvent); + + memcpy(buffer, report, caps.InputReportByteLength); + memcpy(buffer + caps.InputReportByteLength, report, caps.InputReportByteLength); + + SetLastError(0xdeadbeef); + ret = ReadFile(async_file, report, caps.InputReportByteLength, NULL, &overlapped); + ok(!ret, "ReadFile succeded\n"); + ok(GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = ReadFile(async_file, buffer, caps.InputReportByteLength, NULL, &overlapped2); + ok(!ret, "ReadFile succeded\n"); + ok(GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError()); + + /* wait for first report to be ready */ + ret = GetOverlappedResult(async_file, &overlapped, &value, TRUE); + todo_wine ok(ret, "GetOverlappedResult failed, last error %u\n", GetLastError()); + todo_wine ok(value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected 3\n", value); + /* second report should be ready and the same */ + ret = GetOverlappedResult(async_file, &overlapped2, &value, FALSE); + todo_wine ok(ret, "GetOverlappedResult failed, last error %u\n", GetLastError()); + todo_wine ok(value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected 3\n", value); + todo_wine ok(memcmp(report, buffer + caps.InputReportByteLength, caps.InputReportByteLength), "expected different report\n"); + ok(!memcmp(report, buffer, caps.InputReportByteLength), "expected identical reports\n"); + + CloseHandle(overlapped.hEvent); + CloseHandle(overlapped2.hEvent); }
@@ -2828,7 +2869,7 @@ static void test_hid_device(DWORD report_id, DWORD polled) ok(poll_freq == 50, "got poll_freq %u, expected 100\n", poll_freq); }
- test_hidp(file, report_id, polled); + test_hidp(file, async_file, report_id, polled);
CloseHandle(async_file); CloseHandle(file);