-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
This commit is contained in:
Gunnar Dalsnes 2004-12-06 14:37:11 +00:00
parent aab32a11b0
commit 018e3f9601

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -34,7 +34,7 @@ CreateIoCompletionPort(
if ( ExistingCompletionPort == NULL && FileHandle == INVALID_HANDLE_VALUE ) if ( ExistingCompletionPort == NULL && FileHandle == INVALID_HANDLE_VALUE )
{ {
SetLastErrorByStatus (STATUS_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
@ -109,28 +109,20 @@ GetQueuedCompletionStatus(
if (!lpNumberOfBytesTransferred||!lpCompletionKey||!lpOverlapped) if (!lpNumberOfBytesTransferred||!lpCompletionKey||!lpOverlapped)
{ {
return ERROR_INVALID_PARAMETER; SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
} }
if (dwMilliseconds != INFINITE) if (dwMilliseconds != INFINITE)
{ {
/* Interval.QuadPart = RELATIVE_TIME(MILLIS_TO_100NS(dwMilliseconds));
* System time units are 100 nanoseconds (a nanosecond is a billionth of
* a second).
*/
Interval.QuadPart = -((ULONGLONG)dwMilliseconds * 10000);
}
else
{
/* Approximately 292000 years hence */
Interval.QuadPart = -0x7FFFFFFFFFFFFFFFLL;
} }
errCode = NtRemoveIoCompletion(CompletionHandle, errCode = NtRemoveIoCompletion(CompletionHandle,
(PVOID*)lpCompletionKey, (PVOID*)lpCompletionKey,
(PVOID*)lpNumberOfBytesTransferred, (PVOID*)lpNumberOfBytesTransferred,
&IoStatus, &IoStatus,
&Interval); dwMilliseconds == INFINITE ? NULL : &Interval);
if (!NT_SUCCESS(errCode)) { if (!NT_SUCCESS(errCode)) {
*lpOverlapped = NULL; *lpOverlapped = NULL;