winebus.sys: Stop creating a setupapi device.

ntoskrnl.exe handles this now.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-11-06 23:55:04 -06:00 committed by Alexandre Julliard
parent 81cda52d15
commit c074966b9d
6 changed files with 11 additions and 70 deletions

View File

@ -1,5 +1,5 @@
MODULE = winebus.sys
IMPORTS = ntoskrnl setupapi advapi32
IMPORTS = ntoskrnl advapi32
EXTRALIBS = $(IOKIT_LIBS) $(UDEV_LIBS)
EXTRAINCL = $(UDEV_CFLAGS) $(SDL2_CFLAGS)
EXTRADLLFLAGS = -Wl,--subsystem,native

View File

@ -43,7 +43,7 @@ void *get_platform_private(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
/* HID Plug and Play Bus */
DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid,
WORD input, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad,
const GUID *class, const platform_vtbl *vtbl, DWORD platform_data_size) DECLSPEC_HIDDEN;
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;
void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN;

View File

@ -102,9 +102,6 @@ static HANDLE run_loop_handle;
static const WCHAR busidW[] = {'I','O','H','I','D',0};
#include "initguid.h"
DEFINE_GUID(GUID_DEVCLASS_IOHID, 0x989D309D,0x0470,0x4E1A,0x89,0x38,0x50,0x1F,0x42,0xBD,0x9A,0xCD);
struct platform_private
{
IOHIDDeviceRef device;
@ -348,7 +345,7 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
input = 0;
device = bus_create_hid_device(busidW, vid, pid, input,
version, uid, str?serial_string:NULL, is_gamepad, &GUID_DEVCLASS_IOHID,
version, uid, str ? serial_string : NULL, is_gamepad,
&iohid_vtbl, sizeof(struct platform_private));
if (!device)
ERR("Failed to create device\n");

View File

@ -66,9 +66,6 @@ static const WCHAR sdl_busidW[] = {'S','D','L','J','O','Y',0};
static DWORD map_controllers = 0;
#include "initguid.h"
DEFINE_GUID(GUID_DEVCLASS_SDL, 0x463d60b5,0x802b,0x4bb2,0x8f,0xdb,0x7d,0xa9,0xb9,0x96,0x04,0xd8);
static void *sdl_handle = NULL;
static HANDLE deviceloop_handle;
static UINT quit_event = -1;
@ -974,9 +971,8 @@ static void try_add_device(unsigned int index)
if (is_xbox_gamepad)
input = 0;
device = bus_create_hid_device(sdl_busidW, vid, pid,
input, version, index, serial, is_xbox_gamepad, &GUID_DEVCLASS_SDL,
&sdl_vtbl, sizeof(struct platform_private));
device = bus_create_hid_device(sdl_busidW, vid, pid, input, version, index,
serial, is_xbox_gamepad, &sdl_vtbl, sizeof(struct platform_private));
if (device)
{

View File

@ -98,10 +98,6 @@ static int deviceloop_control[2];
static const WCHAR hidraw_busidW[] = {'H','I','D','R','A','W',0};
static const WCHAR lnxev_busidW[] = {'L','N','X','E','V',0};
#include "initguid.h"
DEFINE_GUID(GUID_DEVCLASS_HIDRAW, 0x3def44ad,0x242e,0x46e5,0x82,0x6d,0x70,0x72,0x13,0xf3,0xaa,0x81);
DEFINE_GUID(GUID_DEVCLASS_LINUXEVENT, 0x1b932c0d,0xfea7,0x42cd,0x8e,0xaa,0x0e,0x48,0x79,0xb6,0x9e,0xaa);
struct platform_private
{
struct udev_device *udev_device;
@ -1241,13 +1237,13 @@ static void try_add_device(struct udev_device *dev)
if (strcmp(subsystem, "hidraw") == 0)
{
device = bus_create_hid_device(hidraw_busidW, vid, pid, input, version, 0, serial, is_gamepad,
&GUID_DEVCLASS_HIDRAW, &hidraw_vtbl, sizeof(struct platform_private));
&hidraw_vtbl, sizeof(struct platform_private));
}
#ifdef HAS_PROPER_INPUT_HEADER
else if (strcmp(subsystem, "input") == 0)
{
device = bus_create_hid_device(lnxev_busidW, vid, pid, input, version, 0, serial, is_gamepad,
&GUID_DEVCLASS_LINUXEVENT, &lnxev_vtbl, sizeof(struct wine_input_private));
&lnxev_vtbl, sizeof(struct wine_input_private));
}
#endif

View File

@ -25,13 +25,7 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winternl.h"
#include "winreg.h"
#include "setupapi.h"
#include "cfgmgr32.h"
#include "winioctl.h"
#include "hidusage.h"
#include "ddk/wdm.h"
@ -47,8 +41,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
WINE_DECLARE_DEBUG_CHANNEL(hid_report);
static const WCHAR backslashW[] = {'\\',0};
struct product_desc
{
WORD vid;
@ -223,23 +215,20 @@ static WCHAR *get_compatible_ids(DEVICE_OBJECT *device)
DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid,
WORD input, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad,
const GUID *class, const platform_vtbl *vtbl, DWORD platform_data_size)
const platform_vtbl *vtbl, DWORD platform_data_size)
{
static const WCHAR device_name_fmtW[] = {'\\','D','e','v','i','c','e','\\','%','s','#','%','p',0};
WCHAR *id, instance[MAX_DEVICE_ID_LEN];
struct device_extension *ext;
struct pnp_device *pnp_dev;
DEVICE_OBJECT *device;
UNICODE_STRING nameW;
WCHAR dev_name[256];
HDEVINFO devinfo;
SP_DEVINFO_DATA data = {sizeof(data)};
NTSTATUS status;
DWORD length;
TRACE("(%s, %04x, %04x, %04x, %u, %u, %s, %u, %s, %p, %u)\n",
TRACE("(%s, %04x, %04x, %04x, %u, %u, %s, %u, %p, %u)\n",
debugstr_w(busidW), vid, pid, input, version, uid, debugstr_w(serialW),
is_gamepad, debugstr_guid(class), vtbl, platform_data_size);
is_gamepad, vtbl, platform_data_size);
if (!(pnp_dev = HeapAlloc(GetProcessHeap(), 0, sizeof(*pnp_dev))))
return NULL;
@ -286,41 +275,6 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid,
list_add_tail(&pnp_devset, &pnp_dev->entry);
LeaveCriticalSection(&device_list_cs);
devinfo = SetupDiCreateDeviceInfoList(class, NULL);
if (devinfo == INVALID_HANDLE_VALUE)
{
ERR("failed to create device info list, error %#x\n", GetLastError());
goto error;
}
if (!(id = get_device_id(device)))
{
ERR("failed to generate instance id\n");
goto error;
}
strcpyW(instance, id);
ExFreePool(id);
if (!(id = get_instance_id(device)))
{
ERR("failed to generate instance id\n");
goto error;
}
strcatW(instance, backslashW);
strcatW(instance, id);
ExFreePool(id);
if (SetupDiCreateDeviceInfoW(devinfo, instance, class, NULL, NULL, DICD_INHERIT_CLASSDRVS, &data))
{
if (!SetupDiRegisterDeviceInfo(devinfo, &data, 0, NULL, NULL, NULL))
ERR("failed to register device info, error %#x\n", GetLastError());
}
else if (GetLastError() != ERROR_DEVINST_ALREADY_EXISTS)
ERR("failed to create device info, error %#x\n", GetLastError());
error:
SetupDiDestroyDeviceInfoList(devinfo);
return device;
}
@ -556,11 +510,9 @@ static const platform_vtbl mouse_vtbl =
static void mouse_device_create(void)
{
static const GUID wine_mouse_class = {0xdfe2580e,0x52fd,0x453d,{0xa2,0xc1,0x33,0x81,0xf2,0x32,0x68,0x4c}};
static const WCHAR busidW[] = {'W','I','N','E','M','O','U','S','E',0};
mouse_obj = bus_create_hid_device(busidW, 0, 0, -1, 0, 0, busidW, FALSE,
&wine_mouse_class, &mouse_vtbl, 0);
mouse_obj = bus_create_hid_device(busidW, 0, 0, -1, 0, 0, busidW, FALSE, &mouse_vtbl, 0);
IoInvalidateDeviceRelations(bus_pdo, BusRelations);
}