Commit 97a6870c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput8/tests: Read HID_DEVICE_ATTRIBUTES from the registry.

parent b648e67f
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
static UNICODE_STRING control_symlink; static UNICODE_STRING control_symlink;
static unsigned int got_start_device; static unsigned int got_start_device;
static HID_DEVICE_ATTRIBUTES attributes;
static char report_descriptor_buf[4096]; static char report_descriptor_buf[4096];
static DWORD report_descriptor_len; static DWORD report_descriptor_len;
static DWORD report_id; static DWORD report_id;
...@@ -228,25 +229,16 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) ...@@ -228,25 +229,16 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
break; break;
case IOCTL_HID_GET_DEVICE_ATTRIBUTES: case IOCTL_HID_GET_DEVICE_ATTRIBUTES:
{
HID_DEVICE_ATTRIBUTES *attr = irp->UserBuffer;
ok( !in_size, "got input size %u\n", in_size ); 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 ); memcpy( irp->UserBuffer, &attributes, sizeof(attributes) );
irp->IoStatus.Information = sizeof(attributes);
attr->Size = sizeof(*attr);
attr->VendorID = 0x1209;
attr->ProductID = 0x0001;
attr->VersionNumber = 0xface;
irp->IoStatus.Information = sizeof(*attr);
} }
ret = STATUS_SUCCESS; ret = STATUS_SUCCESS;
break; break;
}
case IOCTL_HID_READ_REPORT: case IOCTL_HID_READ_REPORT:
{ {
...@@ -472,6 +464,12 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry ) ...@@ -472,6 +464,12 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
memcpy( report_descriptor_buf, buffer + info_size, size - info_size ); memcpy( report_descriptor_buf, buffer + info_size, size - info_size );
report_descriptor_len = 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->DriverExtension->AddDevice = driver_add_device;
driver->DriverUnload = driver_unload; driver->DriverUnload = driver_unload;
driver->MajorFunction[IRP_MJ_PNP] = driver_pnp; driver->MajorFunction[IRP_MJ_PNP] = driver_pnp;
......
...@@ -2301,6 +2301,14 @@ static void test_hid_driver( DWORD report_id, DWORD polled ) ...@@ -2301,6 +2301,14 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
#undef REPORT_ID_OR_USAGE_PAGE #undef REPORT_ID_OR_USAGE_PAGE
#include "pop_hid_macros.h" #include "pop_hid_macros.h"
static const HID_DEVICE_ATTRIBUTES attributes =
{
.Size = sizeof(HID_DEVICE_ATTRIBUTES),
.VendorID = 0x1209,
.ProductID = 0x0001,
.VersionNumber = 0x0100,
};
WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH];
LSTATUS status; LSTATUS status;
HKEY hkey; HKEY hkey;
...@@ -2322,6 +2330,9 @@ static void test_hid_driver( DWORD report_id, DWORD polled ) ...@@ -2322,6 +2330,9 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
status = RegSetValueExW( hkey, L"Descriptor", 0, REG_BINARY, (void *)report_desc, sizeof(report_desc) ); status = RegSetValueExW( hkey, L"Descriptor", 0, REG_BINARY, (void *)report_desc, sizeof(report_desc) );
ok( !status, "RegSetValueExW returned %#x\n", status ); 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 );
if (pnp_driver_start( L"driver_hid.dll" )) test_hid_device( report_id, polled ); if (pnp_driver_start( L"driver_hid.dll" )) test_hid_device( report_id, polled );
pnp_driver_stop(); pnp_driver_stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment