[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-diffs
Subject:    [ros-diffs] [ekohl] 13763: - Data is now written to the readers
From:       <ekohl () svn ! reactos ! com>
Date:       2005-02-27 12:43:39
Message-ID: 000001c51cc9$f601e250$6601a8c0 () penelope
[Download RAW message or body]

- Data is now written to the readers data buffer and the reader reads
from his own data buffer. This fixes Filip's wrokaround to enable the
reader to read data although the writers side was closed.
- Minor cleanup.
Modified: trunk/reactos/drivers/fs/np/create.c
Modified: trunk/reactos/drivers/fs/np/finfo.c
Modified: trunk/reactos/drivers/fs/np/fsctrl.c
Modified: trunk/reactos/drivers/fs/np/npfs.c
Modified: trunk/reactos/drivers/fs/np/npfs.h
Modified: trunk/reactos/drivers/fs/np/rw.c
Modified: trunk/reactos/drivers/fs/np/volume.c
  _____  

Modified: trunk/reactos/drivers/fs/np/create.c
--- trunk/reactos/drivers/fs/np/create.c	2005-02-26 23:22:48 UTC
(rev 13762)
+++ trunk/reactos/drivers/fs/np/create.c	2005-02-27 12:43:37 UTC
(rev 13763)
@@ -2,7 +2,7 @@

  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/np/create.c
+ * FILE:       drivers/fs/np/create.c
  * PURPOSE:    Named pipe filesystem
  * PROGRAMMER: David Welch <welch@cwcom.net>
  */
@@ -164,9 +164,9 @@
   ClientFcb->PipeState = SpecialAccess ? 0 :
FILE_PIPE_DISCONNECTED_STATE;
 
   /* Initialize data list. */
-  if (Pipe->InboundQuota)
+  if (Pipe->OutboundQuota)
     {
-      ClientFcb->Data = ExAllocatePool(NonPagedPool,
Pipe->InboundQuota);
+      ClientFcb->Data = ExAllocatePool(NonPagedPool,
Pipe->OutboundQuota);
       if (ClientFcb->Data == NULL)
         {
           DPRINT("No memory!\n");
@@ -185,8 +185,8 @@
   ClientFcb->ReadPtr = ClientFcb->Data;
   ClientFcb->WritePtr = ClientFcb->Data;
   ClientFcb->ReadDataAvailable = 0;
-  ClientFcb->WriteQuotaAvailable = Pipe->InboundQuota;
-  ClientFcb->MaxDataLength = Pipe->InboundQuota;
+  ClientFcb->WriteQuotaAvailable = Pipe->OutboundQuota;
+  ClientFcb->MaxDataLength = Pipe->OutboundQuota;
   KeInitializeSpinLock(&ClientFcb->DataListLock);
   KeInitializeEvent(&ClientFcb->ConnectEvent, SynchronizationEvent,
FALSE);
   KeInitializeEvent(&ClientFcb->Event, SynchronizationEvent, FALSE);
@@ -381,9 +381,9 @@
        KeUnlockMutex(&DeviceExt->PipeListLock);
      }
 
-   if (Pipe->OutboundQuota)
+   if (Pipe->InboundQuota)
      {
-       Fcb->Data = ExAllocatePool(NonPagedPool, Pipe->OutboundQuota);
+       Fcb->Data = ExAllocatePool(NonPagedPool, Pipe->InboundQuota);
        if (Fcb->Data == NULL)
          {
            ExFreePool(Fcb);
@@ -407,8 +407,8 @@
    Fcb->ReadPtr = Fcb->Data;
    Fcb->WritePtr = Fcb->Data;
    Fcb->ReadDataAvailable = 0;
-   Fcb->WriteQuotaAvailable = Pipe->OutboundQuota;
-   Fcb->MaxDataLength = Pipe->OutboundQuota;
+   Fcb->WriteQuotaAvailable = Pipe->InboundQuota;
+   Fcb->MaxDataLength = Pipe->InboundQuota;
    KeInitializeSpinLock(&Fcb->DataListLock);
 
    Pipe->CurrentInstances++;
@@ -442,9 +442,8 @@
 
 
 NTSTATUS STDCALL
-NpfsClose(
-   PDEVICE_OBJECT DeviceObject,
-   PIRP Irp)
+NpfsClose(PDEVICE_OBJECT DeviceObject,
+          PIRP Irp)
 {
    PNPFS_DEVICE_EXTENSION DeviceExt;
    PIO_STACK_LOCATION IoStack;
@@ -493,10 +492,8 @@
    {
       if (Fcb->OtherSide)
       {
-#ifndef FIN_WORKAROUND_READCLOSE
          Fcb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE;
          Fcb->OtherSide->OtherSide = NULL;
-#endif
          /*
           * Signaling the write event. If is possible that an other
           * thread waits for an empty buffer.
@@ -504,40 +501,16 @@
          KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
       }
 
-#ifndef FIN_WORKAROUND_READCLOSE
       Fcb->PipeState = 0;
-#endif
    }
 
    FileObject->FsContext = NULL;
 
-#ifndef FIN_WORKAROUND_READCLOSE
    RemoveEntryList(&Fcb->FcbListEntry);
    if (Fcb->Data)
       ExFreePool(Fcb->Data);
    ExFreePool(Fcb);
-#else
-   Fcb->PipeState = FILE_PIPE_CLOSING_STATE;
-   if (Fcb->OtherSide == NULL ||
-       Fcb->OtherSide->PipeState == FILE_PIPE_CLOSING_STATE)
-   {
-      if (Server && Fcb->OtherSide != NULL &&
-          Fcb->OtherSide->PipeState == FILE_PIPE_CLOSING_STATE)
-      {
-         RemoveEntryList(&Fcb->OtherSide->FcbListEntry);
-         if (Fcb->OtherSide->Data)
-            ExFreePool(Fcb->OtherSide->Data);
-	 ExFreePool(Fcb->OtherSide);
-      }
 
-      RemoveEntryList(&Fcb->FcbListEntry);
-      if (Fcb->Data)
-         ExFreePool(Fcb->Data);
-
-      ExFreePool(Fcb);
-   }
-#endif
-
    KeUnlockMutex(&Pipe->FcbListLock);
 
    if (IsListEmpty(&Pipe->ServerFcbListHead) &&
  _____  

Modified: trunk/reactos/drivers/fs/np/finfo.c
--- trunk/reactos/drivers/fs/np/finfo.c	2005-02-26 23:22:48 UTC (rev
13762)
+++ trunk/reactos/drivers/fs/np/finfo.c	2005-02-27 12:43:37 UTC (rev
13763)
@@ -2,9 +2,9 @@

  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/np/finfo.c
+ * FILE:       drivers/fs/np/finfo.c
  * PURPOSE:    Named pipe filesystem
- * PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
+ * PROGRAMMER: Eric Kohl
  */
 
 /* INCLUDES
******************************************************************/
@@ -36,7 +36,7 @@
 //  Info->CompletionMode = 
 
   *BufferLength -= sizeof(FILE_PIPE_INFORMATION);
-  return(STATUS_SUCCESS);
+  return STATUS_SUCCESS;
 }
 
 
@@ -76,7 +76,7 @@
     }
 
   *BufferLength -= sizeof(FILE_PIPE_LOCAL_INFORMATION);
-  return(STATUS_SUCCESS);
+  return STATUS_SUCCESS;
 }
 
 
@@ -93,24 +93,24 @@
   PVOID SystemBuffer;
   ULONG BufferLength;
   NTSTATUS Status;
-  
+
   DPRINT("NpfsQueryInformation(DeviceObject %p Irp %p)\n",
DeviceObject, Irp);
-  
+
   IoStack = IoGetCurrentIrpStackLocation (Irp);
   FileInformationClass =
IoStack->Parameters.QueryFile.FileInformationClass;
   DeviceExtension = DeviceObject->DeviceExtension;
   FileObject = IoStack->FileObject;
   Fcb = (PNPFS_FCB)FileObject->FsContext;
   Pipe = Fcb->Pipe;
-  
+
   SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
   BufferLength = IoStack->Parameters.QueryFile.Length;
-  
+
   DPRINT("Pipe name: %wZ\n", &Pipe->PipeName);
   DPRINT("FileInformationClass %d\n", FileInformationClass);
   DPRINT("SystemBuffer %p\n", SystemBuffer);
   DPRINT("BufferLength %lu\n", BufferLength);
-  
+
   switch (FileInformationClass)
     {
       case FilePipeInformation:
@@ -134,7 +134,7 @@
       default:
 	Status = STATUS_NOT_SUPPORTED;
     }
-  
+
   Irp->IoStatus.Status = Status;
   if (NT_SUCCESS(Status))
     Irp->IoStatus.Information =
@@ -142,8 +142,8 @@
   else
     Irp->IoStatus.Information = 0;
   IoCompleteRequest (Irp, IO_NO_INCREMENT);
-  
-  return(Status);
+
+  return Status;
 }
 
 
@@ -196,7 +196,7 @@
   IoCompleteRequest(Irp,
 		    IO_NO_INCREMENT);
 
-  return(Status);
+  return Status;
 }
 
 /* EOF */
  _____  

Modified: trunk/reactos/drivers/fs/np/fsctrl.c
--- trunk/reactos/drivers/fs/np/fsctrl.c	2005-02-26 23:22:48 UTC
(rev 13762)
+++ trunk/reactos/drivers/fs/np/fsctrl.c	2005-02-27 12:43:37 UTC
(rev 13763)
@@ -2,10 +2,10 @@

  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/np/fsctrl.c
+ * FILE:       drivers/fs/np/fsctrl.c
  * PURPOSE:    Named pipe filesystem
  * PROGRAMMER: David Welch <welch@cwcom.net>
- *             Eric Kohl <ekohl@rz-online.de>
+ *             Eric Kohl
  */
 
 /* INCLUDES
******************************************************************/
  _____  

Modified: trunk/reactos/drivers/fs/np/npfs.c
--- trunk/reactos/drivers/fs/np/npfs.c	2005-02-26 23:22:48 UTC (rev
13762)
+++ trunk/reactos/drivers/fs/np/npfs.c	2005-02-27 12:43:37 UTC (rev
13763)
@@ -2,7 +2,7 @@

  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/np/mount.c
+ * FILE:       drivers/fs/np/mount.c
  * PURPOSE:    Named pipe filesystem
  * PROGRAMMER: David Welch <welch@cwcom.net>
  */
@@ -64,7 +64,7 @@
    if (!NT_SUCCESS(Status))
      {
 	DPRINT("Failed to create named pipe device! (Status %x)\n",
Status);
-	return(Status);
+	return Status;
      }
    
    /* initialize the device object */
@@ -81,7 +81,7 @@
    DeviceExtension->DefaultQuota = 8 * PAGE_SIZE;
    DeviceExtension->MaxQuota = 64 * PAGE_SIZE;
 
-   return(STATUS_SUCCESS);
+   return STATUS_SUCCESS;
 }
 
 /* EOF */
  _____  

Modified: trunk/reactos/drivers/fs/np/npfs.h
--- trunk/reactos/drivers/fs/np/npfs.h	2005-02-26 23:22:48 UTC (rev
13762)
+++ trunk/reactos/drivers/fs/np/npfs.h	2005-02-27 12:43:37 UTC (rev
13763)
@@ -1,14 +1,8 @@

 /* $Id$ */
 
-#ifndef __SERVICES_FS_NP_NPFS_H
-#define __SERVICES_FS_NP_NPFS_H
+#ifndef __DRIVERS_FS_NP_NPFS_H
+#define __DRIVERS_FS_NP_NPFS_H
 
-/*
- * Hacky support for delayed closing of pipes. We need this to support
- * reading from pipe the was closed on one end.
- */
-#define FIN_WORKAROUND_READCLOSE
-
 typedef struct _NPFS_DEVICE_EXTENSION
 {
   LIST_ENTRY PipeListHead;
@@ -70,9 +64,7 @@
 
 #define KeUnlockMutex(x) KeReleaseMutex(x, FALSE);
 
-#define CP DPRINT("\n");
 
-
 NTSTATUS STDCALL NpfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp);
 NTSTATUS STDCALL NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, PIRP
Irp);
 NTSTATUS STDCALL NpfsClose(PDEVICE_OBJECT DeviceObject, PIRP Irp);
@@ -89,4 +81,4 @@
 
 NTSTATUS STDCALL NpfsQueryVolumeInformation (PDEVICE_OBJECT
DeviceObject, PIRP Irp);
 
-#endif /* __SERVICES_FS_NP_NPFS_H */
+#endif /* __DRIVERS_FS_NP_NPFS_H */
  _____  

Modified: trunk/reactos/drivers/fs/np/rw.c
--- trunk/reactos/drivers/fs/np/rw.c	2005-02-26 23:22:48 UTC (rev
13762)
+++ trunk/reactos/drivers/fs/np/rw.c	2005-02-27 12:43:37 UTC (rev
13763)
@@ -2,7 +2,7 @@

  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/np/rw.c
+ * FILE:       drivers/fs/np/rw.c
  * PURPOSE:    Named pipe filesystem
  * PROGRAMMER: David Welch <welch@cwcom.net>
  */
@@ -16,8 +16,6 @@
 #define NDEBUG
 #include <debug.h>
 
-#define FIN_WORKAROUND_READCLOSE
-
 /* FUNCTIONS
*****************************************************************/
 
 #ifndef NDEBUG
@@ -60,7 +58,7 @@
   KIRQL OldIrql;
   ULONG Information;
   PNPFS_FCB Fcb;
-  PNPFS_FCB ReadFcb;
+  PNPFS_FCB WriterFcb;
   PNPFS_PIPE Pipe;
   ULONG Length;
   PVOID Buffer;
@@ -74,22 +72,8 @@
   FileObject = IoStack->FileObject;
   Fcb = FileObject->FsContext;
   Pipe = Fcb->Pipe;
-  ReadFcb = Fcb->OtherSide;
+  WriterFcb = Fcb->OtherSide;
 
-  if (ReadFcb == NULL)
-    {
-      DPRINT("Pipe is NOT connected!\n");
-      if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
-        Status = STATUS_PIPE_LISTENING;
-      else if (Fcb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
-        Status = STATUS_PIPE_DISCONNECTED;
-      else
-        Status = STATUS_PIPE_BROKEN;
-      Information = 0;
-      DPRINT("%x\n", Status);
-      goto done;
-    }
-
   if (Irp->MdlAddress == NULL)
     {
       DPRINT("Irp->MdlAddress == NULL\n");
@@ -98,7 +82,7 @@
       goto done;
     }
 
-  if (ReadFcb->Data == NULL)
+  if (Fcb->Data == NULL)
     {
       DPRINT("Pipe is NOT readable!\n");
       Status = STATUS_UNSUCCESSFUL;
@@ -106,31 +90,20 @@
       goto done;
     }
 
-#ifdef FIN_WORKAROUND_READCLOSE
-  if (ReadFcb->ReadDataAvailable == 0 &&
-      ReadFcb->PipeState == FILE_PIPE_CLOSING_STATE)
-    {
-      DPRINT("Other end of pipe is closed!\n");
-      Status = STATUS_PIPE_BROKEN;
-      Information = 0;
-      goto done;
-    }
-#endif
-
   Status = STATUS_SUCCESS;
   Length = IoStack->Parameters.Read.Length;
   Information = 0;
 
   Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
-  KeAcquireSpinLock(&ReadFcb->DataListLock, &OldIrql);
+  KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
   while (1)
     {
       /* FIXME: check if in blocking mode */
-      if (ReadFcb->ReadDataAvailable == 0)
+      if (Fcb->ReadDataAvailable == 0)
 	{
 	  KeResetEvent(&Fcb->Event);
-	  KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE);
-	  KeReleaseSpinLock(&ReadFcb->DataListLock, OldIrql);
+	  KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
+	  KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
 	  if (Information > 0)
 	    {
 	      Status = STATUS_SUCCESS;
@@ -153,56 +126,44 @@
 				         NULL);
 	  DPRINT("Finished waiting (%S)! Status: %x\n",
Pipe->PipeName.Buffer, Status);
 
-#ifndef FIN_WORKAROUND_READCLOSE
-	  /*
-	   * It's possible that the event was signaled because the
-	   * other side of pipe was closed.
-	   */
-	  if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
-	    {
-	      DPRINT("PipeState: %x\n", Fcb->PipeState);
-	      Status = STATUS_PIPE_BROKEN;
-	      goto done;
-	    }
-#endif
-	  KeAcquireSpinLock(&ReadFcb->DataListLock, &OldIrql);
+	  KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
 	}
 
       if (Pipe->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
 	{
 	  DPRINT("Byte stream mode\n");
 	  /* Byte stream mode */
-	  while (Length > 0 && ReadFcb->ReadDataAvailable > 0)
+	  while (Length > 0 && Fcb->ReadDataAvailable > 0)
 	    {
-	      CopyLength = RtlRosMin(ReadFcb->ReadDataAvailable,
Length);
-	      if (ReadFcb->ReadPtr + CopyLength <= ReadFcb->Data +
ReadFcb->MaxDataLength)
+	      CopyLength = RtlRosMin(Fcb->ReadDataAvailable, Length);
+	      if (Fcb->ReadPtr + CopyLength <= Fcb->Data +
Fcb->MaxDataLength)
 		{
-		  memcpy(Buffer, ReadFcb->ReadPtr, CopyLength);
-		  ReadFcb->ReadPtr += CopyLength;
-		  if (ReadFcb->ReadPtr == ReadFcb->Data +
ReadFcb->MaxDataLength)
+		  memcpy(Buffer, Fcb->ReadPtr, CopyLength);
+		  Fcb->ReadPtr += CopyLength;
+		  if (Fcb->ReadPtr == Fcb->Data + Fcb->MaxDataLength)
 		    {
-		      ReadFcb->ReadPtr = ReadFcb->Data;
+		      Fcb->ReadPtr = Fcb->Data;
 		    }
 		}
 	      else
 		{
-		  TempLength = ReadFcb->Data + ReadFcb->MaxDataLength -
ReadFcb->ReadPtr;
-		  memcpy(Buffer, ReadFcb->ReadPtr, TempLength);
-		  memcpy(Buffer + TempLength, ReadFcb->Data, CopyLength
- TempLength);
-		  ReadFcb->ReadPtr = ReadFcb->Data + CopyLength -
TempLength;
+		  TempLength = Fcb->Data + Fcb->MaxDataLength -
Fcb->ReadPtr;
+		  memcpy(Buffer, Fcb->ReadPtr, TempLength);
+		  memcpy(Buffer + TempLength, Fcb->Data, CopyLength -
TempLength);
+		  Fcb->ReadPtr = Fcb->Data + CopyLength - TempLength;
 		}
 
 	      Buffer += CopyLength;
 	      Length -= CopyLength;
 	      Information += CopyLength;
 
-	      ReadFcb->ReadDataAvailable -= CopyLength;
-	      ReadFcb->WriteQuotaAvailable += CopyLength;
+	      Fcb->ReadDataAvailable -= CopyLength;
+	      Fcb->WriteQuotaAvailable += CopyLength;
 	    }
 
 	  if (Length == 0)
 	    {
-	      KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE);
+	      KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
 	      break;
 	    }
 	}
@@ -211,11 +172,11 @@
 	  DPRINT("Message mode\n");
 
 	  /* Message mode */
-	  if (ReadFcb->ReadDataAvailable)
+	  if (Fcb->ReadDataAvailable)
 	    {
 	      /* Truncate the message if the receive buffer is too small
*/
-	      CopyLength = RtlRosMin(ReadFcb->ReadDataAvailable,
Length);
-	      memcpy(Buffer, ReadFcb->Data, CopyLength);
+	      CopyLength = RtlRosMin(Fcb->ReadDataAvailable, Length);
+	      memcpy(Buffer, Fcb->Data, CopyLength);
 
 #ifndef NDEBUG
 	      DPRINT("Length %d Buffer %x\n",CopyLength,Buffer);
@@ -223,28 +184,19 @@
 #endif
 
 	      Information = CopyLength;
-	      ReadFcb->ReadDataAvailable = 0;
-	      ReadFcb->WriteQuotaAvailable = ReadFcb->MaxDataLength;
+	      Fcb->ReadDataAvailable = 0;
+	      Fcb->WriteQuotaAvailable = Fcb->MaxDataLength;
 	    }
 
 	  if (Information > 0)
 	    {
-	      KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE);
+	      KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE);
 	      break;
 	    }
 	}
-
-#ifdef FIN_WORKAROUND_READCLOSE
-      if (ReadFcb->ReadDataAvailable == 0 &&
-	  ReadFcb->PipeState == FILE_PIPE_CLOSING_STATE)
-	{
-	  DPRINT("Other end of pipe is closed!\n");
-	  break;
-	}
-#endif
     }
 
-  KeReleaseSpinLock(&ReadFcb->DataListLock, OldIrql);
+  KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
 
 done:
   Irp->IoStatus.Status = Status;
@@ -265,6 +217,7 @@
   PIO_STACK_LOCATION IoStack;
   PFILE_OBJECT FileObject;
   PNPFS_FCB Fcb = NULL;
+  PNPFS_FCB ReaderFcb;
   PNPFS_PIPE Pipe = NULL;
   PUCHAR Buffer;
   NTSTATUS Status = STATUS_SUCCESS;
@@ -283,6 +236,7 @@
   DPRINT("Pipe name %wZ\n", &FileObject->FileName);
 
   Fcb = FileObject->FsContext;
+  ReaderFcb = Fcb->OtherSide;
   Pipe = Fcb->Pipe;
 
   Length = IoStack->Parameters.Write.Length;
@@ -297,7 +251,7 @@
       goto done;
     }
 
-  if (Fcb->OtherSide == NULL)
+  if (ReaderFcb == NULL)
     {
       DPRINT("Pipe is NOT connected!\n");
       if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
@@ -310,7 +264,7 @@
       goto done;
     }
 
-  if (Fcb->Data == NULL)
+  if (ReaderFcb->Data == NULL)
     {
       DPRINT("Pipe is NOT writable!\n");
       Status = STATUS_UNSUCCESSFUL;
@@ -321,7 +275,7 @@
   Status = STATUS_SUCCESS;
   Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
 
-  KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
+  KeAcquireSpinLock(&ReaderFcb->DataListLock, &OldIrql);
 #ifndef NDEBUG
   DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset);
   HexDump(Buffer, Length);
@@ -329,11 +283,11 @@
 
   while(1)
     {
-      if (Fcb->WriteQuotaAvailable == 0)
+      if (ReaderFcb->WriteQuotaAvailable == 0)
 	{
 	  KeResetEvent(&Fcb->Event);
-	  KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE);
-	  KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
+	  KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
+	  KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql);
 	  if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
 	    {
 	      Status = STATUS_PIPE_BROKEN;
@@ -348,7 +302,6 @@
 				         NULL);
 	  DPRINT("Finished waiting (%S)! Status: %x\n",
Pipe->PipeName.Buffer, Status);
 
-#ifndef FIN_WORKAROUND_READCLOSE
 	  /*
 	   * It's possible that the event was signaled because the
 	   * other side of pipe was closed.
@@ -359,44 +312,43 @@
 	      Status = STATUS_PIPE_BROKEN;
 	      goto done;
 	    }
-#endif
-	  KeAcquireSpinLock(&Fcb->DataListLock, &OldIrql);
+	  KeAcquireSpinLock(&ReaderFcb->DataListLock, &OldIrql);
 	}
 
       if (Pipe->WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
 	{
 	  DPRINT("Byte stream mode\n");
-	  while (Length > 0 && Fcb->WriteQuotaAvailable > 0)
+	  while (Length > 0 && ReaderFcb->WriteQuotaAvailable > 0)
 	    {
-	      CopyLength = RtlRosMin(Length, Fcb->WriteQuotaAvailable);
-	      if (Fcb->WritePtr + CopyLength <= Fcb->Data +
Fcb->MaxDataLength)
+	      CopyLength = RtlRosMin(Length,
ReaderFcb->WriteQuotaAvailable);
+	      if (ReaderFcb->WritePtr + CopyLength <= ReaderFcb->Data +
ReaderFcb->MaxDataLength)
 		{
-		  memcpy(Fcb->WritePtr, Buffer, CopyLength);
-		  Fcb->WritePtr += CopyLength;
-		  if (Fcb->WritePtr == Fcb->Data + Fcb->MaxDataLength)
+		  memcpy(ReaderFcb->WritePtr, Buffer, CopyLength);
+		  ReaderFcb->WritePtr += CopyLength;
+		  if (ReaderFcb->WritePtr == ReaderFcb->Data +
ReaderFcb->MaxDataLength)
 		    {
-		      Fcb->WritePtr = Fcb->Data;
+		      ReaderFcb->WritePtr = ReaderFcb->Data;
 		    }
 		}
 	      else
 		{
-		  TempLength = Fcb->Data + Fcb->MaxDataLength -
Fcb->WritePtr;
-		  memcpy(Fcb->WritePtr, Buffer, TempLength);
-		  memcpy(Fcb->Data, Buffer + TempLength, CopyLength -
TempLength);
-		  Fcb->WritePtr = Fcb->Data + CopyLength - TempLength;
+		  TempLength = ReaderFcb->Data +
ReaderFcb->MaxDataLength - ReaderFcb->WritePtr;
+		  memcpy(ReaderFcb->WritePtr, Buffer, TempLength);
+		  memcpy(ReaderFcb->Data, Buffer + TempLength,
CopyLength - TempLength);
+		  ReaderFcb->WritePtr = ReaderFcb->Data + CopyLength -
TempLength;
 		}
 
 	      Buffer += CopyLength;
 	      Length -= CopyLength;
 	      Information += CopyLength;
 
-	      Fcb->ReadDataAvailable += CopyLength;
-	      Fcb->WriteQuotaAvailable -= CopyLength;
+	      ReaderFcb->ReadDataAvailable += CopyLength;
+	      ReaderFcb->WriteQuotaAvailable -= CopyLength;
 	    }
 
 	  if (Length == 0)
 	    {
-	      KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT,
FALSE);
+	      KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
 	      break;
 	    }
 	}
@@ -405,23 +357,23 @@
 	  DPRINT("Message mode\n");
 	  if (Length > 0)
 	    {
-	      CopyLength = RtlRosMin(Length, Fcb->WriteQuotaAvailable);
-	      memcpy(Fcb->Data, Buffer, CopyLength);
+	      CopyLength = RtlRosMin(Length,
ReaderFcb->WriteQuotaAvailable);
+	      memcpy(ReaderFcb->Data, Buffer, CopyLength);
 
 	      Information = CopyLength;
-	      Fcb->ReadDataAvailable = CopyLength;
-	      Fcb->WriteQuotaAvailable = 0;
+	      ReaderFcb->ReadDataAvailable = CopyLength;
+	      ReaderFcb->WriteQuotaAvailable = 0;
 	    }
 
 	  if (Information > 0)
 	    {
-	      KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT,
FALSE);
+	      KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE);
 	      break;
 	    }
 	}
     }
 
-  KeReleaseSpinLock(&Fcb->DataListLock, OldIrql);
+  KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql);
 
 done:
   Irp->IoStatus.Status = Status;
  _____  

Modified: trunk/reactos/drivers/fs/np/volume.c
--- trunk/reactos/drivers/fs/np/volume.c	2005-02-26 23:22:48 UTC
(rev 13762)
+++ trunk/reactos/drivers/fs/np/volume.c	2005-02-27 12:43:37 UTC
(rev 13763)
@@ -2,9 +2,9 @@

  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
- * FILE:             services/fs/npfs/volume.c
+ * FILE:             drivers/fs/npfs/volume.c
  * PURPOSE:          Named pipe filesystem
- * PROGRAMMER:       Eric Kohl <ekohl@rz-online.de>
+ * PROGRAMMER:       Eric Kohl
  */
 
 /* INCLUDES
*****************************************************************/
@@ -23,20 +23,20 @@
 NpfsQueryFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
 			     PULONG BufferLength)
 {
-   DPRINT("NpfsQueryFsDeviceInformation()\n");
-   DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
-   
-   if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
-     return(STATUS_BUFFER_OVERFLOW);
-   
-   FsDeviceInfo->DeviceType = FILE_DEVICE_NAMED_PIPE;
-   FsDeviceInfo->Characteristics = 0;
-   
-   *BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
-   
-   DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
-   
-   return(STATUS_SUCCESS);
+  DPRINT("NpfsQueryFsDeviceInformation()\n");
+  DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
+
+  if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
+    return STATUS_BUFFER_OVERFLOW;
+
+  FsDeviceInfo->DeviceType = FILE_DEVICE_NAMED_PIPE;
+  FsDeviceInfo->Characteristics = 0;
+
+  *BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
+
+  DPRINT("NpfsQueryFsDeviceInformation() finished.\n");
+
+   return STATUS_SUCCESS;
 }
 
 
@@ -44,22 +44,22 @@
 NpfsQueryFsAttributeInformation(PFILE_FS_ATTRIBUTE_INFORMATION
FsAttributeInfo,
 				PULONG BufferLength)
 {
-   DPRINT("NpfsQueryFsAttributeInformation() called.\n");
-   DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
-   
-   if (*BufferLength < sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
-     return(STATUS_BUFFER_OVERFLOW);
-   
-   FsAttributeInfo->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
-   FsAttributeInfo->MaximumComponentNameLength = 255;
-   FsAttributeInfo->FileSystemNameLength = 8;
-   wcscpy(FsAttributeInfo->FileSystemName,
-	  L"NPFS");
-   
-   DPRINT("NpfsQueryFsAttributeInformation() finished.\n");
-   *BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
-   
-   return(STATUS_SUCCESS);
+  DPRINT("NpfsQueryFsAttributeInformation() called.\n");
+  DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
+
+  if (*BufferLength < sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
+    return STATUS_BUFFER_OVERFLOW;
+
+  FsAttributeInfo->FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
+  FsAttributeInfo->MaximumComponentNameLength = 255;
+  FsAttributeInfo->FileSystemNameLength = 8;
+  wcscpy(FsAttributeInfo->FileSystemName,
+	 L"NPFS");
+
+  DPRINT("NpfsQueryFsAttributeInformation() finished.\n");
+  *BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
+
+  return STATUS_SUCCESS;
 }
 
 
@@ -67,54 +67,53 @@
 NpfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject,
 			   PIRP Irp)
 {
-   PIO_STACK_LOCATION Stack;
-   FS_INFORMATION_CLASS FsInformationClass;
-   NTSTATUS Status = STATUS_SUCCESS;
-   PVOID SystemBuffer;
-   ULONG BufferLength;
-   
-   /* PRECONDITION */
-   assert(DeviceObject != NULL);
-   assert(Irp != NULL);
-   
-   DPRINT("NpfsQueryVolumeInformation(DeviceObject %x, Irp %x)\n",
-	  DeviceObject,
-	  Irp);
-   
-   Stack = IoGetCurrentIrpStackLocation (Irp);
-   FsInformationClass =
Stack->Parameters.QueryVolume.FsInformationClass;
-   BufferLength = Stack->Parameters.QueryVolume.Length;
-   SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
-   
-   DPRINT("FsInformationClass %d\n", FsInformationClass);
-   DPRINT("SystemBuffer %x\n", SystemBuffer);
-   
-   switch (FsInformationClass)
-     {
-     case FileFsDeviceInformation:
-       Status = NpfsQueryFsDeviceInformation(SystemBuffer,
-					     &BufferLength);
-       break;
-   
-     case FileFsAttributeInformation:
-       Status = NpfsQueryFsAttributeInformation(SystemBuffer,
-						&BufferLength);
-       break;
-   
-     default:
-       Status = STATUS_NOT_SUPPORTED;
-     }
-   
-   Irp->IoStatus.Status = Status;
-   if (NT_SUCCESS(Status))
-     Irp->IoStatus.Information =
-       Stack->Parameters.QueryVolume.Length - BufferLength;
-   else
-     Irp->IoStatus.Information = 0;
-   IoCompleteRequest(Irp,
-		     IO_NO_INCREMENT);
-   
-   return(Status);
+  PIO_STACK_LOCATION Stack;
+  FS_INFORMATION_CLASS FsInformationClass;
+  NTSTATUS Status = STATUS_SUCCESS;
+  PVOID SystemBuffer;
+  ULONG BufferLength;
+
+  /* PRECONDITION */
+  ASSERT(DeviceObject != NULL);
+  ASSERT(Irp != NULL);
+
+  DPRINT("NpfsQueryVolumeInformation(DeviceObject %x, Irp %x)\n",
+	 DeviceObject,
+	 Irp);
+
+  Stack = IoGetCurrentIrpStackLocation(Irp);
+  FsInformationClass =
Stack->Parameters.QueryVolume.FsInformationClass;
+  BufferLength = Stack->Parameters.QueryVolume.Length;
+  SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
+
+  DPRINT("FsInformationClass %d\n", FsInformationClass);
+  DPRINT("SystemBuffer %x\n", SystemBuffer);
+
+  switch (FsInformationClass)
+    {
+      case FileFsDeviceInformation:
+	Status = NpfsQueryFsDeviceInformation(SystemBuffer,
+					      &BufferLength);
+	break;
+
+      case FileFsAttributeInformation:
+	Status = NpfsQueryFsAttributeInformation(SystemBuffer,
+						 &BufferLength);
+	break;
+
+      default:
+	Status = STATUS_NOT_SUPPORTED;
+    }
+
+  Irp->IoStatus.Status = Status;
+  if (NT_SUCCESS(Status))
+    Irp->IoStatus.Information = Stack->Parameters.QueryVolume.Length -
BufferLength;
+  else
+    Irp->IoStatus.Information = 0;
+  IoCompleteRequest(Irp,
+		    IO_NO_INCREMENT);
+
+  return Status;
 }
 
 /* EOF */

[Attachment #3 (text/html)]

<html>
<head>
<style>
<!--
body { background-color:#ffffff }
.file { border:1px solid #eeeeee; margin-top:1em; margin-bottom:1em }
.pathname { font-family:monospace; float:right }
.fileheader { margin-bottom:.5em }
.diff { margin:0 }
.tasklist { padding:4px; border:1px dashed #000000; margin-top:1em }
.tasklist ul { margin-top:0; margin-bottom:0 }
tr.alt { background-color:#eeeeee }
#added { background-color:#ddffdd }
#addedchars { background-color:#99ff99; font-weight:bolder }
tr.alt #added { background-color:#ccf7cc }
#removed { background-color:#ffdddd }
#removedchars { background-color:#ff9999; font-weight:bolder }
tr.alt #removed { background-color:#f7cccc }
#info { color:#888888 }
#context { background-color:#eeeeee }
td {padding-left:.3em; padding-right:.3em }
tr.head { border-bottom-width:1px; border-bottom-style:solid }
tr.head td { padding:0; padding-top:.2em }
.task { background-color:#ffff00 }
.comment { padding:4px; border:1px dashed #000000; background-color:#ffffdd }
.error { color:red }
hr { border-width:0px; height:2px; background:black }
-->
</style>
</head>
<body>
<pre class="comment">- Data is now written to the readers data buffer and the reader \
reads from his own data buffer. This fixes Filip's wrokaround to enable the reader to \
                read data although the writers side was closed.
- Minor cleanup.</pre><pre class="diff" id="context">Modified: \
                trunk/reactos/drivers/fs/np/create.c
Modified: trunk/reactos/drivers/fs/np/finfo.c
Modified: trunk/reactos/drivers/fs/np/fsctrl.c
Modified: trunk/reactos/drivers/fs/np/npfs.c
Modified: trunk/reactos/drivers/fs/np/npfs.h
Modified: trunk/reactos/drivers/fs/np/rw.c
Modified: trunk/reactos/drivers/fs/np/volume.c
</pre><hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/drivers/fs/np/create.c</b></big></div> <pre class="diff"><small \
id="info">--- trunk/reactos/drivers/fs/np/create.c	2005-02-26 23:22:48 UTC (rev \
                13762)
+++ trunk/reactos/drivers/fs/np/create.c	2005-02-27 12:43:37 UTC (rev 13763)
@@ -2,7 +2,7 @@
</small></pre><pre class="diff" id="context"> &nbsp;*
 &nbsp;* COPYRIGHT: &nbsp;See COPYING in the top level directory
 &nbsp;* PROJECT: &nbsp; &nbsp;ReactOS kernel
</pre><pre class="diff" id="removed">- * FILE: &nbsp; &nbsp; &nbsp; <span \
id="removedchars">service</span>s/fs/np/create.c </pre><pre class="diff" id="added">+ \
* FILE: &nbsp; &nbsp; &nbsp; <span id="addedchars">driver</span>s/fs/np/create.c \
</pre><pre class="diff" id="context"> &nbsp;* PURPOSE: &nbsp; &nbsp;Named pipe \
filesystem  &nbsp;* PROGRAMMER: David Welch &lt;welch@cwcom.net&gt;
 &nbsp;*/
@@ -164,9 +164,9 @@
</pre><pre class="diff" id="context"> &nbsp; ClientFcb-&gt;PipeState = SpecialAccess \
? 0 : FILE_PIPE_DISCONNECTED_STATE;  
 &nbsp; /* Initialize data list. */
</pre><pre class="diff" id="removed">- &nbsp;if (Pipe-&gt;<span \
id="removedchars">In</span>boundQuota) </pre><pre class="diff" id="added">+ &nbsp;if \
(Pipe-&gt;<span id="addedchars">Out</span>boundQuota) </pre><pre class="diff" \
id="context"> &nbsp; &nbsp; { </pre><pre class="diff" id="removed">- &nbsp; &nbsp; \
&nbsp;ClientFcb-&gt;Data = ExAllocatePool(NonPagedPool, Pipe-&gt;<span \
id="removedchars">In</span>boundQuota); </pre><pre class="diff" id="added">+ &nbsp; \
&nbsp; &nbsp;ClientFcb-&gt;Data = ExAllocatePool(NonPagedPool, Pipe-&gt;<span \
id="addedchars">Out</span>boundQuota); </pre><pre class="diff" id="context"> &nbsp; \
&nbsp; &nbsp; if (ClientFcb-&gt;Data == NULL)  &nbsp; &nbsp; &nbsp; &nbsp; {
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DPRINT(&quot;No memory!\n&quot;);
@@ -185,8 +185,8 @@
</pre><pre class="diff" id="context"> &nbsp; ClientFcb-&gt;ReadPtr = \
ClientFcb-&gt;Data;  &nbsp; ClientFcb-&gt;WritePtr = ClientFcb-&gt;Data;
 &nbsp; ClientFcb-&gt;ReadDataAvailable = 0;
</pre><pre class="diff" id="removed">- &nbsp;ClientFcb-&gt;WriteQuotaAvailable = \
                Pipe-&gt;InboundQuota;
- &nbsp;ClientFcb-&gt;<span id="removedchars">MaxDataLength = \
Pipe-&gt;In</span>boundQuota; </pre><pre class="diff" id="added">+ \
&nbsp;ClientFcb-&gt;<span id="addedchars">WriteQuotaAvailable = \
Pipe-&gt;Out</span>boundQuota; + &nbsp;ClientFcb-&gt;MaxDataLength = \
Pipe-&gt;OutboundQuota; </pre><pre class="diff" id="context"> &nbsp; \
KeInitializeSpinLock(&amp;ClientFcb-&gt;DataListLock);  &nbsp; \
KeInitializeEvent(&amp;ClientFcb-&gt;ConnectEvent, SynchronizationEvent, FALSE);  \
&nbsp; KeInitializeEvent(&amp;ClientFcb-&gt;Event, SynchronizationEvent, FALSE); @@ \
-381,9 +381,9 @@ </pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; \
&nbsp;KeUnlockMutex(&amp;DeviceExt-&gt;PipeListLock);  &nbsp; &nbsp; &nbsp;}
 
</pre><pre class="diff" id="removed">- &nbsp; if (Pipe-&gt;<span \
id="removedchars">Out</span>boundQuota) </pre><pre class="diff" id="added">+ &nbsp; \
if (Pipe-&gt;<span id="addedchars">In</span>boundQuota) </pre><pre class="diff" \
id="context"> &nbsp; &nbsp; &nbsp;{ </pre><pre class="diff" id="removed">- &nbsp; \
&nbsp; &nbsp; Fcb-&gt;Data = ExAllocatePool(NonPagedPool, Pipe-&gt;<span \
id="removedchars">Out</span>boundQuota); </pre><pre class="diff" id="added">+ &nbsp; \
&nbsp; &nbsp; Fcb-&gt;Data = ExAllocatePool(NonPagedPool, Pipe-&gt;<span \
id="addedchars">In</span>boundQuota); </pre><pre class="diff" id="context"> &nbsp; \
&nbsp; &nbsp; &nbsp;if (Fcb-&gt;Data == NULL)  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ExFreePool(Fcb);
@@ -407,8 +407,8 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp;Fcb-&gt;ReadPtr = Fcb-&gt;Data;
 &nbsp; &nbsp;Fcb-&gt;WritePtr = Fcb-&gt;Data;
 &nbsp; &nbsp;Fcb-&gt;ReadDataAvailable = 0;
</pre><pre class="diff" id="removed">- &nbsp; Fcb-&gt;WriteQuotaAvailable = \
                Pipe-&gt;OutboundQuota;
- &nbsp; Fcb-&gt;<span id="removedchars">MaxDataLength = \
Pipe-&gt;Out</span>boundQuota; </pre><pre class="diff" id="added">+ &nbsp; \
Fcb-&gt;<span id="addedchars">WriteQuotaAvailable = Pipe-&gt;In</span>boundQuota; + \
&nbsp; Fcb-&gt;MaxDataLength = Pipe-&gt;InboundQuota; </pre><pre class="diff" \
id="context"> &nbsp; &nbsp;KeInitializeSpinLock(&amp;Fcb-&gt;DataListLock);  
 &nbsp; &nbsp;Pipe-&gt;CurrentInstances++;
@@ -442,9 +442,8 @@
</pre><pre class="diff" id="context"> 
 
 NTSTATUS STDCALL
</pre><pre class="diff" id="removed">-NpfsClose(
- &nbsp; PDEVICE_OBJECT DeviceObject,
- &nbsp; PIRP Irp)
</pre><pre class="diff" id="added">+NpfsClose(PDEVICE_OBJECT DeviceObject,
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PIRP Irp)
</pre><pre class="diff" id="context"> {
 &nbsp; &nbsp;PNPFS_DEVICE_EXTENSION DeviceExt;
 &nbsp; &nbsp;PIO_STACK_LOCATION IoStack;
@@ -493,10 +492,8 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; if (Fcb-&gt;OtherSide)
 &nbsp; &nbsp; &nbsp; {
</pre><pre class="diff" id="removed">-#ifndef FIN_WORKAROUND_READCLOSE
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;Fcb-&gt;OtherSide-&gt;PipeState = FILE_PIPE_CLOSING_STATE;  &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp;Fcb-&gt;OtherSide-&gt;OtherSide = NULL; </pre><pre class="diff" \
id="removed">-#endif </pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp;/*  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * Signaling the write event. If \
is possible that an other  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * thread waits for an \
empty buffer. @@ -504,40 +501,16 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;KeSetEvent(&amp;Fcb-&gt;OtherSide-&gt;Event, IO_NO_INCREMENT, FALSE);  &nbsp; \
&nbsp; &nbsp; }  
</pre><pre class="diff" id="removed">-#ifndef FIN_WORKAROUND_READCLOSE
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; Fcb-&gt;PipeState = 0;
</pre><pre class="diff" id="removed">-#endif
</pre><pre class="diff" id="context"> &nbsp; &nbsp;}
 
 &nbsp; &nbsp;FileObject-&gt;FsContext = NULL;
 
</pre><pre class="diff" id="removed">-#ifndef FIN_WORKAROUND_READCLOSE
</pre><pre class="diff" id="context"> &nbsp; \
&nbsp;RemoveEntryList(&amp;Fcb-&gt;FcbListEntry);  &nbsp; &nbsp;if (Fcb-&gt;Data)
 &nbsp; &nbsp; &nbsp; ExFreePool(Fcb-&gt;Data);
 &nbsp; &nbsp;ExFreePool(Fcb);
</pre><pre class="diff" id="removed">-#else
- &nbsp; Fcb-&gt;PipeState = FILE_PIPE_CLOSING_STATE;
- &nbsp; if (Fcb-&gt;OtherSide == NULL ||
- &nbsp; &nbsp; &nbsp; Fcb-&gt;OtherSide-&gt;PipeState == FILE_PIPE_CLOSING_STATE)
- &nbsp; {
- &nbsp; &nbsp; &nbsp;if (Server &amp;&amp; Fcb-&gt;OtherSide != NULL &amp;&amp;
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Fcb-&gt;OtherSide-&gt;PipeState == \
                FILE_PIPE_CLOSING_STATE)
- &nbsp; &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp; &nbsp; \
                RemoveEntryList(&amp;Fcb-&gt;OtherSide-&gt;FcbListEntry);
- &nbsp; &nbsp; &nbsp; &nbsp; if (Fcb-&gt;OtherSide-&gt;Data)
- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ExFreePool(Fcb-&gt;OtherSide-&gt;Data);
-	 ExFreePool(Fcb-&gt;OtherSide);
- &nbsp; &nbsp; &nbsp;}
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; \
                &nbsp;RemoveEntryList(&amp;Fcb-&gt;FcbListEntry);
- &nbsp; &nbsp; &nbsp;if (Fcb-&gt;Data)
- &nbsp; &nbsp; &nbsp; &nbsp; ExFreePool(Fcb-&gt;Data);
-
- &nbsp; &nbsp; &nbsp;ExFreePool(Fcb);
- &nbsp; }
-#endif
-
</pre><pre class="diff" id="context"> &nbsp; \
&nbsp;KeUnlockMutex(&amp;Pipe-&gt;FcbListLock);  
 &nbsp; &nbsp;if (IsListEmpty(&amp;Pipe-&gt;ServerFcbListHead) &amp;&amp;
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/drivers/fs/np/finfo.c</b></big></div> <pre class="diff"><small \
                id="info">--- trunk/reactos/drivers/fs/np/finfo.c	2005-02-26 23:22:48 \
                UTC (rev 13762)
+++ trunk/reactos/drivers/fs/np/finfo.c	2005-02-27 12:43:37 UTC (rev 13763)
@@ -2,9 +2,9 @@
</small></pre><pre class="diff" id="context"> &nbsp;*
 &nbsp;* COPYRIGHT: &nbsp;See COPYING in the top level directory
 &nbsp;* PROJECT: &nbsp; &nbsp;ReactOS kernel
</pre><pre class="diff" id="removed">- * FILE: &nbsp; &nbsp; &nbsp; <span \
id="removedchars">service</span>s/fs/np/finfo.c </pre><pre class="diff" id="added">+ \
* FILE: &nbsp; &nbsp; &nbsp; <span id="addedchars">driver</span>s/fs/np/finfo.c \
</pre><pre class="diff" id="context"> &nbsp;* PURPOSE: &nbsp; &nbsp;Named pipe \
filesystem </pre><pre class="diff" id="removed">- * PROGRAMMER: Eric Kohl<span \
id="removedchars"> &lt;ekohl@rz-online.de&gt;</span> </pre><pre class="diff" \
id="added">+ * PROGRAMMER: Eric Kohl </pre><pre class="diff" id="context"> &nbsp;*/
 
 /* INCLUDES ******************************************************************/
@@ -36,7 +36,7 @@
</pre><pre class="diff" id="context"> // &nbsp;Info-&gt;CompletionMode = 
 
 &nbsp; *BufferLength -= sizeof(FILE_PIPE_INFORMATION);
</pre><pre class="diff" id="removed">- &nbsp;return<span \
id="removedchars">(STATUS_SUCCESS)</span>; </pre><pre class="diff" id="added">+ \
&nbsp;return<span id="addedchars"> STATUS_SUCCESS</span>; </pre><pre class="diff" \
id="context"> }  
 
@@ -76,7 +76,7 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; }
 
 &nbsp; *BufferLength -= sizeof(FILE_PIPE_LOCAL_INFORMATION);
</pre><pre class="diff" id="removed">- &nbsp;return<span \
id="removedchars">(STATUS_SUCCESS)</span>; </pre><pre class="diff" id="added">+ \
&nbsp;return<span id="addedchars"> STATUS_SUCCESS</span>; </pre><pre class="diff" \
id="context"> }  
 
@@ -93,24 +93,24 @@
</pre><pre class="diff" id="context"> &nbsp; PVOID SystemBuffer;
 &nbsp; ULONG BufferLength;
 &nbsp; NTSTATUS Status;
</pre><pre class="diff" id="removed">- &nbsp;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> &nbsp; \
DPRINT(&quot;NpfsQueryInformation(DeviceObject %p Irp %p)\n&quot;, DeviceObject, \
Irp); </pre><pre class="diff" id="removed">- &nbsp;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> &nbsp; IoStack = IoGetCurrentIrpStackLocation \
(Irp);  &nbsp; FileInformationClass = \
IoStack-&gt;Parameters.QueryFile.FileInformationClass;  &nbsp; DeviceExtension = \
DeviceObject-&gt;DeviceExtension;  &nbsp; FileObject = IoStack-&gt;FileObject;
 &nbsp; Fcb = (PNPFS_FCB)FileObject-&gt;FsContext;
 &nbsp; Pipe = Fcb-&gt;Pipe;
</pre><pre class="diff" id="removed">- &nbsp;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> &nbsp; SystemBuffer = \
Irp-&gt;AssociatedIrp.SystemBuffer;  &nbsp; BufferLength = \
IoStack-&gt;Parameters.QueryFile.Length; </pre><pre class="diff" id="removed">- \
&nbsp; </pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> &nbsp; DPRINT(&quot;Pipe name: %wZ\n&quot;, \
&amp;Pipe-&gt;PipeName);  &nbsp; DPRINT(&quot;FileInformationClass %d\n&quot;, \
FileInformationClass);  &nbsp; DPRINT(&quot;SystemBuffer %p\n&quot;, SystemBuffer);
 &nbsp; DPRINT(&quot;BufferLength %lu\n&quot;, BufferLength);
</pre><pre class="diff" id="removed">- &nbsp;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> &nbsp; switch (FileInformationClass)
 &nbsp; &nbsp; {
 &nbsp; &nbsp; &nbsp; case FilePipeInformation:
@@ -134,7 +134,7 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; default:
 	Status = STATUS_NOT_SUPPORTED;
 &nbsp; &nbsp; }
</pre><pre class="diff" id="removed">- &nbsp;
</pre><pre class="diff" id="added">+
</pre><pre class="diff" id="context"> &nbsp; Irp-&gt;IoStatus.Status = Status;
 &nbsp; if (NT_SUCCESS(Status))
 &nbsp; &nbsp; Irp-&gt;IoStatus.Information =
@@ -142,8 +142,8 @@
</pre><pre class="diff" id="context"> &nbsp; else
 &nbsp; &nbsp; Irp-&gt;IoStatus.Information = 0;
 &nbsp; IoCompleteRequest (Irp, IO_NO_INCREMENT);
</pre><pre class="diff" id="removed">- &nbsp;
- &nbsp;return(Status);
</pre><pre class="diff" id="added">+
+ &nbsp;return Status;
</pre><pre class="diff" id="context"> }
 
 
@@ -196,7 +196,7 @@
</pre><pre class="diff" id="context"> &nbsp; IoCompleteRequest(Irp,
 		 &nbsp; &nbsp;IO_NO_INCREMENT);
 
</pre><pre class="diff" id="removed">- &nbsp;return<span \
id="removedchars">(Status)</span>; </pre><pre class="diff" id="added">+ \
&nbsp;return<span id="addedchars"> Status</span>; </pre><pre class="diff" \
id="context"> }  
 /* EOF */
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/drivers/fs/np/fsctrl.c</b></big></div> <pre class="diff"><small \
id="info">--- trunk/reactos/drivers/fs/np/fsctrl.c	2005-02-26 23:22:48 UTC (rev \
                13762)
+++ trunk/reactos/drivers/fs/np/fsctrl.c	2005-02-27 12:43:37 UTC (rev 13763)
@@ -2,10 +2,10 @@
</small></pre><pre class="diff" id="context"> &nbsp;*
 &nbsp;* COPYRIGHT: &nbsp;See COPYING in the top level directory
 &nbsp;* PROJECT: &nbsp; &nbsp;ReactOS kernel
</pre><pre class="diff" id="removed">- * FILE: &nbsp; &nbsp; &nbsp; <span \
id="removedchars">service</span>s/fs/np/fsctrl.c </pre><pre class="diff" id="added">+ \
* FILE: &nbsp; &nbsp; &nbsp; <span id="addedchars">driver</span>s/fs/np/fsctrl.c \
</pre><pre class="diff" id="context"> &nbsp;* PURPOSE: &nbsp; &nbsp;Named pipe \
filesystem  &nbsp;* PROGRAMMER: David Welch &lt;welch@cwcom.net&gt;
</pre><pre class="diff" id="removed">- * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
Eric Kohl<span id="removedchars"> &lt;ekohl@rz-online.de&gt;</span> </pre><pre \
class="diff" id="added">+ * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Eric Kohl \
</pre><pre class="diff" id="context"> &nbsp;*/  
 /* INCLUDES ******************************************************************/
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/drivers/fs/np/npfs.c</b></big></div> <pre class="diff"><small \
                id="info">--- trunk/reactos/drivers/fs/np/npfs.c	2005-02-26 23:22:48 \
                UTC (rev 13762)
+++ trunk/reactos/drivers/fs/np/npfs.c	2005-02-27 12:43:37 UTC (rev 13763)
@@ -2,7 +2,7 @@
</small></pre><pre class="diff" id="context"> &nbsp;*
 &nbsp;* COPYRIGHT: &nbsp;See COPYING in the top level directory
 &nbsp;* PROJECT: &nbsp; &nbsp;ReactOS kernel
</pre><pre class="diff" id="removed">- * FILE: &nbsp; &nbsp; &nbsp; <span \
id="removedchars">service</span>s/fs/np/mount.c </pre><pre class="diff" id="added">+ \
* FILE: &nbsp; &nbsp; &nbsp; <span id="addedchars">driver</span>s/fs/np/mount.c \
</pre><pre class="diff" id="context"> &nbsp;* PURPOSE: &nbsp; &nbsp;Named pipe \
filesystem  &nbsp;* PROGRAMMER: David Welch &lt;welch@cwcom.net&gt;
 &nbsp;*/
@@ -64,7 +64,7 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp;if (!NT_SUCCESS(Status))
 &nbsp; &nbsp; &nbsp;{
 	DPRINT(&quot;Failed to create named pipe device! (Status %x)\n&quot;, Status);
</pre><pre class="diff" id="removed">-	return<span id="removedchars">(Status)</span>;
</pre><pre class="diff" id="added">+	return<span id="addedchars"> Status</span>;
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp;}
 &nbsp; &nbsp;
 &nbsp; &nbsp;/* initialize the device object */
@@ -81,7 +81,7 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp;DeviceExtension-&gt;DefaultQuota = \
8 * PAGE_SIZE;  &nbsp; &nbsp;DeviceExtension-&gt;MaxQuota = 64 * PAGE_SIZE;
 
</pre><pre class="diff" id="removed">- &nbsp; return<span \
id="removedchars">(STATUS_SUCCESS)</span>; </pre><pre class="diff" id="added">+ \
&nbsp; return<span id="addedchars"> STATUS_SUCCESS</span>; </pre><pre class="diff" \
id="context"> }  
 /* EOF */
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/drivers/fs/np/npfs.h</b></big></div> <pre class="diff"><small \
                id="info">--- trunk/reactos/drivers/fs/np/npfs.h	2005-02-26 23:22:48 \
                UTC (rev 13762)
+++ trunk/reactos/drivers/fs/np/npfs.h	2005-02-27 12:43:37 UTC (rev 13763)
@@ -1,14 +1,8 @@
</small></pre><pre class="diff" id="context"> /* $Id$ */
 
</pre><pre class="diff" id="removed">-#ifndef __SERVICES_FS_NP_NPFS_H
-#<span id="removedchars">define __SERVICE</span>S_FS_NP_NPFS_H
</pre><pre class="diff" id="added">+#<span id="addedchars">ifndef \
__DRIVER</span>S_FS_NP_NPFS_H +#define __DRIVERS_FS_NP_NPFS_H
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-/*
- * Hacky support for delayed closing of pipes. We need this to support
- * reading from pipe the was closed on one end.
- */
-#define FIN_WORKAROUND_READCLOSE
-
</pre><pre class="diff" id="context"> typedef struct _NPFS_DEVICE_EXTENSION
 {
 &nbsp; LIST_ENTRY PipeListHead;
@@ -70,9 +64,7 @@
</pre><pre class="diff" id="context"> 
 #define KeUnlockMutex(x) KeReleaseMutex(x, FALSE);
 
</pre><pre class="diff" id="removed">-#define CP DPRINT(&quot;\n&quot;);
</pre><pre class="diff" id="context"> 
</pre><pre class="diff" id="removed">-
</pre><pre class="diff" id="context"> NTSTATUS STDCALL NpfsCreate(PDEVICE_OBJECT \
DeviceObject, PIRP Irp);  NTSTATUS STDCALL NpfsCreateNamedPipe(PDEVICE_OBJECT \
DeviceObject, PIRP Irp);  NTSTATUS STDCALL NpfsClose(PDEVICE_OBJECT DeviceObject, \
PIRP Irp); @@ -89,4 +81,4 @@
</pre><pre class="diff" id="context"> 
 NTSTATUS STDCALL NpfsQueryVolumeInformation (PDEVICE_OBJECT DeviceObject, PIRP Irp);
 
</pre><pre class="diff" id="removed">-#endif /* __<span \
id="removedchars">SERVICE</span>S_FS_NP_NPFS_H */ </pre><pre class="diff" \
id="added">+#endif /* __<span id="addedchars">DRIVER</span>S_FS_NP_NPFS_H */ \
</pre></div> <hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/drivers/fs/np/rw.c</b></big></div> <pre class="diff"><small \
                id="info">--- trunk/reactos/drivers/fs/np/rw.c	2005-02-26 23:22:48 \
                UTC (rev 13762)
+++ trunk/reactos/drivers/fs/np/rw.c	2005-02-27 12:43:37 UTC (rev 13763)
@@ -2,7 +2,7 @@
</small></pre><pre class="diff" id="context"> &nbsp;*
 &nbsp;* COPYRIGHT: &nbsp;See COPYING in the top level directory
 &nbsp;* PROJECT: &nbsp; &nbsp;ReactOS kernel
</pre><pre class="diff" id="removed">- * FILE: &nbsp; &nbsp; &nbsp; <span \
id="removedchars">service</span>s/fs/np/rw.c </pre><pre class="diff" id="added">+ * \
FILE: &nbsp; &nbsp; &nbsp; <span id="addedchars">driver</span>s/fs/np/rw.c </pre><pre \
class="diff" id="context"> &nbsp;* PURPOSE: &nbsp; &nbsp;Named pipe filesystem  \
&nbsp;* PROGRAMMER: David Welch &lt;welch@cwcom.net&gt;  &nbsp;*/
@@ -16,8 +16,6 @@
</pre><pre class="diff" id="context"> #define NDEBUG
 #include &lt;debug.h&gt;
 
</pre><pre class="diff" id="removed">-#define FIN_WORKAROUND_READCLOSE
-
</pre><pre class="diff" id="context"> /* FUNCTIONS \
*****************************************************************/  
 #ifndef NDEBUG
@@ -60,7 +58,7 @@
</pre><pre class="diff" id="context"> &nbsp; KIRQL OldIrql;
 &nbsp; ULONG Information;
 &nbsp; PNPFS_FCB Fcb;
</pre><pre class="diff" id="removed">- &nbsp;PNPFS_FCB <span \
id="removedchars">Read</span>Fcb; </pre><pre class="diff" id="added">+ \
&nbsp;PNPFS_FCB <span id="addedchars">Writer</span>Fcb; </pre><pre class="diff" \
id="context"> &nbsp; PNPFS_PIPE Pipe;  &nbsp; ULONG Length;
 &nbsp; PVOID Buffer;
@@ -74,22 +72,8 @@
</pre><pre class="diff" id="context"> &nbsp; FileObject = IoStack-&gt;FileObject;
 &nbsp; Fcb = FileObject-&gt;FsContext;
 &nbsp; Pipe = Fcb-&gt;Pipe;
</pre><pre class="diff" id="removed">- &nbsp;<span id="removedchars">Read</span>Fcb = \
Fcb-&gt;OtherSide; </pre><pre class="diff" id="added">+ &nbsp;<span \
id="addedchars">Writer</span>Fcb = Fcb-&gt;OtherSide; </pre><pre class="diff" \
id="context">  </pre><pre class="diff" id="removed">- &nbsp;if (ReadFcb == NULL)
- &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp;DPRINT(&quot;Pipe is NOT connected!\n&quot;);
- &nbsp; &nbsp; &nbsp;if (Fcb-&gt;PipeState == FILE_PIPE_LISTENING_STATE)
- &nbsp; &nbsp; &nbsp; &nbsp;Status = STATUS_PIPE_LISTENING;
- &nbsp; &nbsp; &nbsp;else if (Fcb-&gt;PipeState == FILE_PIPE_DISCONNECTED_STATE)
- &nbsp; &nbsp; &nbsp; &nbsp;Status = STATUS_PIPE_DISCONNECTED;
- &nbsp; &nbsp; &nbsp;else
- &nbsp; &nbsp; &nbsp; &nbsp;Status = STATUS_PIPE_BROKEN;
- &nbsp; &nbsp; &nbsp;Information = 0;
- &nbsp; &nbsp; &nbsp;DPRINT(&quot;%x\n&quot;, Status);
- &nbsp; &nbsp; &nbsp;goto done;
- &nbsp; &nbsp;}
-
</pre><pre class="diff" id="context"> &nbsp; if (Irp-&gt;MdlAddress == NULL)
 &nbsp; &nbsp; {
 &nbsp; &nbsp; &nbsp; DPRINT(&quot;Irp-&gt;MdlAddress == NULL\n&quot;);
@@ -98,7 +82,7 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; goto done;
 &nbsp; &nbsp; }
 
</pre><pre class="diff" id="removed">- &nbsp;if (<span \
id="removedchars">Read</span>Fcb-&gt;Data == NULL) </pre><pre class="diff" \
id="added">+ &nbsp;if (Fcb-&gt;Data == NULL) </pre><pre class="diff" id="context"> \
&nbsp; &nbsp; {  &nbsp; &nbsp; &nbsp; DPRINT(&quot;Pipe is NOT readable!\n&quot;);
 &nbsp; &nbsp; &nbsp; Status = STATUS_UNSUCCESSFUL;
@@ -106,31 +90,20 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; goto done;
 &nbsp; &nbsp; }
 
</pre><pre class="diff" id="removed">-#ifdef FIN_WORKAROUND_READCLOSE
- &nbsp;if (ReadFcb-&gt;ReadDataAvailable == 0 &amp;&amp;
- &nbsp; &nbsp; &nbsp;ReadFcb-&gt;PipeState == FILE_PIPE_CLOSING_STATE)
- &nbsp; &nbsp;{
- &nbsp; &nbsp; &nbsp;DPRINT(&quot;Other end of pipe is closed!\n&quot;);
- &nbsp; &nbsp; &nbsp;Status = STATUS_PIPE_BROKEN;
- &nbsp; &nbsp; &nbsp;Information = 0;
- &nbsp; &nbsp; &nbsp;goto done;
- &nbsp; &nbsp;}
-#endif
-
</pre><pre class="diff" id="context"> &nbsp; Status = STATUS_SUCCESS;
 &nbsp; Length = IoStack-&gt;Parameters.Read.Length;
 &nbsp; Information = 0;
 
 &nbsp; Buffer = MmGetSystemAddressForMdl(Irp-&gt;MdlAddress);
</pre><pre class="diff" id="removed">- &nbsp;KeAcquireSpinLock(&amp;<span \
id="removedchars">Read</span>Fcb-&gt;DataListLock, &amp;OldIrql); </pre><pre \
class="diff" id="added">+ &nbsp;KeAcquireSpinLock(&amp;Fcb-&gt;DataListLock, \
&amp;OldIrql); </pre><pre class="diff" id="context"> &nbsp; while (1)
 &nbsp; &nbsp; {
 &nbsp; &nbsp; &nbsp; /* FIXME: check if in blocking mode */
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp;if (<span \
id="removedchars">Read</span>Fcb-&gt;ReadDataAvailable == 0) </pre><pre class="diff" \
id="added">+ &nbsp; &nbsp; &nbsp;if (Fcb-&gt;ReadDataAvailable == 0) </pre><pre \
class="diff" id="context"> 	{  &nbsp;KeResetEvent(&amp;Fcb-&gt;Event);
</pre><pre class="diff" id="removed">-	 &nbsp;KeSetEvent(&amp;ReadFcb-&gt;Event, \
                IO_NO_INCREMENT, FALSE);
-	 &nbsp;Ke<span id="removedchars">ReleaseSpinLock(&amp;ReadFcb-&gt;DataListLock, \
OldIrql</span>); </pre><pre class="diff" id="added">+	 &nbsp;Ke<span \
id="addedchars">SetEvent(&amp;WriterFcb-&gt;Event, IO_NO_INCREMENT, FALSE</span>); +	 \
&nbsp;KeReleaseSpinLock(&amp;Fcb-&gt;DataListLock, OldIrql); </pre><pre class="diff" \
id="context"> 	 &nbsp;if (Information &gt; 0)  &nbsp; &nbsp;{
 	 &nbsp; &nbsp; &nbsp;Status = STATUS_SUCCESS;
@@ -153,56 +126,44 @@
</pre><pre class="diff" id="context"> 				 &nbsp; &nbsp; &nbsp; &nbsp; NULL);
 	 &nbsp;DPRINT(&quot;Finished waiting (%S)! Status: %x\n&quot;, \
Pipe-&gt;PipeName.Buffer, Status);  
</pre><pre class="diff" id="removed">-#ifndef FIN_WORKAROUND_READCLOSE
-	 &nbsp;/*
-	 &nbsp; * It's possible that the event was signaled because the
-	 &nbsp; * other side of pipe was closed.
-	 &nbsp; */
-	 &nbsp;if (Fcb-&gt;PipeState != FILE_PIPE_CONNECTED_STATE)
-	 &nbsp; &nbsp;{
-	 &nbsp; &nbsp; &nbsp;DPRINT(&quot;PipeState: %x\n&quot;, Fcb-&gt;PipeState);
-	 &nbsp; &nbsp; &nbsp;Status = STATUS_PIPE_BROKEN;
-	 &nbsp; &nbsp; &nbsp;goto done;
-	 &nbsp; &nbsp;}
-#endif
-	 &nbsp;KeAcquireSpinLock(&amp;<span \
id="removedchars">Read</span>Fcb-&gt;DataListLock, &amp;OldIrql); </pre><pre \
class="diff" id="added">+	 &nbsp;KeAcquireSpinLock(&amp;Fcb-&gt;DataListLock, \
&amp;OldIrql); </pre><pre class="diff" id="context"> 	}
 
 &nbsp; &nbsp; &nbsp; if (Pipe-&gt;ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
 	{
 	 &nbsp;DPRINT(&quot;Byte stream mode\n&quot;);
 	 &nbsp;/* Byte stream mode */
</pre><pre class="diff" id="removed">-	 &nbsp;while (Length &gt; 0 &amp;&amp; <span \
id="removedchars">Read</span>Fcb-&gt;ReadDataAvailable &gt; 0) </pre><pre \
class="diff" id="added">+	 &nbsp;while (Length &gt; 0 &amp;&amp; \
Fcb-&gt;ReadDataAvailable &gt; 0) </pre><pre class="diff" id="context"> 	 &nbsp; \
&nbsp;{ </pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;CopyLength = \
                RtlRosMin(ReadFcb-&gt;ReadDataAvailable, Length);
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">if (ReadFcb-&gt;ReadPtr + CopyLength \
&lt;= ReadFcb-&gt;Data + ReadFcb-&gt;MaxDataLength)</span> </pre><pre class="diff" \
id="added">+	 &nbsp; &nbsp; &nbsp;<span id="addedchars">CopyLength = \
RtlRosMin(Fcb-&gt;ReadDataAvailable, Length);</span> +	 &nbsp; &nbsp; &nbsp;if \
(Fcb-&gt;ReadPtr + CopyLength &lt;= Fcb-&gt;Data + Fcb-&gt;MaxDataLength) </pre><pre \
class="diff" id="context"> 		{ </pre><pre class="diff" id="removed">-		 \
                &nbsp;memcpy(Buffer, ReadFcb-&gt;ReadPtr, CopyLength);
-		 &nbsp;ReadFcb-&gt;ReadPtr += CopyLength;
-		 &nbsp;<span id="removedchars">if (ReadFcb-&gt;ReadPtr == ReadFcb-&gt;Data + \
ReadFcb-&gt;MaxDataLength)</span> </pre><pre class="diff" id="added">+		 &nbsp;<span \
id="addedchars">memcpy(Buffer, Fcb-&gt;ReadPtr, CopyLength);</span> +		 \
&nbsp;Fcb-&gt;ReadPtr += CopyLength; +		 &nbsp;if (Fcb-&gt;ReadPtr == Fcb-&gt;Data + \
Fcb-&gt;MaxDataLength) </pre><pre class="diff" id="context"> 		 &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">-		 &nbsp; &nbsp; &nbsp;<span \
id="removedchars">ReadFcb-&gt;ReadPtr = Read</span>Fcb-&gt;Data; </pre><pre \
class="diff" id="added">+		 &nbsp; &nbsp; &nbsp;<span id="addedchars">Fcb-&gt;ReadPtr \
= </span>Fcb-&gt;Data; </pre><pre class="diff" id="context"> 		 &nbsp; &nbsp;}
 		}
 	 &nbsp; &nbsp; &nbsp;else
 		{
</pre><pre class="diff" id="removed">-		 &nbsp;TempLength = ReadFcb-&gt;Data + \
                ReadFcb-&gt;MaxDataLength - ReadFcb-&gt;ReadPtr;
-		 &nbsp;memcpy(Buffer, ReadFcb-&gt;ReadPtr, TempLength);
-		 &nbsp;memcpy(Buffer + TempLength, ReadFcb-&gt;Data, CopyLength - TempLength);
-		 &nbsp;<span id="removedchars">ReadFcb-&gt;ReadPtr = ReadFcb-&gt;Data + CopyLength \
- TempLength</span>; </pre><pre class="diff" id="added">+		 &nbsp;<span \
id="addedchars">TempLength = Fcb-&gt;Data + Fcb-&gt;MaxDataLength - \
Fcb-&gt;ReadPtr</span>; +		 &nbsp;memcpy(Buffer, Fcb-&gt;ReadPtr, TempLength);
+		 &nbsp;memcpy(Buffer + TempLength, Fcb-&gt;Data, CopyLength - TempLength);
+		 &nbsp;Fcb-&gt;ReadPtr = Fcb-&gt;Data + CopyLength - TempLength;
</pre><pre class="diff" id="context"> 		}
 
 	 &nbsp; &nbsp; &nbsp;Buffer += CopyLength;
 	 &nbsp; &nbsp; &nbsp;Length -= CopyLength;
 	 &nbsp; &nbsp; &nbsp;Information += CopyLength;
 
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; \
                &nbsp;ReadFcb-&gt;ReadDataAvailable -= CopyLength;
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">ReadFcb-&gt;WriteQuotaAvailable \
+</span>= CopyLength; </pre><pre class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;<span \
id="addedchars">Fcb-&gt;ReadDataAvailable -</span>= CopyLength; +	 &nbsp; &nbsp; \
&nbsp;Fcb-&gt;WriteQuotaAvailable += CopyLength; </pre><pre class="diff" \
id="context"> 	 &nbsp; &nbsp;}  
 	 &nbsp;if (Length == 0)
 	 &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="removedchars">Read</span>Fcb-&gt;Event, IO_NO_INCREMENT, FALSE); </pre><pre \
class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="addedchars">Writer</span>Fcb-&gt;Event, IO_NO_INCREMENT, FALSE); </pre><pre \
class="diff" id="context"> 	 &nbsp; &nbsp; &nbsp;break;  &nbsp; &nbsp;}
 	}
@@ -211,11 +172,11 @@
</pre><pre class="diff" id="context"> 	 &nbsp;DPRINT(&quot;Message mode\n&quot;);
 
 	 &nbsp;/* Message mode */
</pre><pre class="diff" id="removed">-	 &nbsp;if (<span \
id="removedchars">Read</span>Fcb-&gt;ReadDataAvailable) </pre><pre class="diff" \
id="added">+	 &nbsp;if (Fcb-&gt;ReadDataAvailable) </pre><pre class="diff" \
id="context"> 	 &nbsp; &nbsp;{  &nbsp; &nbsp; &nbsp;/* Truncate the message if the \
receive buffer is too small */ </pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; \
                &nbsp;CopyLength = RtlRosMin(ReadFcb-&gt;ReadDataAvailable, Length);
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">memcpy(Buffer, ReadFcb-&gt;Data, \
Copy</span>Length); </pre><pre class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;<span \
id="addedchars">CopyLength = RtlRosMin(Fcb-&gt;ReadDataAvailable, </span>Length); +	 \
&nbsp; &nbsp; &nbsp;memcpy(Buffer, Fcb-&gt;Data, CopyLength); </pre><pre class="diff" \
id="context">   #ifndef NDEBUG
 	 &nbsp; &nbsp; &nbsp;DPRINT(&quot;Length %d Buffer %x\n&quot;,CopyLength,Buffer);
@@ -223,28 +184,19 @@
</pre><pre class="diff" id="context"> #endif
 
 	 &nbsp; &nbsp; &nbsp;Information = CopyLength;
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; \
                &nbsp;ReadFcb-&gt;ReadDataAvailable = 0;
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">ReadFcb-&gt;WriteQuotaAvailable = \
ReadFcb-&gt;MaxDataLength</span>; </pre><pre class="diff" id="added">+	 &nbsp; &nbsp; \
&nbsp;<span id="addedchars">Fcb-&gt;ReadDataAvailable = 0</span>; +	 &nbsp; &nbsp; \
&nbsp;Fcb-&gt;WriteQuotaAvailable = Fcb-&gt;MaxDataLength; </pre><pre class="diff" \
id="context"> 	 &nbsp; &nbsp;}  
 	 &nbsp;if (Information &gt; 0)
 	 &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="removedchars">Read</span>Fcb-&gt;Event, IO_NO_INCREMENT, FALSE); </pre><pre \
class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="addedchars">Writer</span>Fcb-&gt;Event, IO_NO_INCREMENT, FALSE); </pre><pre \
class="diff" id="context"> 	 &nbsp; &nbsp; &nbsp;break;  &nbsp; &nbsp;}
 	}
