[NPFS-NEW]: Fix moar bougs. pipe: 33920 tests execute (0 marked as todo, 84 failures), 0 skipped. Note that this is already better than trunk's npfs!

svn path=/trunk/; revision=60067
This commit is contained in:
Alex Ionescu 2013-09-12 22:42:13 +00:00
parent 4f9c6d1106
commit fb79499369
5 changed files with 22 additions and 9 deletions

View file

@ -175,9 +175,9 @@ NpGetNextRealDataQueueEntry(IN PNP_DATA_QUEUE DataQueue,
PLIST_ENTRY NextEntry;
PAGED_CODE();
DataEntry = NULL;
NextEntry = DataQueue->Queue.Flink;
DataEntry = CONTAINING_RECORD(NextEntry, NP_DATA_QUEUE_ENTRY, QueueEntry);
while (NextEntry != &DataQueue->Queue)
{
DataEntry = CONTAINING_RECORD(NextEntry, NP_DATA_QUEUE_ENTRY, QueueEntry);

View file

@ -37,11 +37,11 @@ NpCommonFlushBuffers(IN PDEVICE_OBJECT DeviceObject,
if (NamedPipeEnd == FILE_PIPE_SERVER_END)
{
FlushQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
FlushQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
}
else
{
FlushQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
FlushQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
}
if (FlushQueue->QueueState == WriteEntries)
@ -81,6 +81,12 @@ NpFsdFlushBuffers(IN PDEVICE_OBJECT DeviceObject,
NpReleaseVcb();
FsRtlExitFileSystem();
if (Status != STATUS_PENDING)
{
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
}
return Status;
}

View file

@ -351,6 +351,8 @@ NpReleaseVcb(VOID)
ExReleaseResourceLite(&NpVcb->Lock);
}
//
// Function to process deferred IRPs outside the VCB lock but still within the
// critical region

View file

@ -75,7 +75,7 @@ NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue,
}
DataLength = Offset;
if (Offset >= RemainingSize) DataLength = RemainingSize;
if (DataLength >= RemainingSize) DataLength = RemainingSize;
_SEH2_TRY
{
@ -130,14 +130,17 @@ NpReadDataQueue(IN PNP_DATA_QUEUE DataQueue,
InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
}
}
if (Mode == FILE_PIPE_MESSAGE_MODE)
{
Status.Status = STATUS_SUCCESS;
break;
}
ASSERT(!ReadOverflowOperation);
}
}
if (Peek)
{
DataEntry = CONTAINING_RECORD(DataEntry->QueueEntry.Flink,

View file

@ -36,7 +36,7 @@ NpCommonWrite(IN PFILE_OBJECT FileObject,
PNP_DATA_QUEUE WriteQueue;
NTSTATUS Status;
PNP_EVENT_BUFFER EventBuffer;
ULONG BytesWritten, NamedPipeEnd;
ULONG BytesWritten, NamedPipeEnd, ReadMode;
PAGED_CODE();
IoStatus->Information = 0;
@ -91,10 +91,12 @@ NpCommonWrite(IN PFILE_OBJECT FileObject,
if (NamedPipeEnd == FILE_PIPE_SERVER_END)
{
WriteQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
ReadMode = Ccb->ReadMode[FILE_PIPE_CLIENT_END];
}
else
{
WriteQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
ReadMode = Ccb->ReadMode[FILE_PIPE_SERVER_END];
}
EventBuffer = NonPagedCcb->EventBuffer[NamedPipeEnd];
@ -122,7 +124,7 @@ NpCommonWrite(IN PFILE_OBJECT FileObject,
}
Status = NpWriteDataQueue(WriteQueue,
Ccb->ReadMode[NamedPipeEnd],
ReadMode,
Buffer,
DataSize,
Ccb->Fcb->NamedPipeType,
@ -136,8 +138,8 @@ NpCommonWrite(IN PFILE_OBJECT FileObject,
if (Status == STATUS_MORE_PROCESSING_REQUIRED)
{
ASSERT(WriteQueue->QueueState != ReadEntries);
if ((Ccb->CompletionMode[NamedPipeEnd] == FILE_PIPE_COMPLETE_OPERATION || !Irp)
&& WriteQueue->Quota - WriteQueue->QuotaUsed < BytesWritten)
if ((Ccb->CompletionMode[NamedPipeEnd] == FILE_PIPE_COMPLETE_OPERATION || !Irp) &&
((WriteQueue->Quota - WriteQueue->QuotaUsed) < BytesWritten))
{
IoStatus->Information = DataSize - BytesWritten;
IoStatus->Status = STATUS_SUCCESS;