Author: dgorbachev
Date: Tue Dec 16 23:50:20 2008
New Revision: 38141
URL:
http://svn.reactos.org/svn/reactos?rev=38141&view=rev
Log:
In GetQueuedCompletionStatus function:
- change order of arguments of NtRemoveIoCompletion function,
- check maybe it returns STATUS_TIMEOUT.
Modified:
trunk/reactos/dll/win32/kernel32/file/iocompl.c
Modified: trunk/reactos/dll/win32/kernel32/file/iocompl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/io…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/iocompl.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/iocompl.c [iso-8859-1] Tue Dec 16 23:50:20 2008
@@ -99,9 +99,10 @@
{
NTSTATUS errCode;
IO_STATUS_BLOCK IoStatus;
+ ULONG_PTR CompletionKey;
LARGE_INTEGER Interval;
- if (!lpNumberOfBytesTransferred||!lpCompletionKey||!lpOverlapped)
+ if (!lpNumberOfBytesTransferred || !lpCompletionKey || !lpOverlapped)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
@@ -113,18 +114,19 @@
}
errCode = NtRemoveIoCompletion(CompletionHandle,
- (PVOID*)lpCompletionKey,
- (PVOID*)lpNumberOfBytesTransferred,
+ (PVOID*)&CompletionKey,
+ (PVOID*)lpOverlapped,
&IoStatus,
dwMilliseconds == INFINITE ? NULL : &Interval);
- if (!NT_SUCCESS(errCode)) {
+ if (!NT_SUCCESS(errCode) || errCode == STATUS_TIMEOUT) {
*lpOverlapped = NULL;
SetLastErrorByStatus(errCode);
return FALSE;
}
- *lpOverlapped = (LPOVERLAPPED)IoStatus.Information;
+ *lpCompletionKey = CompletionKey;
+ *lpNumberOfBytesTransferred = IoStatus.Information;
if (!NT_SUCCESS(IoStatus.Status)){
//failed io operation
@@ -133,7 +135,6 @@
}
return TRUE;
-
}
@@ -152,10 +153,10 @@
NTSTATUS errCode;
errCode = NtSetIoCompletion(CompletionHandle,
- (PVOID)dwCompletionKey,
- (PVOID)lpOverlapped,//CompletionValue
- STATUS_SUCCESS,
//IoStatusBlock->Status
- dwNumberOfBytesTransferred);
//IoStatusBlock->Information
+ (PVOID)dwCompletionKey, // KeyContext
+ (PVOID)lpOverlapped, // ApcContext
+ STATUS_SUCCESS, // IoStatusBlock->Status
+ dwNumberOfBytesTransferred); //
IoStatusBlock->Information
if ( !NT_SUCCESS(errCode) )
{