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/cleanup.c
|
|
|
|
* PURPOSE: Pipes Cleanup
|
|
|
|
* PROGRAMMERS: ReactOS Portable Systems Group
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *******************************************************************/
|
|
|
|
|
[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
|
|
|
#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_CLEANUP)
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
[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
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NpCommonCleanup(IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp)
|
|
|
|
{
|
|
|
|
PIO_STACK_LOCATION IoStack;
|
|
|
|
NODE_TYPE_CODE NodeTypeCode;
|
2013-09-11 17:10:30 +00:00
|
|
|
LIST_ENTRY DeferredList;
|
[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
|
|
|
PNP_FCB Fcb;
|
|
|
|
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
|
|
|
ULONG NamedPipeEnd;
|
[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
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
2013-09-11 17:10:30 +00:00
|
|
|
InitializeListHead(&DeferredList);
|
[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
|
|
|
|
2013-09-11 17:10:30 +00:00
|
|
|
NpAcquireExclusiveVcb();
|
[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
|
|
|
NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
|
|
|
|
(PVOID*)&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
|
|
|
&NamedPipeEnd);
|
|
|
|
if (NodeTypeCode == NPFS_NTC_CCB)
|
[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
|
|
|
{
|
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)
|
[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
|
|
|
{
|
|
|
|
ASSERT(Ccb->Fcb->ServerOpenCount != 0);
|
|
|
|
--Ccb->Fcb->ServerOpenCount;
|
|
|
|
}
|
|
|
|
|
2013-09-11 17:10:30 +00:00
|
|
|
NpSetClosingPipeState(Ccb, Irp, NamedPipeEnd, &DeferredList);
|
[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
|
|
|
}
|
|
|
|
|
2013-09-11 17:10:30 +00:00
|
|
|
NpReleaseVcb();
|
|
|
|
NpCompleteDeferredIrps(&DeferredList);
|
[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 STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NpFsdCleanup(IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
FsRtlEnterFileSystem();
|
|
|
|
|
|
|
|
Status = NpCommonCleanup(DeviceObject, Irp);
|
|
|
|
|
|
|
|
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 (Status != STATUS_PENDING)
|
[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
|
|
|
{
|
|
|
|
Irp->IoStatus.Status = Status;
|
|
|
|
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2013-09-11 23:19:20 +00:00
|
|
|
/* EOF */
|