mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 07:33:20 +00:00
-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:
parent
aab32a11b0
commit
018e3f9601
1 changed files with 8 additions and 16 deletions
|
@ -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,30 +109,22 @@ 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;
|
||||||
SetLastErrorByStatus(errCode);
|
SetLastErrorByStatus(errCode);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -142,7 +134,7 @@ GetQueuedCompletionStatus(
|
||||||
|
|
||||||
if (!NT_SUCCESS(IoStatus.Status)){
|
if (!NT_SUCCESS(IoStatus.Status)){
|
||||||
//failed io operation
|
//failed io operation
|
||||||
SetLastErrorByStatus (IoStatus.Status);
|
SetLastErrorByStatus(IoStatus.Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue