winebus.sys: Implement IOCTL_HID_GET_DEVICE_ATTRIBUTES for hid devices.

Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aric Stewart 2016-10-06 07:19:27 -05:00 committed by Alexandre Julliard
parent 7abde01cc1
commit ea95a47bb5
3 changed files with 48 additions and 0 deletions

View File

@ -34,3 +34,4 @@ DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW,
const GUID *class, const platform_vtbl *vtbl, DWORD platform_data_size) DECLSPEC_HIDDEN;
DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev) DECLSPEC_HIDDEN;
void bus_remove_hid_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;

View File

@ -299,6 +299,7 @@ NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry
udev_driver_obj = driver;
driver->MajorFunction[IRP_MJ_PNP] = common_pnp_dispatch;
driver->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = hid_internal_dispatch;
if (!(events[0] = CreateEventW(NULL, TRUE, FALSE, NULL)))
goto error;

View File

@ -30,7 +30,9 @@
#include "winternl.h"
#include "winreg.h"
#include "setupapi.h"
#include "winioctl.h"
#include "ddk/wdm.h"
#include "ddk/hidport.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/list.h"
@ -346,6 +348,50 @@ NTSTATUS WINAPI common_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
return status;
}
NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
{
NTSTATUS status = irp->IoStatus.u.Status;
IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
struct device_extension *extension = (struct device_extension *)device->DeviceExtension;
TRACE("(%p, %p)\n", device, irp);
switch (irpsp->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_HID_GET_DEVICE_ATTRIBUTES:
{
HID_DEVICE_ATTRIBUTES *attr = (HID_DEVICE_ATTRIBUTES *)irp->UserBuffer;
TRACE("IOCTL_HID_GET_DEVICE_ATTRIBUTES\n");
if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(*attr))
{
irp->IoStatus.u.Status = status = STATUS_BUFFER_TOO_SMALL;
break;
}
memset(attr, 0, sizeof(*attr));
attr->Size = sizeof(HID_DEVICE_ATTRIBUTES);
attr->VendorID = extension->vid;
attr->ProductID = extension->pid;
attr->VersionNumber = extension->version;
irp->IoStatus.u.Status = status = STATUS_SUCCESS;
irp->IoStatus.Information = sizeof(HID_DEVICE_ATTRIBUTES);
break;
}
default:
{
ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;
FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n",
code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
break;
}
}
IoCompleteRequest(irp, IO_NO_INCREMENT);
return status;
}
NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
{
static const WCHAR udevW[] = {'\\','D','r','i','v','e','r','\\','U','D','E','V',0};