Implement CancelIo properly.
This commit is contained in:
parent
0964495bc4
commit
de339f3021
18
files/file.c
18
files/file.c
|
@ -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;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue