diff --git a/reactos/drivers/fs/np/create.c b/reactos/drivers/fs/np/create.c index 773abf7150a..34e44a9151b 100644 --- a/reactos/drivers/fs/np/create.c +++ b/reactos/drivers/fs/np/create.c @@ -113,7 +113,6 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, PNPFS_FCB ClientFcb; PNPFS_FCB ServerFcb = NULL; PNPFS_DEVICE_EXTENSION DeviceExt; - BOOLEAN SpecialAccess; DPRINT("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp); @@ -125,12 +124,6 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, Irp->IoStatus.Information = 0; - SpecialAccess = ((IoStack->Parameters.CreatePipe.ShareAccess & 3) == 3); - if (SpecialAccess) - { - DPRINT("NpfsCreate() open client end for special use!\n"); - } - /* * Step 1. Find the pipe we're trying to open. */ @@ -172,7 +165,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, ClientFcb->Pipe = Pipe; ClientFcb->PipeEnd = FILE_PIPE_CLIENT_END; ClientFcb->OtherSide = NULL; - ClientFcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE; + ClientFcb->PipeState = FILE_PIPE_DISCONNECTED_STATE; InitializeListHead(&ClientFcb->ReadRequestListHead); DPRINT("Fcb: %x\n", ClientFcb); @@ -211,67 +204,56 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, * Step 3. Search for listening server FCB. */ - if (!SpecialAccess) + /* + * WARNING: Point of no return! Once we get the server FCB it's + * possible that we completed a wait request and so we have to + * complete even this request. + */ + + ServerFcb = NpfsFindListeningServerInstance(Pipe); + if (ServerFcb == NULL) { + PLIST_ENTRY CurrentEntry; + PNPFS_FCB Fcb; + /* - * WARNING: Point of no return! Once we get the server FCB it's - * possible that we completed a wait request and so we have to - * complete even this request. + * If no waiting server FCB was found then try to pick + * one of the listing server FCB on the pipe. + */ + + CurrentEntry = Pipe->ServerFcbListHead.Flink; + while (CurrentEntry != &Pipe->ServerFcbListHead) + { + Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry); + if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE) + { + ServerFcb = Fcb; + break; + } + CurrentEntry = CurrentEntry->Flink; + } + + /* + * No one is listening to me?! I'm so lonely... :( */ - ServerFcb = NpfsFindListeningServerInstance(Pipe); if (ServerFcb == NULL) { - PLIST_ENTRY CurrentEntry; - PNPFS_FCB Fcb; - - /* - * If no waiting server FCB was found then try to pick - * one of the listing server FCB on the pipe. - */ - - CurrentEntry = Pipe->ServerFcbListHead.Flink; - while (CurrentEntry != &Pipe->ServerFcbListHead) - { - Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry); - if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE) - { - ServerFcb = Fcb; - break; - } - CurrentEntry = CurrentEntry->Flink; - } - - /* - * No one is listening to me?! I'm so lonely... :( - */ - - if (ServerFcb == NULL) - { - /* Not found, bail out with error for FILE_OPEN requests. */ - DPRINT("No listening server fcb found!\n"); - if (ClientFcb->Data) - ExFreePool(ClientFcb->Data); - KeUnlockMutex(&Pipe->FcbListLock); - Irp->IoStatus.Status = STATUS_PIPE_BUSY; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_PIPE_BUSY; - } - } - else - { - /* Signal the server thread and remove it from the waiter list */ - /* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */ - NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb); + /* Not found, bail out with error for FILE_OPEN requests. */ + DPRINT("No listening server fcb found!\n"); + if (ClientFcb->Data) + ExFreePool(ClientFcb->Data); + KeUnlockMutex(&Pipe->FcbListLock); + Irp->IoStatus.Status = STATUS_PIPE_NOT_AVAILABLE; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_PIPE_NOT_AVAILABLE; } } - else if (IsListEmpty(&Pipe->ServerFcbListHead)) + else { - DPRINT("No server fcb found!\n"); - KeUnlockMutex(&Pipe->FcbListLock); - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_UNSUCCESSFUL; + /* Signal the server thread and remove it from the waiter list */ + /* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */ + NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb); } /*