Author: pschweitzer
Date: Tue Aug 26 05:33:40 2008
New Revision: 35663
URL:
http://svn.reactos.org/svn/reactos?rev=35663&view=rev
Log:
Implemented FsRtlLookupPerStreamContextInternal
Modified:
branches/pierre-fsd/ntoskrnl/fsrtl/filtrctx.c
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:33:40 2008
@@ -37,60 +37,13 @@
}
/*
- * @unimplemented
+ * @implemented
*/
PFSRTL_PER_STREAM_CONTEXT
NTAPI
FsRtlLookupPerStreamContextInternal(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext,
IN PVOID OwnerId OPTIONAL,
IN PVOID InstanceId OPTIONAL)
-{
- KEBUGCHECK(0);
- return FALSE;
-}
-
-/*
- * @unimplemented
- */
-PFSRTL_PER_FILEOBJECT_CONTEXT
-NTAPI
-FsRtlLookupPerFileObjectContext(IN PFILE_OBJECT FileObject,
- IN PVOID OwnerId OPTIONAL,
- IN PVOID InstanceId OPTIONAL)
-{
- KEBUGCHECK(0);
- return FALSE;
-}
-
-/*
- * @implemented
- */
-NTSTATUS
-NTAPI
-FsRtlInsertPerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER PerStreamContext,
- IN PFSRTL_PER_STREAM_CONTEXT Ptr)
-{
- 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;
-}
-
-/*
- * @implemented
- */
-PFSRTL_PER_STREAM_CONTEXT
-NTAPI
-FsRtlRemovePerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext,
- IN PVOID OwnerId OPTIONAL,
- IN PVOID InstanceId OPTIONAL)
{
PLIST_ENTRY NextEntry;
PFSRTL_PER_STREAM_CONTEXT TmpPerStreamContext, PerStreamContext = NULL;
@@ -128,6 +81,91 @@
}
}
}
+ }
+ ExReleaseFastMutex(StreamContext->FastMutex);
+
+ return PerStreamContext;
+}
+
+/*
+ * @unimplemented
+ */
+PFSRTL_PER_FILEOBJECT_CONTEXT
+NTAPI
+FsRtlLookupPerFileObjectContext(IN PFILE_OBJECT FileObject,
+ IN PVOID OwnerId OPTIONAL,
+ IN PVOID InstanceId OPTIONAL)
+{
+ KEBUGCHECK(0);
+ return FALSE;
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+FsRtlInsertPerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER PerStreamContext,
+ IN PFSRTL_PER_STREAM_CONTEXT Ptr)
+{
+ 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;
+}
+
+/*
+ * @implemented
+ */
+PFSRTL_PER_STREAM_CONTEXT
+NTAPI
+FsRtlRemovePerStreamContext(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext,
+ IN PVOID OwnerId OPTIONAL,
+ IN PVOID InstanceId OPTIONAL)
+{
+ 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)
{