hidclass.sys: Stop creating a setupapi device.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aff72f2253
commit
a173672911
dlls/hidclass.sys
|
@ -1,7 +1,6 @@
|
||||||
MODULE = hidclass.sys
|
MODULE = hidclass.sys
|
||||||
IMPORTLIB = hidclass
|
IMPORTLIB = hidclass
|
||||||
IMPORTS = hal ntoskrnl
|
IMPORTS = hal ntoskrnl
|
||||||
DELAYIMPORTS = setupapi
|
|
||||||
|
|
||||||
EXTRADLLFLAGS = -mno-cygwin
|
EXTRADLLFLAGS = -mno-cygwin
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "setupapi.h"
|
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "ddk/hidsdi.h"
|
#include "ddk/hidsdi.h"
|
||||||
|
@ -37,69 +36,6 @@
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(hid);
|
WINE_DEFAULT_DEBUG_CHANNEL(hid);
|
||||||
WINE_DECLARE_DEBUG_CHANNEL(hid_report);
|
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)
|
IRP *pop_irp_from_queue(BASE_DEVICE_EXTENSION *ext)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *entry;
|
LIST_ENTRY *entry;
|
||||||
|
|
|
@ -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;
|
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 */
|
/* Internal device functions */
|
||||||
NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
|
||||||
void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
IRP *pop_irp_from_queue(BASE_DEVICE_EXTENSION *ext) DECLSPEC_HIDDEN;
|
IRP *pop_irp_from_queue(BASE_DEVICE_EXTENSION *ext) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -86,6 +86,17 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
|
||||||
return irp_status.u.Status;
|
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)
|
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];
|
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};
|
HID_DEVICE_ATTRIBUTES attr = {0};
|
||||||
DEVICE_OBJECT *fdo, *child_pdo;
|
DEVICE_OBJECT *fdo, *child_pdo;
|
||||||
UNICODE_STRING string;
|
UNICODE_STRING string;
|
||||||
|
USAGE page, usage;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
minidriver *minidriver;
|
minidriver *minidriver;
|
||||||
HID_DESCRIPTOR descriptor;
|
HID_DESCRIPTOR descriptor;
|
||||||
|
@ -214,7 +226,14 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *b
|
||||||
|
|
||||||
IoInvalidateDeviceRelations(bus_pdo, BusRelations);
|
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;
|
pdo_ext->u.pdo.poll_interval = DEFAULT_POLL_INTERVAL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue