Commit de339f30 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Implement CancelIo properly.

parent 0964495b
...@@ -1275,7 +1275,23 @@ BOOL FILE_StartAsync(HANDLE hFile, LPOVERLAPPED lpOverlapped, DWORD type, DWORD ...@@ -1275,7 +1275,23 @@ BOOL FILE_StartAsync(HANDLE hFile, LPOVERLAPPED lpOverlapped, DWORD type, DWORD
*/ */
BOOL WINAPI CancelIo(HANDLE handle) BOOL WINAPI CancelIo(HANDLE handle)
{ {
return FILE_StartAsync(handle, NULL, ASYNC_TYPE_NONE, 0, STATUS_CANCELLED); async_private *ovp,*t;
TRACE("handle = %x\n",handle);
ovp = NtCurrentTeb()->pending_list;
while(ovp)
{
t = ovp->next;
if(FILE_StartAsync(handle, ovp->lpOverlapped, ovp->type, 0, STATUS_CANCELLED))
{
TRACE("overlapped = %p\n",ovp->lpOverlapped);
finish_async(ovp, STATUS_CANCELLED);
}
ovp = t;
}
WaitForMultipleObjectsEx(0,NULL,FALSE,1,TRUE);
return TRUE;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -49,6 +49,7 @@ typedef struct async_private ...@@ -49,6 +49,7 @@ typedef struct async_private
} async_private; } async_private;
extern void WINAPI check_async_list(LPOVERLAPPED ov, DWORD status); extern void WINAPI check_async_list(LPOVERLAPPED ov, DWORD status);
extern void finish_async(struct async_private *ovp, DWORD status);
/* locale-independent case conversion */ /* locale-independent case conversion */
inline static char FILE_tolower( char c ) inline static char FILE_tolower( char c )
......
...@@ -47,7 +47,7 @@ static void CALLBACK call_completion_routine(ULONG_PTR data) ...@@ -47,7 +47,7 @@ static void CALLBACK call_completion_routine(ULONG_PTR data)
HeapFree(GetProcessHeap(), 0, ovp); HeapFree(GetProcessHeap(), 0, ovp);
} }
static void finish_async(async_private *ovp, DWORD status) void finish_async(async_private *ovp, DWORD status)
{ {
ovp->lpOverlapped->Internal=status; ovp->lpOverlapped->Internal=status;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment