Correctly set internal state in NpfsDisconnectPipe and fix some return values in NpfsRead.
Modified: trunk/reactos/drivers/fs/np/fsctrl.c
Modified: trunk/reactos/drivers/fs/np/rw.c

Modified: trunk/reactos/drivers/fs/np/fsctrl.c
--- trunk/reactos/drivers/fs/np/fsctrl.c	2005-08-07 10:13:46 UTC (rev 17155)
+++ trunk/reactos/drivers/fs/np/fsctrl.c	2005-08-07 10:56:57 UTC (rev 17156)
@@ -187,6 +187,7 @@
       Server = (Fcb->PipeEnd == FILE_PIPE_SERVER_END);
       OtherSide = Fcb->OtherSide;
       Fcb->OtherSide = NULL;
+      Fcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
       /* Lock the server first */
       if (Server)
       {

Modified: trunk/reactos/drivers/fs/np/rw.c
--- trunk/reactos/drivers/fs/np/rw.c	2005-08-07 10:13:46 UTC (rev 17155)
+++ trunk/reactos/drivers/fs/np/rw.c	2005-08-07 10:56:57 UTC (rev 17156)
@@ -27,7 +27,7 @@
 
   DbgPrint("---------------\n");
 
-  for (i = 0; i < ROUND_UP(Length, 16); i+= 16)
+  for (i = 0; i < Length; i+= 16)
     {
       memset(Line, ' ', 64);
       Line[64] = 0;
@@ -398,23 +398,19 @@
      {
         if (Fcb->ReadDataAvailable == 0)
         {
-	   if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
-	   {
-	      ASSERT(Fcb->OtherSide != NULL);
-	      KeSetEvent(&Fcb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
-	   }
-	   if (Information > 0 &&
-	       (Fcb->Pipe->ReadMode != FILE_PIPE_BYTE_STREAM_MODE ||
-	        Fcb->PipeState != FILE_PIPE_CONNECTED_STATE))
-	   {
-	      break;
-	   }
       	   if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
 	   {
 	      DPRINT("PipeState: %x\n", Fcb->PipeState);
-	      Status = STATUS_PIPE_BROKEN;
+	      if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+	         Status = STATUS_PIPE_LISTENING;
+	      else
+	         Status = STATUS_PIPE_DISCONNECTED;
 	      break;
            }
+
+	   ASSERT(Fcb->OtherSide != NULL);
+	   KeSetEvent(&Fcb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
+
 	   ExReleaseFastMutex(&Fcb->DataListLock);
 	   if (IoIsOperationSynchronous(Irp))
 	   {