[Wine-patches] [eterhack 6/7] Fix problem with drivers which create more than one device.

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Чт Мар 26 19:54:00 MSK 2009


---
 dlls/ntoskrnl.exe/ntoskrnl.c |    9 +++++----
 dlls/usbhub.sys/usbhub.c     |    8 +++++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 8897568..e8e9c68 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -702,9 +702,9 @@ NTSTATUS CDECL __wine_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *dev )
 /***********************************************************************
  *           __wine_start_device   (Not a Windows API)
  */
-NTSTATUS CDECL __wine_start_device( DRIVER_OBJECT *driver )
+NTSTATUS CDECL __wine_start_device( DEVICE_OBJECT *device )
 {
-    DEVICE_OBJECT *device = driver->DeviceObject;
+    DRIVER_OBJECT *driver = device->DriverObject;
     IO_STACK_LOCATION *irpsp;
     PIRP irp;
     NTSTATUS status;
@@ -1296,8 +1296,9 @@ void WINAPI IoInvalidateDeviceRelations( PDEVICE_OBJECT DeviceObject,
                         while (!(driver = __wine_get_driver_object( service )))
                             Sleep( 100 );
                         status = __wine_add_device( driver, rel->Objects[k] );
-                        if (status == STATUS_SUCCESS)
-                            __wine_start_device( driver );
+                        if (status == STATUS_SUCCESS &&
+                            rel->Objects[k]->AttachedDevice)
+                            __wine_start_device( rel->Objects[k]->AttachedDevice );
                     }
                     if (service) RtlFreeHeap( GetProcessHeap(), 0, service );
                 }
diff --git a/dlls/usbhub.sys/usbhub.c b/dlls/usbhub.sys/usbhub.c
index 5d3fd27..9a5bb27 100644
--- a/dlls/usbhub.sys/usbhub.c
+++ b/dlls/usbhub.sys/usbhub.c
@@ -49,7 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(usbhub);
 
 extern NTSTATUS CDECL __wine_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *dev );
 extern DRIVER_OBJECT * CDECL __wine_get_driver_object( const WCHAR *service );
-extern NTSTATUS CDECL __wine_start_device( DRIVER_OBJECT *driver );
+extern NTSTATUS CDECL __wine_start_device( DEVICE_OBJECT *device );
 
 static unsigned int last_pdo_num;
 
@@ -523,7 +523,8 @@ static DWORD CALLBACK enum_usb_devices( void *usbhubdrv )
                             Sleep( 100 );
                         status = __wine_add_device( driver, pdo );
                         if (status != STATUS_SUCCESS) break;
-                        __wine_start_device( driver );
+                        if (pdo->AttachedDevice)
+                            __wine_start_device( pdo->AttachedDevice );
                     }
                     if (start_service( instance->service ))
                     {
@@ -535,7 +536,8 @@ static DWORD CALLBACK enum_usb_devices( void *usbhubdrv )
                             Sleep( 100 );
                         status = __wine_add_device( driver, pdo );
                         if (status != STATUS_SUCCESS) break;
-                        __wine_start_device( driver );
+                        if (pdo->AttachedDevice)
+                            __wine_start_device( pdo->AttachedDevice );
                     }
                     break;
                 }
-- 
1.6.1.3.GIT



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