Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/ntoskrnl.exe/tests/driver_hid.c | 24 +++++++++++------------- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 13 +++++++++++++ 2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver_hid.c b/dlls/ntoskrnl.exe/tests/driver_hid.c index 590483f528f..7819c5556bb 100644 --- a/dlls/ntoskrnl.exe/tests/driver_hid.c +++ b/dlls/ntoskrnl.exe/tests/driver_hid.c @@ -40,6 +40,7 @@ static UNICODE_STRING control_symlink;
static unsigned int got_start_device; +static HID_DEVICE_ATTRIBUTES attributes; static char report_descriptor_buf[4096]; static DWORD report_descriptor_len; static DWORD report_id; @@ -230,25 +231,16 @@ static NTSTATUS WINAPI driver_internal_ioctl(DEVICE_OBJECT *device, IRP *irp) break;
case IOCTL_HID_GET_DEVICE_ATTRIBUTES: - { - HID_DEVICE_ATTRIBUTES *attr = irp->UserBuffer; - ok(!in_size, "got input size %u\n", in_size); - ok(out_size == sizeof(*attr), "got output size %u\n", out_size); + ok(out_size == sizeof(attributes), "got output size %u\n", out_size);
- if (out_size == sizeof(*attr)) + if (out_size == sizeof(attributes)) { - ok(!attr->Size, "got size %u\n", attr->Size); - - attr->Size = sizeof(*attr); - attr->VendorID = 0x1209; - attr->ProductID = 0x0001; - attr->VersionNumber = 0xface; - irp->IoStatus.Information = sizeof(*attr); + memcpy(irp->UserBuffer, &attributes, sizeof(attributes)); + irp->IoStatus.Information = sizeof(attributes); } ret = STATUS_SUCCESS; break; - }
case IOCTL_HID_READ_REPORT: { @@ -475,6 +467,12 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *registry) memcpy(report_descriptor_buf, buffer + info_size, size - info_size); report_descriptor_len = size - info_size;
+ RtlInitUnicodeString(&name_str, L"Attributes"); + size = info_size + sizeof(attributes); + ret = ZwQueryValueKey(hkey, &name_str, KeyValuePartialInformation, buffer, size, &size); + ok(!ret, "ZwQueryValueKey returned %#x\n", ret); + memcpy(&attributes, buffer + info_size, size - info_size); + driver->DriverExtension->AddDevice = driver_add_device; driver->DriverUnload = driver_unload; driver->MajorFunction[IRP_MJ_PNP] = driver_pnp; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index adb5b05aa90..293422777c5 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -39,9 +39,11 @@ #include "dbt.h" #include "initguid.h" #include "devguid.h" +#include "ddk/wdm.h" #include "ddk/hidclass.h" #include "ddk/hidsdi.h" #include "ddk/hidpi.h" +#include "ddk/hidport.h" #include "wine/test.h" #include "wine/heap.h" #include "wine/mssign.h" @@ -3594,6 +3596,14 @@ static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD #undef REPORT_ID_OR_USAGE_PAGE #include "pop_hid_macros.h"
+ static HID_DEVICE_ATTRIBUTES attributes = + { + .Size = sizeof(HID_DEVICE_ATTRIBUTES), + .VendorID = 0x1209, + .ProductID = 0x0001, + .VersionNumber = 0x0100, + }; + char cwd[MAX_PATH], tempdir[MAX_PATH]; LSTATUS status; HKEY hkey; @@ -3614,6 +3624,9 @@ static void test_hid_driver(struct testsign_context *ctx, DWORD report_id, DWORD status = RegSetValueExW(hkey, L"Descriptor", 0, REG_BINARY, (void *)report_descriptor, sizeof(report_descriptor)); ok(!status, "RegSetValueExW returned %#x\n", status);
+ status = RegSetValueExW(hkey, L"Attributes", 0, REG_BINARY, (void *)&attributes, sizeof(attributes)); + ok(!status, "RegSetValueExW returned %#x\n", status); + driver_start(ctx, L"driver_hid.dll"); test_hid_device(report_id, polled); driver_stop();