wineandroid: Create the top-level view on desktop window creation.
[wine.git] / dlls / winehid.sys / main.c
blob0f18514208a7f55336247b6764066375af9db3eb
1 /*
2 * WINE Hid minidriver
4 * Copyright 2016 Aric Stewart
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #define NONAMELESSUNION
25 #include "ntstatus.h"
26 #define WIN32_NO_STATUS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winternl.h"
30 #include "winioctl.h"
31 #include "ddk/wdm.h"
32 #include "ddk/hidport.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(hid);
37 static NTSTATUS WINAPI internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
39 NTSTATUS status = irp->IoStatus.u.Status;
40 IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
41 ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;
43 switch (code)
45 case IOCTL_GET_PHYSICAL_DESCRIPTOR:
46 case IOCTL_HID_ACTIVATE_DEVICE:
47 case IOCTL_HID_DEACTIVATE_DEVICE:
48 case IOCTL_HID_GET_INDEXED_STRING:
49 case IOCTL_HID_GET_DEVICE_ATTRIBUTES:
50 case IOCTL_HID_GET_DEVICE_DESCRIPTOR:
51 case IOCTL_HID_GET_REPORT_DESCRIPTOR:
52 case IOCTL_HID_GET_STRING:
53 case IOCTL_HID_GET_INPUT_REPORT:
54 case IOCTL_HID_READ_REPORT:
55 case IOCTL_HID_SET_OUTPUT_REPORT:
56 case IOCTL_HID_WRITE_REPORT:
57 case IOCTL_HID_GET_FEATURE:
58 case IOCTL_HID_SET_FEATURE:
59 /* All these are handled by the lower level driver */
60 IoSkipCurrentIrpStackLocation(irp);
61 return IoCallDriver(((HID_DEVICE_EXTENSION *)device->DeviceExtension)->NextDeviceObject, irp);
63 default:
64 FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n",
65 code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
66 IoCompleteRequest(irp, IO_NO_INCREMENT);
67 return status;
71 static NTSTATUS WINAPI add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *device)
73 TRACE("(%p, %p)\n", driver, device);
74 return STATUS_SUCCESS;
77 NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *path)
79 HID_MINIDRIVER_REGISTRATION registration;
81 TRACE("(%p, %s)\n", driver, debugstr_w(path->Buffer));
83 driver->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = internal_ioctl;
84 driver->DriverExtension->AddDevice = add_device;
86 memset(&registration, 0, sizeof(registration));
87 registration.DriverObject = driver;
88 registration.RegistryPath = path;
89 registration.DeviceExtensionSize = sizeof(HID_DEVICE_EXTENSION);
90 registration.DevicesArePolled = FALSE;
92 return HidRegisterMinidriver(&registration);