mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:42:57 +00:00
[NPFS]
- Fix return status if no listening server found in NpfsCreate - Do not use obsolete function MmGetSystemAddressForMdl - Fix a few MSVC/GCC 4.7 warnings - Correctly handle device/root FCB allocation failure - Fix type of NPFS_CCB::RefCount svn path=/trunk/; revision=57419
This commit is contained in:
parent
ca666fb5a8
commit
fccc5788cc
8 changed files with 72 additions and 29 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/fs/np/create.c
|
* FILE: drivers/filesystems/npfs/create.c
|
||||||
* PURPOSE: Named pipe filesystem
|
* PURPOSE: Named pipe filesystem
|
||||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||||
*/
|
*/
|
||||||
|
@ -49,6 +49,7 @@ NpfsAllocateCcb(CCB_TYPE Type, PNPFS_FCB Fcb)
|
||||||
|
|
||||||
Ccb->RefCount = 1;
|
Ccb->RefCount = 1;
|
||||||
Ccb->Type = Type;
|
Ccb->Type = Type;
|
||||||
|
// FIXME: why does this function not reference Fcb?
|
||||||
Ccb->Fcb = Fcb;
|
Ccb->Fcb = Fcb;
|
||||||
Ccb->OtherSide = NULL;
|
Ccb->OtherSide = NULL;
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ VOID
|
||||||
NpfsReferenceCcb(PNPFS_CCB Ccb)
|
NpfsReferenceCcb(PNPFS_CCB Ccb)
|
||||||
{
|
{
|
||||||
ASSERT(Ccb->RefCount > 0);
|
ASSERT(Ccb->RefCount > 0);
|
||||||
InterlockedIncrement((PLONG)&Ccb->RefCount);
|
InterlockedIncrement(&Ccb->RefCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -69,7 +70,7 @@ NpfsDereferenceCcb(PNPFS_CCB Ccb)
|
||||||
{
|
{
|
||||||
/* Decrement reference count */
|
/* Decrement reference count */
|
||||||
ASSERT(Ccb->RefCount > 0);
|
ASSERT(Ccb->RefCount > 0);
|
||||||
if (InterlockedDecrement((PLONG)&Ccb->RefCount) == 0)
|
if (InterlockedDecrement(&Ccb->RefCount) == 0)
|
||||||
{
|
{
|
||||||
/* Its zero, delete CCB */
|
/* Its zero, delete CCB */
|
||||||
ExFreePoolWithTag(Ccb, TAG_NPFS_CCB);
|
ExFreePoolWithTag(Ccb, TAG_NPFS_CCB);
|
||||||
|
@ -249,9 +250,9 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
PNPFS_CCB ClientCcb;
|
PNPFS_CCB ClientCcb;
|
||||||
PNPFS_CCB ServerCcb = NULL;
|
PNPFS_CCB ServerCcb = NULL;
|
||||||
PNPFS_VCB Vcb;
|
PNPFS_VCB Vcb;
|
||||||
ACCESS_MASK DesiredAccess;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS
|
#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS
|
||||||
|
ACCESS_MASK DesiredAccess;
|
||||||
BOOLEAN SpecialAccess;
|
BOOLEAN SpecialAccess;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -262,7 +263,9 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
FileObject = IoStack->FileObject;
|
FileObject = IoStack->FileObject;
|
||||||
RelatedFileObject = FileObject->RelatedFileObject;
|
RelatedFileObject = FileObject->RelatedFileObject;
|
||||||
FileName = &FileObject->FileName;
|
FileName = &FileObject->FileName;
|
||||||
|
#ifndef USING_PROPER_NPFS_WAIT_SEMANTICS
|
||||||
DesiredAccess = IoStack->Parameters.CreatePipe.SecurityContext->DesiredAccess;
|
DesiredAccess = IoStack->Parameters.CreatePipe.SecurityContext->DesiredAccess;
|
||||||
|
#endif
|
||||||
|
|
||||||
DPRINT("FileObject %p\n", FileObject);
|
DPRINT("FileObject %p\n", FileObject);
|
||||||
DPRINT("FileName %wZ\n", &FileObject->FileName);
|
DPRINT("FileName %wZ\n", &FileObject->FileName);
|
||||||
|
@ -444,9 +447,9 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
NpfsDereferenceCcb(ClientCcb);
|
NpfsDereferenceCcb(ClientCcb);
|
||||||
KeUnlockMutex(&Fcb->CcbListLock);
|
KeUnlockMutex(&Fcb->CcbListLock);
|
||||||
NpfsDereferenceFcb(Fcb);
|
NpfsDereferenceFcb(Fcb);
|
||||||
Irp->IoStatus.Status = STATUS_OBJECT_PATH_NOT_FOUND;
|
Irp->IoStatus.Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_OBJECT_PATH_NOT_FOUND;
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/filesastems/npfs/dirctl.c
|
* FILE: drivers/filesystems/npfs/dirctl.c
|
||||||
* PURPOSE: Named pipe filesystem
|
* PURPOSE: Named pipe filesystem
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,8 @@ NpfsQueryDirectory(PNPFS_CCB Ccb,
|
||||||
/* Determine Buffer for result */
|
/* Determine Buffer for result */
|
||||||
if (Irp->MdlAddress)
|
if (Irp->MdlAddress)
|
||||||
{
|
{
|
||||||
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
|
||||||
|
NormalPagePriority);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -298,6 +299,8 @@ NpfsDirectoryControl(PDEVICE_OBJECT DeviceObject,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Size = 0;
|
ULONG Size = 0;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
DPRINT("NpfsDirectoryControl() called\n");
|
DPRINT("NpfsDirectoryControl() called\n");
|
||||||
|
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/fs/np/finfo.c
|
* FILE: drivers/filesystems/npfs/finfo.c
|
||||||
* PURPOSE: Named pipe filesystem
|
* PURPOSE: Named pipe filesystem
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,9 @@ NpfsSetPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
PNPFS_FCB Fcb;
|
PNPFS_FCB Fcb;
|
||||||
PFILE_PIPE_INFORMATION Request;
|
PFILE_PIPE_INFORMATION Request;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
DPRINT("NpfsSetPipeInformation()\n");
|
DPRINT("NpfsSetPipeInformation()\n");
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
|
if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
|
||||||
|
@ -68,6 +71,9 @@ NpfsSetPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
PNPFS_FCB Fcb;
|
PNPFS_FCB Fcb;
|
||||||
PFILE_PIPE_REMOTE_INFORMATION Request;
|
PFILE_PIPE_REMOTE_INFORMATION Request;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
DPRINT("NpfsSetPipeRemoteInformation()\n");
|
DPRINT("NpfsSetPipeRemoteInformation()\n");
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
||||||
|
@ -97,6 +103,9 @@ NpfsQueryPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
PNPFS_FCB Fcb;
|
PNPFS_FCB Fcb;
|
||||||
ULONG ConnectionSideReadMode;
|
ULONG ConnectionSideReadMode;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
DPRINT("NpfsQueryPipeInformation()\n");
|
DPRINT("NpfsQueryPipeInformation()\n");
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
|
if (*BufferLength < sizeof(FILE_PIPE_INFORMATION))
|
||||||
|
@ -132,6 +141,9 @@ NpfsQueryPipeRemoteInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
PULONG BufferLength)
|
PULONG BufferLength)
|
||||||
{
|
{
|
||||||
PNPFS_FCB Fcb;
|
PNPFS_FCB Fcb;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
DPRINT("NpfsQueryPipeRemoteInformation()\n");
|
DPRINT("NpfsQueryPipeRemoteInformation()\n");
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
||||||
|
@ -165,6 +177,8 @@ NpfsQueryLocalPipeInformation(PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
PNPFS_FCB Fcb;
|
PNPFS_FCB Fcb;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
DPRINT("NpfsQueryLocalPipeInformation()\n");
|
DPRINT("NpfsQueryLocalPipeInformation()\n");
|
||||||
|
|
||||||
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
if (*BufferLength < sizeof(FILE_PIPE_REMOTE_INFORMATION))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/fs/np/fsctrl.c
|
* FILE: drivers/filesystems/npfs/fsctrl.c
|
||||||
* PURPOSE: Named pipe filesystem
|
* PURPOSE: Named pipe filesystem
|
||||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||||
* Eric Kohl
|
* Eric Kohl
|
||||||
|
@ -26,6 +26,8 @@ NpfsListeningCancelRoutine(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
PNPFS_WAITER_ENTRY Waiter;
|
PNPFS_WAITER_ENTRY Waiter;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
Waiter = (PNPFS_WAITER_ENTRY)&Irp->Tail.Overlay.DriverContext;
|
Waiter = (PNPFS_WAITER_ENTRY)&Irp->Tail.Overlay.DriverContext;
|
||||||
|
|
||||||
DPRINT("NpfsListeningCancelRoutine() called for <%wZ>\n",
|
DPRINT("NpfsListeningCancelRoutine() called for <%wZ>\n",
|
||||||
|
@ -795,6 +797,7 @@ NpfsFlushBuffers(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
/* FIXME: Implement */
|
/* FIXME: Implement */
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/fs/np/mount.c
|
* FILE: drivers/filesystems/npfs/npfs.c
|
||||||
* PURPOSE: Named pipe filesystem
|
* PURPOSE: Named pipe filesystem
|
||||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||||
*/
|
*/
|
||||||
|
@ -25,6 +25,8 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
PNPFS_FCB Fcb;
|
PNPFS_FCB Fcb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(RegistryPath);
|
||||||
|
|
||||||
DPRINT("Named Pipe FSD 0.0.2\n");
|
DPRINT("Named Pipe FSD 0.0.2\n");
|
||||||
|
|
||||||
ASSERT (sizeof(NPFS_CONTEXT) <= FIELD_OFFSET(IRP, Tail.Overlay.DriverContext));
|
ASSERT (sizeof(NPFS_CONTEXT) <= FIELD_OFFSET(IRP, Tail.Overlay.DriverContext));
|
||||||
|
@ -87,6 +89,12 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
/* Create the device FCB */
|
/* Create the device FCB */
|
||||||
Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB);
|
Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB);
|
||||||
|
if (!Fcb)
|
||||||
|
{
|
||||||
|
DPRINT1("Out of memory for device FCB!\n");
|
||||||
|
IoDeleteDevice(DeviceObject);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
Fcb->Type = FCB_DEVICE;
|
Fcb->Type = FCB_DEVICE;
|
||||||
Fcb->Vcb = Vcb;
|
Fcb->Vcb = Vcb;
|
||||||
Fcb->RefCount = 1;
|
Fcb->RefCount = 1;
|
||||||
|
@ -94,6 +102,13 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
/* Create the root directory FCB */
|
/* Create the root directory FCB */
|
||||||
Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB);
|
Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB);
|
||||||
|
if (!Fcb)
|
||||||
|
{
|
||||||
|
DPRINT1("Out of memory for root FCB!\n");
|
||||||
|
IoDeleteDevice(DeviceObject);
|
||||||
|
ExFreePoolWithTag(Vcb->DeviceFcb, TAG_NPFS_FCB);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
Fcb->Type = FCB_DIRECTORY;
|
Fcb->Type = FCB_DIRECTORY;
|
||||||
Fcb->Vcb = Vcb;
|
Fcb->Vcb = Vcb;
|
||||||
Fcb->RefCount = 1;
|
Fcb->RefCount = 1;
|
||||||
|
|
|
@ -95,7 +95,7 @@ typedef struct _NPFS_CCB
|
||||||
ULONG PipeState;
|
ULONG PipeState;
|
||||||
ULONG ReadDataAvailable;
|
ULONG ReadDataAvailable;
|
||||||
ULONG WriteQuotaAvailable;
|
ULONG WriteQuotaAvailable;
|
||||||
ULONG RefCount;
|
volatile LONG RefCount;
|
||||||
|
|
||||||
LIST_ENTRY ReadRequestListHead;
|
LIST_ENTRY ReadRequestListHead;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/fs/np/rw.c
|
* FILE: drivers/filesystems/npfs/rw.c
|
||||||
* PURPOSE: Named pipe filesystem
|
* PURPOSE: Named pipe filesystem
|
||||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||||
* Michael Martin
|
* Michael Martin
|
||||||
|
@ -115,6 +115,7 @@ NpfsReadWriteCancelRoutine(IN PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static KSTART_ROUTINE NpfsWaiterThread;
|
||||||
static VOID NTAPI
|
static VOID NTAPI
|
||||||
NpfsWaiterThread(PVOID InitContext)
|
NpfsWaiterThread(PVOID InitContext)
|
||||||
{
|
{
|
||||||
|
@ -175,7 +176,7 @@ NpfsWaiterThread(PVOID InitContext)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* someone has add a new wait request or cancelled an old one */
|
/* someone has added a new wait request or cancelled an old one */
|
||||||
Irp = NULL;
|
Irp = NULL;
|
||||||
|
|
||||||
/* Look for cancelled requests */
|
/* Look for cancelled requests */
|
||||||
|
@ -183,16 +184,16 @@ NpfsWaiterThread(PVOID InitContext)
|
||||||
{
|
{
|
||||||
if (ThreadContext->WaitIrpArray[i] == NULL)
|
if (ThreadContext->WaitIrpArray[i] == NULL)
|
||||||
{
|
{
|
||||||
ThreadContext->Count--;
|
ThreadContext->Count--;
|
||||||
ThreadContext->Vcb->EmptyWaiterCount++;
|
ThreadContext->Vcb->EmptyWaiterCount++;
|
||||||
ThreadContext->WaitObjectArray[i] = ThreadContext->WaitObjectArray[ThreadContext->Count];
|
ThreadContext->WaitObjectArray[i] = ThreadContext->WaitObjectArray[ThreadContext->Count];
|
||||||
ThreadContext->WaitIrpArray[i] = ThreadContext->WaitIrpArray[ThreadContext->Count];
|
ThreadContext->WaitIrpArray[i] = ThreadContext->WaitIrpArray[ThreadContext->Count];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ThreadContext->Count == 1 && ThreadContext->Vcb->EmptyWaiterCount >= MAXIMUM_WAIT_OBJECTS)
|
if (ThreadContext->Count == 1 && ThreadContext->Vcb->EmptyWaiterCount >= MAXIMUM_WAIT_OBJECTS)
|
||||||
{
|
{
|
||||||
/* it exist an other thread with empty wait slots, we can remove our thread from the list */
|
/* there is another thread with empty wait slots, we can remove our thread from the list */
|
||||||
RemoveEntryList(&ThreadContext->ListEntry);
|
RemoveEntryList(&ThreadContext->ListEntry);
|
||||||
ExFreePoolWithTag(ThreadContext, TAG_NPFS_THREAD_CONTEXT);
|
ExFreePoolWithTag(ThreadContext, TAG_NPFS_THREAD_CONTEXT);
|
||||||
KeUnlockMutex(&ThreadContext->Vcb->PipeListLock);
|
KeUnlockMutex(&ThreadContext->Vcb->PipeListLock);
|
||||||
|
@ -416,10 +417,11 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
|
||||||
|
NormalPagePriority);
|
||||||
Information = Irp->IoStatus.Information;
|
Information = Irp->IoStatus.Information;
|
||||||
Length = IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length;
|
Length = IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length;
|
||||||
ASSERT (Information <= Length);
|
ASSERT(Information <= Length);
|
||||||
Buffer = (PVOID)((ULONG_PTR)Buffer + Information);
|
Buffer = (PVOID)((ULONG_PTR)Buffer + Information);
|
||||||
Length -= Information;
|
Length -= Information;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -443,7 +445,8 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) || (!Ccb->OtherSide)) && (Ccb->ReadDataAvailable == 0))
|
ASSERT(Ccb->ReadDataAvailable == 0);
|
||||||
|
if ((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) || (!Ccb->OtherSide))
|
||||||
{
|
{
|
||||||
DPRINT("PipeState: %x\n", Ccb->PipeState);
|
DPRINT("PipeState: %x\n", Ccb->PipeState);
|
||||||
Status = STATUS_PIPE_BROKEN;
|
Status = STATUS_PIPE_BROKEN;
|
||||||
|
@ -556,7 +559,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
||||||
{
|
{
|
||||||
ULONG NextMessageLength = 0;
|
ULONG NextMessageLength = 0;
|
||||||
|
|
||||||
/*First get the size of the message */
|
/* First get the size of the message */
|
||||||
memcpy(&NextMessageLength, Ccb->ReadPtr, sizeof(NextMessageLength));
|
memcpy(&NextMessageLength, Ccb->ReadPtr, sizeof(NextMessageLength));
|
||||||
|
|
||||||
if ((NextMessageLength == 0) || (NextMessageLength > Ccb->ReadDataAvailable))
|
if ((NextMessageLength == 0) || (NextMessageLength > Ccb->ReadDataAvailable))
|
||||||
|
@ -579,7 +582,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
||||||
/* Client only requested part of the message */
|
/* Client only requested part of the message */
|
||||||
{
|
{
|
||||||
/* Calculate the remaining message new size */
|
/* Calculate the remaining message new size */
|
||||||
ULONG NewMessageSize = NextMessageLength-CopyLength;
|
ULONG NewMessageSize = NextMessageLength - CopyLength;
|
||||||
|
|
||||||
/* Update ReadPtr to point to new Message size location */
|
/* Update ReadPtr to point to new Message size location */
|
||||||
Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->ReadPtr + CopyLength);
|
Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->ReadPtr + CopyLength);
|
||||||
|
@ -616,7 +619,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
Ccb->ReadDataAvailable -= CopyLength;
|
Ccb->ReadDataAvailable -= CopyLength;
|
||||||
|
|
||||||
if ((ULONG)Ccb->WriteQuotaAvailable > (ULONG)Ccb->MaxDataLength) ASSERT(FALSE);
|
ASSERT(Ccb->WriteQuotaAvailable <= Ccb->MaxDataLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Information > 0)
|
if (Information > 0)
|
||||||
|
@ -740,6 +743,8 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
ULONG CopyLength;
|
ULONG CopyLength;
|
||||||
ULONG TempLength;
|
ULONG TempLength;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(DeviceObject);
|
||||||
|
|
||||||
DPRINT("NpfsWrite()\n");
|
DPRINT("NpfsWrite()\n");
|
||||||
|
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
@ -794,7 +799,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
Buffer = MmGetSystemAddressForMdlSafe (Irp->MdlAddress, NormalPagePriority);
|
Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
|
||||||
|
|
||||||
if (!Buffer)
|
if (!Buffer)
|
||||||
{
|
{
|
||||||
|
@ -813,7 +818,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
HexDump(Buffer, Length);
|
HexDump(Buffer, Length);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (ReaderCcb->WriteQuotaAvailable == 0)
|
if (ReaderCcb->WriteQuotaAvailable == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: drivers/fs/npfs/volume.c
|
* FILE: drivers/filesystems/npfs/volume.c
|
||||||
* PURPOSE: Named pipe filesystem
|
* PURPOSE: Named pipe filesystem
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue