Author: arty
Date: Thu Jun 14 16:19:01 2012
New Revision: 56732

URL: http://svn.reactos.org/svn/reactos?rev=56732&view=rev
Log:
[NTOSKRNL]
Actually remove the matching exclusive lock region when unlocking.

Modified:
    trunk/reactos/ntoskrnl/fsrtl/filelock.c

Modified: trunk/reactos/ntoskrnl/fsrtl/filelock.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/filelock.c?rev=56732&r1=56731&r2=56732&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/filelock.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/filelock.c [iso-8859-1] Thu Jun 14 16:19:01 
2012
@@ -579,8 +579,8 @@
                &FileObject->FileName,
                Conflict->Exclusive.FileLock.StartingByte.HighPart,
                Conflict->Exclusive.FileLock.StartingByte.LowPart,
-               Conflict->Exclusive.FileLock.StartingByte.HighPart,
-               Conflict->Exclusive.FileLock.StartingByte.LowPart,
+               Conflict->Exclusive.FileLock.EndingByte.HighPart,
+               Conflict->Exclusive.FileLock.EndingByte.LowPart,
                Conflict->Exclusive.FileLock.ExclusiveLock);
         if (!ExclusiveLock)
         {
@@ -824,6 +824,14 @@
         DPRINT("Range not locked %wZ\n", &FileObject->FileName);
         return STATUS_RANGE_NOT_LOCKED;
     }
+
+    DPRINT("Found lock entry: Exclusive %d %08x%08x:%08x%08x %wZ\n",
+           Entry->Exclusive.FileLock.ExclusiveLock,
+           Entry->Exclusive.FileLock.StartingByte.HighPart,
+           Entry->Exclusive.FileLock.StartingByte.LowPart,
+           Entry->Exclusive.FileLock.EndingByte.HighPart,
+           Entry->Exclusive.FileLock.EndingByte.LowPart,
+           &FileObject->FileName);
     
     if (Entry->Exclusive.FileLock.ExclusiveLock)
     {
@@ -837,6 +845,8 @@
             return STATUS_RANGE_NOT_LOCKED;
         }
         RtlCopyMemory(&Find, Entry, sizeof(Find));
+        // Remove the old exclusive lock region
+        RtlDeleteElementGenericTable(&InternalInfo->RangeTable, Entry);
     }
     else
     {
@@ -882,7 +892,12 @@
     }
     
     if (IsListEmpty(&InternalInfo->SharedLocks)) {
-        DPRINT("Removing the lock entry %wZ\n", &FileObject->FileName);
+        DPRINT("Removing the lock entry %wZ (%08x%08x:%08x%08x)\n", 
+               &FileObject->FileName, 
+               Entry->Exclusive.FileLock.StartingByte.HighPart, 
+               Entry->Exclusive.FileLock.StartingByte.LowPart,
+               Entry->Exclusive.FileLock.EndingByte.HighPart, 
+               Entry->Exclusive.FileLock.EndingByte.LowPart);
         RtlDeleteElementGenericTable(&InternalInfo->RangeTable, Entry);
     } else {
         DPRINT("Lock still has:\n");


Reply via email to