[Wine-patches] [eterhack 05/12] ntoskrnl.exe: Do not register interface for the second time.

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Чт Май 21 17:53:41 MSD 2009


---
 dlls/ntoskrnl.exe/ntoskrnl.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index eab4f5b..aa7a52d 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -1461,8 +1461,8 @@ NTSTATUS WINAPI IoRegisterDeviceInterface( PDEVICE_OBJECT PhysicalDeviceObject,
                     RtlFreeHeap( GetProcessHeap(), 0, interf );
                     break;
                 }
+                detail->DevicePath[1] = '?';
                 strcpyW( interf->link, detail->DevicePath );
-                interf->link[1] = '?';
                 target = RtlAllocateHeap( GetProcessHeap(), 0,
                         MAX_PATH * sizeof(WCHAR) );
                 if (target == NULL)
@@ -1478,22 +1478,25 @@ NTSTATUS WINAPI IoRegisterDeviceInterface( PDEVICE_OBJECT PhysicalDeviceObject,
                 {
                     RtlInitUnicodeString( &interf->target, target );
                     EnterCriticalSection( &cs );
-                    list_add_tail( &Interfaces, &interf->entry );
+                    if (!get_registered_interface( interf->link,
+                            strlenW(interf->link) ))
+                    {
+                        list_add_tail( &Interfaces, &interf->entry );
+                        LeaveCriticalSection( &cs );
+                        break;
+                    }
                     LeaveCriticalSection( &cs );
                 }
-                else
-                {
-                    RtlFreeHeap( GetProcessHeap(), 0, target );
-                    RtlFreeHeap( GetProcessHeap(), 0, interf->link );
-                    RtlFreeHeap( GetProcessHeap(), 0, interf );
-                }
+                RtlFreeHeap( GetProcessHeap(), 0, target );
+                RtlFreeHeap( GetProcessHeap(), 0, interf->link );
+                RtlFreeHeap( GetProcessHeap(), 0, interf );
             }
             break;
         }
     SetupDiDestroyDeviceInfoList( set );
 
     if (STATUS_SUCCESS == status)
-        RtlCreateUnicodeString( SymbolicLinkName, interf->link );
+        RtlCreateUnicodeString( SymbolicLinkName, detail->DevicePath );
 end:
     if (detail) RtlFreeHeap( GetProcessHeap(), 0, detail );
     if (id) RtlFreeHeap( GetProcessHeap(), 0, id );
-- 
1.6.2.5



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