2013-09-11 23:19:20 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Named Pipe FileSystem
|
|
|
|
* LICENSE: BSD - See COPYING.ARM in the top level directory
|
|
|
|
* FILE: drivers/filesystems/npfs/datasup.c
|
|
|
|
* PURPOSE: Data Queues Support
|
|
|
|
* PROGRAMMERS: ReactOS Portable Systems Group
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *******************************************************************/
|
|
|
|
|
2013-09-07 15:32:29 +00:00
|
|
|
#include "npfs.h"
|
|
|
|
|
2013-09-12 00:05:54 +00:00
|
|
|
// File ID number for NPFS bugchecking support
|
|
|
|
#define NPFS_BUGCHECK_FILE_ID (NPFS_BUGCHECK_DATASUP)
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
2013-09-07 15:32:29 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NpUninitializeDataQueue(IN PNP_DATA_QUEUE DataQueue)
|
|
|
|
{
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
ASSERT(DataQueue->QueueState == Empty);
|
|
|
|
|
|
|
|
RtlZeroMemory(DataQueue, sizeof(*DataQueue));
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NpInitializeDataQueue(IN PNP_DATA_QUEUE DataQueue,
|
|
|
|
IN ULONG Quota)
|
|
|
|
{
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
DataQueue->BytesInQueue = 0;
|
|
|
|
DataQueue->EntriesInQueue = 0;
|
|
|
|
DataQueue->QuotaUsed = 0;
|
|
|
|
DataQueue->ByteOffset = 0;
|
|
|
|
DataQueue->QueueState = Empty;
|
|
|
|
DataQueue->Quota = Quota;
|
2013-09-09 01:16:06 +00:00
|
|
|
InitializeListHead(&DataQueue->Queue);
|
2013-09-07 15:32:29 +00:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
2013-09-09 01:16:06 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
NpCompleteStalledWrites(IN PNP_DATA_QUEUE DataQueue,
|
|
|
|
IN PLIST_ENTRY List)
|
|
|
|
{
|
|
|
|
ULONG QuotaLeft, ByteOffset, DataLeft, NewQuotaLeft;
|
|
|
|
PNP_DATA_QUEUE_ENTRY DataQueueEntry;
|
|
|
|
PIRP Irp;
|
|
|
|
PLIST_ENTRY NextEntry;
|
|
|
|
|
|
|
|
QuotaLeft = DataQueue->Quota - DataQueue->QuotaUsed;
|
|
|
|
ByteOffset = DataQueue->ByteOffset;
|
|
|
|
|
|
|
|
NextEntry = DataQueue->Queue.Flink;
|
|
|
|
while (NextEntry != &DataQueue->Queue)
|
|
|
|
{
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (!QuotaLeft) break;
|
2013-09-09 01:16:06 +00:00
|
|
|
|
2014-08-07 10:10:02 +00:00
|
|
|
DataQueueEntry = CONTAINING_RECORD(NextEntry,
|
|
|
|
NP_DATA_QUEUE_ENTRY,
|
|
|
|
QueueEntry);
|
2013-09-09 01:16:06 +00:00
|
|
|
|
|
|
|
Irp = DataQueueEntry->Irp;
|
|
|
|
|
2014-08-07 10:24:07 +00:00
|
|
|
if ((DataQueueEntry->DataEntryType == Buffered) && (Irp))
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
DataLeft = DataQueueEntry->DataSize - ByteOffset;
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DataQueueEntry->QuotaInEntry < DataLeft)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
NewQuotaLeft = DataLeft - DataQueueEntry->QuotaInEntry;
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (NewQuotaLeft > QuotaLeft) NewQuotaLeft = QuotaLeft;
|
2013-09-09 01:16:06 +00:00
|
|
|
|
|
|
|
QuotaLeft -= NewQuotaLeft;
|
|
|
|
DataQueueEntry->QuotaInEntry += NewQuotaLeft;
|
|
|
|
|
|
|
|
if (DataQueueEntry->QuotaInEntry == DataLeft &&
|
|
|
|
IoSetCancelRoutine(Irp, NULL))
|
|
|
|
{
|
|
|
|
DataQueueEntry->Irp = NULL;
|
|
|
|
|
2014-10-16 16:36:17 +00:00
|
|
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
2013-09-09 01:16:06 +00:00
|
|
|
Irp->IoStatus.Information = DataQueueEntry->DataSize;
|
|
|
|
|
|
|
|
InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NextEntry = NextEntry->Flink;
|
|
|
|
ByteOffset = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataQueue->QuotaUsed = DataQueue->Quota - QuotaLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
PIRP
|
|
|
|
NTAPI
|
|
|
|
NpRemoveDataQueueEntry(IN PNP_DATA_QUEUE DataQueue,
|
|
|
|
IN BOOLEAN Flag,
|
|
|
|
IN PLIST_ENTRY List)
|
|
|
|
{
|
|
|
|
PIRP Irp;
|
|
|
|
PNP_DATA_QUEUE_ENTRY QueueEntry;
|
|
|
|
BOOLEAN HasWrites;
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DataQueue->QueueState == Empty)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
Irp = NULL;
|
|
|
|
ASSERT(IsListEmpty(&DataQueue->Queue));
|
|
|
|
ASSERT(DataQueue->EntriesInQueue == 0);
|
|
|
|
ASSERT(DataQueue->BytesInQueue == 0);
|
|
|
|
ASSERT(DataQueue->QuotaUsed == 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QueueEntry = CONTAINING_RECORD(RemoveHeadList(&DataQueue->Queue),
|
|
|
|
NP_DATA_QUEUE_ENTRY,
|
|
|
|
QueueEntry);
|
|
|
|
|
|
|
|
DataQueue->BytesInQueue -= QueueEntry->DataSize;
|
|
|
|
--DataQueue->EntriesInQueue;
|
|
|
|
|
2014-08-07 10:24:07 +00:00
|
|
|
HasWrites = TRUE;
|
2013-09-12 23:54:59 +00:00
|
|
|
if (DataQueue->QueueState != WriteEntries ||
|
|
|
|
DataQueue->QuotaUsed < DataQueue->Quota ||
|
|
|
|
!QueueEntry->QuotaInEntry)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2014-08-07 10:24:07 +00:00
|
|
|
HasWrites = FALSE;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DataQueue->QuotaUsed -= QueueEntry->QuotaInEntry;
|
|
|
|
|
2013-09-13 12:41:44 +00:00
|
|
|
if (IsListEmpty(&DataQueue->Queue))
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
DataQueue->QueueState = Empty;
|
2014-08-07 10:24:07 +00:00
|
|
|
HasWrites = FALSE;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Irp = QueueEntry->Irp;
|
|
|
|
NpFreeClientSecurityContext(QueueEntry->ClientSecurityContext);
|
|
|
|
|
2014-10-16 21:43:03 +00:00
|
|
|
if (Irp && !IoSetCancelRoutine(Irp, NULL))
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2013-09-11 17:10:30 +00:00
|
|
|
Irp->Tail.Overlay.DriverContext[3] = NULL;
|
2014-10-16 21:43:03 +00:00
|
|
|
Irp = NULL;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExFreePool(QueueEntry);
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (Flag)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
NpGetNextRealDataQueueEntry(DataQueue, List);
|
|
|
|
}
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (HasWrites)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
NpCompleteStalledWrites(DataQueue, List);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DataQueue->ByteOffset = 0;
|
|
|
|
return Irp;
|
|
|
|
}
|
|
|
|
|
2013-09-12 23:54:59 +00:00
|
|
|
PLIST_ENTRY
|
2013-09-09 01:16:06 +00:00
|
|
|
NTAPI
|
|
|
|
NpGetNextRealDataQueueEntry(IN PNP_DATA_QUEUE DataQueue,
|
|
|
|
IN PLIST_ENTRY List)
|
|
|
|
{
|
|
|
|
PNP_DATA_QUEUE_ENTRY DataEntry;
|
|
|
|
ULONG Type;
|
|
|
|
PIRP Irp;
|
|
|
|
PLIST_ENTRY NextEntry;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
2013-09-12 23:54:59 +00:00
|
|
|
for (NextEntry = DataQueue->Queue.Flink;
|
|
|
|
NextEntry != &DataQueue->Queue;
|
|
|
|
NextEntry = DataQueue->Queue.Flink)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2014-08-07 10:24:07 +00:00
|
|
|
DataEntry = CONTAINING_RECORD(NextEntry,
|
|
|
|
NP_DATA_QUEUE_ENTRY,
|
|
|
|
QueueEntry);
|
2013-09-09 01:16:06 +00:00
|
|
|
|
|
|
|
Type = DataEntry->DataEntryType;
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (Type == Buffered || Type == Unbuffered) break;
|
2013-09-09 01:16:06 +00:00
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
Irp = NpRemoveDataQueueEntry(DataQueue, FALSE, List);
|
|
|
|
if (Irp)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
|
|
|
InsertTailList(List, &Irp->Tail.Overlay.ListEntry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-12 23:54:59 +00:00
|
|
|
return NextEntry;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
NpCancelDataQueueIrp(IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp)
|
|
|
|
{
|
|
|
|
PNP_DATA_QUEUE DataQueue;
|
|
|
|
PNP_DATA_QUEUE_ENTRY DataEntry;
|
2013-09-11 17:10:30 +00:00
|
|
|
LIST_ENTRY DeferredList;
|
2013-09-09 01:16:06 +00:00
|
|
|
PSECURITY_CLIENT_CONTEXT ClientSecurityContext;
|
|
|
|
BOOLEAN CompleteWrites, FirstEntry;
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DeviceObject) IoReleaseCancelSpinLock(Irp->CancelIrql);
|
2013-09-09 01:16:06 +00:00
|
|
|
|
2013-09-11 17:10:30 +00:00
|
|
|
InitializeListHead(&DeferredList);
|
2013-09-09 01:16:06 +00:00
|
|
|
|
2014-10-16 16:36:17 +00:00
|
|
|
DataQueue = Irp->Tail.Overlay.DriverContext[2];
|
2013-09-09 01:16:06 +00:00
|
|
|
ClientSecurityContext = NULL;
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DeviceObject)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
FsRtlEnterFileSystem();
|
2013-09-11 17:10:30 +00:00
|
|
|
NpAcquireExclusiveVcb();
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
2014-08-07 10:24:07 +00:00
|
|
|
DataEntry = Irp->Tail.Overlay.DriverContext[3];
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DataEntry)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DataEntry->QueueEntry.Blink == &DataQueue->Queue)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
DataQueue->ByteOffset = 0;
|
2014-08-07 10:24:07 +00:00
|
|
|
FirstEntry = TRUE;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-07 10:24:07 +00:00
|
|
|
FirstEntry = FALSE;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RemoveEntryList(&DataEntry->QueueEntry);
|
|
|
|
|
|
|
|
ClientSecurityContext = DataEntry->ClientSecurityContext;
|
|
|
|
|
2014-08-07 10:24:07 +00:00
|
|
|
CompleteWrites = TRUE;
|
2013-09-13 12:41:44 +00:00
|
|
|
if (DataQueue->QueueState != WriteEntries ||
|
|
|
|
DataQueue->QuotaUsed < DataQueue->Quota ||
|
|
|
|
!DataEntry->QuotaInEntry)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2014-08-07 10:24:07 +00:00
|
|
|
CompleteWrites = FALSE;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DataQueue->BytesInQueue -= DataEntry->DataSize;
|
|
|
|
DataQueue->QuotaUsed -= DataEntry->QuotaInEntry;
|
|
|
|
--DataQueue->EntriesInQueue;
|
|
|
|
|
2013-09-13 12:41:44 +00:00
|
|
|
if (IsListEmpty(&DataQueue->Queue))
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
DataQueue->QueueState = Empty;
|
|
|
|
ASSERT(DataQueue->BytesInQueue == 0);
|
|
|
|
ASSERT(DataQueue->EntriesInQueue == 0);
|
|
|
|
ASSERT(DataQueue->QuotaUsed == 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (FirstEntry)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2013-09-11 17:10:30 +00:00
|
|
|
NpGetNextRealDataQueueEntry(DataQueue, &DeferredList);
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (CompleteWrites)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2013-09-11 17:10:30 +00:00
|
|
|
NpCompleteStalledWrites(DataQueue, &DeferredList);
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DeviceObject)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2013-09-11 17:10:30 +00:00
|
|
|
NpReleaseVcb();
|
2013-09-09 01:16:06 +00:00
|
|
|
FsRtlExitFileSystem();
|
|
|
|
}
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DataEntry) ExFreePool(DataEntry);
|
2013-09-09 01:16:06 +00:00
|
|
|
|
|
|
|
NpFreeClientSecurityContext(ClientSecurityContext);
|
|
|
|
Irp->IoStatus.Status = STATUS_CANCELLED;
|
2013-09-11 07:05:15 +00:00
|
|
|
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
|
2013-09-09 01:16:06 +00:00
|
|
|
|
2013-09-11 17:10:30 +00:00
|
|
|
NpCompleteDeferredIrps(&DeferredList);
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
NpAddDataQueueEntry(IN ULONG NamedPipeEnd,
|
2013-09-09 01:16:06 +00:00
|
|
|
IN PNP_CCB Ccb,
|
|
|
|
IN PNP_DATA_QUEUE DataQueue,
|
2013-09-13 12:41:44 +00:00
|
|
|
IN ULONG Who,
|
2013-09-09 01:16:06 +00:00
|
|
|
IN ULONG Type,
|
|
|
|
IN ULONG DataSize,
|
|
|
|
IN PIRP Irp,
|
|
|
|
IN PVOID Buffer,
|
|
|
|
IN ULONG ByteOffset)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
PNP_DATA_QUEUE_ENTRY DataEntry;
|
|
|
|
SIZE_T EntrySize;
|
|
|
|
ULONG QuotaInEntry;
|
|
|
|
PSECURITY_CLIENT_CONTEXT ClientContext;
|
|
|
|
BOOLEAN HasSpace;
|
|
|
|
|
|
|
|
ClientContext = NULL;
|
|
|
|
ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
|
|
|
|
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
if ((Type != 2) && (Who == WriteEntries))
|
|
|
|
{
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
Status = NpGetClientSecurityContext(NamedPipeEnd,
|
2013-09-09 01:16:06 +00:00
|
|
|
Ccb,
|
|
|
|
Irp ? Irp->Tail.Overlay.Thread :
|
|
|
|
PsGetCurrentThread(),
|
|
|
|
&ClientContext);
|
2013-09-11 07:05:15 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return Status;
|
|
|
|
}
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (Type)
|
|
|
|
{
|
|
|
|
case Unbuffered:
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
ASSERT(Irp != NULL);
|
2013-09-16 17:37:47 +00:00
|
|
|
DataEntry = ExAllocatePoolWithQuotaTag(NonPagedPool | POOL_QUOTA_FAIL_INSTEAD_OF_RAISE,
|
2013-09-11 07:05:15 +00:00
|
|
|
sizeof(*DataEntry),
|
|
|
|
NPFS_DATA_ENTRY_TAG);
|
|
|
|
if (!DataEntry)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2013-09-11 07:05:15 +00:00
|
|
|
NpFreeClientSecurityContext(ClientContext);
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
2013-09-11 07:05:15 +00:00
|
|
|
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;
|
|
|
|
|
2013-09-09 01:16:06 +00:00
|
|
|
case Buffered:
|
|
|
|
|
|
|
|
EntrySize = sizeof(*DataEntry);
|
2013-09-11 07:05:15 +00:00
|
|
|
if (Who != ReadEntries)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
2013-09-11 07:05:15 +00:00
|
|
|
EntrySize += DataSize;
|
|
|
|
if (EntrySize < DataSize)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
NpFreeClientSecurityContext(ClientContext);
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QuotaInEntry = DataSize - ByteOffset;
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DataQueue->Quota - DataQueue->QuotaUsed < QuotaInEntry)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
QuotaInEntry = DataQueue->Quota - DataQueue->QuotaUsed;
|
2013-09-11 07:05:15 +00:00
|
|
|
HasSpace = TRUE;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-11 07:05:15 +00:00
|
|
|
HasSpace = FALSE;
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
|
2013-09-16 17:37:47 +00:00
|
|
|
DataEntry = ExAllocatePoolWithQuotaTag(NonPagedPool | POOL_QUOTA_FAIL_INSTEAD_OF_RAISE,
|
2013-09-11 07:05:15 +00:00
|
|
|
EntrySize,
|
|
|
|
NPFS_DATA_ENTRY_TAG);
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (!DataEntry)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
NpFreeClientSecurityContext(ClientContext);
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataEntry->QuotaInEntry = QuotaInEntry;
|
|
|
|
DataEntry->Irp = Irp;
|
|
|
|
DataEntry->DataEntryType = Buffered;
|
|
|
|
DataEntry->ClientSecurityContext = ClientContext;
|
|
|
|
DataEntry->DataSize = DataSize;
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (Who == ReadEntries)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
ASSERT(Irp);
|
|
|
|
|
|
|
|
Status = STATUS_PENDING;
|
|
|
|
ASSERT((DataQueue->QueueState == Empty) ||
|
|
|
|
(DataQueue->QueueState == Who));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
2013-09-11 07:05:15 +00:00
|
|
|
RtlCopyMemory(DataEntry + 1,
|
|
|
|
Irp ? Irp->UserBuffer: Buffer,
|
|
|
|
DataSize);
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
NpFreeClientSecurityContext(ClientContext);
|
2013-09-12 00:16:42 +00:00
|
|
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (HasSpace && Irp)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
Status = STATUS_PENDING;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-11 07:05:15 +00:00
|
|
|
DataEntry->Irp = NULL;
|
2013-09-09 01:16:06 +00:00
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
}
|
2013-09-11 07:05:15 +00:00
|
|
|
|
|
|
|
ASSERT((DataQueue->QueueState == Empty) ||
|
|
|
|
(DataQueue->QueueState == Who));
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
2013-09-11 07:05:15 +00:00
|
|
|
break;
|
2013-09-09 01:16:06 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
ASSERT(FALSE);
|
|
|
|
NpFreeClientSecurityContext(ClientContext);
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT((DataQueue->QueueState == Empty) || (DataQueue->QueueState == Who));
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (DataQueue->QueueState == Empty)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
ASSERT(DataQueue->BytesInQueue == 0);
|
|
|
|
ASSERT(DataQueue->EntriesInQueue == 0);
|
2013-09-13 12:41:44 +00:00
|
|
|
ASSERT(IsListEmpty(&DataQueue->Queue));
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSERT(DataQueue->QueueState == Who);
|
|
|
|
ASSERT(DataQueue->QueueState != Empty);
|
|
|
|
ASSERT(DataQueue->EntriesInQueue != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
DataQueue->QuotaUsed += DataEntry->QuotaInEntry;
|
|
|
|
DataQueue->QueueState = Who;
|
|
|
|
DataQueue->BytesInQueue += DataEntry->DataSize;
|
2013-09-11 07:05:15 +00:00
|
|
|
DataQueue->EntriesInQueue++;
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (ByteOffset)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
DataQueue->ByteOffset = ByteOffset;
|
|
|
|
ASSERT(Who == WriteEntries);
|
|
|
|
ASSERT(ByteOffset < DataEntry->DataSize);
|
|
|
|
ASSERT(DataQueue->EntriesInQueue == 1);
|
|
|
|
}
|
2013-09-11 02:04:17 +00:00
|
|
|
|
2013-09-09 01:16:06 +00:00
|
|
|
InsertTailList(&DataQueue->Queue, &DataEntry->QueueEntry);
|
|
|
|
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
if (Status == STATUS_PENDING)
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
|
|
|
IoMarkIrpPending(Irp);
|
|
|
|
Irp->Tail.Overlay.DriverContext[2] = DataQueue;
|
|
|
|
Irp->Tail.Overlay.DriverContext[3] = DataEntry;
|
|
|
|
|
|
|
|
IoSetCancelRoutine(Irp, NpCancelDataQueueIrp);
|
|
|
|
|
2013-09-11 07:05:15 +00:00
|
|
|
if ((Irp->Cancel) && (IoSetCancelRoutine(Irp, NULL)))
|
2013-09-09 01:16:06 +00:00
|
|
|
{
|
For our 60000th commit, I bring you a complete rewrite of the Named Pipe File System. It is not yet "active", but I consider this to now be largely code complete and worthy of the prize (and I didn't want to delay other commiters any further). Once the code is reviewed, fixed, tested, and commented, it will replace our old and aging NPFS. This driver is cross-compatible with Windows Server 2003. It is expected to fix winetest incompatiblities, speed up performance, and reduce bizare RPC/SCM issues. This commit is dedicated to my best friend Rachel, who has not only always been there for me, but was also the motivating factor behind my return to my passion -- ReactOS :)
[NPFS-NEW]: Implement QueryVolume, QuerySecurity, SetSecurity. Everything but Directory Query, Fast I/O, and a few rare FSCTLs is implemented now. The former two will come in an upcoming commit.
[NPFS-NEW]: Major cleanup in the way some member variables were being addressed. Reference them as array members based on the correct FILE_PIPE defines from now on. Also fix a lot of formatting issues. Fix a bunch of bugs that were found. Use FILE_PIPE_SERVER_END and FILE_PIPE_CLIENT_END intead of a BOOLEAN. Use TRUE/FALSE/STATUS_SUCCESS/NULL/etc when needed intead of 0/1. The code formatting can/should still be improved, but this was a big help.
svn path=/trunk/; revision=60000
2013-09-10 08:36:25 +00:00
|
|
|
NpCancelDataQueueIrp(NULL, Irp);
|
2013-09-09 01:16:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
2013-09-11 23:19:20 +00:00
|
|
|
|
|
|
|
/* EOF */
|