diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index 9742964499997c0eaa53228fc013c422b85eef8b..d9fbddb84c60d3e24a9c3c9dc81398fdbed940a7 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 2fd1b10c382306515e2987d85e4a56e23a9d67c1..458a47d44677c87abb1826499bacff97e62928bd 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 9e52bde471d5eec559a259145be90fc2d12c5193..791d58e205bbd55d5e162e5ce4365fabd2ff23f6 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);