Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wineusb.sys/wineusb.c | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index b60d496e9e..918c7a584b 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -278,15 +278,58 @@ static NTSTATUS fdo_pnp(IRP *irp) return IoCallDriver(bus_pdo, irp); }
+static void get_device_id(const struct usb_device *device, WCHAR *buffer) +{ + static const WCHAR formatW[] = {'U','S','B','\','V','I','D','_','%','0','4','X', + '&','P','I','D','_','%','0','4','X',0}; + struct libusb_device_descriptor desc; + + libusb_get_device_descriptor(device->libusb_device, &desc); + sprintfW(buffer, formatW, desc.idVendor, desc.idProduct); +} + +static NTSTATUS query_id(const struct usb_device *device, IRP *irp, BUS_QUERY_ID_TYPE type) +{ + WCHAR *id = NULL; + + switch (type) + { + case BusQueryDeviceID: + if ((id = ExAllocatePool(PagedPool, 28 * sizeof(WCHAR)))) + get_device_id(device, id); + break; + + case BusQueryInstanceID: + if ((id = ExAllocatePool(PagedPool, 2 * sizeof(WCHAR)))) + { + id[0] = '0'; + id[1] = 0; + } + break; + + default: + FIXME("Unhandled ID query type %#x.\n", type); + return irp->IoStatus.Status; + } + + irp->IoStatus.Information = (ULONG_PTR)id; + return STATUS_SUCCESS; +} + static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp) { IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); + struct usb_device *device = device_obj->DeviceExtension; NTSTATUS ret = irp->IoStatus.Status;
TRACE("device_obj %p, irp %p, minor function %#x.\n", device_obj, irp, stack->MinorFunction);
switch (stack->MinorFunction) { + case IRP_MN_QUERY_ID: + ret = query_id(device, irp, stack->Parameters.QueryId.IdType); + break; + case IRP_MN_START_DEVICE: case IRP_MN_QUERY_CAPABILITIES: ret = STATUS_SUCCESS;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wineusb.sys/wineusb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index 918c7a584b..8798645f2f 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -288,6 +288,19 @@ static void get_device_id(const struct usb_device *device, WCHAR *buffer) sprintfW(buffer, formatW, desc.idVendor, desc.idProduct); }
+static void get_hardware_ids(const struct usb_device *device, WCHAR *buffer) +{ + static const WCHAR formatW[] = {'U','S','B','\','V','I','D','_','%','0','4','X', + '&','P','I','D','_','%','0','4','X','&','R','E','V','_','%','0','4','X',0}; + struct libusb_device_descriptor desc; + + libusb_get_device_descriptor(device->libusb_device, &desc); + buffer += sprintfW(buffer, formatW, desc.idVendor, desc.idProduct, desc.bcdDevice) + 1; + get_device_id(device, buffer); + buffer += strlenW(buffer) + 1; + *buffer = 0; +} + static NTSTATUS query_id(const struct usb_device *device, IRP *irp, BUS_QUERY_ID_TYPE type) { WCHAR *id = NULL; @@ -307,6 +320,11 @@ static NTSTATUS query_id(const struct usb_device *device, IRP *irp, BUS_QUERY_ID } break;
+ case BusQueryHardwareIDs: + if ((id = ExAllocatePool(PagedPool, (28 + 37 + 1) * sizeof(WCHAR)))) + get_hardware_ids(device, id); + break; + default: FIXME("Unhandled ID query type %#x.\n", type); return irp->IoStatus.Status;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wineusb.sys/wineusb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index 8798645f2f..eb1b7a261f 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -301,6 +301,26 @@ static void get_hardware_ids(const struct usb_device *device, WCHAR *buffer) *buffer = 0; }
+static void get_compatible_ids(const struct usb_device *device, WCHAR *buffer) +{ + static const WCHAR prot_format[] = {'U','S','B','\','C','l','a','s','s','_','%','0','2','x', + '&','S','u','b','C','l','a','s','s','_','%','0','2','x', + '&','P','r','o','t','_','%','0','2','x',0}; + static const WCHAR subclass_format[] = {'U','S','B','\','C','l','a','s','s','_','%','0','2','x', + '&','S','u','b','C','l','a','s','s','_','%','0','2','x',0}; + static const WCHAR class_format[] = {'U','S','B','\','C','l','a','s','s','_','%','0','2','x',0}; + + struct libusb_device_descriptor device_desc; + + libusb_get_device_descriptor(device->libusb_device, &device_desc); + + buffer += sprintfW(buffer, prot_format, device_desc.bDeviceClass, device_desc.bDeviceSubClass, + device_desc.bDeviceProtocol) + 1; + buffer += sprintfW(buffer, subclass_format, device_desc.bDeviceClass, device_desc.bDeviceSubClass) + 1; + buffer += sprintfW(buffer, class_format, device_desc.bDeviceClass) + 1; + *buffer = 0; +} + static NTSTATUS query_id(const struct usb_device *device, IRP *irp, BUS_QUERY_ID_TYPE type) { WCHAR *id = NULL; @@ -325,6 +345,11 @@ static NTSTATUS query_id(const struct usb_device *device, IRP *irp, BUS_QUERY_ID get_hardware_ids(device, id); break;
+ case BusQueryCompatibleIDs: + if ((id = ExAllocatePool(PagedPool, (33 + 25 + 13 + 1) * sizeof(WCHAR)))) + get_compatible_ids(device, id); + break; + default: FIXME("Unhandled ID query type %#x.\n", type); return irp->IoStatus.Status;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- loader/Makefile.in | 3 ++- loader/wine.inf.in | 1 + loader/wineusb.inf.in | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 loader/wineusb.inf.in
diff --git a/loader/Makefile.in b/loader/Makefile.in index f9b2fa9293..f76b7c6d64 100644 --- a/loader/Makefile.in +++ b/loader/Makefile.in @@ -10,7 +10,8 @@ SOURCES = \ wine.pl.UTF-8.man.in \ wine_info.plist.in \ winebus.inf.in \ - winehid.inf.in + winehid.inf.in \ + wineusb.inf.in
PROGRAMS = $(WINELOADER_PROGRAMS) INSTALL_LIB = $(WINELOADER_PROGRAMS) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index e1546713db..91eb68e6d5 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -3851,6 +3851,7 @@ HKLM,Software\Wine\LicenseInformation,"Shell-PremiumInBoxGames-Chess-EnableGame" [InfFiles] winebus.inf winehid.inf +wineusb.inf
[NlsFiles] c_037.nls diff --git a/loader/wineusb.inf.in b/loader/wineusb.inf.in new file mode 100644 index 0000000000..be01f00296 --- /dev/null +++ b/loader/wineusb.inf.in @@ -0,0 +1,22 @@ +[Version] +Signature="$CHICAGO$" +ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} +Class=System + +[Manufacturer] +Wine=mfg_section + +[mfg_section] +Wine USB bus driver=device_section,root\wineusb + +[device_section.Services] +AddService = wineusb,0x2,svc_section + +[svc_section] +Description="Wine USB bus driver" +DisplayName="Wine USB bus" +ServiceBinary="%12%\wineusb.sys" +LoadOrderGroup="WinePlugPlay" +ServiceType=1 +StartType=3 +ErrorControl=1
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- programs/wineboot/wineboot.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index e1dbe66302..54e48d0310 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -1367,6 +1367,7 @@ static void install_root_pnp_devices(void) root_devices[] = { {"root\wine\winebus", "root\winebus\0", "C:\windows\inf\winebus.inf"}, + {"root\wine\wineusb", "root\wineusb\0", "C:\windows\inf\wineusb.inf"}, }; SP_DEVINFO_DATA device = {sizeof(device)}; unsigned int i;