https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1bd25c5c24047c5d6e4c3…
commit 1bd25c5c24047c5d6e4c387386c38073d551d827
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Thu Oct 4 07:53:12 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Thu Oct 4 07:53:12 2018 +0200
[NTOSKRNL] When checking for byte offset alignment, tolerate some magic values
---
ntoskrnl/io/iomgr/iofunc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index c344b422d8..f3ad7164c2 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -3656,9 +3656,15 @@ NtWriteFile(IN HANDLE FileHandle,
if ((DeviceObject->SectorSize != 0) &&
(ByteOffset->QuadPart % DeviceObject->SectorSize != 0))
{
- /* Release the file object and and fail */
- ObDereferenceObject(FileObject);
- return STATUS_INVALID_PARAMETER;
+ /* Only if that's not specific values for synchronous IO */
+ if ((ByteOffset->QuadPart != FILE_WRITE_TO_END_OF_FILE)
&&
+ (ByteOffset->QuadPart != FILE_USE_FILE_POINTER_POSITION
||
+ !BooleanFlagOn(FileObject->Flags, FO_SYNCHRONOUS_IO)))
+ {
+ /* Release the file object and and fail */
+ ObDereferenceObject(FileObject);
+ return STATUS_INVALID_PARAMETER;
+ }
}
}
}