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/strucsup.c
|
|
|
|
* PURPOSE:
|
|
|
|
* 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_STRUCSUP)
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* GLOBALS ********************************************************************/
|
|
|
|
|
2017-06-18 18:08:52 +00:00
|
|
|
WCHAR NpRootDCBName[] = L"\\";
|
2013-09-07 15:32:29 +00:00
|
|
|
PNP_VCB NpVcb;
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
2013-09-07 15:32:29 +00:00
|
|
|
RTL_GENERIC_COMPARE_RESULTS
|
|
|
|
NTAPI
|
|
|
|
NpEventTableCompareRoutine(IN PRTL_GENERIC_TABLE Table,
|
|
|
|
IN PVOID FirstStruct,
|
|
|
|
IN PVOID SecondStruct)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return GenericEqual;
|
|
|
|
}
|
|
|
|
|
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
NpEventTableAllocate(IN PRTL_GENERIC_TABLE Table,
|
|
|
|
IN CLONG ByteSize)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
NpEventTableDeallocate(IN PRTL_GENERIC_TABLE Table,
|
|
|
|
IN PVOID Buffer)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
NpDeleteEventTableEntry(IN PRTL_GENERIC_TABLE Table,
|
|
|
|
IN PVOID Buffer)
|
|
|
|
{
|
[NPFS-NEW]: Implement Close, Cleanup, Disconnect, Flush, Listen, Peek, SetInfo, Transceive, Wait, Write. Only QueryInfo remains as critical functionality to support the Kernel32 APIs. Code is WIP, untested, and ugly! But it is now 90% complete. r60000 should hopefully finalize the implementation. As long as I didn't forget a file :)
svn path=/trunk/; revision=59999
2013-09-10 02:23:32 +00:00
|
|
|
if (!Buffer) return FALSE;
|
|
|
|
|
2013-09-13 12:46:32 +00:00
|
|
|
ObDereferenceObject(((PNP_EVENT_BUFFER)Buffer)->Event);
|
[NPFS-NEW]: Implement Close, Cleanup, Disconnect, Flush, Listen, Peek, SetInfo, Transceive, Wait, Write. Only QueryInfo remains as critical functionality to support the Kernel32 APIs. Code is WIP, untested, and ugly! But it is now 90% complete. r60000 should hopefully finalize the implementation. As long as I didn't forget a file :)
svn path=/trunk/; revision=59999
2013-09-10 02:23:32 +00:00
|
|
|
return RtlDeleteElementGenericTable(Table, Buffer);
|
2013-09-07 15:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
NpDeleteFcb(IN PNP_FCB Fcb,
|
|
|
|
IN PLIST_ENTRY ListEntry)
|
|
|
|
{
|
|
|
|
PNP_DCB Dcb;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
Dcb = Fcb->ParentDcb;
|
2013-09-12 00:05:54 +00:00
|
|
|
if (Fcb->CurrentInstances) NpBugCheck(0, 0, 0);
|
2013-09-07 15:32:29 +00:00
|
|
|
|
|
|
|
NpCancelWaiter(&NpVcb->WaitQueue,
|
|
|
|
&Fcb->FullName,
|
|
|
|
STATUS_OBJECT_NAME_NOT_FOUND,
|
|
|
|
ListEntry);
|
2013-09-13 07:49:42 +00:00
|
|
|
|
2013-09-07 15:32:29 +00:00
|
|
|
RemoveEntryList(&Fcb->DcbEntry);
|
|
|
|
|
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 (Fcb->SecurityDescriptor)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
ObDereferenceSecurityDescriptor(Fcb->SecurityDescriptor, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
RtlRemoveUnicodePrefix(&NpVcb->PrefixTable, &Fcb->PrefixTableEntry);
|
|
|
|
ExFreePool(Fcb->FullName.Buffer);
|
|
|
|
ExFreePool(Fcb);
|
|
|
|
NpCheckForNotify(Dcb, TRUE, ListEntry);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
NpDeleteCcb(IN PNP_CCB Ccb,
|
|
|
|
IN PLIST_ENTRY ListEntry)
|
|
|
|
{
|
|
|
|
PNP_ROOT_DCB_FCB RootDcbCcb;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
RootDcbCcb = (PNP_ROOT_DCB_FCB)Ccb;
|
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 (Ccb->NodeType == NPFS_NTC_CCB)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
RemoveEntryList(&Ccb->CcbEntry);
|
|
|
|
--Ccb->Fcb->CurrentInstances;
|
|
|
|
|
|
|
|
NpDeleteEventTableEntry(&NpVcb->EventTable,
|
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
|
|
|
Ccb->NonPagedCcb->EventBuffer[FILE_PIPE_CLIENT_END]);
|
2013-09-07 15:32:29 +00:00
|
|
|
NpDeleteEventTableEntry(&NpVcb->EventTable,
|
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
|
|
|
Ccb->NonPagedCcb->EventBuffer[FILE_PIPE_SERVER_END]);
|
|
|
|
NpUninitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_INBOUND]);
|
|
|
|
NpUninitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_OUTBOUND]);
|
|
|
|
NpCheckForNotify(Ccb->Fcb->ParentDcb, FALSE, ListEntry);
|
2013-09-07 15:32:29 +00:00
|
|
|
ExDeleteResourceLite(&Ccb->NonPagedCcb->Lock);
|
|
|
|
NpUninitializeSecurity(Ccb);
|
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 (Ccb->ClientSession)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
ExFreePool(Ccb->ClientSession);
|
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
|
|
|
Ccb->ClientSession = NULL;
|
2013-09-07 15:32:29 +00:00
|
|
|
}
|
|
|
|
ExFreePool(Ccb->NonPagedCcb);
|
|
|
|
}
|
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
|
|
|
else if (RootDcbCcb->NodeType == NPFS_NTC_ROOT_DCB_CCB && RootDcbCcb->Unknown)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
ExFreePool(RootDcbCcb->Unknown);
|
|
|
|
}
|
|
|
|
|
|
|
|
ExFreePool(Ccb);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
NpInitializeVcb(VOID)
|
|
|
|
{
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
RtlZeroMemory(NpVcb, sizeof(*NpVcb));
|
|
|
|
|
|
|
|
NpVcb->NodeType = NPFS_NTC_VCB;
|
|
|
|
RtlInitializeUnicodePrefix(&NpVcb->PrefixTable);
|
|
|
|
ExInitializeResourceLite(&NpVcb->Lock);
|
|
|
|
RtlInitializeGenericTable(&NpVcb->EventTable,
|
|
|
|
NpEventTableCompareRoutine,
|
|
|
|
NpEventTableAllocate,
|
|
|
|
NpEventTableDeallocate,
|
|
|
|
0);
|
|
|
|
NpInitializeWaitQueue(&NpVcb->WaitQueue);
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
2013-09-28 06:28:32 +00:00
|
|
|
NpCreateRootDcbCcb(IN PNP_ROOT_DCB_FCB *NewRootCcb)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
PNP_ROOT_DCB_FCB RootCcb;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
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
|
|
|
RootCcb = ExAllocatePoolWithTag(PagedPool, sizeof(*RootCcb), NPFS_ROOT_DCB_CCB_TAG);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!RootCcb) return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
|
|
|
RtlZeroMemory(RootCcb, sizeof(*RootCcb));
|
|
|
|
RootCcb->NodeType = NPFS_NTC_ROOT_DCB_CCB;
|
|
|
|
*NewRootCcb = RootCcb;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NpCreateRootDcb(VOID)
|
|
|
|
{
|
|
|
|
PNP_DCB Dcb;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
if (NpVcb->RootDcb)
|
|
|
|
{
|
2013-09-12 00:05:54 +00:00
|
|
|
NpBugCheck(0, 0, 0);
|
2013-09-07 15:32:29 +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
|
|
|
NpVcb->RootDcb = ExAllocatePoolWithTag(PagedPool, sizeof(*Dcb), NPFS_DCB_TAG);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!NpVcb->RootDcb)
|
|
|
|
{
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
}
|
|
|
|
|
|
|
|
Dcb = NpVcb->RootDcb;
|
|
|
|
RtlZeroMemory(Dcb, sizeof(*Dcb));
|
|
|
|
Dcb->NodeType = NPFS_NTC_ROOT_DCB;
|
|
|
|
|
|
|
|
InitializeListHead(&Dcb->DcbEntry);
|
|
|
|
InitializeListHead(&Dcb->NotifyList);
|
|
|
|
InitializeListHead(&Dcb->NotifyList2);
|
|
|
|
InitializeListHead(&Dcb->FcbList);
|
|
|
|
|
|
|
|
Dcb->FullName.Buffer = NpRootDCBName;
|
2017-06-18 18:08:52 +00:00
|
|
|
Dcb->FullName.Length = sizeof(NpRootDCBName) - sizeof(UNICODE_NULL);
|
|
|
|
Dcb->FullName.MaximumLength = sizeof(NpRootDCBName);
|
2013-09-07 15:32:29 +00:00
|
|
|
|
|
|
|
Dcb->ShortName.Length = Dcb->FullName.Length;
|
|
|
|
Dcb->ShortName.MaximumLength = Dcb->FullName.MaximumLength;
|
|
|
|
Dcb->ShortName.Buffer = Dcb->FullName.Buffer;
|
|
|
|
|
|
|
|
if (!RtlInsertUnicodePrefix(&NpVcb->PrefixTable,
|
|
|
|
&Dcb->FullName,
|
|
|
|
&Dcb->PrefixTableEntry))
|
|
|
|
{
|
2013-09-12 00:05:54 +00:00
|
|
|
NpBugCheck(0, 0, 0);
|
2013-09-07 15:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NpCreateFcb(IN PNP_DCB Dcb,
|
|
|
|
IN PUNICODE_STRING PipeName,
|
|
|
|
IN ULONG MaximumInstances,
|
|
|
|
IN LARGE_INTEGER Timeout,
|
|
|
|
IN USHORT NamedPipeConfiguration,
|
|
|
|
IN USHORT NamedPipeType,
|
|
|
|
OUT PNP_FCB *NewFcb)
|
|
|
|
{
|
|
|
|
PNP_FCB Fcb;
|
|
|
|
BOOLEAN RootPipe;
|
|
|
|
PWCHAR NameBuffer;
|
2013-09-11 02:04:17 +00:00
|
|
|
USHORT Length, MaximumLength;
|
2013-09-07 15:32:29 +00:00
|
|
|
PAGED_CODE();
|
|
|
|
|
2013-09-11 02:04:17 +00:00
|
|
|
Length = PipeName->Length;
|
|
|
|
MaximumLength = Length + sizeof(UNICODE_NULL);
|
2013-09-07 15:32:29 +00:00
|
|
|
|
2013-09-11 02:04:17 +00:00
|
|
|
if ((Length < sizeof(WCHAR)) || (MaximumLength < Length))
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
RootPipe = FALSE;
|
2013-09-11 02:04:17 +00:00
|
|
|
if (PipeName->Buffer[0] != OBJ_NAME_PATH_SEPARATOR)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
2014-10-16 16:57:11 +00:00
|
|
|
Length += sizeof(OBJ_NAME_PATH_SEPARATOR);
|
2013-09-11 02:04:17 +00:00
|
|
|
MaximumLength += sizeof(OBJ_NAME_PATH_SEPARATOR);
|
2013-09-07 15:32:29 +00:00
|
|
|
RootPipe = TRUE;
|
2013-09-11 02:04:17 +00:00
|
|
|
if (MaximumLength < sizeof(WCHAR))
|
|
|
|
{
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
2013-09-07 15:32:29 +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
|
|
|
Fcb = ExAllocatePoolWithTag(PagedPool, sizeof(*Fcb), NPFS_FCB_TAG);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!Fcb) return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
|
|
|
RtlZeroMemory(Fcb, sizeof(*Fcb));
|
|
|
|
Fcb->MaximumInstances = MaximumInstances;
|
|
|
|
Fcb->Timeout = Timeout;
|
|
|
|
Fcb->NodeType = NPFS_NTC_FCB;
|
|
|
|
Fcb->ParentDcb = Dcb;
|
|
|
|
InitializeListHead(&Fcb->CcbList);
|
|
|
|
|
|
|
|
NameBuffer = ExAllocatePoolWithTag(PagedPool,
|
2013-09-11 02:04:17 +00:00
|
|
|
MaximumLength,
|
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
|
|
|
NPFS_NAME_BLOCK_TAG);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!NameBuffer)
|
|
|
|
{
|
|
|
|
ExFreePool(Fcb);
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertTailList(&Dcb->FcbList, &Fcb->DcbEntry);
|
|
|
|
|
|
|
|
if (RootPipe)
|
|
|
|
{
|
2013-09-11 02:04:17 +00:00
|
|
|
NameBuffer[0] = OBJ_NAME_PATH_SEPARATOR;
|
2014-10-16 16:57:11 +00:00
|
|
|
RtlCopyMemory(NameBuffer + 1,
|
|
|
|
PipeName->Buffer,
|
|
|
|
PipeName->Length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RtlCopyMemory(NameBuffer,
|
|
|
|
PipeName->Buffer,
|
|
|
|
PipeName->Length);
|
2013-09-07 15:32:29 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 16:57:11 +00:00
|
|
|
NameBuffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
|
2013-09-07 15:32:29 +00:00
|
|
|
|
2013-09-11 02:04:17 +00:00
|
|
|
Fcb->FullName.Length = Length;
|
|
|
|
Fcb->FullName.MaximumLength = MaximumLength;
|
2013-09-07 15:32:29 +00:00
|
|
|
Fcb->FullName.Buffer = NameBuffer;
|
|
|
|
|
2013-09-11 02:04:17 +00:00
|
|
|
Fcb->ShortName.MaximumLength = Length;
|
|
|
|
Fcb->ShortName.Length = Length - sizeof(OBJ_NAME_PATH_SEPARATOR);
|
2013-09-07 15:32:29 +00:00
|
|
|
Fcb->ShortName.Buffer = NameBuffer + 1;
|
|
|
|
|
|
|
|
if (!RtlInsertUnicodePrefix(&NpVcb->PrefixTable,
|
|
|
|
&Fcb->FullName,
|
|
|
|
&Fcb->PrefixTableEntry))
|
|
|
|
{
|
2013-09-12 00:05:54 +00:00
|
|
|
NpBugCheck(0, 0, 0);
|
2013-09-07 15:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Fcb->NamedPipeConfiguration = NamedPipeConfiguration;
|
|
|
|
Fcb->NamedPipeType = NamedPipeType;
|
|
|
|
*NewFcb = Fcb;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NpCreateCcb(IN PNP_FCB Fcb,
|
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN UCHAR State,
|
|
|
|
IN UCHAR ReadMode,
|
|
|
|
IN UCHAR CompletionMode,
|
|
|
|
IN ULONG InQuota,
|
|
|
|
IN ULONG OutQuota,
|
2013-09-28 06:28:32 +00:00
|
|
|
OUT PNP_CCB *NewCcb)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
PNP_CCB Ccb;
|
|
|
|
PNP_NONPAGED_CCB CcbNonPaged;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
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
|
|
|
Ccb = ExAllocatePoolWithTag(PagedPool, sizeof(*Ccb), NPFS_CCB_TAG);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!Ccb) return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
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
|
|
|
CcbNonPaged = ExAllocatePoolWithTag(NonPagedPool, sizeof(*CcbNonPaged), NPFS_CCB_TAG);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!CcbNonPaged)
|
|
|
|
{
|
|
|
|
ExFreePool(Ccb);
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
}
|
|
|
|
|
|
|
|
RtlZeroMemory(CcbNonPaged, sizeof(*CcbNonPaged));
|
|
|
|
CcbNonPaged->NodeType = NPFS_NTC_NONPAGED_CCB;
|
|
|
|
|
|
|
|
RtlZeroMemory(Ccb, sizeof(*Ccb));
|
|
|
|
Ccb->NodeType = NPFS_NTC_CCB;
|
|
|
|
Ccb->NonPagedCcb = CcbNonPaged;
|
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
|
|
|
Ccb->FileObject[FILE_PIPE_SERVER_END] = FileObject;
|
2013-09-07 15:32:29 +00:00
|
|
|
Ccb->Fcb = Fcb;
|
|
|
|
Ccb->NamedPipeState = State;
|
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
|
|
|
Ccb->ReadMode[FILE_PIPE_SERVER_END] = ReadMode;
|
|
|
|
Ccb->CompletionMode[FILE_PIPE_SERVER_END] = CompletionMode;
|
2013-09-07 15:32:29 +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
|
|
|
Status = NpInitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_INBOUND], InQuota);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ExFreePool(CcbNonPaged);
|
|
|
|
ExFreePool(Ccb);
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
}
|
|
|
|
|
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 = NpInitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_OUTBOUND], OutQuota);
|
2013-09-07 15:32:29 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
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
|
|
|
NpUninitializeDataQueue(&Ccb->DataQueue[FILE_PIPE_INBOUND]);
|
2013-09-07 15:32:29 +00:00
|
|
|
ExFreePool(CcbNonPaged);
|
|
|
|
ExFreePool(Ccb);
|
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertTailList(&Fcb->CcbList, &Ccb->CcbEntry);
|
|
|
|
|
2013-09-11 02:04:17 +00:00
|
|
|
Fcb->CurrentInstances++;
|
|
|
|
Fcb->ServerOpenCount++;
|
2013-09-07 15:32:29 +00:00
|
|
|
InitializeListHead(&Ccb->IrpList);
|
|
|
|
ExInitializeResourceLite(&Ccb->NonPagedCcb->Lock);
|
|
|
|
*NewCcb = Ccb;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* EOF */
|