Dmitry Timoshkov : ntdll: Unify the checks for asynchronous NtReadFile behaviour.
Alexandre Julliard
julliard at winehq.org
Mon Sep 30 16:07:55 CDT 2013
Module: wine
Branch: master
Commit: fe3bc8c574a63b2e37cfe18803c150c54ca2e34d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fe3bc8c574a63b2e37cfe18803c150c54ca2e34d
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Mon Sep 30 20:19:34 2013 +0900
ntdll: Unify the checks for asynchronous NtReadFile behaviour.
---
dlls/ntdll/file.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 13bcb3c..62ae135 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -587,7 +587,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
ULONG total = 0;
enum server_fd_type type;
ULONG_PTR cvalue = apc ? 0 : (ULONG_PTR)apc_user;
- BOOL send_completion = FALSE;
+ BOOL send_completion = FALSE, async_read;
TRACE("(%p,%p,%p,%p,%p,%p,0x%08x,%p,%p),partial stub!\n",
hFile,hEvent,apc,apc_user,io_status,buffer,length,offset,key);
@@ -604,9 +604,11 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
goto done;
}
+ async_read = !(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT));
+
if (type == FD_TYPE_FILE)
{
- if (!(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)) && (!offset || offset->QuadPart < 0))
+ if (async_read && (!offset || offset->QuadPart < 0))
{
status = STATUS_INVALID_PARAMETER;
goto done;
@@ -623,7 +625,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
goto done;
}
}
- if (options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))
+ if (!async_read)
/* update file pointer position */
lseek( unix_handle, offset->QuadPart + result, SEEK_SET );
@@ -634,7 +636,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
}
else if (type == FD_TYPE_SERIAL)
{
- if (!(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)) && (!offset || offset->QuadPart < 0))
+ if (async_read && (!offset || offset->QuadPart < 0))
{
status = STATUS_INVALID_PARAMETER;
goto done;
@@ -675,7 +677,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
goto done;
}
- if (!(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT)))
+ if (async_read)
{
async_fileio_read *fileio;
BOOL avail_mode;
More information about the wine-cvs
mailing list