[Wine-patches] [eterhack 10/12] ntoskrnl.exe: Do not create symbolic link for the second time.

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


---
 dlls/ntoskrnl.exe/ntoskrnl.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 638f335..16cfb28 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -1678,6 +1678,7 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( PUNICODE_STRING SymbolicLinkName,
         struct InterfaceInstance *interf;
         NTSTATUS status;
         GUID guid;
+        int changed = 0;
 
         status = STATUS_OBJECT_NAME_NOT_FOUND;
         EnterCriticalSection( &cs );
@@ -1685,14 +1686,21 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( PUNICODE_STRING SymbolicLinkName,
                 SymbolicLinkName->Length / sizeof(WCHAR) );
         if (interf != NULL)
         {
-            guid = interf->guid;
-            status = IoCreateSymbolicLink( SymbolicLinkName, &interf->target );
+            if (!interf->active)
+            {
+                guid = interf->guid;
+                status = IoCreateSymbolicLink( SymbolicLinkName, &interf->target );
+                if (status == STATUS_SUCCESS)
+                {
+                    interf->active = 1;
+                    changed = 1;
+                }
+            }
+            else status = STATUS_SUCCESS;
         }
         LeaveCriticalSection( &cs );
-        if (status != STATUS_SUCCESS) return status;
-        interf->active = 1;
-        call_interface_change_callbacks( &guid, SymbolicLinkName );
-        return STATUS_SUCCESS;
+        if (changed) call_interface_change_callbacks( &guid, SymbolicLinkName );
+        return status;
     }
     else
     {
-- 
1.6.2.5



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