From 018e3f9601b52e3be78029218c310a645aeaca4c Mon Sep 17 00:00:00 2001 From: Gunnar Dalsnes Date: Mon, 6 Dec 2004 14:37:11 +0000 Subject: [PATCH] -correct return value/last error -make use of macros for stu conversion -pass NULL timeout for INFINITE wait instead of waiting for 292000 years;-D svn path=/trunk/; revision=11968 --- reactos/lib/kernel32/file/iocompl.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/reactos/lib/kernel32/file/iocompl.c b/reactos/lib/kernel32/file/iocompl.c index 8b6ec7bc17e..82cdd6723e6 100644 --- a/reactos/lib/kernel32/file/iocompl.c +++ b/reactos/lib/kernel32/file/iocompl.c @@ -1,4 +1,4 @@ -/* $Id: iocompl.c,v 1.16 2004/11/25 22:18:16 ion Exp $ +/* $Id: iocompl.c,v 1.17 2004/12/06 14:37:11 gdalsnes Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -34,7 +34,7 @@ CreateIoCompletionPort( if ( ExistingCompletionPort == NULL && FileHandle == INVALID_HANDLE_VALUE ) { - SetLastErrorByStatus (STATUS_INVALID_PARAMETER); + SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } @@ -109,30 +109,22 @@ GetQueuedCompletionStatus( if (!lpNumberOfBytesTransferred||!lpCompletionKey||!lpOverlapped) { - return ERROR_INVALID_PARAMETER; + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; } if (dwMilliseconds != INFINITE) { - /* - * System time units are 100 nanoseconds (a nanosecond is a billionth of - * a second). - */ - Interval.QuadPart = -((ULONGLONG)dwMilliseconds * 10000); + Interval.QuadPart = RELATIVE_TIME(MILLIS_TO_100NS(dwMilliseconds)); } - else - { - /* Approximately 292000 years hence */ - Interval.QuadPart = -0x7FFFFFFFFFFFFFFFLL; - } errCode = NtRemoveIoCompletion(CompletionHandle, (PVOID*)lpCompletionKey, (PVOID*)lpNumberOfBytesTransferred, &IoStatus, - &Interval); + dwMilliseconds == INFINITE ? NULL : &Interval); - if (!NT_SUCCESS(errCode) ) { + if (!NT_SUCCESS(errCode)) { *lpOverlapped = NULL; SetLastErrorByStatus(errCode); return FALSE; @@ -142,7 +134,7 @@ GetQueuedCompletionStatus( if (!NT_SUCCESS(IoStatus.Status)){ //failed io operation - SetLastErrorByStatus (IoStatus.Status); + SetLastErrorByStatus(IoStatus.Status); return FALSE; }