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/fileobsup.c
|
|
|
|
* PURPOSE: Pipes File Object 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_FILEOBSUP)
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
2013-09-07 15:32:29 +00:00
|
|
|
NODE_TYPE_CODE
|
|
|
|
NTAPI
|
|
|
|
NpDecodeFileObject(IN PFILE_OBJECT FileObject,
|
|
|
|
OUT PVOID* PrimaryContext OPTIONAL,
|
|
|
|
OUT PNP_CCB* 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
|
|
|
OUT PULONG NamedPipeEnd OPTIONAL)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
ULONG_PTR Context;
|
|
|
|
PNP_CCB Node;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
Context = (ULONG_PTR)FileObject->FsContext;
|
|
|
|
if ((Context) && (Context != 1))
|
|
|
|
{
|
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 (NamedPipeEnd) *NamedPipeEnd = Context & 1;
|
2013-09-07 15:32:29 +00:00
|
|
|
|
|
|
|
Node = (PVOID)(Context & ~1);
|
|
|
|
|
|
|
|
switch (Node->NodeType)
|
|
|
|
{
|
|
|
|
case NPFS_NTC_VCB:
|
|
|
|
return NPFS_NTC_VCB;
|
|
|
|
|
|
|
|
case NPFS_NTC_ROOT_DCB:
|
|
|
|
*Ccb = FileObject->FsContext2;
|
|
|
|
if (PrimaryContext) *PrimaryContext = Node;
|
|
|
|
return NPFS_NTC_ROOT_DCB;
|
|
|
|
|
|
|
|
case NPFS_NTC_CCB:
|
|
|
|
*Ccb = Node;
|
|
|
|
if (PrimaryContext) *PrimaryContext = Node->Fcb;
|
|
|
|
return NPFS_NTC_CCB;
|
|
|
|
|
|
|
|
default:
|
2013-09-12 00:05:54 +00:00
|
|
|
NpBugCheck(Node->NodeType, 0, 0);
|
2013-09-07 15:32:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
NpSetFileObject(IN PFILE_OBJECT FileObject,
|
|
|
|
IN PVOID PrimaryContext,
|
|
|
|
IN PVOID 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
|
|
|
IN ULONG NamedPipeEnd)
|
2013-09-07 15:32:29 +00:00
|
|
|
{
|
|
|
|
BOOLEAN FileIsPipe;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
if (!FileObject) return;
|
|
|
|
|
|
|
|
if ((PrimaryContext) && (((PNP_CCB)PrimaryContext)->NodeType == NPFS_NTC_CCB))
|
|
|
|
{
|
|
|
|
FileIsPipe = TRUE;
|
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 (NamedPipeEnd == FILE_PIPE_SERVER_END)
|
|
|
|
{
|
|
|
|
PrimaryContext = (PVOID) ((ULONG_PTR) PrimaryContext | 1);
|
|
|
|
}
|
2013-09-07 15:32:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FileIsPipe = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
FileObject->FsContext = PrimaryContext;
|
|
|
|
FileObject->FsContext2 = Ccb;
|
|
|
|
FileObject->PrivateCacheMap = (PVOID)1;
|
|
|
|
if (FileIsPipe) FileObject->Flags |= FO_NAMED_PIPE;
|
|
|
|
}
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* EOF */
|