Connect client and server side upon client side creation only if both sides were created by the same thread.
Modified: trunk/reactos/drivers/fs/np/create.c
Modified: trunk/reactos/drivers/fs/np/fsctrl.c
Modified: trunk/reactos/drivers/fs/np/npfs.h

Modified: trunk/reactos/drivers/fs/np/create.c
--- trunk/reactos/drivers/fs/np/create.c	2005-01-01 14:35:46 UTC (rev 12703)
+++ trunk/reactos/drivers/fs/np/create.c	2005-01-01 14:54:25 UTC (rev 12704)
@@ -1,4 +1,4 @@
-/* $Id: create.c,v 1.28 2004/12/30 16:15:10 ekohl Exp $
+/* $Id$
  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
@@ -157,6 +157,7 @@
       return STATUS_NO_MEMORY;
     }
 
+  ClientFcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
   ClientFcb->Pipe = Pipe;
   ClientFcb->PipeEnd = FILE_PIPE_CLIENT_END;
   ClientFcb->OtherSide = NULL;
@@ -197,7 +198,8 @@
   /* Add the client FCB to the pipe FCB list. */
   InsertTailList(&Pipe->ClientFcbListHead, &ClientFcb->FcbListEntry);
 
-  if (ServerFcb)
+  /* Connect pipes if they were created by the same thread */
+  if (ServerFcb && ServerFcb->Thread == ClientFcb->Thread)
     {
       ClientFcb->OtherSide = ServerFcb;
       ServerFcb->OtherSide = ClientFcb;
@@ -254,6 +256,7 @@
 	return STATUS_NO_MEMORY;
      }
 
+   Fcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
    KeLockMutex(&DeviceExt->PipeListLock);
 
    /*

Modified: trunk/reactos/drivers/fs/np/fsctrl.c
--- trunk/reactos/drivers/fs/np/fsctrl.c	2005-01-01 14:35:46 UTC (rev 12703)
+++ trunk/reactos/drivers/fs/np/fsctrl.c	2005-01-01 14:54:25 UTC (rev 12704)
@@ -1,4 +1,4 @@
-/* $Id: fsctrl.c,v 1.18 2004/12/30 12:34:27 ekohl Exp $
+/* $Id$
  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
@@ -59,7 +59,6 @@
 	  break;
 	}
 
-
 #if 0
       if (ClientFcb->PipeState == FILE_PIPE_LISTENING_STATE)
 	{

Modified: trunk/reactos/drivers/fs/np/npfs.h
--- trunk/reactos/drivers/fs/np/npfs.h	2005-01-01 14:35:46 UTC (rev 12703)
+++ trunk/reactos/drivers/fs/np/npfs.h	2005-01-01 14:54:25 UTC (rev 12704)
@@ -1,4 +1,4 @@
-/* $Id: npfs.h,v 1.17 2004/05/10 19:58:10 navaraf Exp $ */
+/* $Id$ */
 
 #ifndef __SERVICES_FS_NP_NPFS_H
 #define __SERVICES_FS_NP_NPFS_H
@@ -9,7 +9,7 @@
  */
 #define FIN_WORKAROUND_READCLOSE
 
-typedef struct
+typedef struct _NPFS_DEVICE_EXTENSION
 {
   LIST_ENTRY PipeListHead;
   KMUTEX PipeListLock;
@@ -18,7 +18,7 @@
   ULONG MaxQuota;
 } NPFS_DEVICE_EXTENSION, *PNPFS_DEVICE_EXTENSION;
 
-typedef struct
+typedef struct _NPFS_PIPE
 {
   UNICODE_STRING PipeName;
   LIST_ENTRY PipeListEntry;
@@ -41,6 +41,7 @@
 {
   LIST_ENTRY FcbListEntry;
   struct _NPFS_FCB* OtherSide;
+  struct ETHREAD *Thread;
   PNPFS_PIPE Pipe;
   KEVENT ConnectEvent;
   KEVENT Event;