Author: ekohl
Date: Sun May 7 23:56:32 2006
New Revision: 21845
URL:
http://svn.reactos.ru/svn/reactos?rev=21845&view=rev
Log:
The NPFS_FCB struct is actually a CCB (Context Control Block) instead of an FCB (File
Control Block). Rename it accordingly and store pointers to it in
FileObject->FsContext2 instead of FileObject->FsContext.
Modified:
trunk/reactos/drivers/filesystems/np/create.c
trunk/reactos/drivers/filesystems/np/finfo.c
trunk/reactos/drivers/filesystems/np/fsctrl.c
trunk/reactos/drivers/filesystems/np/npfs.h
trunk/reactos/drivers/filesystems/np/rw.c
Modified: trunk/reactos/drivers/filesystems/np/create.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/crea…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/create.c (original)
+++ trunk/reactos/drivers/filesystems/np/create.c Sun May 7 23:56:32 2006
@@ -41,7 +41,7 @@
}
-static PNPFS_FCB
+static PNPFS_CCB
NpfsFindListeningServerInstance(PNPFS_PIPE Pipe)
{
PLIST_ENTRY CurrentEntry;
@@ -54,16 +54,16 @@
{
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
Irp = CONTAINING_RECORD(Waiter, IRP, Tail.Overlay.DriverContext);
- if (Waiter->Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ if (Waiter->Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
{
- DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
+ DPRINT("Server found! CCB %p\n", Waiter->Ccb);
IoAcquireCancelSpinLock(&oldIrql);
if (!Irp->Cancel)
{
(void)IoSetCancelRoutine(Irp, NULL);
IoReleaseCancelSpinLock(oldIrql);
- return Waiter->Fcb;
+ return Waiter->Ccb;
}
IoReleaseCancelSpinLock(oldIrql);
}
@@ -77,7 +77,7 @@
static VOID
NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe,
- PNPFS_FCB Fcb)
+ PNPFS_CCB Ccb)
{
PLIST_ENTRY CurrentEntry;
PNPFS_WAITER_ENTRY Waiter;
@@ -87,9 +87,9 @@
while (CurrentEntry != &Pipe->WaiterListHead)
{
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
- if (Waiter->Fcb == Fcb)
+ if (Waiter->Ccb == Ccb)
{
- DPRINT("Server found! Fcb %p\n", Waiter->Fcb);
+ DPRINT("Server found! CCB %p\n", Waiter->Ccb);
RemoveEntryList(&Waiter->Entry);
Irp = CONTAINING_RECORD(Waiter, IRP, Tail.Overlay.DriverContext);
@@ -110,8 +110,8 @@
PEXTENDED_IO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
PNPFS_PIPE Pipe;
- PNPFS_FCB ClientFcb;
- PNPFS_FCB ServerFcb = NULL;
+ PNPFS_CCB ClientCcb;
+ PNPFS_CCB ServerCcb = NULL;
PNPFS_DEVICE_EXTENSION DeviceExt;
BOOLEAN SpecialAccess;
ACCESS_MASK DesiredAccess;
@@ -152,42 +152,42 @@
KeUnlockMutex(&DeviceExt->PipeListLock);
/*
- * Acquire the lock for FCB lists. From now on no modifications to the
- * FCB lists are allowed, because it can cause various misconsistencies.
+ * Acquire the lock for CCB lists. From now on no modifications to the
+ * CCB lists are allowed, because it can cause various misconsistencies.
*/
- KeLockMutex(&Pipe->FcbListLock);
+ KeLockMutex(&Pipe->CcbListLock);
/*
- * Step 2. Create the client FCB.
+ * Step 2. Create the client CCB.
*/
- ClientFcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB));
- if (ClientFcb == NULL)
+ ClientCcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB));
+ if (ClientCcb == NULL)
{
DPRINT("No memory!\n");
- KeUnlockMutex(&Pipe->FcbListLock);
+ KeUnlockMutex(&Pipe->CcbListLock);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NO_MEMORY;
}
- ClientFcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
- ClientFcb->Pipe = Pipe;
- ClientFcb->PipeEnd = FILE_PIPE_CLIENT_END;
- ClientFcb->OtherSide = NULL;
- ClientFcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE;
- InitializeListHead(&ClientFcb->ReadRequestListHead);
-
- DPRINT("Fcb: %x\n", ClientFcb);
+ ClientCcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
+ ClientCcb->Pipe = Pipe;
+ ClientCcb->PipeEnd = FILE_PIPE_CLIENT_END;
+ ClientCcb->OtherSide = NULL;
+ ClientCcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE;
+ InitializeListHead(&ClientCcb->ReadRequestListHead);
+
+ DPRINT("CCB: %p\n", ClientCcb);
/* Initialize data list. */
if (Pipe->OutboundQuota)
{
- ClientFcb->Data = ExAllocatePool(PagedPool, Pipe->OutboundQuota);
- if (ClientFcb->Data == NULL)
+ ClientCcb->Data = ExAllocatePool(PagedPool, Pipe->OutboundQuota);
+ if (ClientCcb->Data == NULL)
{
DPRINT("No memory!\n");
- ExFreePool(ClientFcb);
- KeUnlockMutex(&Pipe->FcbListLock);
+ ExFreePool(ClientCcb);
+ KeUnlockMutex(&Pipe->CcbListLock);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NO_MEMORY;
@@ -195,50 +195,50 @@
}
else
{
- ClientFcb->Data = NULL;
- }
-
- ClientFcb->ReadPtr = ClientFcb->Data;
- ClientFcb->WritePtr = ClientFcb->Data;
- ClientFcb->ReadDataAvailable = 0;
- ClientFcb->WriteQuotaAvailable = Pipe->OutboundQuota;
- ClientFcb->MaxDataLength = Pipe->OutboundQuota;
- ExInitializeFastMutex(&ClientFcb->DataListLock);
- KeInitializeEvent(&ClientFcb->ConnectEvent, SynchronizationEvent, FALSE);
- KeInitializeEvent(&ClientFcb->ReadEvent, SynchronizationEvent, FALSE);
- KeInitializeEvent(&ClientFcb->WriteEvent, SynchronizationEvent, FALSE);
+ ClientCcb->Data = NULL;
+ }
+
+ ClientCcb->ReadPtr = ClientCcb->Data;
+ ClientCcb->WritePtr = ClientCcb->Data;
+ ClientCcb->ReadDataAvailable = 0;
+ ClientCcb->WriteQuotaAvailable = Pipe->OutboundQuota;
+ ClientCcb->MaxDataLength = Pipe->OutboundQuota;
+ ExInitializeFastMutex(&ClientCcb->DataListLock);
+ KeInitializeEvent(&ClientCcb->ConnectEvent, SynchronizationEvent, FALSE);
+ KeInitializeEvent(&ClientCcb->ReadEvent, SynchronizationEvent, FALSE);
+ KeInitializeEvent(&ClientCcb->WriteEvent, SynchronizationEvent, FALSE);
/*
- * Step 3. Search for listening server FCB.
+ * Step 3. Search for listening server CCB.
*/
if (!SpecialAccess)
{
/*
- * WARNING: Point of no return! Once we get the server FCB it's
+ * WARNING: Point of no return! Once we get the server CCB it's
* possible that we completed a wait request and so we have to
* complete even this request.
*/
- ServerFcb = NpfsFindListeningServerInstance(Pipe);
- if (ServerFcb == NULL)
+ ServerCcb = NpfsFindListeningServerInstance(Pipe);
+ if (ServerCcb == NULL)
{
PLIST_ENTRY CurrentEntry;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
/*
- * If no waiting server FCB was found then try to pick
- * one of the listing server FCB on the pipe.
+ * If no waiting server CCB was found then try to pick
+ * one of the listing server CCB on the pipe.
*/
- CurrentEntry = Pipe->ServerFcbListHead.Flink;
- while (CurrentEntry != &Pipe->ServerFcbListHead)
+ CurrentEntry = Pipe->ServerCcbListHead.Flink;
+ while (CurrentEntry != &Pipe->ServerCcbListHead)
{
- Fcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry);
- if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ Ccb = CONTAINING_RECORD(CurrentEntry, NPFS_CCB, CcbListEntry);
+ if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
{
- ServerFcb = Fcb;
+ ServerCcb = Ccb;
break;
}
CurrentEntry = CurrentEntry->Flink;
@@ -248,13 +248,13 @@
* No one is listening to me?! I'm so lonely... :(
*/
- if (ServerFcb == NULL)
+ if (ServerCcb == 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);
+ DPRINT("No listening server CCB found!\n");
+ if (ClientCcb->Data)
+ ExFreePool(ClientCcb->Data);
+ KeUnlockMutex(&Pipe->CcbListLock);
Irp->IoStatus.Status = STATUS_PIPE_BUSY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_PIPE_BUSY;
@@ -264,37 +264,37 @@
{
/* Signal the server thread and remove it from the waiter list */
/* FIXME: Merge this with the NpfsFindListeningServerInstance routine. */
- NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb);
+ NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerCcb);
}
}
- else if (IsListEmpty(&Pipe->ServerFcbListHead))
+ else if (IsListEmpty(&Pipe->ServerCcbListHead))
{
DPRINT("No server fcb found!\n");
- KeUnlockMutex(&Pipe->FcbListLock);
+ KeUnlockMutex(&Pipe->CcbListLock);
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_UNSUCCESSFUL;
}
/*
- * Step 4. Add the client FCB to a list and connect it if possible.
+ * Step 4. Add the client CCB to a list and connect it if possible.
*/
- /* Add the client FCB to the pipe FCB list. */
- InsertTailList(&Pipe->ClientFcbListHead, &ClientFcb->FcbListEntry);
+ /* Add the client CCB to the pipe CCB list. */
+ InsertTailList(&Pipe->ClientCcbListHead, &ClientCcb->CcbListEntry);
/* Connect to listening server side */
- if (ServerFcb)
- {
- ClientFcb->OtherSide = ServerFcb;
- ServerFcb->OtherSide = ClientFcb;
- ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
- ServerFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
- }
-
- KeUnlockMutex(&Pipe->FcbListLock);
-
- FileObject->FsContext = ClientFcb;
+ if (ServerCcb)
+ {
+ ClientCcb->OtherSide = ServerCcb;
+ ServerCcb->OtherSide = ClientCcb;
+ ClientCcb->PipeState = FILE_PIPE_CONNECTED_STATE;
+ ServerCcb->PipeState = FILE_PIPE_CONNECTED_STATE;
+ }
+
+ KeUnlockMutex(&Pipe->CcbListLock);
+
+ FileObject->FsContext2 = ClientCcb;
FileObject->Flags |= FO_NAMED_PIPE;
Irp->IoStatus.Status = STATUS_SUCCESS;
@@ -314,7 +314,7 @@
PFILE_OBJECT FileObject;
PNPFS_DEVICE_EXTENSION DeviceExt;
PNPFS_PIPE Pipe;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
PNAMED_PIPE_CREATE_PARAMETERS Buffer;
BOOLEAN NewPipe = FALSE;
@@ -338,15 +338,15 @@
return STATUS_INVALID_PARAMETER;
}
- Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB));
- if (Fcb == NULL)
+ Ccb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB));
+ if (Ccb == NULL)
{
Irp->IoStatus.Status = STATUS_NO_MEMORY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NO_MEMORY;
}
- Fcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
+ Ccb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread;
KeLockMutex(&DeviceExt->PipeListLock);
/*
@@ -365,7 +365,7 @@
if (Pipe->CurrentInstances >= Pipe->MaximumInstances)
{
DPRINT("Out of instances.\n");
- ExFreePool(Fcb);
+ ExFreePool(Ccb);
Irp->IoStatus.Status = STATUS_PIPE_BUSY;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_PIPE_BUSY;
@@ -376,7 +376,7 @@
Pipe->TimeOut.QuadPart != Buffer->DefaultTimeout.QuadPart)
{
DPRINT("Asked for invalid pipe mode.\n");
- ExFreePool(Fcb);
+ ExFreePool(Ccb);
Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_ACCESS_DENIED;
@@ -402,7 +402,7 @@
{
KeUnlockMutex(&DeviceExt->PipeListLock);
ExFreePool(Pipe);
- ExFreePool(Fcb);
+ ExFreePool(Ccb);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
@@ -411,10 +411,10 @@
RtlCopyUnicodeString(&Pipe->PipeName, &FileObject->FileName);
- InitializeListHead(&Pipe->ServerFcbListHead);
- InitializeListHead(&Pipe->ClientFcbListHead);
+ InitializeListHead(&Pipe->ServerCcbListHead);
+ InitializeListHead(&Pipe->ClientCcbListHead);
InitializeListHead(&Pipe->WaiterListHead);
- KeInitializeMutex(&Pipe->FcbListLock, 0);
+ KeInitializeMutex(&Pipe->CcbListLock, 0);
Pipe->PipeType = Buffer->NamedPipeType;
Pipe->WriteMode = Buffer->ReadMode;
@@ -490,10 +490,10 @@
if (Pipe->InboundQuota)
{
- Fcb->Data = ExAllocatePool(PagedPool, Pipe->InboundQuota);
- if (Fcb->Data == NULL)
- {
- ExFreePool(Fcb);
+ Ccb->Data = ExAllocatePool(PagedPool, Pipe->InboundQuota);
+ if (Ccb->Data == NULL)
+ {
+ ExFreePool(Ccb);
if (NewPipe)
{
@@ -511,35 +511,35 @@
}
else
{
- Fcb->Data = NULL;
+ Ccb->Data = NULL;
}
- Fcb->ReadPtr = Fcb->Data;
- Fcb->WritePtr = Fcb->Data;
- Fcb->ReadDataAvailable = 0;
- Fcb->WriteQuotaAvailable = Pipe->InboundQuota;
- Fcb->MaxDataLength = Pipe->InboundQuota;
- InitializeListHead(&Fcb->ReadRequestListHead);
- ExInitializeFastMutex(&Fcb->DataListLock);
+ Ccb->ReadPtr = Ccb->Data;
+ Ccb->WritePtr = Ccb->Data;
+ Ccb->ReadDataAvailable = 0;
+ Ccb->WriteQuotaAvailable = Pipe->InboundQuota;
+ Ccb->MaxDataLength = Pipe->InboundQuota;
+ InitializeListHead(&Ccb->ReadRequestListHead);
+ ExInitializeFastMutex(&Ccb->DataListLock);
Pipe->CurrentInstances++;
- Fcb->Pipe = Pipe;
- Fcb->PipeEnd = FILE_PIPE_SERVER_END;
- Fcb->PipeState = FILE_PIPE_LISTENING_STATE;
- Fcb->OtherSide = NULL;
-
- DPRINT("Fcb: %x\n", Fcb);
-
- KeInitializeEvent(&Fcb->ConnectEvent, SynchronizationEvent, FALSE);
- KeInitializeEvent(&Fcb->ReadEvent, SynchronizationEvent, FALSE);
- KeInitializeEvent(&Fcb->WriteEvent, SynchronizationEvent, FALSE);
-
- KeLockMutex(&Pipe->FcbListLock);
- InsertTailList(&Pipe->ServerFcbListHead, &Fcb->FcbListEntry);
- KeUnlockMutex(&Pipe->FcbListLock);
-
- FileObject->FsContext = Fcb;
+ Ccb->Pipe = Pipe;
+ Ccb->PipeEnd = FILE_PIPE_SERVER_END;
+ Ccb->PipeState = FILE_PIPE_LISTENING_STATE;
+ Ccb->OtherSide = NULL;
+
+ DPRINT("CCB: %x\n", Ccb);
+
+ KeInitializeEvent(&Ccb->ConnectEvent, SynchronizationEvent, FALSE);
+ KeInitializeEvent(&Ccb->ReadEvent, SynchronizationEvent, FALSE);
+ KeInitializeEvent(&Ccb->WriteEvent, SynchronizationEvent, FALSE);
+
+ KeLockMutex(&Pipe->CcbListLock);
+ InsertTailList(&Pipe->ServerCcbListHead, &Ccb->CcbListEntry);
+ KeUnlockMutex(&Pipe->CcbListLock);
+
+ FileObject->FsContext2 = Ccb;
FileObject->Flags |= FO_NAMED_PIPE;
Irp->IoStatus.Status = STATUS_SUCCESS;
@@ -558,7 +558,7 @@
PNPFS_DEVICE_EXTENSION DeviceExt;
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
- PNPFS_FCB Fcb, OtherSide;
+ PNPFS_CCB Ccb, OtherSide;
PNPFS_PIPE Pipe;
BOOLEAN Server;
@@ -567,9 +567,9 @@
IoStack = IoGetCurrentIrpStackLocation(Irp);
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject;
- Fcb = FileObject->FsContext;
-
- if (Fcb == NULL)
+ Ccb = FileObject->FsContext2;
+
+ if (Ccb == NULL)
{
DPRINT("Success!\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
@@ -578,14 +578,14 @@
return STATUS_SUCCESS;
}
- DPRINT("Fcb %x\n", Fcb);
- Pipe = Fcb->Pipe;
+ DPRINT("CCB %p\n", Ccb);
+ Pipe = Ccb->Pipe;
DPRINT("Cleaning pipe %wZ\n", &Pipe->PipeName);
- KeLockMutex(&Pipe->FcbListLock);
-
- Server = (Fcb->PipeEnd == FILE_PIPE_SERVER_END);
+ KeLockMutex(&Pipe->CcbListLock);
+
+ Server = (Ccb->PipeEnd == FILE_PIPE_SERVER_END);
if (Server)
{
@@ -596,19 +596,19 @@
{
DPRINT("Client\n");
}
- if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
- {
- OtherSide = Fcb->OtherSide;
+ if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ {
+ OtherSide = Ccb->OtherSide;
/* Lock the server first */
if (Server)
{
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
ExAcquireFastMutex(&OtherSide->DataListLock);
}
else
{
ExAcquireFastMutex(&OtherSide->DataListLock);
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
}
OtherSide->PipeState = FILE_PIPE_DISCONNECTED_STATE;
OtherSide->OtherSide = NULL;
@@ -621,15 +621,15 @@
if (Server)
{
ExReleaseFastMutex(&OtherSide->DataListLock);
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
}
else
{
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
ExReleaseFastMutex(&OtherSide->DataListLock);
}
}
- else if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ else if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
{
PLIST_ENTRY Entry;
PNPFS_WAITER_ENTRY WaitEntry = NULL;
@@ -637,11 +637,11 @@
KIRQL oldIrql;
PIRP tmpIrp;
- Entry = Fcb->Pipe->WaiterListHead.Flink;
- while (Entry != &Fcb->Pipe->WaiterListHead)
+ Entry = Ccb->Pipe->WaiterListHead.Flink;
+ while (Entry != &Ccb->Pipe->WaiterListHead)
{
WaitEntry = CONTAINING_RECORD(Entry, NPFS_WAITER_ENTRY, Entry);
- if (WaitEntry->Fcb == Fcb)
+ if (WaitEntry->Ccb == Ccb)
{
RemoveEntryList(Entry);
tmpIrp = CONTAINING_RECORD(WaitEntry, IRP, Tail.Overlay.DriverContext);
@@ -664,19 +664,19 @@
}
}
- Fcb->PipeState = FILE_PIPE_CLOSING_STATE;
-
- KeUnlockMutex(&Pipe->FcbListLock);
-
- ExAcquireFastMutex(&Fcb->DataListLock);
- if (Fcb->Data)
- {
- ExFreePool(Fcb->Data);
- Fcb->Data = NULL;
- Fcb->ReadPtr = NULL;
- Fcb->WritePtr = NULL;
- }
- ExReleaseFastMutex(&Fcb->DataListLock);
+ Ccb->PipeState = FILE_PIPE_CLOSING_STATE;
+
+ KeUnlockMutex(&Pipe->CcbListLock);
+
+ ExAcquireFastMutex(&Ccb->DataListLock);
+ if (Ccb->Data)
+ {
+ ExFreePool(Ccb->Data);
+ Ccb->Data = NULL;
+ Ccb->ReadPtr = NULL;
+ Ccb->WritePtr = NULL;
+ }
+ ExReleaseFastMutex(&Ccb->DataListLock);
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
@@ -694,7 +694,7 @@
PNPFS_DEVICE_EXTENSION DeviceExt;
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
PNPFS_PIPE Pipe;
BOOLEAN Server;
@@ -703,9 +703,9 @@
IoStack = IoGetCurrentIrpStackLocation(Irp);
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject;
- Fcb = FileObject->FsContext;
-
- if (Fcb == NULL)
+ Ccb = FileObject->FsContext2;
+
+ if (Ccb == NULL)
{
DPRINT("Success!\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
@@ -714,14 +714,14 @@
return STATUS_SUCCESS;
}
- DPRINT("Fcb %x\n", Fcb);
- Pipe = Fcb->Pipe;
+ DPRINT("CCB %x\n", Ccb);
+ Pipe = Ccb->Pipe;
DPRINT("Closing pipe %wZ\n", &Pipe->PipeName);
- KeLockMutex(&Pipe->FcbListLock);
-
- Server = (Fcb->PipeEnd == FILE_PIPE_SERVER_END);
+ KeLockMutex(&Pipe->CcbListLock);
+
+ Server = (Ccb->PipeEnd == FILE_PIPE_SERVER_END);
if (Server)
{
@@ -733,18 +733,18 @@
DPRINT("Client\n");
}
- ASSERT (Fcb->PipeState == FILE_PIPE_CLOSING_STATE);
-
- FileObject->FsContext = NULL;
-
- RemoveEntryList(&Fcb->FcbListEntry);
-
- ExFreePool(Fcb);
-
- KeUnlockMutex(&Pipe->FcbListLock);
-
- if (IsListEmpty(&Pipe->ServerFcbListHead) &&
- IsListEmpty(&Pipe->ClientFcbListHead))
+ ASSERT(Ccb->PipeState == FILE_PIPE_CLOSING_STATE);
+
+ FileObject->FsContext2 = NULL;
+
+ RemoveEntryList(&Ccb->CcbListEntry);
+
+ ExFreePool(Ccb);
+
+ KeUnlockMutex(&Pipe->CcbListLock);
+
+ if (IsListEmpty(&Pipe->ServerCcbListHead) &&
+ IsListEmpty(&Pipe->ClientCcbListHead))
{
RtlFreeUnicodeString(&Pipe->PipeName);
KeLockMutex(&DeviceExt->PipeListLock);
Modified: trunk/reactos/drivers/filesystems/np/finfo.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/finf…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/finfo.c (original)
+++ trunk/reactos/drivers/filesystems/np/finfo.c Sun May 7 23:56:32 2006
@@ -18,7 +18,7 @@
static
NTSTATUS
NpfsSetPipeInformation(PDEVICE_OBJECT DeviceObject,
- PNPFS_FCB Fcb,
+ PNPFS_CCB Ccb,
PFILE_PIPE_INFORMATION Info,
PULONG BufferLength)
{
@@ -27,21 +27,21 @@
DPRINT("NpfsSetPipeInformation()\n");
/* Get the Pipe and data */
- Pipe = Fcb->Pipe;
+ Pipe = Ccb->Pipe;
Request = (PFILE_PIPE_INFORMATION)Info;
-
+
/* Set Pipe Data */
Pipe->ReadMode = Request->ReadMode;
Pipe->CompletionMode = Request->CompletionMode;
/* Return Success */
- return STATUS_SUCCESS;
+ return STATUS_SUCCESS;
}
static
NTSTATUS
NpfsSetPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
- PNPFS_FCB Fcb,
+ PNPFS_CCB Ccb,
PFILE_PIPE_INFORMATION Info,
PULONG BufferLength)
{
@@ -50,21 +50,21 @@
DPRINT("NpfsSetPipeRemoteInformation()\n");
/* Get the Pipe and data */
- Pipe = Fcb->Pipe;
+ Pipe = Ccb->Pipe;
Request = (PFILE_PIPE_REMOTE_INFORMATION)Info;
-
+
/* Set the Settings */
Pipe->TimeOut = Request->CollectDataTime;
Pipe->InboundQuota = Request->MaximumCollectionCount;
-
+
/* Return Success */
return STATUS_SUCCESS;
}
-
-static
+
+static
NTSTATUS
NpfsQueryPipeInformation(PDEVICE_OBJECT DeviceObject,
- PNPFS_FCB Fcb,
+ PNPFS_CCB Ccb,
PFILE_PIPE_INFORMATION Info,
PULONG BufferLength)
{
@@ -72,24 +72,24 @@
DPRINT("NpfsQueryPipeInformation()\n");
/* Get the Pipe */
- Pipe = Fcb->Pipe;
-
+ Pipe = Ccb->Pipe;
+
/* Clear Info */
RtlZeroMemory(Info, sizeof(FILE_PIPE_INFORMATION));
/* Return Info */
Info->CompletionMode = Pipe->CompletionMode;
Info->ReadMode = Pipe->ReadMode;
-
+
/* Return success */
*BufferLength -= sizeof(FILE_PIPE_INFORMATION);
return STATUS_SUCCESS;
}
-static
+static
NTSTATUS
NpfsQueryPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
- PNPFS_FCB Fcb,
+ PNPFS_CCB Ccb,
PFILE_PIPE_REMOTE_INFORMATION Info,
PULONG BufferLength)
{
@@ -97,15 +97,15 @@
DPRINT("NpfsQueryPipeRemoteInformation()\n");
/* Get the Pipe */
- Pipe = Fcb->Pipe;
-
+ Pipe = Ccb->Pipe;
+
/* Clear Info */
RtlZeroMemory(Info, sizeof(FILE_PIPE_REMOTE_INFORMATION));
/* Return Info */
Info->MaximumCollectionCount = Pipe->InboundQuota;
Info->CollectDataTime = Pipe->TimeOut;
-
+
/* Return success */
*BufferLength -= sizeof(FILE_PIPE_REMOTE_INFORMATION);
return STATUS_SUCCESS;
@@ -114,7 +114,7 @@
static NTSTATUS
NpfsQueryLocalPipeInformation(PDEVICE_OBJECT DeviceObject,
- PNPFS_FCB Fcb,
+ PNPFS_CCB Ccb,
PFILE_PIPE_LOCAL_INFORMATION Info,
PULONG BufferLength)
{
@@ -122,7 +122,7 @@
DPRINT("NpfsQueryLocalPipeInformation()\n");
- Pipe = Fcb->Pipe;
+ Pipe = Ccb->Pipe;
RtlZeroMemory(Info,
sizeof(FILE_PIPE_LOCAL_INFORMATION));
@@ -133,18 +133,18 @@
Info->CurrentInstances = Pipe->CurrentInstances;
Info->InboundQuota = Pipe->InboundQuota;
Info->OutboundQuota = Pipe->OutboundQuota;
- Info->NamedPipeState = Fcb->PipeState;
- Info->NamedPipeEnd = Fcb->PipeEnd;
-
- if (Fcb->PipeEnd == FILE_PIPE_SERVER_END)
- {
- Info->ReadDataAvailable = Fcb->ReadDataAvailable;
- Info->WriteQuotaAvailable = Fcb->WriteQuotaAvailable;
- }
- else if (Fcb->OtherSide != NULL)
- {
- Info->ReadDataAvailable = Fcb->OtherSide->ReadDataAvailable;
- Info->WriteQuotaAvailable = Fcb->OtherSide->WriteQuotaAvailable;
+ Info->NamedPipeState = Ccb->PipeState;
+ Info->NamedPipeEnd = Ccb->PipeEnd;
+
+ if (Ccb->PipeEnd == FILE_PIPE_SERVER_END)
+ {
+ Info->ReadDataAvailable = Ccb->ReadDataAvailable;
+ Info->WriteQuotaAvailable = Ccb->WriteQuotaAvailable;
+ }
+ else if (Ccb->OtherSide != NULL)
+ {
+ Info->ReadDataAvailable = Ccb->OtherSide->ReadDataAvailable;
+ Info->WriteQuotaAvailable = Ccb->OtherSide->WriteQuotaAvailable;
}
*BufferLength -= sizeof(FILE_PIPE_LOCAL_INFORMATION);
@@ -160,7 +160,7 @@
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_OBJECT FileObject;
PNPFS_DEVICE_EXTENSION DeviceExtension;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
PNPFS_PIPE Pipe;
PVOID SystemBuffer;
ULONG BufferLength;
@@ -172,8 +172,8 @@
FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
DeviceExtension = DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject;
- Fcb = (PNPFS_FCB)FileObject->FsContext;
- Pipe = Fcb->Pipe;
+ Ccb = (PNPFS_CCB)FileObject->FsContext2;
+ Pipe = Ccb->Pipe;
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
BufferLength = IoStack->Parameters.QueryFile.Length;
@@ -187,21 +187,21 @@
{
case FilePipeInformation:
Status = NpfsQueryPipeInformation(DeviceObject,
- Fcb,
+ Ccb,
SystemBuffer,
&BufferLength);
break;
case FilePipeLocalInformation:
Status = NpfsQueryLocalPipeInformation(DeviceObject,
- Fcb,
+ Ccb,
SystemBuffer,
&BufferLength);
break;
case FilePipeRemoteInformation:
Status = NpfsQueryPipeRemoteInformation(DeviceObject,
- Fcb,
+ Ccb,
SystemBuffer,
&BufferLength);
break;
@@ -229,7 +229,7 @@
PIO_STACK_LOCATION IoStack;
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_OBJECT FileObject;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
PNPFS_PIPE Pipe;
PVOID SystemBuffer;
ULONG BufferLength;
@@ -240,8 +240,8 @@
IoStack = IoGetCurrentIrpStackLocation (Irp);
FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
FileObject = IoStack->FileObject;
- Fcb = (PNPFS_FCB)FileObject->FsContext;
- Pipe = Fcb->Pipe;
+ Ccb = (PNPFS_CCB)FileObject->FsContext2;
+ Pipe = Ccb->Pipe;
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
BufferLength = IoStack->Parameters.QueryFile.Length;
@@ -256,19 +256,19 @@
case FilePipeInformation:
/* Call the handler */
Status = NpfsSetPipeInformation(DeviceObject,
- Fcb,
+ Ccb,
SystemBuffer,
&BufferLength);
break;
-
+
case FilePipeLocalInformation:
Status = STATUS_NOT_IMPLEMENTED;
break;
-
+
case FilePipeRemoteInformation:
/* Call the handler */
Status = NpfsSetPipeRemoteInformation(DeviceObject,
- Fcb,
+ Ccb,
SystemBuffer,
&BufferLength);
break;
Modified: trunk/reactos/drivers/filesystems/np/fsctrl.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/fsct…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/fsctrl.c (original)
+++ trunk/reactos/drivers/filesystems/np/fsctrl.c Sun May 7 23:56:32 2006
@@ -25,14 +25,14 @@
Waiter = (PNPFS_WAITER_ENTRY)&Irp->Tail.Overlay.DriverContext;
DPRINT1("NpfsListeningCancelRoutine() called for <%wZ>\n",
- &Waiter->Fcb->Pipe->PipeName);
+ &Waiter->Ccb->Pipe->PipeName);
IoReleaseCancelSpinLock(Irp->CancelIrql);
- KeLockMutex(&Waiter->Fcb->Pipe->FcbListLock);
+ KeLockMutex(&Waiter->Ccb->Pipe->CcbListLock);
RemoveEntryList(&Waiter->Entry);
- KeUnlockMutex(&Waiter->Fcb->Pipe->FcbListLock);
+ KeUnlockMutex(&Waiter->Ccb->Pipe->CcbListLock);
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
@@ -42,26 +42,26 @@
static NTSTATUS
NpfsAddListeningServerInstance(PIRP Irp,
- PNPFS_FCB Fcb)
+ PNPFS_CCB Ccb)
{
PNPFS_WAITER_ENTRY Entry;
KIRQL oldIrql;
Entry = (PNPFS_WAITER_ENTRY)&Irp->Tail.Overlay.DriverContext;
- Entry->Fcb = Fcb;
-
- KeLockMutex(&Fcb->Pipe->FcbListLock);
+ Entry->Ccb = Ccb;
+
+ KeLockMutex(&Ccb->Pipe->CcbListLock);
IoMarkIrpPending(Irp);
- InsertTailList(&Fcb->Pipe->WaiterListHead, &Entry->Entry);
+ InsertTailList(&Ccb->Pipe->WaiterListHead, &Entry->Entry);
IoAcquireCancelSpinLock(&oldIrql);
if (!Irp->Cancel)
{
(void)IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine);
IoReleaseCancelSpinLock(oldIrql);
- KeUnlockMutex(&Fcb->Pipe->FcbListLock);
+ KeUnlockMutex(&Ccb->Pipe->CcbListLock);
return STATUS_PENDING;
}
IoReleaseCancelSpinLock(oldIrql);
@@ -71,7 +71,7 @@
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
- KeUnlockMutex(&Fcb->Pipe->FcbListLock);
+ KeUnlockMutex(&Ccb->Pipe->CcbListLock);
return STATUS_CANCELLED;
}
@@ -79,67 +79,67 @@
static NTSTATUS
NpfsConnectPipe(PIRP Irp,
- PNPFS_FCB Fcb)
+ PNPFS_CCB Ccb)
{
PNPFS_PIPE Pipe;
PLIST_ENTRY current_entry;
- PNPFS_FCB ClientFcb;
+ PNPFS_CCB ClientCcb;
NTSTATUS Status;
DPRINT("NpfsConnectPipe()\n");
- if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
- {
- KeResetEvent(&Fcb->ConnectEvent);
+ if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ {
+ KeResetEvent(&Ccb->ConnectEvent);
return STATUS_PIPE_CONNECTED;
}
- if (Fcb->PipeState == FILE_PIPE_CLOSING_STATE)
+ if (Ccb->PipeState == FILE_PIPE_CLOSING_STATE)
return STATUS_PIPE_CLOSING;
DPRINT("Waiting for connection...\n");
- Pipe = Fcb->Pipe;
+ Pipe = Ccb->Pipe;
/* search for a listening client fcb */
- KeLockMutex(&Pipe->FcbListLock);
-
- current_entry = Pipe->ClientFcbListHead.Flink;
- while (current_entry != &Pipe->ClientFcbListHead)
- {
- ClientFcb = CONTAINING_RECORD(current_entry,
- NPFS_FCB,
- FcbListEntry);
-
- if (ClientFcb->PipeState == 0)
+ KeLockMutex(&Pipe->CcbListLock);
+
+ current_entry = Pipe->ClientCcbListHead.Flink;
+ while (current_entry != &Pipe->ClientCcbListHead)
+ {
+ ClientCcb = CONTAINING_RECORD(current_entry,
+ NPFS_CCB,
+ CcbListEntry);
+
+ if (ClientCcb->PipeState == 0)
{
- /* found a passive (waiting) client fcb */
- DPRINT("Passive (waiting) client fcb found -- wake the client\n");
- KeSetEvent(&ClientFcb->ConnectEvent, IO_NO_INCREMENT, FALSE);
+ /* found a passive (waiting) client CCB */
+ DPRINT("Passive (waiting) client CCB found -- wake the client\n");
+ KeSetEvent(&ClientCcb->ConnectEvent, IO_NO_INCREMENT, FALSE);
break;
}
#if 0
- if (ClientFcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ if (ClientCcb->PipeState == FILE_PIPE_LISTENING_STATE)
{
- /* found a listening client fcb */
- DPRINT("Listening client fcb found -- connecting\n");
-
- /* connect client and server fcb's */
- Fcb->OtherSide = ClientFcb;
- ClientFcb->OtherSide = Fcb;
+ /* found a listening client CCB */
+ DPRINT("Listening client CCB found -- connecting\n");
+
+ /* connect client and server CCBs */
+ Ccb->OtherSide = ClientCcb;
+ ClientCcb->OtherSide = Ccb;
/* set connected state */
- Fcb->PipeState = FILE_PIPE_CONNECTED_STATE;
- ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE;
-
- KeUnlockMutex(&Pipe->FcbListLock);
+ Ccb->PipeState = FILE_PIPE_CONNECTED_STATE;
+ ClientCcb->PipeState = FILE_PIPE_CONNECTED_STATE;
+
+ KeUnlockMutex(&Pipe->CcbListLock);
/* FIXME: create and initialize data queues */
/* signal client's connect event */
- DPRINT("Setting the ConnectEvent for %x\n", ClientFcb);
- KeSetEvent(&ClientFcb->ConnectEvent, IO_NO_INCREMENT, FALSE);
+ DPRINT("Setting the ConnectEvent for %x\n", ClientCcb);
+ KeSetEvent(&ClientCcb->ConnectEvent, IO_NO_INCREMENT, FALSE);
return STATUS_PIPE_CONNECTED;
}
@@ -151,11 +151,11 @@
/* no listening client fcb found */
DPRINT("No listening client fcb found -- waiting for client\n");
- Fcb->PipeState = FILE_PIPE_LISTENING_STATE;
-
- Status = NpfsAddListeningServerInstance(Irp, Fcb);
-
- KeUnlockMutex(&Pipe->FcbListLock);
+ Ccb->PipeState = FILE_PIPE_LISTENING_STATE;
+
+ Status = NpfsAddListeningServerInstance(Irp, Ccb);
+
+ KeUnlockMutex(&Pipe->CcbListLock);
DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status);
@@ -164,39 +164,39 @@
static NTSTATUS
-NpfsDisconnectPipe(PNPFS_FCB Fcb)
+NpfsDisconnectPipe(PNPFS_CCB Ccb)
{
NTSTATUS Status;
- PNPFS_FCB OtherSide;
+ PNPFS_CCB OtherSide;
PNPFS_PIPE Pipe;
BOOLEAN Server;
DPRINT("NpfsDisconnectPipe()\n");
- Pipe = Fcb->Pipe;
- KeLockMutex(&Pipe->FcbListLock);
-
- if (Fcb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
+ Pipe = Ccb->Pipe;
+ KeLockMutex(&Pipe->CcbListLock);
+
+ if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
{
DPRINT("Pipe is already disconnected\n");
Status = STATUS_SUCCESS;
}
- else if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ else if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
{
- Server = (Fcb->PipeEnd == FILE_PIPE_SERVER_END);
- OtherSide = Fcb->OtherSide;
- Fcb->OtherSide = NULL;
- Fcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
+ Server = (Ccb->PipeEnd == FILE_PIPE_SERVER_END);
+ OtherSide = Ccb->OtherSide;
+ Ccb->OtherSide = NULL;
+ Ccb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
/* Lock the server first */
if (Server)
{
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
ExAcquireFastMutex(&OtherSide->DataListLock);
}
else
{
ExAcquireFastMutex(&OtherSide->DataListLock);
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
}
OtherSide->PipeState = FILE_PIPE_DISCONNECTED_STATE;
OtherSide->OtherSide = NULL;
@@ -209,27 +209,27 @@
if (Server)
{
ExReleaseFastMutex(&OtherSide->DataListLock);
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
}
else
{
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
ExReleaseFastMutex(&OtherSide->DataListLock);
}
Status = STATUS_SUCCESS;
}
- else if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ else if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
{
PLIST_ENTRY Entry;
PNPFS_WAITER_ENTRY WaitEntry = NULL;
BOOLEAN Complete = FALSE;
PIRP Irp = NULL;
- Entry = Fcb->Pipe->WaiterListHead.Flink;
- while (Entry != &Fcb->Pipe->WaiterListHead)
+ Entry = Ccb->Pipe->WaiterListHead.Flink;
+ while (Entry != &Ccb->Pipe->WaiterListHead)
{
WaitEntry = CONTAINING_RECORD(Entry, NPFS_WAITER_ENTRY, Entry);
- if (WaitEntry->Fcb == Fcb)
+ if (WaitEntry->Ccb == Ccb)
{
RemoveEntryList(Entry);
Irp = CONTAINING_RECORD(Entry, IRP, Tail.Overlay.DriverContext);
@@ -248,10 +248,10 @@
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
}
- Fcb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
+ Ccb->PipeState = FILE_PIPE_DISCONNECTED_STATE;
Status = STATUS_SUCCESS;
}
- else if (Fcb->PipeState == FILE_PIPE_CLOSING_STATE)
+ else if (Ccb->PipeState == FILE_PIPE_CLOSING_STATE)
{
Status = STATUS_PIPE_CLOSING;
}
@@ -259,44 +259,44 @@
{
Status = STATUS_UNSUCCESSFUL;
}
- KeUnlockMutex(&Pipe->FcbListLock);
+ KeUnlockMutex(&Pipe->CcbListLock);
return Status;
}
static NTSTATUS
NpfsWaitPipe(PIRP Irp,
- PNPFS_FCB Fcb)
+ PNPFS_CCB Ccb)
{
PNPFS_PIPE Pipe;
PLIST_ENTRY current_entry;
- PNPFS_FCB ServerFcb;
+ PNPFS_CCB ServerCcb;
PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe;
NTSTATUS Status;
DPRINT("NpfsWaitPipe\n");
WaitPipe = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer;
- Pipe = Fcb->Pipe;
-
- if (Fcb->PipeState != 0)
+ Pipe = Ccb->Pipe;
+
+ if (Ccb->PipeState != 0)
{
DPRINT("Pipe is not in passive (waiting) state!\n");
return STATUS_UNSUCCESSFUL;
}
/* search for listening server */
- current_entry = Pipe->ServerFcbListHead.Flink;
- while (current_entry != &Pipe->ServerFcbListHead)
- {
- ServerFcb = CONTAINING_RECORD(current_entry,
- NPFS_FCB,
- FcbListEntry);
-
- if (ServerFcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ current_entry = Pipe->ServerCcbListHead.Flink;
+ while (current_entry != &Pipe->ServerCcbListHead)
+ {
+ ServerCcb = CONTAINING_RECORD(current_entry,
+ NPFS_CCB,
+ CcbListEntry);
+
+ if (ServerCcb->PipeState == FILE_PIPE_LISTENING_STATE)
{
- /* found a listening server fcb */
- DPRINT("Listening server fcb found -- connecting\n");
+ /* found a listening server CCB */
+ DPRINT("Listening server CCB found -- connecting\n");
return STATUS_SUCCESS;
}
@@ -305,7 +305,7 @@
}
/* no listening server fcb found -- wait for one */
- Status = KeWaitForSingleObject(&Fcb->ConnectEvent,
+ Status = KeWaitForSingleObject(&Ccb->ConnectEvent,
UserRequest,
KernelMode,
FALSE,
@@ -341,25 +341,41 @@
ULONG OutputBufferLength;
PNPFS_PIPE Pipe;
PFILE_PIPE_PEEK_BUFFER Reply;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
NTSTATUS Status;
- DPRINT("NpfsPeekPipe\n");
+ DPRINT1("NpfsPeekPipe\n");
OutputBufferLength = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
+ DPRINT1("OutputBufferLength: %lu\n", OutputBufferLength);
/* Validate parameters */
if (OutputBufferLength < sizeof(FILE_PIPE_PEEK_BUFFER))
{
- DPRINT("Buffer too small\n");
+ DPRINT1("Buffer too small\n");
return STATUS_INVALID_PARAMETER;
}
- Fcb = IoStack->FileObject->FsContext;
+ Ccb = IoStack->FileObject->FsContext2;
Reply = (PFILE_PIPE_PEEK_BUFFER)Irp->AssociatedIrp.SystemBuffer;
- Pipe = Fcb->Pipe;
-
+ Pipe = Ccb->Pipe;
+
+
+ Reply->NamedPipeState = Ccb->PipeState;
+
+ Reply->ReadDataAvailable = Ccb->ReadDataAvailable;
+ DPRINT("ReadDataAvailable: %lu\n", Ccb->ReadDataAvailable);
+
+ Reply->NumberOfMessages = 0; /* FIXME */
+ Reply->MessageLength = 0; /* FIXME */
+ Reply->Data[0] = 0; /* FIXME */
+
+// Irp->IoStatus.Information = sizeof(FILE_PIPE_PEEK_BUFFER);
+
+// Status = STATUS_SUCCESS;
Status = STATUS_NOT_IMPLEMENTED;
+
+ DPRINT1("NpfsPeekPipe done\n");
return Status;
}
@@ -374,7 +390,7 @@
NTSTATUS Status;
PNPFS_DEVICE_EXTENSION DeviceExt;
PNPFS_PIPE Pipe;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
DPRINT("NpfsFileSystemContol(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
@@ -383,9 +399,9 @@
DPRINT("IoStack: %p\n", IoStack);
FileObject = IoStack->FileObject;
DPRINT("FileObject: %p\n", FileObject);
- Fcb = FileObject->FsContext;
- DPRINT("Fcb: %p\n", Fcb);
- Pipe = Fcb->Pipe;
+ Ccb = FileObject->FsContext2;
+ DPRINT("CCB: %p\n", Ccb);
+ Pipe = Ccb->Pipe;
DPRINT("Pipe: %p\n", Pipe);
DPRINT("PipeName: %wZ\n", &Pipe->PipeName);
@@ -400,12 +416,12 @@
case FSCTL_PIPE_DISCONNECT:
DPRINT("Disconnecting pipe %wZ\n", &Pipe->PipeName);
- Status = NpfsDisconnectPipe(Fcb);
+ Status = NpfsDisconnectPipe(Ccb);
break;
case FSCTL_PIPE_LISTEN:
DPRINT("Connecting pipe %wZ\n", &Pipe->PipeName);
- Status = NpfsConnectPipe(Irp, Fcb);
+ Status = NpfsConnectPipe(Irp, Ccb);
break;
case FSCTL_PIPE_PEEK:
@@ -427,7 +443,7 @@
case FSCTL_PIPE_WAIT:
DPRINT("Waiting for pipe %wZ\n", &Pipe->PipeName);
- Status = NpfsWaitPipe(Irp, Fcb);
+ Status = NpfsWaitPipe(Irp, Ccb);
break;
case FSCTL_PIPE_IMPERSONATE:
Modified: trunk/reactos/drivers/filesystems/np/npfs.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/npfs…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/npfs.h (original)
+++ trunk/reactos/drivers/filesystems/np/npfs.h Sun May 7 23:56:32 2006
@@ -19,9 +19,9 @@
{
UNICODE_STRING PipeName;
LIST_ENTRY PipeListEntry;
- KMUTEX FcbListLock;
- LIST_ENTRY ServerFcbListHead;
- LIST_ENTRY ClientFcbListHead;
+ KMUTEX CcbListLock;
+ LIST_ENTRY ServerCcbListHead;
+ LIST_ENTRY ClientCcbListHead;
LIST_ENTRY WaiterListHead;
LIST_ENTRY EmptyBufferListHead;
ULONG PipeType;
@@ -36,10 +36,10 @@
LARGE_INTEGER TimeOut;
} NPFS_PIPE, *PNPFS_PIPE;
-typedef struct _NPFS_FCB
+typedef struct _NPFS_CCB
{
- LIST_ENTRY FcbListEntry;
- struct _NPFS_FCB* OtherSide;
+ LIST_ENTRY CcbListEntry;
+ struct _NPFS_CCB* OtherSide;
struct ETHREAD *Thread;
PNPFS_PIPE Pipe;
KEVENT ConnectEvent;
@@ -58,7 +58,7 @@
ULONG MaxDataLength;
FAST_MUTEX DataListLock; /* Data queue lock */
-} NPFS_FCB, *PNPFS_FCB;
+} NPFS_CCB, *PNPFS_CCB;
typedef struct _NPFS_CONTEXT
{
@@ -80,7 +80,7 @@
typedef struct _NPFS_WAITER_ENTRY
{
LIST_ENTRY Entry;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
} NPFS_WAITER_ENTRY, *PNPFS_WAITER_ENTRY;
Modified: trunk/reactos/drivers/filesystems/np/rw.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/np/rw.c…
==============================================================================
--- trunk/reactos/drivers/filesystems/np/rw.c (original)
+++ trunk/reactos/drivers/filesystems/np/rw.c Sun May 7 23:56:32 2006
@@ -50,7 +50,7 @@
PNPFS_CONTEXT Context;
PNPFS_DEVICE_EXTENSION DeviceExt;
PIO_STACK_LOCATION IoStack;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
BOOLEAN Complete = FALSE;
DPRINT("NpfsReadWriteCancelRoutine(DeviceObject %x, Irp %x)\n",
DeviceObject, Irp);
@@ -60,14 +60,14 @@
Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
DeviceExt = (PNPFS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
IoStack = IoGetCurrentIrpStackLocation(Irp);
- Fcb = IoStack->FileObject->FsContext;
+ Ccb = IoStack->FileObject->FsContext2;
KeLockMutex(&DeviceExt->PipeListLock);
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
switch(IoStack->MajorFunction)
{
case IRP_MJ_READ:
- if (Fcb->ReadRequestListHead.Flink != &Context->ListEntry)
+ if (Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
{
/* we are not the first in the list, remove an complete us */
RemoveEntryList(&Context->ListEntry);
@@ -75,13 +75,13 @@
}
else
{
- KeSetEvent(&Fcb->ReadEvent, IO_NO_INCREMENT, FALSE);
+ KeSetEvent(&Ccb->ReadEvent, IO_NO_INCREMENT, FALSE);
}
break;
default:
KEBUGCHECK(0);
}
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
KeUnlockMutex(&DeviceExt->PipeListLock);
if (Complete)
{
@@ -105,7 +105,7 @@
PIO_STACK_LOCATION IoStack = NULL;
PNPFS_CONTEXT Context;
PNPFS_CONTEXT NextContext;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
KeLockMutex(&ThreadContext->DeviceExt->PipeListLock);
@@ -166,16 +166,16 @@
if (Cancel)
{
- Fcb = IoStack->FileObject->FsContext;
- ExAcquireFastMutex(&Fcb->DataListLock);
+ Ccb = IoStack->FileObject->FsContext2;
+ ExAcquireFastMutex(&Ccb->DataListLock);
RemoveEntryList(&Context->ListEntry);
switch (IoStack->MajorFunction)
{
case IRP_MJ_READ:
- if (!IsListEmpty(&Fcb->ReadRequestListHead))
+ if (!IsListEmpty(&Ccb->ReadRequestListHead))
{
/* put the next request on the wait list */
- NextContext = CONTAINING_RECORD(Fcb->ReadRequestListHead.Flink,
NPFS_CONTEXT, ListEntry);
+ NextContext = CONTAINING_RECORD(Ccb->ReadRequestListHead.Flink,
NPFS_CONTEXT, ListEntry);
ThreadContext->WaitObjectArray[ThreadContext->Count] =
NextContext->WaitEvent;
NextIrp = CONTAINING_RECORD(NextContext, IRP, Tail.Overlay.DriverContext);
ThreadContext->WaitIrpArray[ThreadContext->Count] = NextIrp;
@@ -186,7 +186,7 @@
default:
KEBUGCHECK(0);
}
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
}
}
else
@@ -294,11 +294,11 @@
PFILE_OBJECT FileObject;
NTSTATUS Status;
NTSTATUS OriginalStatus = STATUS_SUCCESS;
- PNPFS_FCB Fcb;
+ PNPFS_CCB Ccb;
PNPFS_CONTEXT Context;
KEVENT Event;
ULONG Length;
- ULONG Information;
+ ULONG Information = 0;
ULONG CopyLength;
ULONG TempLength;
BOOLEAN IsOriginalRequest = TRUE;
@@ -315,15 +315,15 @@
}
FileObject = IoGetCurrentIrpStackLocation(Irp)->FileObject;
- Fcb = FileObject->FsContext;
+ Ccb = FileObject->FsContext2;
Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
- if (Fcb->OtherSide == NULL)
+ if (Ccb->OtherSide == NULL)
{
DPRINT("Pipe is NOT connected!\n");
- if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
Status = STATUS_PIPE_LISTENING;
- else if (Fcb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
+ else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
Status = STATUS_PIPE_DISCONNECTED;
else
Status = STATUS_UNSUCCESSFUL;
@@ -331,7 +331,7 @@
goto done;
}
- if (Fcb->Data == NULL)
+ if (Ccb->Data == NULL)
{
DPRINT1("Pipe is NOT readable!\n");
Status = STATUS_UNSUCCESSFUL;
@@ -339,16 +339,16 @@
goto done;
}
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
if (IoIsOperationSynchronous(Irp))
{
- InsertTailList(&Fcb->ReadRequestListHead, &Context->ListEntry);
- if (Fcb->ReadRequestListHead.Flink != &Context->ListEntry)
+ InsertTailList(&Ccb->ReadRequestListHead, &Context->ListEntry);
+ if (Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
{
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
Context->WaitEvent = &Event;
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
Status = KeWaitForSingleObject(&Event,
Executive,
KernelMode,
@@ -358,21 +358,21 @@
{
KEBUGCHECK(0);
}
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
}
Irp->IoStatus.Information = 0;
}
else
{
KIRQL oldIrql;
- if (IsListEmpty(&Fcb->ReadRequestListHead) ||
- Fcb->ReadRequestListHead.Flink != &Context->ListEntry)
+ if (IsListEmpty(&Ccb->ReadRequestListHead) ||
+ Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
{
/* this is a new request */
Irp->IoStatus.Information = 0;
- Context->WaitEvent = &Fcb->ReadEvent;
- InsertTailList(&Fcb->ReadRequestListHead, &Context->ListEntry);
- if (Fcb->ReadRequestListHead.Flink != &Context->ListEntry)
+ Context->WaitEvent = &Ccb->ReadEvent;
+ InsertTailList(&Ccb->ReadRequestListHead, &Context->ListEntry);
+ if (Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
{
/* there was already a request on the list */
IoAcquireCancelSpinLock(&oldIrql);
@@ -380,13 +380,13 @@
{
IoReleaseCancelSpinLock(oldIrql);
RemoveEntryList(&Context->ListEntry);
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
Status = STATUS_CANCELLED;
goto done;
}
(void)IoSetCancelRoutine(Irp, NpfsReadWriteCancelRoutine);
IoReleaseCancelSpinLock(oldIrql);
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
IoMarkIrpPending(Irp);
Status = STATUS_PENDING;
goto done;
@@ -406,94 +406,94 @@
while (1)
{
- if (Fcb->ReadDataAvailable == 0)
+ if (Ccb->ReadDataAvailable == 0)
{
- if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
- {
- ASSERT(Fcb->OtherSide != NULL);
- KeSetEvent(&Fcb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
+ if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ {
+ ASSERT(Ccb->OtherSide != NULL);
+ KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
}
if (Information > 0 &&
- (Fcb->Pipe->ReadMode != FILE_PIPE_BYTE_STREAM_MODE ||
- Fcb->PipeState != FILE_PIPE_CONNECTED_STATE))
+ (Ccb->Pipe->ReadMode != FILE_PIPE_BYTE_STREAM_MODE ||
+ Ccb->PipeState != FILE_PIPE_CONNECTED_STATE))
{
break;
}
- if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
- {
- DPRINT("PipeState: %x\n", Fcb->PipeState);
+ if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE)
+ {
+ DPRINT("PipeState: %x\n", Ccb->PipeState);
Status = STATUS_PIPE_BROKEN;
break;
}
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
if (IoIsOperationSynchronous(Irp))
{
/* Wait for ReadEvent to become signaled */
- DPRINT("Waiting for readable data (%wZ)\n",
&Fcb->Pipe->PipeName);
- Status = KeWaitForSingleObject(&Fcb->ReadEvent,
+ DPRINT1("Waiting for readable data (%wZ)\n",
&Ccb->Pipe->PipeName);
+ Status = KeWaitForSingleObject(&Ccb->ReadEvent,
UserRequest,
KernelMode,
FALSE,
NULL);
- DPRINT("Finished waiting (%wZ)! Status: %x\n",
&Fcb->Pipe->PipeName, Status);
- ExAcquireFastMutex(&Fcb->DataListLock);
+ DPRINT("Finished waiting (%wZ)! Status: %x\n",
&Ccb->Pipe->PipeName, Status);
+ ExAcquireFastMutex(&Ccb->DataListLock);
}
else
{
Context = (PNPFS_CONTEXT)&Irp->Tail.Overlay.DriverContext;
- Context->WaitEvent = &Fcb->ReadEvent;
+ Context->WaitEvent = &Ccb->ReadEvent;
Status = NpfsAddWaitingReadWriteRequest(DeviceObject, Irp);
if (NT_SUCCESS(Status))
{
Status = STATUS_PENDING;
}
- ExAcquireFastMutex(&Fcb->DataListLock);
+ ExAcquireFastMutex(&Ccb->DataListLock);
break;
}
}
ASSERT(IoGetCurrentIrpStackLocation(Irp)->FileObject != NULL);
- if (Fcb->Pipe->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
+ if (Ccb->Pipe->ReadMode == FILE_PIPE_BYTE_STREAM_MODE)
{
DPRINT("Byte stream mode\n");
/* Byte stream mode */
- while (Length > 0 && Fcb->ReadDataAvailable > 0)
- {
- CopyLength = min(Fcb->ReadDataAvailable, Length);
- if ((ULONG_PTR)Fcb->ReadPtr + CopyLength <= (ULONG_PTR)Fcb->Data +
Fcb->MaxDataLength)
+ while (Length > 0 && Ccb->ReadDataAvailable > 0)
+ {
+ CopyLength = min(Ccb->ReadDataAvailable, Length);
+ if ((ULONG_PTR)Ccb->ReadPtr + CopyLength <= (ULONG_PTR)Ccb->Data +
Ccb->MaxDataLength)
{
- memcpy(Buffer, Fcb->ReadPtr, CopyLength);
- Fcb->ReadPtr = (PVOID)((ULONG_PTR)Fcb->ReadPtr + CopyLength);
- if (Fcb->ReadPtr == (PVOID)((ULONG_PTR)Fcb->Data +
Fcb->MaxDataLength))
+ memcpy(Buffer, Ccb->ReadPtr, CopyLength);
+ Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->ReadPtr + CopyLength);
+ if (Ccb->ReadPtr == (PVOID)((ULONG_PTR)Ccb->Data +
Ccb->MaxDataLength))
{
- Fcb->ReadPtr = Fcb->Data;
+ Ccb->ReadPtr = Ccb->Data;
}
}
else
{
- TempLength = (ULONG)((ULONG_PTR)Fcb->Data + Fcb->MaxDataLength -
(ULONG_PTR)Fcb->ReadPtr);
- memcpy(Buffer, Fcb->ReadPtr, TempLength);
- memcpy((PVOID)((ULONG_PTR)Buffer + TempLength), Fcb->Data, CopyLength -
TempLength);
- Fcb->ReadPtr = (PVOID)((ULONG_PTR)Fcb->Data + CopyLength - TempLength);
+ TempLength = (ULONG)((ULONG_PTR)Ccb->Data + Ccb->MaxDataLength -
(ULONG_PTR)Ccb->ReadPtr);
+ memcpy(Buffer, Ccb->ReadPtr, TempLength);
+ memcpy((PVOID)((ULONG_PTR)Buffer + TempLength), Ccb->Data, CopyLength -
TempLength);
+ Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->Data + CopyLength - TempLength);
}
Buffer = (PVOID)((ULONG_PTR)Buffer + CopyLength);
Length -= CopyLength;
Information += CopyLength;
- Fcb->ReadDataAvailable -= CopyLength;
- Fcb->WriteQuotaAvailable += CopyLength;
+ Ccb->ReadDataAvailable -= CopyLength;
+ Ccb->WriteQuotaAvailable += CopyLength;
}
if (Length == 0)
{
- if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
{
- KeSetEvent(&Fcb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
+ KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
}
- KeResetEvent(&Fcb->ReadEvent);
+ KeResetEvent(&Ccb->ReadEvent);
break;
}
}
@@ -502,11 +502,11 @@
DPRINT("Message mode\n");
/* Message mode */
- if (Fcb->ReadDataAvailable)
+ if (Ccb->ReadDataAvailable)
{
/* Truncate the message if the receive buffer is too small */
- CopyLength = min(Fcb->ReadDataAvailable, Length);
- memcpy(Buffer, Fcb->Data, CopyLength);
+ CopyLength = min(Ccb->ReadDataAvailable, Length);
+ memcpy(Buffer, Ccb->Data, CopyLength);
#ifndef NDEBUG
DPRINT("Length %d Buffer %x\n",CopyLength,Buffer);
@@ -515,22 +515,22 @@
Information = CopyLength;
- if (Fcb->ReadDataAvailable > Length)
+ if (Ccb->ReadDataAvailable > Length)
{
- memmove(Fcb->Data, (PVOID)((ULONG_PTR)Fcb->Data + Length),
- Fcb->ReadDataAvailable - Length);
- Fcb->ReadDataAvailable -= Length;
+ memmove(Ccb->Data, (PVOID)((ULONG_PTR)Ccb->Data + Length),
+ Ccb->ReadDataAvailable - Length);
+ Ccb->ReadDataAvailable -= Length;
Status = STATUS_MORE_ENTRIES;
}
else
{
- KeResetEvent(&Fcb->ReadEvent);
- if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE)
+ KeResetEvent(&Ccb->ReadEvent);
+ if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
{
- KeSetEvent(&Fcb->OtherSide->WriteEvent, IO_NO_INCREMENT,
FALSE);
+ KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT,
FALSE);
}
- Fcb->ReadDataAvailable = 0;
- Fcb->WriteQuotaAvailable = Fcb->MaxDataLength;
+ Ccb->ReadDataAvailable = 0;
+ Ccb->WriteQuotaAvailable = Ccb->MaxDataLength;
}
}
@@ -548,12 +548,12 @@
if (IoIsOperationSynchronous(Irp))
{
RemoveEntryList(&Context->ListEntry);
- if (!IsListEmpty(&Fcb->ReadRequestListHead))
- {
- Context = CONTAINING_RECORD(Fcb->ReadRequestListHead.Flink, NPFS_CONTEXT,
ListEntry);
+ if (!IsListEmpty(&Ccb->ReadRequestListHead))
+ {
+ Context = CONTAINING_RECORD(Ccb->ReadRequestListHead.Flink, NPFS_CONTEXT,
ListEntry);
KeSetEvent(Context->WaitEvent, IO_NO_INCREMENT, FALSE);
}
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
DPRINT("NpfsRead done (Status %lx)\n", Status);
@@ -568,19 +568,19 @@
}
if (Status == STATUS_PENDING)
{
- ExReleaseFastMutex(&Fcb->DataListLock);
+ ExReleaseFastMutex(&Ccb->DataListLock);
DPRINT("NpfsRead done (Status %lx)\n", OriginalStatus);
return OriginalStatus;
}
RemoveEntryList(&Context->ListEntry);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
- if (IsListEmpty(&Fcb->ReadRequestListHead))
- {
- ExReleaseFastMutex(&Fcb->DataListLock);
+ if (IsListEmpty(&Ccb->ReadRequestListHead))
+ {
+ ExReleaseFastMutex(&Ccb->DataListLock);
DPRINT("NpfsRead done (Status %lx)\n", OriginalStatus);
return OriginalStatus;
}
- Context = CONTAINING_RECORD(Fcb->ReadRequestListHead.Flink, NPFS_CONTEXT,
ListEntry);
+ Context = CONTAINING_RECORD(Ccb->ReadRequestListHead.Flink, NPFS_CONTEXT,
ListEntry);
Irp = CONTAINING_RECORD(Context, IRP, Tail.Overlay.DriverContext);
}
}
@@ -603,8 +603,8 @@
{
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
- PNPFS_FCB Fcb = NULL;
- PNPFS_FCB ReaderFcb;
+ PNPFS_CCB Ccb = NULL;
+ PNPFS_CCB ReaderCcb;
PNPFS_PIPE Pipe = NULL;
PUCHAR Buffer;
NTSTATUS Status = STATUS_SUCCESS;
@@ -621,9 +621,9 @@
DPRINT("FileObject %p\n", FileObject);
DPRINT("Pipe name %wZ\n", &FileObject->FileName);
- Fcb = FileObject->FsContext;
- ReaderFcb = Fcb->OtherSide;
- Pipe = Fcb->Pipe;
+ Ccb = FileObject->FsContext2;
+ ReaderCcb = Ccb->OtherSide;
+ Pipe = Ccb->Pipe;
Length = IoStack->Parameters.Write.Length;
Offset = IoStack->Parameters.Write.ByteOffset.u.LowPart;
@@ -637,12 +637,12 @@
goto done;
}
- if (ReaderFcb == NULL)
+ if (ReaderCcb == NULL)
{
DPRINT("Pipe is NOT connected!\n");
- if (Fcb->PipeState == FILE_PIPE_LISTENING_STATE)
+ if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
Status = STATUS_PIPE_LISTENING;
- else if (Fcb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
+ else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE)
Status = STATUS_PIPE_DISCONNECTED;
else
Status = STATUS_UNSUCCESSFUL;
@@ -650,7 +650,7 @@
goto done;
}
- if (ReaderFcb->Data == NULL)
+ if (ReaderCcb->Data == NULL)
{
DPRINT("Pipe is NOT writable!\n");
Status = STATUS_UNSUCCESSFUL;
@@ -661,7 +661,7 @@
Status = STATUS_SUCCESS;
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
- ExAcquireFastMutex(&ReaderFcb->DataListLock);
+ ExAcquireFastMutex(&ReaderCcb->DataListLock);
#ifndef NDEBUG
DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset);
HexDump(Buffer, Length);
@@ -669,35 +669,35 @@
while(1)
{
- if (ReaderFcb->WriteQuotaAvailable == 0)
- {
- KeSetEvent(&ReaderFcb->ReadEvent, IO_NO_INCREMENT, FALSE);
- if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
+ if (ReaderCcb->WriteQuotaAvailable == 0)
+ {
+ KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
+ if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE)
{
Status = STATUS_PIPE_BROKEN;
- ExReleaseFastMutex(&ReaderFcb->DataListLock);
+ ExReleaseFastMutex(&ReaderCcb->DataListLock);
goto done;
}
- ExReleaseFastMutex(&ReaderFcb->DataListLock);
+ ExReleaseFastMutex(&ReaderCcb->DataListLock);
DPRINT("Waiting for buffer space (%S)\n", Pipe->PipeName.Buffer);
- Status = KeWaitForSingleObject(&Fcb->WriteEvent,
+ Status = KeWaitForSingleObject(&Ccb->WriteEvent,
UserRequest,
KernelMode,
FALSE,
NULL);
DPRINT("Finished waiting (%S)! Status: %x\n", Pipe->PipeName.Buffer,
Status);
- ExAcquireFastMutex(&ReaderFcb->DataListLock);
+ ExAcquireFastMutex(&ReaderCcb->DataListLock);
/*
* It's possible that the event was signaled because the
* other side of pipe was closed.
*/
- if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE)
+ if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE)
{
- DPRINT("PipeState: %x\n", Fcb->PipeState);
+ DPRINT("PipeState: %x\n", Ccb->PipeState);
Status = STATUS_PIPE_BROKEN;
- ExReleaseFastMutex(&ReaderFcb->DataListLock);
+ ExReleaseFastMutex(&ReaderCcb->DataListLock);
goto done;
}
}
@@ -705,38 +705,38 @@
if (Pipe->WriteMode == FILE_PIPE_BYTE_STREAM_MODE)
{
DPRINT("Byte stream mode\n");
- while (Length > 0 && ReaderFcb->WriteQuotaAvailable > 0)
+ while (Length > 0 && ReaderCcb->WriteQuotaAvailable > 0)
{
- CopyLength = min(Length, ReaderFcb->WriteQuotaAvailable);
- if ((ULONG_PTR)ReaderFcb->WritePtr + CopyLength <=
(ULONG_PTR)ReaderFcb->Data + ReaderFcb->MaxDataLength)
+ CopyLength = min(Length, ReaderCcb->WriteQuotaAvailable);
+ if ((ULONG_PTR)ReaderCcb->WritePtr + CopyLength <=
(ULONG_PTR)ReaderCcb->Data + ReaderCcb->MaxDataLength)
{
- memcpy(ReaderFcb->WritePtr, Buffer, CopyLength);
- ReaderFcb->WritePtr = (PVOID)((ULONG_PTR)ReaderFcb->WritePtr + CopyLength);
- if ((ULONG_PTR)ReaderFcb->WritePtr == (ULONG_PTR)ReaderFcb->Data +
ReaderFcb->MaxDataLength)
+ memcpy(ReaderCcb->WritePtr, Buffer, CopyLength);
+ ReaderCcb->WritePtr = (PVOID)((ULONG_PTR)ReaderCcb->WritePtr + CopyLength);
+ if ((ULONG_PTR)ReaderCcb->WritePtr == (ULONG_PTR)ReaderCcb->Data +
ReaderCcb->MaxDataLength)
{
- ReaderFcb->WritePtr = ReaderFcb->Data;
+ ReaderCcb->WritePtr = ReaderCcb->Data;
}
}
else
{
- TempLength = (ULONG)((ULONG_PTR)ReaderFcb->Data + ReaderFcb->MaxDataLength -
(ULONG_PTR)ReaderFcb->WritePtr);
- memcpy(ReaderFcb->WritePtr, Buffer, TempLength);
- memcpy(ReaderFcb->Data, Buffer + TempLength, CopyLength - TempLength);
- ReaderFcb->WritePtr = (PVOID)((ULONG_PTR)ReaderFcb->Data + CopyLength -
TempLength);
+ TempLength = (ULONG)((ULONG_PTR)ReaderCcb->Data + ReaderCcb->MaxDataLength -
(ULONG_PTR)ReaderCcb->WritePtr);
+ memcpy(ReaderCcb->WritePtr, Buffer, TempLength);
+ memcpy(ReaderCcb->Data, Buffer + TempLength, CopyLength - TempLength);
+ ReaderCcb->WritePtr = (PVOID)((ULONG_PTR)ReaderCcb->Data + CopyLength -
TempLength);
}
Buffer += CopyLength;
Length -= CopyLength;
Information += CopyLength;
- ReaderFcb->ReadDataAvailable += CopyLength;
- ReaderFcb->WriteQuotaAvailable -= CopyLength;
+ ReaderCcb->ReadDataAvailable += CopyLength;
+ ReaderCcb->WriteQuotaAvailable -= CopyLength;
}
if (Length == 0)
{
- KeSetEvent(&ReaderFcb->ReadEvent, IO_NO_INCREMENT, FALSE);
- KeResetEvent(&Fcb->WriteEvent);
+ KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
+ KeResetEvent(&Ccb->WriteEvent);
break;
}
}
@@ -745,24 +745,24 @@
DPRINT("Message mode\n");
if (Length > 0)
{
- CopyLength = min(Length, ReaderFcb->WriteQuotaAvailable);
- memcpy(ReaderFcb->Data, Buffer, CopyLength);
+ CopyLength = min(Length, ReaderCcb->WriteQuotaAvailable);
+ memcpy(ReaderCcb->Data, Buffer, CopyLength);
Information = CopyLength;
- ReaderFcb->ReadDataAvailable = CopyLength;
- ReaderFcb->WriteQuotaAvailable = 0;
+ ReaderCcb->ReadDataAvailable = CopyLength;
+ ReaderCcb->WriteQuotaAvailable = 0;
}
if (Information > 0)
{
- KeSetEvent(&ReaderFcb->ReadEvent, IO_NO_INCREMENT, FALSE);
- KeResetEvent(&Fcb->WriteEvent);
+ KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
+ KeResetEvent(&Ccb->WriteEvent);
break;
}
}
}
- ExReleaseFastMutex(&ReaderFcb->DataListLock);
+ ExReleaseFastMutex(&ReaderCcb->DataListLock);
done:
Irp->IoStatus.Status = Status;