Author: pschweitzer
Date: Tue Aug 26 05:02:57 2008
New Revision: 35662
URL:
http://svn.reactos.org/svn/reactos?rev=35662&view=rev
Log:
- Added a missing define to ntifs.h
- Implemented FsRtlInsertPerStreamContext, FsRtlRemovePerStreamContext
Modified:
branches/pierre-fsd/include/ddk/ntifs.h
branches/pierre-fsd/ntoskrnl/fsrtl/filtrctx.c
Modified: branches/pierre-fsd/include/ddk/ntifs.h
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/include/ddk/ntifs.h?…
==============================================================================
--- branches/pierre-fsd/include/ddk/ntifs.h [iso-8859-1] (original)
+++ branches/pierre-fsd/include/ddk/ntifs.h [iso-8859-1] Tue Aug 26 05:02:57 2008
@@ -270,7 +270,8 @@
#define FSRTL_FLAG_USER_MAPPED_FILE (0x20)
#define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80)
-#define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01)
+#define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01)
+#define FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS (0x02)
#define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
#define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
Modified: branches/pierre-fsd/ntoskrnl/fsrtl/filtrctx.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/filtr…
==============================================================================
--- branches/pierre-fsd/ntoskrnl/fsrtl/filtrctx.c [iso-8859-1] (original)
+++ branches/pierre-fsd/ntoskrnl/fsrtl/filtrctx.c [iso-8859-1] Tue Aug 26 05:02:57 2008
@@ -63,19 +63,28 @@
}
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
NTAPI
FsRtlInsertPerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER PerStreamContext,
IN PFSRTL_PER_STREAM_CONTEXT Ptr)
{
- KEBUGCHECK(0);
- return STATUS_NOT_IMPLEMENTED;
+ ASSERT(PerStreamContext);
+
+ if (!(PerStreamContext->Flags2 & FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS))
+ {
+ return STATUS_INVALID_DEVICE_REQUEST;
+ }
+
+ ExAcquireFastMutex(PerStreamContext->FastMutex);
+ InsertHeadList(&PerStreamContext->FilterContexts, &Ptr->Links);
+ ExReleaseFastMutex(PerStreamContext->FastMutex);
+ return STATUS_SUCCESS;
}
/*
- * @unimplemented
+ * @implemented
*/
PFSRTL_PER_STREAM_CONTEXT
NTAPI
@@ -83,8 +92,51 @@
IN PVOID OwnerId OPTIONAL,
IN PVOID InstanceId OPTIONAL)
{
- KEBUGCHECK(0);
- return NULL;
+ PLIST_ENTRY NextEntry;
+ PFSRTL_PER_STREAM_CONTEXT TmpPerStreamContext, PerStreamContext = NULL;
+
+ ASSERT(StreamContext);
+
+ if (!(StreamContext->Flags2 & FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS))
+ {
+ return NULL;
+ }
+
+ ExAcquireFastMutex(StreamContext->FastMutex);
+ /* If list is empty, no need to browse it */
+ if (!IsListEmpty(&(StreamContext->FilterContexts)))
+ {
+ for (NextEntry = StreamContext->FilterContexts.Flink;
+ NextEntry != &(StreamContext->FilterContexts);
+ NextEntry = NextEntry->Flink)
+ {
+ /* If we don't have any criteria for search, first entry will be enough
*/
+ if (!OwnerId && !InstanceId)
+ {
+ PerStreamContext = (PFSRTL_PER_STREAM_CONTEXT)NextEntry;
+ break;
+ }
+ /* Else, we've to find something that matches with the parameters. */
+ else
+ {
+ TmpPerStreamContext = CONTAINING_RECORD(NextEntry,
FSRTL_PER_STREAM_CONTEXT, Links);
+ if ((InstanceId && TmpPerStreamContext->InstanceId ==
InstanceId && TmpPerStreamContext->OwnerId == OwnerId) ||
+ (OwnerId && TmpPerStreamContext->OwnerId == OwnerId))
+ {
+ PerStreamContext = TmpPerStreamContext;
+ break;
+ }
+ }
+ }
+ /* Finally remove entry from list */
+ if (PerStreamContext)
+ {
+ RemoveEntryList(&(PerStreamContext->Links));
+ }
+ }
+ ExReleaseFastMutex(StreamContext->FastMutex);
+
+ return PerStreamContext;
}
/*