Connect client and server side upon client side creation only if both sides were...
authorEric Kohl <eric.kohl@reactos.org>
Sat, 1 Jan 2005 14:54:25 +0000 (14:54 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 1 Jan 2005 14:54:25 +0000 (14:54 +0000)
svn path=/trunk/; revision=12704

reactos/drivers/fs/np/create.c
reactos/drivers/fs/np/fsctrl.c
reactos/drivers/fs/np/npfs.h

index e13fefe..c0ac915 100644 (file)
@@ -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 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
       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 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
   /* 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 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
        return STATUS_NO_MEMORY;
      }
 
+   Fcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
    KeLockMutex(&DeviceExt->PipeListLock);
 
    /*
index 54f597c..f0d9d5c 100644 (file)
@@ -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 @@ NpfsConnectPipe(PNPFS_FCB Fcb)
          break;
        }
 
-
 #if 0
       if (ClientFcb->PipeState == FILE_PIPE_LISTENING_STATE)
        {
index 92d59c4..db552a5 100644 (file)
@@ -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 @@ typedef struct
   ULONG MaxQuota;
 } NPFS_DEVICE_EXTENSION, *PNPFS_DEVICE_EXTENSION;
 
-typedef struct
+typedef struct _NPFS_PIPE
 {
   UNICODE_STRING PipeName;
   LIST_ENTRY PipeListEntry;
@@ -41,6 +41,7 @@ typedef struct _NPFS_FCB
 {
   LIST_ENTRY FcbListEntry;
   struct _NPFS_FCB* OtherSide;
+  struct ETHREAD *Thread;
   PNPFS_PIPE Pipe;
   KEVENT ConnectEvent;
   KEVENT Event;