[FASTFAT]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 26 Oct 2014 18:48:30 +0000 (18:48 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 26 Oct 2014 18:48:30 +0000 (18:48 +0000)
Acquire DirResource in DoQuery() before attempting to play with FCBs.

This is dedicated to Thomas ;-)

svn path=/trunk/; revision=65024

reactos/drivers/filesystems/fastfat/dir.c

index 57fda52..bf7dd13 100644 (file)
@@ -504,6 +504,13 @@ DoQuery(
     DirContext.ShortNameU.Buffer = ShortNameBuffer;
     DirContext.ShortNameU.MaximumLength = sizeof(ShortNameBuffer);
 
+    if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource,
+                                        (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
+    {
+        ExReleaseResourceLite(&pFcb->MainResource);
+        return VfatQueueRequest(IrpContext);
+    }
+
     while ((Status == STATUS_SUCCESS) && (BufferLength > 0))
     {
         Status = FindFile(IrpContext->DeviceExt,
@@ -579,6 +586,7 @@ DoQuery(
         IrpContext->Irp->IoStatus.Information = Stack->Parameters.QueryDirectory.Length - BufferLength;
     }
 
+    ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource);
     ExReleaseResourceLite(&pFcb->MainResource);
 
     return Status;