[Wine-devel] usbd.sys: Added USBD_CreateConfigurationRequest implementation

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Чт Июл 31 19:26:33 MSD 2008


----------- следующая часть -----------
From 76699c00bfc35e0e160abbf75d8d0a562c7885b5 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Thu, 31 Jul 2008 19:17:40 +0400
Subject: [PATCH] usbd.sys: Added USBD_CreateConfigurationRequest implementation

---
 dlls/usbd.sys/usbd.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/dlls/usbd.sys/usbd.c b/dlls/usbd.sys/usbd.c
index f35e7fe..1c0a6c3 100644
--- a/dlls/usbd.sys/usbd.c
+++ b/dlls/usbd.sys/usbd.c
@@ -99,8 +99,37 @@ PUSB_INTERFACE_DESCRIPTOR WINAPI USBD_ParseConfigurationDescriptorEx(
 PURB WINAPI USBD_CreateConfigurationRequest(
         PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PUSHORT Siz )
 {
-    FIXME( "%p, %p\n", ConfigurationDescriptor, Siz );
-    return NULL;
+    USBD_INTERFACE_LIST_ENTRY *uile;
+    USB_INTERFACE_DESCRIPTOR *if_desc, *max;
+    ULONG uile_size, k = 0;
+    URB *urb;
+
+    TRACE( "%p, %p\n", ConfigurationDescriptor, Siz );
+
+    uile_size = (ConfigurationDescriptor->bNumInterfaces + 1) *
+            sizeof(USBD_INTERFACE_LIST_ENTRY);
+    uile = ExAllocatePool( NonPagedPool, uile_size );
+    if (NULL == uile)
+        return NULL;
+    RtlZeroMemory( uile, uile_size );
+
+    if_desc = (USB_INTERFACE_DESCRIPTOR *)(ConfigurationDescriptor + 1);
+    max = (USB_INTERFACE_DESCRIPTOR *)((char *)ConfigurationDescriptor +
+            ConfigurationDescriptor->wTotalLength);
+    while (if_desc < max && k < ConfigurationDescriptor->bNumInterfaces)
+    {
+        if (USB_INTERFACE_DESCRIPTOR_TYPE == if_desc->bDescriptorType)
+            uile[k++].InterfaceDescriptor = if_desc;
+        if_desc = (USB_INTERFACE_DESCRIPTOR *)((char *)if_desc +
+                if_desc->bLength);
+    }
+
+    urb = USBD_CreateConfigurationRequestEx( ConfigurationDescriptor, uile );
+    *Siz = (NULL == urb) ? 0 : urb->u.UrbSelectConfiguration.Hdr.Length;
+
+    ExFreePool( uile );
+
+    return urb;
 }
 
 NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
-- 
1.5.4.5.GIT



Подробная информация о списке рассылки Wine-devel