Implement CancelIo properly.

This commit is contained in:
Mike McCormack 2002-01-07 18:06:59 +00:00 committed by Alexandre Julliard
parent 0964495bc4
commit de339f3021
3 changed files with 19 additions and 2 deletions

View File

@ -1275,7 +1275,23 @@ BOOL FILE_StartAsync(HANDLE hFile, LPOVERLAPPED lpOverlapped, DWORD type, DWORD
*/
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;
}
/***********************************************************************

View File

@ -49,6 +49,7 @@ typedef struct async_private
} async_private;
extern void WINAPI check_async_list(LPOVERLAPPED ov, DWORD status);
extern void finish_async(struct async_private *ovp, DWORD status);
/* locale-independent case conversion */
inline static char FILE_tolower( char c )

View File

@ -47,7 +47,7 @@ static void CALLBACK call_completion_routine(ULONG_PTR data)
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;