</pre><pre class="diff" id="removed">-
-#ifdef FIN_WORKAROUND_READCLOSE
- &nbsp; &nbsp; &nbsp;if (ReadFcb-&gt;ReadDataAvailable == 0 &amp;&amp;
-	 &nbsp;ReadFcb-&gt;PipeState == FILE_PIPE_CLOSING_STATE)
-	{
-	 &nbsp;DPRINT(&quot;Other end of pipe is closed!\n&quot;);
-	 &nbsp;break;
-	}
-#endif
</pre><pre class="diff" id="context"> &nbsp; &nbsp; }
 
</pre><pre class="diff" id="removed">- &nbsp;KeReleaseSpinLock(&amp;<span \
id="removedchars">Read</span>Fcb-&gt;DataListLock, OldIrql); </pre><pre class="diff" \
id="added">+ &nbsp;KeReleaseSpinLock(&amp;Fcb-&gt;DataListLock, OldIrql); </pre><pre \
class="diff" id="context">   done:
 &nbsp; Irp-&gt;IoStatus.Status = Status;
@@ -265,6 +217,7 @@
</pre><pre class="diff" id="context"> &nbsp; PIO_STACK_LOCATION IoStack;
 &nbsp; PFILE_OBJECT FileObject;
 &nbsp; PNPFS_FCB Fcb = NULL;
</pre><pre class="diff" id="added">+ &nbsp;PNPFS_FCB ReaderFcb;
</pre><pre class="diff" id="context"> &nbsp; PNPFS_PIPE Pipe = NULL;
 &nbsp; PUCHAR Buffer;
 &nbsp; NTSTATUS Status = STATUS_SUCCESS;
@@ -283,6 +236,7 @@
</pre><pre class="diff" id="context"> &nbsp; DPRINT(&quot;Pipe name %wZ\n&quot;, \
&amp;FileObject-&gt;FileName);  
 &nbsp; Fcb = FileObject-&gt;FsContext;
</pre><pre class="diff" id="added">+ &nbsp;ReaderFcb = Fcb-&gt;OtherSide;
</pre><pre class="diff" id="context"> &nbsp; Pipe = Fcb-&gt;Pipe;
 
 &nbsp; Length = IoStack-&gt;Parameters.Write.Length;
@@ -297,7 +251,7 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; goto done;
 &nbsp; &nbsp; }
 
</pre><pre class="diff" id="removed">- &nbsp;if (<span \
id="removedchars">Fcb-&gt;OtherSide</span> == NULL) </pre><pre class="diff" \
id="added">+ &nbsp;if (<span id="addedchars">ReaderFcb</span> == NULL) </pre><pre \
class="diff" id="context"> &nbsp; &nbsp; {  &nbsp; &nbsp; &nbsp; DPRINT(&quot;Pipe is \
NOT connected!\n&quot;);  &nbsp; &nbsp; &nbsp; if (Fcb-&gt;PipeState == \
FILE_PIPE_LISTENING_STATE) @@ -310,7 +264,7 @@
</pre><pre class="diff" id="context"> &nbsp; &nbsp; &nbsp; goto done;
 &nbsp; &nbsp; }
 
</pre><pre class="diff" id="removed">- &nbsp;if (Fcb-&gt;Data == NULL)
</pre><pre class="diff" id="added">+ &nbsp;if (<span \
id="addedchars">Reader</span>Fcb-&gt;Data == NULL) </pre><pre class="diff" \
id="context"> &nbsp; &nbsp; {  &nbsp; &nbsp; &nbsp; DPRINT(&quot;Pipe is NOT \
writable!\n&quot;);  &nbsp; &nbsp; &nbsp; Status = STATUS_UNSUCCESSFUL;
@@ -321,7 +275,7 @@
</pre><pre class="diff" id="context"> &nbsp; Status = STATUS_SUCCESS;
 &nbsp; Buffer = MmGetSystemAddressForMdl (Irp-&gt;MdlAddress);
 
</pre><pre class="diff" id="removed">- \
&nbsp;KeAcquireSpinLock(&amp;Fcb-&gt;DataListLock, &amp;OldIrql); </pre><pre \
class="diff" id="added">+ &nbsp;KeAcquireSpinLock(&amp;<span \
id="addedchars">Reader</span>Fcb-&gt;DataListLock, &amp;OldIrql); </pre><pre \
class="diff" id="context"> #ifndef NDEBUG  &nbsp; DPRINT(&quot;Length %d Buffer %x \
Offset %x\n&quot;,Length,Buffer,Offset);  &nbsp; HexDump(Buffer, Length);
@@ -329,11 +283,11 @@
</pre><pre class="diff" id="context"> 
 &nbsp; while(1)
 &nbsp; &nbsp; {
</pre><pre class="diff" id="removed">- &nbsp; &nbsp; &nbsp;if \
(Fcb-&gt;WriteQuotaAvailable == 0) </pre><pre class="diff" id="added">+ &nbsp; &nbsp; \
&nbsp;if (<span id="addedchars">Reader</span>Fcb-&gt;WriteQuotaAvailable == 0) \
</pre><pre class="diff" id="context"> 	{  &nbsp;KeResetEvent(&amp;Fcb-&gt;Event);
</pre><pre class="diff" id="removed">-	 \
                &nbsp;KeSetEvent(&amp;Fcb-&gt;OtherSide-&gt;Event, IO_NO_INCREMENT, \
                FALSE);
-	 &nbsp;Ke<span id="removedchars">ReleaseSpinLock(&amp;Fcb-&gt;DataListLock, \
OldIrql</span>); </pre><pre class="diff" id="added">+	 &nbsp;Ke<span \
id="addedchars">SetEvent(&amp;ReaderFcb-&gt;Event, IO_NO_INCREMENT, FALSE</span>); +	 \
&nbsp;KeReleaseSpinLock(&amp;ReaderFcb-&gt;DataListLock, OldIrql); </pre><pre \
class="diff" id="context"> 	 &nbsp;if (Fcb-&gt;PipeState != \
FILE_PIPE_CONNECTED_STATE)  &nbsp; &nbsp;{
 	 &nbsp; &nbsp; &nbsp;Status = STATUS_PIPE_BROKEN;
@@ -348,7 +302,6 @@
</pre><pre class="diff" id="context"> 				 &nbsp; &nbsp; &nbsp; &nbsp; NULL);
 	 &nbsp;DPRINT(&quot;Finished waiting (%S)! Status: %x\n&quot;, \
Pipe-&gt;PipeName.Buffer, Status);  
</pre><pre class="diff" id="removed">-#ifndef FIN_WORKAROUND_READCLOSE
</pre><pre class="diff" id="context"> 	 &nbsp;/*
 	 &nbsp; * It's possible that the event was signaled because the
 	 &nbsp; * other side of pipe was closed.
@@ -359,44 +312,43 @@
</pre><pre class="diff" id="context"> 	 &nbsp; &nbsp; &nbsp;Status = \
STATUS_PIPE_BROKEN;  &nbsp; &nbsp; &nbsp;goto done;
 	 &nbsp; &nbsp;}
</pre><pre class="diff" id="removed">-#endif
-	 &nbsp;KeAcquireSpinLock(&amp;Fcb-&gt;DataListLock, &amp;OldIrql);
</pre><pre class="diff" id="added">+	 &nbsp;KeAcquireSpinLock(&amp;<span \
id="addedchars">Reader</span>Fcb-&gt;DataListLock, &amp;OldIrql); </pre><pre \
class="diff" id="context"> 	}  
 &nbsp; &nbsp; &nbsp; if (Pipe-&gt;WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
 	{
 	 &nbsp;DPRINT(&quot;Byte stream mode\n&quot;);
</pre><pre class="diff" id="removed">-	 &nbsp;while (Length &gt; 0 &amp;&amp; \
Fcb-&gt;WriteQuotaAvailable &gt; 0) </pre><pre class="diff" id="added">+	 &nbsp;while \
(Length &gt; 0 &amp;&amp; <span \
id="addedchars">Reader</span>Fcb-&gt;WriteQuotaAvailable &gt; 0) </pre><pre \
class="diff" id="context"> 	 &nbsp; &nbsp;{ </pre><pre class="diff" id="removed">-	 \
                &nbsp; &nbsp; &nbsp;CopyLength = RtlRosMin(Length, \
                Fcb-&gt;WriteQuotaAvailable);
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">if (Fcb-&gt;WritePtr + CopyLength \
&lt;= Fcb-&gt;Data + Fcb-&gt;MaxDataLength)</span> </pre><pre class="diff" \
id="added">+	 &nbsp; &nbsp; &nbsp;<span id="addedchars">CopyLength = \
RtlRosMin(Length, ReaderFcb-&gt;WriteQuotaAvailable);</span> +	 &nbsp; &nbsp; \
&nbsp;if (ReaderFcb-&gt;WritePtr + CopyLength &lt;= ReaderFcb-&gt;Data + \
ReaderFcb-&gt;MaxDataLength) </pre><pre class="diff" id="context"> 		{
</pre><pre class="diff" id="removed">-		 &nbsp;memcpy(Fcb-&gt;WritePtr, Buffer, \
                CopyLength);
-		 &nbsp;Fcb-&gt;WritePtr += CopyLength;
-		 &nbsp;<span id="removedchars">if (Fcb-&gt;WritePtr == Fcb-&gt;Data + \
Fcb-&gt;MaxDataLength)</span> </pre><pre class="diff" id="added">+		 &nbsp;<span \
id="addedchars">memcpy(ReaderFcb-&gt;WritePtr, Buffer, CopyLength);</span> +		 \
&nbsp;ReaderFcb-&gt;WritePtr += CopyLength; +		 &nbsp;if (ReaderFcb-&gt;WritePtr == \
ReaderFcb-&gt;Data + ReaderFcb-&gt;MaxDataLength) </pre><pre class="diff" \
id="context"> 		 &nbsp; &nbsp;{ </pre><pre class="diff" id="removed">-		 &nbsp; \
&nbsp; &nbsp;<span id="removedchars">Fcb-&gt;WritePtr = </span>Fcb-&gt;Data; \
</pre><pre class="diff" id="added">+		 &nbsp; &nbsp; &nbsp;<span \
id="addedchars">ReaderFcb-&gt;WritePtr = Reader</span>Fcb-&gt;Data; </pre><pre \
class="diff" id="context"> 		 &nbsp; &nbsp;}  }
 	 &nbsp; &nbsp; &nbsp;else
 		{
</pre><pre class="diff" id="removed">-		 &nbsp;TempLength = Fcb-&gt;Data + \
                Fcb-&gt;MaxDataLength - Fcb-&gt;WritePtr;
-		 &nbsp;memcpy(Fcb-&gt;WritePtr, Buffer, TempLength);
-		 &nbsp;memcpy(Fcb-&gt;Data, Buffer + TempLength, CopyLength - TempLength);
-		 &nbsp;<span id="removedchars">Fcb-&gt;WritePtr = Fcb-&gt;Data + CopyLength - \
TempLength</span>; </pre><pre class="diff" id="added">+		 &nbsp;<span \
id="addedchars">TempLength = ReaderFcb-&gt;Data + ReaderFcb-&gt;MaxDataLength - \
ReaderFcb-&gt;WritePtr</span>; +		 &nbsp;memcpy(ReaderFcb-&gt;WritePtr, Buffer, \
TempLength); +		 &nbsp;memcpy(ReaderFcb-&gt;Data, Buffer + TempLength, CopyLength - \
TempLength); +		 &nbsp;ReaderFcb-&gt;WritePtr = ReaderFcb-&gt;Data + CopyLength - \
TempLength; </pre><pre class="diff" id="context"> 		}
 
 	 &nbsp; &nbsp; &nbsp;Buffer += CopyLength;
 	 &nbsp; &nbsp; &nbsp;Length -= CopyLength;
 	 &nbsp; &nbsp; &nbsp;Information += CopyLength;
 
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;Fcb-&gt;ReadDataAvailable \
                += CopyLength;
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">Fcb-&gt;WriteQuotaAvailable -</span>= \
CopyLength; </pre><pre class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;<span \
id="addedchars">ReaderFcb-&gt;ReadDataAvailable +</span>= CopyLength; +	 &nbsp; \
&nbsp; &nbsp;ReaderFcb-&gt;WriteQuotaAvailable -= CopyLength; </pre><pre class="diff" \
id="context"> 	 &nbsp; &nbsp;}  
 	 &nbsp;if (Length == 0)
 	 &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="removedchars">Fcb-&gt;OtherSide</span>-&gt;Event, IO_NO_INCREMENT, FALSE); \
</pre><pre class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="addedchars">ReaderFcb</span>-&gt;Event, IO_NO_INCREMENT, FALSE); </pre><pre \
class="diff" id="context"> 	 &nbsp; &nbsp; &nbsp;break;  &nbsp; &nbsp;}
 	}
@@ -405,23 +357,23 @@
</pre><pre class="diff" id="context"> 	 &nbsp;DPRINT(&quot;Message mode\n&quot;);
 	 &nbsp;if (Length &gt; 0)
 	 &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;CopyLength = \
                RtlRosMin(Length, Fcb-&gt;WriteQuotaAvailable);
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">memcpy(Fcb-&gt;Data, Buffer, \
CopyLength</span>); </pre><pre class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;<span \
id="addedchars">CopyLength = RtlRosMin(Length, \
ReaderFcb-&gt;WriteQuotaAvailable</span>); +	 &nbsp; &nbsp; \
&nbsp;memcpy(ReaderFcb-&gt;Data, Buffer, CopyLength); </pre><pre class="diff" \
id="context">   &nbsp; &nbsp; &nbsp;Information = CopyLength;
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;Fcb-&gt;ReadDataAvailable \
                = CopyLength;
-	 &nbsp; &nbsp; &nbsp;<span id="removedchars">Fcb-&gt;WriteQuotaAvailable = \
0</span>; </pre><pre class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;<span \
id="addedchars">ReaderFcb-&gt;ReadDataAvailable = CopyLength</span>; +	 &nbsp; &nbsp; \
&nbsp;ReaderFcb-&gt;WriteQuotaAvailable = 0; </pre><pre class="diff" id="context"> 	 \
&nbsp; &nbsp;}  
 	 &nbsp;if (Information &gt; 0)
 	 &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">-	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="removedchars">Fcb-&gt;OtherSide</span>-&gt;Event, IO_NO_INCREMENT, FALSE); \
</pre><pre class="diff" id="added">+	 &nbsp; &nbsp; &nbsp;KeSetEvent(&amp;<span \
id="addedchars">ReaderFcb</span>-&gt;Event, IO_NO_INCREMENT, FALSE); </pre><pre \
class="diff" id="context"> 	 &nbsp; &nbsp; &nbsp;break;  &nbsp; &nbsp;}
 	}
 &nbsp; &nbsp; }
 
</pre><pre class="diff" id="removed">- \
&nbsp;KeReleaseSpinLock(&amp;Fcb-&gt;DataListLock, OldIrql); </pre><pre class="diff" \
id="added">+ &nbsp;KeReleaseSpinLock(&amp;<span \
id="addedchars">Reader</span>Fcb-&gt;DataListLock, OldIrql); </pre><pre class="diff" \
id="context">   done:
 &nbsp; Irp-&gt;IoStatus.Status = Status;
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/drivers/fs/np/volume.c</b></big></div> <pre class="diff"><small \
id="info">--- trunk/reactos/drivers/fs/np/volume.c	2005-02-26 23:22:48 UTC (rev \
                13762)
+++ trunk/reactos/drivers/fs/np/volume.c	2005-02-27 12:43:37 UTC (rev 13763)
@@ -2,9 +2,9 @@
</small></pre><pre class="diff" id="context"> &nbsp;*
 &nbsp;* COPYRIGHT: &nbsp; &nbsp; &nbsp; &nbsp;See COPYING in the top level directory
 &nbsp;* PROJECT: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ReactOS kernel
</pre><pre class="diff" id="removed">- * FILE: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; <span id="removedchars">service</span>s/fs/npfs/volume.c </pre><pre \
class="diff" id="added">+ * FILE: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span \
id="addedchars">driver</span>s/fs/npfs/volume.c </pre><pre class="diff" id="context"> \
&nbsp;* PURPOSE: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Named pipe filesystem </pre><pre \
class="diff" id="removed">- * PROGRAMMER: &nbsp; &nbsp; &nbsp; Eric Kohl<span \
id="removedchars"> &lt;ekohl@rz-online.de&gt;</span> </pre><pre class="diff" \
id="added">+ * PROGRAMMER: &nbsp; &nbsp; &nbsp; Eric Kohl </pre><pre class="diff" \
id="context"> &nbsp;*/  
 /* INCLUDES *****************************************************************/
@@ -23,20 +23,20 @@
</pre><pre class="diff" id="context"> \
NpfsQueryFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,  &nbsp; &nbsp; \
PULONG BufferLength)  {
</pre><pre class="diff" id="removed">- &nbsp; \
                DPRINT(&quot;NpfsQueryFsDeviceInformation()\n&quot;);
- &nbsp; DPRINT(&quot;FsDeviceInfo = %p\n&quot;, FsDeviceInfo);
- &nbsp; 
- &nbsp; if (*BufferLength &lt; sizeof(FILE_FS_DEVICE_INFORMATION))
- &nbsp; &nbsp; return(STATUS_BUFFER_OVERFLOW);
- &nbsp; 
- &nbsp; FsDeviceInfo-&gt;DeviceType = FILE_DEVICE_NAMED_PIPE;
- &nbsp; FsDeviceInfo-&gt;Characteristics = 0;
- &nbsp; 
- &nbsp; *BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
- &nbsp; 
- &nbsp; DPRINT(&quot;NpfsQueryFsDeviceInformation() finished.\n&quot;);
- &nbsp; 
- &nbsp;<span id="removedchars"> return(STATUS_SUCCESS</span>);
</pre><pre class="diff" id="added">+ &nbsp;<span \
id="addedchars">DPRINT(&quot;NpfsQueryFsDeviceInformation()\n&quot;</span>); + \
&nbsp;DPRINT(&quot;FsDeviceInfo = %p\n&quot;, FsDeviceInfo); +
+ &nbsp;if (*BufferLength &lt; sizeof(FILE_FS_DEVICE_INFORMATION))
+ &nbsp; &nbsp;return STATUS_BUFFER_OVERFLOW;
+
+ &nbsp;FsDeviceInfo-&gt;DeviceType = FILE_DEVICE_NAMED_PIPE;
+ &nbsp;FsDeviceInfo-&gt;Characteristics = 0;
+
+ &nbsp;*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
+
+ &nbsp;DPRINT(&quot;NpfsQueryFsDeviceInformation() finished.\n&quot;);
+
+ &nbsp; return STATUS_SUCCESS;
</pre><pre class="diff" id="context"> }
 
 
@@ -44,22 +44,22 @@
</pre><pre class="diff" id="context"> \
NpfsQueryFsAttributeInformation(PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,  \
PULONG BufferLength)  {
</pre><pre class="diff" id="removed">- &nbsp; \
                DPRINT(&quot;NpfsQueryFsAttributeInformation() called.\n&quot;);
- &nbsp; DPRINT(&quot;FsAttributeInfo = %p\n&quot;, FsAttributeInfo);
- &nbsp; 
- &nbsp; if (*BufferLength &lt; sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
- &nbsp; &nbsp; return(STATUS_BUFFER_OVERFLOW);
- &nbsp; 
- &nbsp; FsAttributeInfo-&gt;FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
- &nbsp; FsAttributeInfo-&gt;MaximumComponentNameLength = 255;
- &nbsp; FsAttributeInfo-&gt;FileSystemNameLength = 8;
- &nbsp; wcscpy(FsAttributeInfo-&gt;FileSystemName,
-	 &nbsp;L&quot;NPFS&quot;);
- &nbsp; 
- &nbsp; DPRINT(&quot;NpfsQueryFsAttributeInformation() finished.\n&quot;);
- &nbsp; *BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
- &nbsp; 
- &nbsp;<span id="removedchars"> return(STATUS_SUCCESS</span>);
</pre><pre class="diff" id="added">+ &nbsp;<span \
id="addedchars">DPRINT(&quot;NpfsQueryFsAttributeInformation() \
called.\n&quot;</span>); + &nbsp;DPRINT(&quot;FsAttributeInfo = %p\n&quot;, \
FsAttributeInfo); +
+ &nbsp;if (*BufferLength &lt; sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)
+ &nbsp; &nbsp;return STATUS_BUFFER_OVERFLOW;
+
+ &nbsp;FsAttributeInfo-&gt;FileSystemAttributes = FILE_CASE_PRESERVED_NAMES;
+ &nbsp;FsAttributeInfo-&gt;MaximumComponentNameLength = 255;
+ &nbsp;FsAttributeInfo-&gt;FileSystemNameLength = 8;
+ &nbsp;wcscpy(FsAttributeInfo-&gt;FileSystemName,
+	 L&quot;NPFS&quot;);
+
+ &nbsp;DPRINT(&quot;NpfsQueryFsAttributeInformation() finished.\n&quot;);
+ &nbsp;*BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8);
+
+ &nbsp;return STATUS_SUCCESS;
</pre><pre class="diff" id="context"> }
 
 
@@ -67,54 +67,53 @@
</pre><pre class="diff" id="context"> NpfsQueryVolumeInformation(PDEVICE_OBJECT \
DeviceObject,  &nbsp; PIRP Irp)
 {
</pre><pre class="diff" id="removed">- &nbsp; PIO_STACK_LOCATION Stack;
- &nbsp; FS_INFORMATION_CLASS FsInformationClass;
- &nbsp; NTSTATUS Status = STATUS_SUCCESS;
- &nbsp; PVOID SystemBuffer;
- &nbsp; ULONG BufferLength;
- &nbsp; 
- &nbsp; /* PRECONDITION */
- &nbsp; assert(DeviceObject != NULL);
- &nbsp; assert(Irp != NULL);
- &nbsp; 
- &nbsp; DPRINT(&quot;NpfsQueryVolumeInformation(DeviceObject %x, Irp %x)\n&quot;,
-	 &nbsp;DeviceObject,
-	 &nbsp;Irp);
- &nbsp; 
- &nbsp; Stack = IoGetCurrentIrpStackLocation (Irp);
- &nbsp; FsInformationClass = Stack-&gt;Parameters.QueryVolume.FsInformationClass;
- &nbsp; BufferLength = Stack-&gt;Parameters.QueryVolume.Length;
- &nbsp; SystemBuffer = Irp-&gt;AssociatedIrp.SystemBuffer;
- &nbsp; 
- &nbsp; DPRINT(&quot;FsInformationClass %d\n&quot;, FsInformationClass);
- &nbsp; DPRINT(&quot;SystemBuffer %x\n&quot;, SystemBuffer);
- &nbsp; 
- &nbsp; switch (FsInformationClass)
- &nbsp; &nbsp; {
- &nbsp; &nbsp; case FileFsDeviceInformation:
- &nbsp; &nbsp; &nbsp; Status = NpfsQueryFsDeviceInformation(SystemBuffer,
-					 &nbsp; &nbsp; &amp;BufferLength);
- &nbsp; &nbsp; &nbsp; break;
- &nbsp; 
- &nbsp; &nbsp; case FileFsAttributeInformation:
- &nbsp; &nbsp; &nbsp; Status = NpfsQueryFsAttributeInformation(SystemBuffer,
-						&amp;BufferLength);
- &nbsp; &nbsp; &nbsp; break;
- &nbsp; 
- &nbsp; &nbsp; default:
- &nbsp; &nbsp; &nbsp; Status = STATUS_NOT_SUPPORTED;
- &nbsp; &nbsp; }
- &nbsp; 
- &nbsp; Irp-&gt;IoStatus.Status = Status;
- &nbsp; if (NT_SUCCESS(Status))
- &nbsp; &nbsp; Irp-&gt;IoStatus.Information =
- &nbsp; &nbsp; &nbsp; Stack-&gt;Parameters.QueryVolume.Length - BufferLength;
- &nbsp; else
- &nbsp; &nbsp; Irp-&gt;IoStatus.Information = 0;
- &nbsp; IoCompleteRequest(Irp,
-		 &nbsp; &nbsp; IO_NO_INCREMENT);
- &nbsp; 
- &nbsp;<span id="removedchars"> return(Status)</span>;
</pre><pre class="diff" id="added">+ &nbsp;<span id="addedchars">PIO_STACK_LOCATION \
Stack</span>; + &nbsp;FS_INFORMATION_CLASS FsInformationClass;
+ &nbsp;NTSTATUS Status = STATUS_SUCCESS;
+ &nbsp;PVOID SystemBuffer;
+ &nbsp;ULONG BufferLength;
+
+ &nbsp;/* PRECONDITION */
+ &nbsp;ASSERT(DeviceObject != NULL);
+ &nbsp;ASSERT(Irp != NULL);
+
+ &nbsp;DPRINT(&quot;NpfsQueryVolumeInformation(DeviceObject %x, Irp %x)\n&quot;,
+	 DeviceObject,
+	 Irp);
+
+ &nbsp;Stack = IoGetCurrentIrpStackLocation(Irp);
+ &nbsp;FsInformationClass = Stack-&gt;Parameters.QueryVolume.FsInformationClass;
+ &nbsp;BufferLength = Stack-&gt;Parameters.QueryVolume.Length;
+ &nbsp;SystemBuffer = Irp-&gt;AssociatedIrp.SystemBuffer;
+
+ &nbsp;DPRINT(&quot;FsInformationClass %d\n&quot;, FsInformationClass);
+ &nbsp;DPRINT(&quot;SystemBuffer %x\n&quot;, SystemBuffer);
+
+ &nbsp;switch (FsInformationClass)
+ &nbsp; &nbsp;{
+ &nbsp; &nbsp; &nbsp;case FileFsDeviceInformation:
+	Status = NpfsQueryFsDeviceInformation(SystemBuffer,
+					 &nbsp; &nbsp; &nbsp;&amp;BufferLength);
+	break;
+
+ &nbsp; &nbsp; &nbsp;case FileFsAttributeInformation:
+	Status = NpfsQueryFsAttributeInformation(SystemBuffer,
+						 &amp;BufferLength);
+	break;
+
+ &nbsp; &nbsp; &nbsp;default:
+	Status = STATUS_NOT_SUPPORTED;
+ &nbsp; &nbsp;}
+
+ &nbsp;Irp-&gt;IoStatus.Status = Status;
+ &nbsp;if (NT_SUCCESS(Status))
+ &nbsp; &nbsp;Irp-&gt;IoStatus.Information = Stack-&gt;Parameters.QueryVolume.Length \
- BufferLength; + &nbsp;else
+ &nbsp; &nbsp;Irp-&gt;IoStatus.Information = 0;
+ &nbsp;IoCompleteRequest(Irp,
+		 &nbsp; &nbsp;IO_NO_INCREMENT);
+
+ &nbsp;return Status;
</pre><pre class="diff" id="context"> }
 
 /* EOF */
</pre>
</div>

</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic