svn path=/trunk/; revision=18912
PNPFS_FCB ClientFcb;
PNPFS_FCB ServerFcb = NULL;
PNPFS_DEVICE_EXTENSION DeviceExt;
PNPFS_FCB ClientFcb;
PNPFS_FCB ServerFcb = NULL;
PNPFS_DEVICE_EXTENSION DeviceExt;
DPRINT("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
DPRINT("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
Irp->IoStatus.Information = 0;
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.
*/
/*
* Step 1. Find the pipe we're trying to open.
*/
ClientFcb->Pipe = Pipe;
ClientFcb->PipeEnd = FILE_PIPE_CLIENT_END;
ClientFcb->OtherSide = NULL;
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);
InitializeListHead(&ClientFcb->ReadRequestListHead);
DPRINT("Fcb: %x\n", ClientFcb);
* Step 3. Search for listening server FCB.
*/
* Step 3. Search for listening server 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.
+ */
+
+ 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.
- ServerFcb = NpfsFindListeningServerInstance(Pipe);
- if (ServerFcb == NULL)
+ CurrentEntry = Pipe->ServerFcbListHead.Flink;
+ while (CurrentEntry != &Pipe->ServerFcbListHead)
- 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)
- Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry);
- if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
- {
- ServerFcb = Fcb;
- break;
- }
- CurrentEntry = CurrentEntry->Flink;
+ ServerFcb = Fcb;
+ break;
+ CurrentEntry = CurrentEntry->Flink;
+ }
- /*
- * No one is listening to me?! I'm so lonely... :(
- */
+ /*
+ * 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))
- 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);