Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/hidclass.sys/Makefile.in | 1 - dlls/hidclass.sys/device.c | 64 ----------------------------------- dlls/hidclass.sys/hid.h | 1 - dlls/hidclass.sys/pnp.c | 21 +++++++++++- 4 files changed, 20 insertions(+), 67 deletions(-)
diff --git a/dlls/hidclass.sys/Makefile.in b/dlls/hidclass.sys/Makefile.in index 58bb2b5088f..4b1e9338eb4 100644 --- a/dlls/hidclass.sys/Makefile.in +++ b/dlls/hidclass.sys/Makefile.in @@ -1,7 +1,6 @@ MODULE = hidclass.sys IMPORTLIB = hidclass IMPORTS = hal ntoskrnl -DELAYIMPORTS = setupapi
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index ec34b6b8068..35cc40c01ea 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -25,7 +25,6 @@ #include "hid.h" #include "winreg.h" #include "winuser.h" -#include "setupapi.h"
#include "wine/debug.h" #include "ddk/hidsdi.h" @@ -37,69 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(hid); WINE_DECLARE_DEBUG_CHANNEL(hid_report);
-/* user32 reserves 1 & 2 for winemouse and winekeyboard, - * keep this in sync with user_private.h */ -#define WINE_MOUSE_HANDLE 1 -#define WINE_KEYBOARD_HANDLE 2 - -static UINT32 alloc_rawinput_handle(void) -{ - static LONG counter = WINE_KEYBOARD_HANDLE + 1; - return InterlockedIncrement(&counter); -} - -NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device) -{ - WCHAR device_instance_id[MAX_DEVICE_ID_LEN]; - SP_DEVINFO_DATA Data; - HDEVINFO devinfo; - BASE_DEVICE_EXTENSION *ext; - USAGE usage, page; - - ext = device->DeviceExtension; - page = ext->u.pdo.preparsed_data->caps.UsagePage; - usage = ext->u.pdo.preparsed_data->caps.Usage; - - lstrcpyW(device_instance_id, ext->device_id); - lstrcatW(device_instance_id, L"\"); - lstrcatW(device_instance_id, ext->instance_id); - - devinfo = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_HIDCLASS, NULL); - if (devinfo == INVALID_HANDLE_VALUE) - { - FIXME( "failed to get ClassDevs %x\n", GetLastError()); - return STATUS_UNSUCCESSFUL; - } - Data.cbSize = sizeof(Data); - if (SetupDiCreateDeviceInfoW(devinfo, device_instance_id, &GUID_DEVCLASS_HIDCLASS, NULL, NULL, DICD_INHERIT_CLASSDRVS, &Data)) - { - if (!SetupDiRegisterDeviceInfo(devinfo, &Data, 0, NULL, NULL, NULL)) - { - FIXME( "failed to register device info %x\n", GetLastError()); - goto error; - } - } - else if (GetLastError() != ERROR_DEVINST_ALREADY_EXISTS) - { - FIXME( "failed to create device info %x\n", GetLastError()); - goto error; - } - SetupDiDestroyDeviceInfoList(devinfo); - - if (page == HID_USAGE_PAGE_GENERIC && usage == HID_USAGE_GENERIC_MOUSE) - ext->u.pdo.rawinput_handle = WINE_MOUSE_HANDLE; - else if (page == HID_USAGE_PAGE_GENERIC && usage == HID_USAGE_GENERIC_KEYBOARD) - ext->u.pdo.rawinput_handle = WINE_KEYBOARD_HANDLE; - else - ext->u.pdo.rawinput_handle = alloc_rawinput_handle(); - - return STATUS_SUCCESS; - -error: - SetupDiDestroyDeviceInfoList(devinfo); - return STATUS_UNSUCCESSFUL; -} - IRP *pop_irp_from_queue(BASE_DEVICE_EXTENSION *ext) { LIST_ENTRY *entry; diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h index 2a5636121be..9e829332bdc 100644 --- a/dlls/hidclass.sys/hid.h +++ b/dlls/hidclass.sys/hid.h @@ -106,7 +106,6 @@ typedef struct _minidriver NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN;
/* Internal device functions */ -NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
IRP *pop_irp_from_queue(BASE_DEVICE_EXTENSION *ext) DECLSPEC_HIDDEN; diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 5134cb3569a..b9208d146e6 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -86,6 +86,17 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH return irp_status.u.Status; }
+/* user32 reserves 1 & 2 for winemouse and winekeyboard, + * keep this in sync with user_private.h */ +#define WINE_MOUSE_HANDLE 1 +#define WINE_KEYBOARD_HANDLE 2 + +static UINT32 alloc_rawinput_handle(void) +{ + static LONG counter = WINE_KEYBOARD_HANDLE + 1; + return InterlockedIncrement(&counter); +} + static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *bus_pdo) { WCHAR device_id[MAX_DEVICE_ID_LEN], instance_id[MAX_DEVICE_ID_LEN], pdo_name[255]; @@ -93,6 +104,7 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *b HID_DEVICE_ATTRIBUTES attr = {0}; DEVICE_OBJECT *fdo, *child_pdo; UNICODE_STRING string; + USAGE page, usage; NTSTATUS status; minidriver *minidriver; HID_DESCRIPTOR descriptor; @@ -214,7 +226,14 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *b
IoInvalidateDeviceRelations(bus_pdo, BusRelations);
- HID_LinkDevice(child_pdo); + page = pdo_ext->u.pdo.preparsed_data->caps.UsagePage; + usage = pdo_ext->u.pdo.preparsed_data->caps.Usage; + if (page == HID_USAGE_PAGE_GENERIC && usage == HID_USAGE_GENERIC_MOUSE) + pdo_ext->u.pdo.rawinput_handle = WINE_MOUSE_HANDLE; + else if (page == HID_USAGE_PAGE_GENERIC && usage == HID_USAGE_GENERIC_KEYBOARD) + pdo_ext->u.pdo.rawinput_handle = WINE_KEYBOARD_HANDLE; + else + pdo_ext->u.pdo.rawinput_handle = alloc_rawinput_handle();
pdo_ext->u.pdo.poll_interval = DEFAULT_POLL_INTERVAL;