https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2a182931b6dcbb213d342…
commit 2a182931b6dcbb213d342ad552f0d8b8e2ecd40b
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Thu Oct 4 22:24:52 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Thu Oct 4 22:24:52 2018 +0200
[NTOSKRNL] A bit of cleanup in Io*FilterContext()
---
ntoskrnl/io/iomgr/file.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ntoskrnl/io/iomgr/file.c b/ntoskrnl/io/iomgr/file.c
index 860348a370..a8da317317 100644
--- a/ntoskrnl/io/iomgr/file.c
+++ b/ntoskrnl/io/iomgr/file.c
@@ -2441,7 +2441,7 @@ PVOID
NTAPI
IoGetFileObjectFilterContext(IN PFILE_OBJECT FileObject)
{
- if (FileObject->Flags & FO_FILE_OBJECT_HAS_EXTENSION)
+ if (BooleanFlagOn(FileObject->Flags, FO_FILE_OBJECT_HAS_EXTENSION))
{
PFILE_OBJECT_EXTENSION FileObjectExtension;
@@ -2461,7 +2461,7 @@ IoChangeFileObjectFilterContext(IN PFILE_OBJECT FileObject,
ULONG_PTR Success;
PFILE_OBJECT_EXTENSION FileObjectExtension;
- if (!(FileObject->Flags & FO_FILE_OBJECT_HAS_EXTENSION))
+ if (!BooleanFlagOn(FileObject->Flags, FO_FILE_OBJECT_HAS_EXTENSION))
{
return STATUS_INVALID_PARAMETER;
}
@@ -2472,7 +2472,7 @@ IoChangeFileObjectFilterContext(IN PFILE_OBJECT FileObject,
/* If define, just set the new value if not value is set
* Success will only contain old value. It is valid if it is NULL
*/
- Success = InterlockedCompareExchange((volatile LONG
*)&FileObjectExtension->FilterContext, (ULONG_PTR)FilterContext, 0);
+ Success =
(ULONG_PTR)InterlockedCompareExchangePointer(&FileObjectExtension->FilterContext,
FilterContext, NULL);
}
else
{
@@ -2483,7 +2483,7 @@ IoChangeFileObjectFilterContext(IN PFILE_OBJECT FileObject,
* If it matches (and thus, we reset), Success will contain 0
* Otherwise, it will contain a non-zero value.
*/
- Success = InterlockedCompareExchange((volatile LONG
*)&FileObjectExtension->FilterContext, 0, (ULONG_PTR)FilterContext) -
(ULONG_PTR)FilterContext;
+ Success =
(ULONG_PTR)InterlockedCompareExchangePointer(&FileObjectExtension->FilterContext,
NULL, FilterContext) - (ULONG_PTR)FilterContext;
}
/* If success isn't 0, it means we failed somewhere (set or unset) */