From a5c03fbc72f5b084723a7f1181d90731abea8872 Mon Sep 17 00:00:00 2001 From: Mike Kaplinskiy Date: Sun, 9 Aug 2009 00:12:52 -0400 Subject: [PATCH] kernel32: Implement CancelIoEx. --- dlls/kernel32/file.c | 26 ++++++++++++++++++++++++++ dlls/kernel32/kernel32.spec | 1 + include/winbase.h | 1 + 3 files changed, 28 insertions(+) diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index 97429644999..d9fbddb84c6 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -624,6 +624,32 @@ BOOL WINAPI GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped, return !status; } +/*********************************************************************** + * CancelIoEx (KERNEL32.@) + * + * Cancels pending I/O operations on a file given the overlapped used. + * + * PARAMS + * handle [I] File handle. + * lpOverlapped [I,OPT] pointer to overlapped (if null, cancel all) + * + * RETURNS + * Success: TRUE. + * Failure: FALSE, check GetLastError(). + */ +BOOL WINAPI CancelIoEx(HANDLE handle, LPOVERLAPPED lpOverlapped) +{ + IO_STATUS_BLOCK io_status; + + NtCancelIoFileEx(handle, (PIO_STATUS_BLOCK) lpOverlapped, &io_status); + if (io_status.u.Status) + { + SetLastError( RtlNtStatusToDosError( io_status.u.Status ) ); + return FALSE; + } + return TRUE; +} + /*********************************************************************** * CancelIo (KERNEL32.@) * diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 2fd1b10c382..458a47d4467 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -177,6 +177,7 @@ @ stdcall CallNamedPipeW(wstr ptr long ptr long ptr long) @ stub CancelDeviceWakeupRequest @ stdcall CancelIo(long) +@ stdcall CancelIoEx(long ptr) # @ stub CancelTimerQueueTimer @ stdcall CancelWaitableTimer(long) @ stdcall ChangeTimerQueueTimer(ptr ptr long long) diff --git a/include/winbase.h b/include/winbase.h index 9e52bde471d..791d58e205b 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1323,6 +1323,7 @@ WINBASEAPI BOOL WINAPI CallNamedPipeA(LPCSTR,LPVOID,DWORD,LPVOID,DWORD,LP WINBASEAPI BOOL WINAPI CallNamedPipeW(LPCWSTR,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,DWORD); #define CallNamedPipe WINELIB_NAME_AW(CallNamedPipe) WINBASEAPI BOOL WINAPI CancelIo(HANDLE); +WINBASEAPI BOOL WINAPI CancelIoEx(HANDLE,LPOVERLAPPED); WINBASEAPI BOOL WINAPI CancelWaitableTimer(HANDLE); WINBASEAPI BOOL WINAPI ChangeTimerQueueTimer(HANDLE,HANDLE,ULONG,ULONG); WINADVAPI BOOL WINAPI CheckTokenMembership(HANDLE,PSID,PBOOL);