mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[NTOS:IO] Fail, if io completion port and an apc routine are used at the same time
Add checks to NtNotifyChangeDirectoryFile, NtLockFile, NtReadFile and NtWriteFile. This fixes two ntdll tests.
This commit is contained in:
parent
b3c6407d6e
commit
07e19a5e09
1 changed files with 33 additions and 1 deletions
|
@ -287,7 +287,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
|
|||
&HandleInformation);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Can't use an I/O completion port and an APC in the same time */
|
||||
/* Can't use an I/O completion port and an APC at the same time */
|
||||
if ((FileObject->CompletionContext) && (UserApcRoutine))
|
||||
{
|
||||
/* Fail */
|
||||
|
@ -1675,6 +1675,14 @@ NtNotifyChangeDirectoryFile(IN HANDLE FileHandle,
|
|||
NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Can't use an I/O completion port and an APC at the same time */
|
||||
if ((FileObject->CompletionContext) && (ApcRoutine))
|
||||
{
|
||||
/* Fail */
|
||||
ObDereferenceObject(FileObject);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Check if we have an event handle */
|
||||
if (EventHandle)
|
||||
{
|
||||
|
@ -1793,6 +1801,14 @@ NtLockFile(IN HANDLE FileHandle,
|
|||
/* Check if we're called from user mode */
|
||||
if (PreviousMode != KernelMode)
|
||||
{
|
||||
/* Can't use an I/O completion port and an APC at the same time */
|
||||
if ((FileObject->CompletionContext) && (ApcRoutine))
|
||||
{
|
||||
/* Fail */
|
||||
ObDereferenceObject(FileObject);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Must have either FILE_READ_DATA or FILE_WRITE_DATA access */
|
||||
if (!(HandleInformation.GrantedAccess &
|
||||
(FILE_WRITE_DATA | FILE_READ_DATA)))
|
||||
|
@ -2743,6 +2759,14 @@ NtReadFile(IN HANDLE FileHandle,
|
|||
CapturedByteOffset = ProbeForReadLargeInteger(ByteOffset);
|
||||
}
|
||||
|
||||
/* Can't use an I/O completion port and an APC at the same time */
|
||||
if ((FileObject->CompletionContext) && (ApcRoutine))
|
||||
{
|
||||
/* Fail */
|
||||
ObDereferenceObject(FileObject);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Perform additional checks for non-cached file access */
|
||||
if (FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING)
|
||||
{
|
||||
|
@ -3796,6 +3820,14 @@ NtWriteFile(IN HANDLE FileHandle,
|
|||
CapturedByteOffset = ProbeForReadLargeInteger(ByteOffset);
|
||||
}
|
||||
|
||||
/* Can't use an I/O completion port and an APC at the same time */
|
||||
if ((FileObject->CompletionContext) && (ApcRoutine))
|
||||
{
|
||||
/* Fail */
|
||||
ObDereferenceObject(FileObject);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* Perform additional checks for non-cached file access */
|
||||
if (FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue