mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NPFS-NEW]:
NpfsCreate: 339 tests executed (0 marked as todo, 0 failures), 0 skipped. NpfsConnect: 679 tests executed (0 marked as todo, 0 failures), 0 skipped. NpfsReadWrite: 7154 tests executed (0 marked as todo, 0 failures), 0 skipped. NpfsReadWriteAsync: 1176 tests executed (0 marked as todo, 0 failures), 0 skipped. 'Nuff said. svn path=/trunk/; revision=60028
This commit is contained in:
parent
a8e4859598
commit
529ec2cb68
11 changed files with 112 additions and 102 deletions
|
@ -12,6 +12,7 @@ NpCommonCleanup(IN PDEVICE_OBJECT DeviceObject,
|
|||
PNP_CCB Ccb;
|
||||
ULONG NamedPipeEnd;
|
||||
PLIST_ENTRY ThisEntry, NextEntry;
|
||||
PIRP LocalIrp;
|
||||
PAGED_CODE();
|
||||
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
@ -41,8 +42,8 @@ NpCommonCleanup(IN PDEVICE_OBJECT DeviceObject,
|
|||
ThisEntry = NextEntry;
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -12,6 +12,7 @@ NpCommonClose(IN PDEVICE_OBJECT DeviceObject,
|
|||
PNP_CCB Ccb;
|
||||
ULONG NamedPipeEnd;
|
||||
PLIST_ENTRY ThisEntry, NextEntry;
|
||||
PIRP LocalIrp;
|
||||
PAGED_CODE();
|
||||
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
@ -40,8 +41,8 @@ NpCommonClose(IN PDEVICE_OBJECT DeviceObject,
|
|||
ThisEntry = NextEntry;
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
|
|
|
@ -217,11 +217,6 @@ NpFsdCreate(IN PDEVICE_OBJECT DeviceObject,
|
|||
FileName = FileObject->FileName;
|
||||
DesiredAccess = IoStack->Parameters.CreatePipe.SecurityContext->DesiredAccess;
|
||||
|
||||
DPRINT1("NpfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
DPRINT1("FileObject %p\n", FileObject);
|
||||
DPRINT1("FileName %wZ\n", &FileObject->FileName);
|
||||
DPRINT1("FileName->Length: %hu RelatedFileObject: %p\n", FileName.Length, RelatedFileObject);
|
||||
|
||||
FsRtlEnterFileSystem();
|
||||
ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
|
||||
|
||||
|
@ -346,7 +341,7 @@ Quickie:
|
|||
NextEntry = NextEntry->Flink;
|
||||
|
||||
ListIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(ListIrp, IO_DISK_INCREMENT);
|
||||
IoCompleteRequest(ListIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
FsRtlExitFileSystem();
|
||||
|
@ -636,8 +631,6 @@ NpFsdCreateNamedPipe(IN PDEVICE_OBJECT DeviceObject,
|
|||
IO_STATUS_BLOCK IoStatus;
|
||||
PIRP ListIrp;
|
||||
|
||||
DPRINT1("NpFsdCreateNamedPipe(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
InitializeListHead(&LocalList);
|
||||
Process = IoGetRequestorProcess(Irp);
|
||||
|
||||
|
@ -659,10 +652,6 @@ NpFsdCreateNamedPipe(IN PDEVICE_OBJECT DeviceObject,
|
|||
FsRtlEnterFileSystem();
|
||||
ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
|
||||
|
||||
DPRINT1("FileObject %p\n", FileObject);
|
||||
DPRINT1("FileName %wZ\n", &FileObject->FileName);
|
||||
DPRINT1("FileName->Length: %hu RelatedFileObject: %p\n", FileName.Length, RelatedFileObject);
|
||||
|
||||
if (RelatedFileObject)
|
||||
{
|
||||
Fcb = (PNP_FCB)((ULONG_PTR)RelatedFileObject->FsContext & ~1);
|
||||
|
@ -754,13 +743,13 @@ Quickie:
|
|||
NextEntry = NextEntry->Flink;
|
||||
|
||||
ListIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(ListIrp, IO_DISK_INCREMENT);
|
||||
IoCompleteRequest(ListIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
FsRtlExitFileSystem();
|
||||
|
||||
Irp->IoStatus = IoStatus;
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
|
||||
return IoStatus.Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ NpCancelDataQueueIrp(IN PDEVICE_OBJECT DeviceObject,
|
|||
PSECURITY_CLIENT_CONTEXT ClientSecurityContext;
|
||||
BOOLEAN CompleteWrites, FirstEntry;
|
||||
PLIST_ENTRY NextEntry, ThisEntry;
|
||||
PIRP LocalIrp;
|
||||
|
||||
if (DeviceObject) IoReleaseCancelSpinLock(Irp->CancelIrql);
|
||||
|
||||
|
@ -263,7 +264,7 @@ NpCancelDataQueueIrp(IN PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
NpFreeClientSecurityContext(ClientSecurityContext);
|
||||
Irp->IoStatus.Status = STATUS_CANCELLED;
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
|
||||
|
||||
NextEntry = List.Flink;
|
||||
while (NextEntry != &List)
|
||||
|
@ -271,8 +272,8 @@ NpCancelDataQueueIrp(IN PDEVICE_OBJECT DeviceObject,
|
|||
ThisEntry = NextEntry;
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +308,10 @@ NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
|||
Irp ? Irp->Tail.Overlay.Thread :
|
||||
PsGetCurrentThread(),
|
||||
&ClientContext);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Type)
|
||||
|
@ -317,29 +321,31 @@ NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
|||
case 3:
|
||||
|
||||
ASSERT(Irp != NULL);
|
||||
DataEntry = ExAllocatePoolWithQuotaTag(NonPagedPool, sizeof(*DataEntry), NPFS_DATA_ENTRY_TAG);
|
||||
if (DataEntry)
|
||||
DataEntry = ExAllocatePoolWithQuotaTag(NonPagedPool,
|
||||
sizeof(*DataEntry),
|
||||
NPFS_DATA_ENTRY_TAG);
|
||||
if (!DataEntry)
|
||||
{
|
||||
DataEntry->DataEntryType = Type;
|
||||
DataEntry->QuotaInEntry = 0;
|
||||
DataEntry->Irp = Irp;
|
||||
DataEntry->DataSize = DataSize;
|
||||
DataEntry->ClientSecurityContext = ClientContext;
|
||||
ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
|
||||
Status = STATUS_PENDING;
|
||||
break;
|
||||
NpFreeClientSecurityContext(ClientContext);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
NpFreeClientSecurityContext(ClientContext);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
DataEntry->DataEntryType = Type;
|
||||
DataEntry->QuotaInEntry = 0;
|
||||
DataEntry->Irp = Irp;
|
||||
DataEntry->DataSize = DataSize;
|
||||
DataEntry->ClientSecurityContext = ClientContext;
|
||||
ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
|
||||
Status = STATUS_PENDING;
|
||||
break;
|
||||
|
||||
case Buffered:
|
||||
|
||||
EntrySize = sizeof(*DataEntry);
|
||||
if (Who != Empty)
|
||||
if (Who != ReadEntries)
|
||||
{
|
||||
EntrySize = DataSize + sizeof(*DataEntry);
|
||||
if ((DataSize + sizeof(*DataEntry)) < DataSize)
|
||||
EntrySize += DataSize;
|
||||
if (EntrySize < DataSize)
|
||||
{
|
||||
NpFreeClientSecurityContext(ClientContext);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
@ -350,14 +356,16 @@ NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
|||
if (DataQueue->Quota - DataQueue->QuotaUsed < QuotaInEntry)
|
||||
{
|
||||
QuotaInEntry = DataQueue->Quota - DataQueue->QuotaUsed;
|
||||
HasSpace = 1;
|
||||
HasSpace = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
HasSpace = 0;
|
||||
HasSpace = FALSE;
|
||||
}
|
||||
|
||||
DataEntry = ExAllocatePoolWithQuotaTag(NonPagedPool, EntrySize, NPFS_DATA_ENTRY_TAG);
|
||||
DataEntry = ExAllocatePoolWithQuotaTag(NonPagedPool,
|
||||
EntrySize,
|
||||
NPFS_DATA_ENTRY_TAG);
|
||||
if (!DataEntry)
|
||||
{
|
||||
NpFreeClientSecurityContext(ClientContext);
|
||||
|
@ -382,9 +390,9 @@ NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
|||
{
|
||||
_SEH2_TRY
|
||||
{
|
||||
RtlCopyMemory(DataEntry + 1,
|
||||
Irp ? Irp->UserBuffer: Buffer,
|
||||
DataSize);
|
||||
RtlCopyMemory(DataEntry + 1,
|
||||
Irp ? Irp->UserBuffer: Buffer,
|
||||
DataSize);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
@ -399,12 +407,14 @@ NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
|||
}
|
||||
else
|
||||
{
|
||||
DataEntry->Irp = 0;
|
||||
DataEntry->Irp = NULL;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
|
||||
|
||||
ASSERT((DataQueue->QueueState == Empty) ||
|
||||
(DataQueue->QueueState == Who));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(FALSE);
|
||||
|
@ -429,7 +439,8 @@ NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
|||
DataQueue->QuotaUsed += DataEntry->QuotaInEntry;
|
||||
DataQueue->QueueState = Who;
|
||||
DataQueue->BytesInQueue += DataEntry->DataSize;
|
||||
++DataQueue->EntriesInQueue;
|
||||
DataQueue->EntriesInQueue++;
|
||||
|
||||
if (ByteOffset)
|
||||
{
|
||||
DataQueue->ByteOffset = ByteOffset;
|
||||
|
@ -448,9 +459,8 @@ NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
|||
|
||||
IoSetCancelRoutine(Irp, NpCancelDataQueueIrp);
|
||||
|
||||
if (Irp->Cancel)
|
||||
if ((Irp->Cancel) && (IoSetCancelRoutine(Irp, NULL)))
|
||||
{
|
||||
IoSetCancelRoutine(Irp, NULL);
|
||||
NpCancelDataQueueIrp(NULL, Irp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ NpFsdSetInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
NTSTATUS Status;
|
||||
LIST_ENTRY List;
|
||||
PLIST_ENTRY NextEntry, ThisEntry;
|
||||
PIRP LocalIrp;
|
||||
PAGED_CODE();
|
||||
|
||||
InitializeListHead(&List);
|
||||
|
@ -119,8 +120,8 @@ NpFsdSetInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
ThisEntry = NextEntry;
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
FsRtlExitFileSystem();
|
||||
|
|
|
@ -572,6 +572,7 @@ NpCommonFileSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
LIST_ENTRY List;
|
||||
PLIST_ENTRY NextEntry, ThisEntry;
|
||||
NTSTATUS Status;
|
||||
PIRP LocalIrp;
|
||||
PAGED_CODE();
|
||||
|
||||
InitializeListHead(&List);
|
||||
|
@ -667,8 +668,8 @@ NpCommonFileSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||
ThisEntry = NextEntry;
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
|
|
@ -61,8 +61,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
|
||||
/* Initialize the device object */
|
||||
NpfsDeviceObject = DeviceObject;
|
||||
DeviceObject->Flags |= DO_DIRECT_IO;
|
||||
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
DeviceObject->Flags |= DO_LONG_TERM_REQUESTS;
|
||||
|
||||
/* Initialize the Volume Control Block (VCB) */
|
||||
NpVcb = DeviceObject->DeviceExtension;
|
||||
|
|
|
@ -144,6 +144,7 @@ NpFsdRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
IO_STATUS_BLOCK IoStatus;
|
||||
LIST_ENTRY List;
|
||||
PLIST_ENTRY NextEntry, ThisEntry;
|
||||
PIRP LocalIrp;
|
||||
PAGED_CODE();
|
||||
NpSlowReadCalls++;
|
||||
|
||||
|
@ -168,8 +169,8 @@ NpFsdRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
ThisEntry = NextEntry;
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
FsRtlExitFileSystem();
|
||||
|
|
|
@ -235,6 +235,7 @@ NpSetClosingPipeState(IN PNP_CCB Ccb,
|
|||
PLIST_ENTRY NextEntry;
|
||||
PNP_DATA_QUEUE ReadQueue, WriteQueue, DataQueue;
|
||||
PNP_EVENT_BUFFER EventBuffer;
|
||||
PIRP ListIrp;
|
||||
|
||||
NonPagedCcb = Ccb->NonPagedCcb;
|
||||
Fcb = Ccb->Fcb;
|
||||
|
@ -249,11 +250,11 @@ NpSetClosingPipeState(IN PNP_CCB Ccb,
|
|||
{
|
||||
NextEntry = RemoveHeadList(&Ccb->IrpList);
|
||||
|
||||
Irp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
|
||||
ListIrp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
|
||||
|
||||
if (IoSetCancelRoutine(Irp, NULL))
|
||||
if (IoSetCancelRoutine(ListIrp, NULL))
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
InsertTailList(List, NextEntry);
|
||||
}
|
||||
else
|
||||
|
@ -297,11 +298,11 @@ NpSetClosingPipeState(IN PNP_CCB Ccb,
|
|||
|
||||
while (DataQueue->QueueState != Empty)
|
||||
{
|
||||
Irp = NpRemoveDataQueueEntry(DataQueue, FALSE, List);
|
||||
if (Irp)
|
||||
ListIrp = NpRemoveDataQueueEntry(DataQueue, FALSE, List);
|
||||
if (ListIrp)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
|
||||
ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
InsertTailList(List, &ListIrp->Tail.Overlay.ListEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,21 +343,21 @@ NpSetClosingPipeState(IN PNP_CCB Ccb,
|
|||
|
||||
while (ReadQueue->QueueState != Empty)
|
||||
{
|
||||
Irp = NpRemoveDataQueueEntry(ReadQueue, FALSE, List);
|
||||
if (Irp)
|
||||
ListIrp = NpRemoveDataQueueEntry(ReadQueue, FALSE, List);
|
||||
if (ListIrp)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
|
||||
ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
InsertTailList(List, &ListIrp->Tail.Overlay.ListEntry);
|
||||
}
|
||||
}
|
||||
|
||||
while (WriteQueue->QueueState == WriteEntries)
|
||||
while (WriteQueue->QueueState == ReadEntries)
|
||||
{
|
||||
Irp = NpRemoveDataQueueEntry(WriteQueue, FALSE, List);
|
||||
if (Irp)
|
||||
ListIrp = NpRemoveDataQueueEntry(WriteQueue, FALSE, List);
|
||||
if (ListIrp)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
|
||||
ListIrp->IoStatus.Status = STATUS_PIPE_BROKEN;
|
||||
InsertTailList(List, &ListIrp->Tail.Overlay.ListEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,22 +40,26 @@ NpCommonWrite(IN PFILE_OBJECT FileObject,
|
|||
NonPagedCcb = Ccb->NonPagedCcb;
|
||||
ExAcquireResourceExclusiveLite(&NonPagedCcb->Lock, TRUE);
|
||||
|
||||
if (Ccb->NamedPipeState == FILE_PIPE_DISCONNECTED_STATE)
|
||||
if (Ccb->NamedPipeState != FILE_PIPE_CONNECTED_STATE)
|
||||
{
|
||||
IoStatus->Status = STATUS_PIPE_DISCONNECTED;
|
||||
if (Ccb->NamedPipeState == FILE_PIPE_DISCONNECTED_STATE)
|
||||
{
|
||||
IoStatus->Status = STATUS_PIPE_DISCONNECTED;
|
||||
}
|
||||
else if (Ccb->NamedPipeState == FILE_PIPE_LISTENING_STATE)
|
||||
{
|
||||
IoStatus->Status = STATUS_PIPE_LISTENING;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(Ccb->NamedPipeState == FILE_PIPE_CLOSING_STATE);
|
||||
IoStatus->Status = STATUS_PIPE_CLOSING;
|
||||
}
|
||||
|
||||
WriteOk = TRUE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
if (Ccb->NamedPipeState == FILE_PIPE_LISTENING_STATE || Ccb->NamedPipeState == FILE_PIPE_CLOSING_STATE)
|
||||
{
|
||||
IoStatus->Status = Ccb->NamedPipeState != FILE_PIPE_LISTENING_STATE ? STATUS_PIPE_LISTENING : STATUS_PIPE_CLOSING;
|
||||
WriteOk = TRUE;
|
||||
goto Quickie;
|
||||
}
|
||||
|
||||
ASSERT(Ccb->NamedPipeState == FILE_PIPE_CONNECTED_STATE);
|
||||
|
||||
if ((NamedPipeEnd == FILE_PIPE_SERVER_END && Ccb->Fcb->NamedPipeConfiguration == FILE_PIPE_INBOUND) ||
|
||||
(NamedPipeEnd == FILE_PIPE_CLIENT_END && Ccb->Fcb->NamedPipeConfiguration == FILE_PIPE_OUTBOUND))
|
||||
{
|
||||
|
@ -111,6 +115,7 @@ NpCommonWrite(IN PFILE_OBJECT FileObject,
|
|||
Thread,
|
||||
List);
|
||||
IoStatus->Status = Status;
|
||||
|
||||
if (Status == STATUS_MORE_PROCESSING_REQUIRED)
|
||||
{
|
||||
ASSERT(WriteQueue->QueueState != ReadEntries);
|
||||
|
@ -153,6 +158,7 @@ NpFsdWrite(IN PDEVICE_OBJECT DeviceObject,
|
|||
IO_STATUS_BLOCK IoStatus;
|
||||
LIST_ENTRY List;
|
||||
PLIST_ENTRY NextEntry, ThisEntry;
|
||||
PIRP ListIrp;
|
||||
PAGED_CODE();
|
||||
NpSlowWriteCalls++;
|
||||
|
||||
|
@ -178,8 +184,8 @@ NpFsdWrite(IN PDEVICE_OBJECT DeviceObject,
|
|||
ThisEntry = NextEntry;
|
||||
NextEntry = NextEntry->Flink;
|
||||
|
||||
Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
|
||||
ListIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
|
||||
IoCompleteRequest(ListIrp, IO_NAMED_PIPE_INCREMENT);
|
||||
}
|
||||
|
||||
FsRtlExitFileSystem();
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
||||
IN ULONG Mode,
|
||||
IN PVOID OutBuffer,
|
||||
IN ULONG OutBufferSize,
|
||||
IN ULONG PipeType,
|
||||
OUT PULONG BytesWritten,
|
||||
IN PNP_CCB Ccb,
|
||||
IN ULONG NamedPipeEnd,
|
||||
IN PETHREAD Thread,
|
||||
IN ULONG Mode,
|
||||
IN PVOID OutBuffer,
|
||||
IN ULONG OutBufferSize,
|
||||
IN ULONG PipeType,
|
||||
OUT PULONG BytesNotWritten,
|
||||
IN PNP_CCB Ccb,
|
||||
IN ULONG NamedPipeEnd,
|
||||
IN PETHREAD Thread,
|
||||
IN PLIST_ENTRY List)
|
||||
{
|
||||
BOOLEAN HaveContext = FALSE, MoreProcessing, AllocatedBuffer;
|
||||
|
@ -23,7 +23,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
|||
PSECURITY_CLIENT_CONTEXT ClientContext;
|
||||
PAGED_CODE();
|
||||
|
||||
*BytesWritten = OutBufferSize;
|
||||
*BytesNotWritten = OutBufferSize;
|
||||
|
||||
MoreProcessing = TRUE;
|
||||
if ((PipeType != FILE_PIPE_MESSAGE_MODE) || (OutBufferSize))
|
||||
|
@ -33,7 +33,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
|||
|
||||
for (DataEntry = NpGetNextRealDataQueueEntry(WriteQueue, List);
|
||||
((WriteQueue->QueueState == ReadEntries) &&
|
||||
((*BytesWritten > 0) || (MoreProcessing)));
|
||||
((*BytesNotWritten > 0) || (MoreProcessing)));
|
||||
DataEntry = NpGetNextRealDataQueueEntry(WriteQueue, List))
|
||||
{
|
||||
DataSize = DataEntry->DataSize;
|
||||
|
@ -58,7 +58,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
|||
DataEntry->Irp->Overlay.AllocationSize.QuadPart = 0;
|
||||
}
|
||||
|
||||
BufferSize = *BytesWritten;
|
||||
BufferSize = *BytesNotWritten;
|
||||
if (BufferSize >= DataSize) BufferSize = DataSize;
|
||||
|
||||
if (DataEntry->DataEntryType != Unbuffered && BufferSize)
|
||||
|
@ -76,7 +76,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
|||
_SEH2_TRY
|
||||
{
|
||||
RtlCopyMemory(Buffer,
|
||||
(PVOID)((ULONG_PTR)OutBuffer + OutBufferSize - *BytesWritten),
|
||||
(PVOID)((ULONG_PTR)OutBuffer + OutBufferSize - *BytesNotWritten),
|
||||
BufferSize);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
|
@ -106,7 +106,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
|||
WriteIrp = NpRemoveDataQueueEntry(WriteQueue, TRUE, List);
|
||||
if (WriteIrp)
|
||||
{
|
||||
*BytesWritten -= BufferSize;
|
||||
*BytesNotWritten -= BufferSize;
|
||||
WriteIrp->IoStatus.Information = BufferSize;
|
||||
|
||||
if (AllocatedBuffer)
|
||||
|
@ -115,7 +115,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
|||
WriteIrp->Flags |= IRP_DEALLOCATE_BUFFER | IRP_BUFFERED_IO | IRP_INPUT_OPERATION;
|
||||
}
|
||||
|
||||
if (!*BytesWritten)
|
||||
if (!*BytesNotWritten)
|
||||
{
|
||||
MoreProcessing = FALSE;
|
||||
WriteIrp->IoStatus.Status = STATUS_SUCCESS;
|
||||
|
@ -140,7 +140,7 @@ NpWriteDataQueue(IN PNP_DATA_QUEUE WriteQueue,
|
|||
}
|
||||
}
|
||||
|
||||
if (*BytesWritten > 0 || MoreProcessing)
|
||||
if (*BytesNotWritten > 0 || MoreProcessing)
|
||||
{
|
||||
ASSERT(WriteQueue->QueueState != ReadEntries);
|
||||
Status = STATUS_MORE_PROCESSING_REQUIRED;
|
||||
|
|
Loading…
Reference in a new issue