- Scream a little louder about unimplemented IOCTL codes
- Work around missing FSCTL_PIPE_TRANSCEIVE implementation
Modified: trunk/reactos/drivers/fs/np/fsctrl.c
Modified: trunk/reactos/lib/kernel32/file/npipe.c

Modified: trunk/reactos/drivers/fs/np/fsctrl.c
--- trunk/reactos/drivers/fs/np/fsctrl.c	2006-01-08 20:33:14 UTC (rev 20728)
+++ trunk/reactos/drivers/fs/np/fsctrl.c	2006-01-08 20:50:08 UTC (rev 20729)
@@ -394,7 +394,7 @@
   switch (IoStack->Parameters.FileSystemControl.FsControlCode)
     {
       case FSCTL_PIPE_ASSIGN_EVENT:
-	DPRINT("Assign event\n");
+	DPRINT1("Assign event not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
@@ -414,12 +414,14 @@
 	break;
 
       case FSCTL_PIPE_QUERY_EVENT:
-	DPRINT("Query event\n");
+	DPRINT1("Query event not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       case FSCTL_PIPE_TRANSCEIVE:
-	DPRINT("Transceive\n");
+	/* If you implement this, please remove the workaround in
+	   lib/kernel32/file/npipe.c function TransactNamedPipe() */
+	DPRINT1("Transceive not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
@@ -429,42 +431,43 @@
 	break;
 
       case FSCTL_PIPE_IMPERSONATE:
-	DPRINT("Impersonate\n");
+	DPRINT1("Impersonate not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       case FSCTL_PIPE_SET_CLIENT_PROCESS:
-	DPRINT("Set client process\n");
+	DPRINT1("Set client process not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       case FSCTL_PIPE_QUERY_CLIENT_PROCESS:
-	DPRINT("Query client process\n");
+	DPRINT1("Query client process not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       case FSCTL_PIPE_INTERNAL_READ:
-	DPRINT("Internal read\n");
+	DPRINT1("Internal read not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       case FSCTL_PIPE_INTERNAL_WRITE:
-	DPRINT("Internal write\n");
+	DPRINT1("Internal write not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       case FSCTL_PIPE_INTERNAL_TRANSCEIVE:
-	DPRINT("Internal transceive\n");
+	DPRINT1("Internal transceive not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       case FSCTL_PIPE_INTERNAL_READ_OVFLOW:
-	DPRINT("Internal read overflow\n");
+	DPRINT1("Internal read overflow not implemented\n");
 	Status = STATUS_NOT_IMPLEMENTED;
 	break;
 
       default:
-	DPRINT("IoControlCode: %x\n", IoStack->Parameters.FileSystemControl.FsControlCode);
+	DPRINT1("Unrecognized IoControlCode: %x\n",
+ 	       IoStack->Parameters.FileSystemControl.FsControlCode);
 	Status = STATUS_UNSUCCESSFUL;
     }
 

Modified: trunk/reactos/lib/kernel32/file/npipe.c
--- trunk/reactos/lib/kernel32/file/npipe.c	2006-01-08 20:33:14 UTC (rev 20728)
+++ trunk/reactos/lib/kernel32/file/npipe.c	2006-01-08 20:50:08 UTC (rev 20729)
@@ -1150,6 +1150,7 @@
      }
    else
      {
+#if 0 /* We don't implement FSCTL_PIPE_TRANSCEIVE yet */
         IO_STATUS_BLOCK Iosb;
 
         Status = NtFsControlFile(hNamedPipe,
@@ -1187,6 +1188,31 @@
              SetLastErrorByStatus(Status);
              return FALSE;
           }
+#else /* Workaround while FSCTL_PIPE_TRANSCEIVE not available */
+        DWORD nActualBytes;
+
+        while (0 != nInBufferSize &&
+               WriteFile(hNamedPipe, lpInBuffer, nInBufferSize, &nActualBytes,
+                         NULL))
+          {
+             lpInBuffer = (LPVOID)((char *) lpInBuffer + nActualBytes);
+             nInBufferSize -= nActualBytes;
+          }
+        if (0 != nInBufferSize)
+          {
+             /* Must have dropped out of the while 'cause WriteFile failed */
+             return FALSE;
+          }
+        if (! ReadFile(hNamedPipe, lpOutBuffer, nOutBufferSize, &nActualBytes,
+                       NULL))
+          {
+             return FALSE;
+          }
+        if (NULL != lpBytesRead)
+          {
+            *lpBytesRead = nActualBytes;
+          }
+#endif
      }
 
    return TRUE;