[NPFS]
[reactos.git] / reactos / drivers / filesystems / npfs / dirctl.c
index e73b042..708320f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       drivers/filesastems/npfs/dirctl.c
+ * FILE:       drivers/filesystems/npfs/dirctl.c
  * PURPOSE:    Named pipe filesystem
  * PROGRAMMER: Eric Kohl
  */
@@ -55,7 +55,8 @@ NpfsQueryDirectory(PNPFS_CCB Ccb,
     /* Determine Buffer for result */
     if (Irp->MdlAddress)
     {
-        Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
+        Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
+                                              NormalPagePriority);
     }
     else
     {
@@ -144,6 +145,7 @@ NpfsQueryDirectory(PNPFS_CCB Ccb,
     PipeIndex = 0;
 
     Vcb = Ccb->Fcb->Vcb;
+    KeLockMutex(&Vcb->PipeListLock);
     CurrentEntry = Vcb->PipeListHead.Flink;
     while (CurrentEntry != &Vcb->PipeListHead &&
            Status == STATUS_SUCCESS)
@@ -252,11 +254,17 @@ NpfsQueryDirectory(PNPFS_CCB Ccb,
 
                 /* Leave, if there is no space left in the buffer */
                 if (Status == STATUS_BUFFER_OVERFLOW)
+                {
+                    KeUnlockMutex(&Vcb->PipeListLock);
                     return Status;
+                }
 
                 /* Leave, if we should return only one entry */
                 if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
+                {
+                    KeUnlockMutex(&Vcb->PipeListLock);
                     return STATUS_SUCCESS;
+                }
 
                 /* Store the current offset for the next round */
                 LastOffset = CurrentOffset;
@@ -270,6 +278,7 @@ NpfsQueryDirectory(PNPFS_CCB Ccb,
 
         CurrentEntry = CurrentEntry->Flink;
     }
+    KeUnlockMutex(&Vcb->PipeListLock);
 
     /* Return STATUS_NO_MORE_FILES if no matching pipe name was found */
     if (CurrentOffset == 0)
@@ -290,6 +299,8 @@ NpfsDirectoryControl(PDEVICE_OBJECT DeviceObject,
     NTSTATUS Status;
     ULONG Size = 0;
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     DPRINT("NpfsDirectoryControl() called\n");
 
     IoStack = IoGetCurrentIrpStackLocation(Irp);