ntdll: Implement NtCancelIoFileEx and fix NtCancelIoFile.
This commit is contained in:
parent
b05774ee7e
commit
af25949a51
|
@ -2603,6 +2603,38 @@ NTSTATUS WINAPI NtDeleteFile( POBJECT_ATTRIBUTES ObjectAttributes )
|
|||
return status;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* NtCancelIoFileEx (NTDLL.@)
|
||||
*
|
||||
*
|
||||
*/
|
||||
NTSTATUS WINAPI NtCancelIoFileEx( HANDLE hFile, PIO_STATUS_BLOCK iosb, PIO_STATUS_BLOCK io_status )
|
||||
{
|
||||
LARGE_INTEGER timeout;
|
||||
|
||||
TRACE("%p %p %p\n", hFile, iosb, io_status );
|
||||
|
||||
SERVER_START_REQ( cancel_async )
|
||||
{
|
||||
req->handle = wine_server_obj_handle( hFile );
|
||||
req->iosb = wine_server_client_ptr( iosb );
|
||||
req->only_thread = FALSE;
|
||||
io_status->u.Status = wine_server_call( req );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
if (io_status->u.Status)
|
||||
return io_status->u.Status;
|
||||
|
||||
/* Let some APC be run, so that we can run the remaining APCs on hFile
|
||||
* either the cancelation of the pending one, but also the execution
|
||||
* of the queued APC, but not yet run. This is needed to ensure proper
|
||||
* clean-up of allocated data.
|
||||
*/
|
||||
timeout.u.LowPart = timeout.u.HighPart = 0;
|
||||
NtDelayExecution( TRUE, &timeout );
|
||||
return io_status->u.Status;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* NtCancelIoFile (NTDLL.@)
|
||||
*
|
||||
|
@ -2616,17 +2648,23 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
|
|||
|
||||
SERVER_START_REQ( cancel_async )
|
||||
{
|
||||
req->handle = wine_server_obj_handle( hFile );
|
||||
wine_server_call( req );
|
||||
req->handle = wine_server_obj_handle( hFile );
|
||||
req->iosb = 0;
|
||||
req->only_thread = TRUE;
|
||||
io_status->u.Status = wine_server_call( req );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
if (io_status->u.Status)
|
||||
return io_status->u.Status;
|
||||
|
||||
/* Let some APC be run, so that we can run the remaining APCs on hFile
|
||||
* either the cancelation of the pending one, but also the execution
|
||||
* of the queued APC, but not yet run. This is needed to ensure proper
|
||||
* clean-up of allocated data.
|
||||
*/
|
||||
timeout.u.LowPart = timeout.u.HighPart = 0;
|
||||
return io_status->u.Status = NtDelayExecution( TRUE, &timeout );
|
||||
NtDelayExecution( TRUE, &timeout );
|
||||
return io_status->u.Status;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
@ stub NtCallbackReturn
|
||||
# @ stub NtCancelDeviceWakeupRequest
|
||||
@ stdcall NtCancelIoFile(long ptr)
|
||||
@ stdcall NtCancelIoFileEx(long ptr ptr)
|
||||
@ stdcall NtCancelTimer(long ptr)
|
||||
@ stdcall NtClearEvent(long)
|
||||
@ stdcall NtClose(long)
|
||||
|
@ -959,6 +960,7 @@
|
|||
@ stub ZwCallbackReturn
|
||||
# @ stub ZwCancelDeviceWakeupRequest
|
||||
@ stdcall ZwCancelIoFile(long ptr) NtCancelIoFile
|
||||
@ stdcall ZwCancelIoFileEx(long ptr ptr) NtCancelIoFileEx
|
||||
@ stdcall ZwCancelTimer(long ptr) NtCancelTimer
|
||||
@ stdcall ZwClearEvent(long) NtClearEvent
|
||||
@ stdcall ZwClose(long) NtClose
|
||||
|
|
|
@ -295,15 +295,14 @@ static void test_ntncdf_async(void)
|
|||
ok(U(iosb).Status == 0x01234567, "status set too soon\n");
|
||||
ok(iosb.Information == 0x12345678, "info set too soon\n");
|
||||
|
||||
todo_wine {
|
||||
r = pNtCancelIoFile(hdir, &iosb);
|
||||
ok( r == STATUS_SUCCESS, "cancel failed\n");
|
||||
|
||||
CloseHandle(hdir);
|
||||
|
||||
ok(U(iosb).Status == STATUS_SUCCESS, "status wrong\n");
|
||||
ok(U(iosb2).Status == STATUS_CANCELLED, "status wrong\n");
|
||||
}
|
||||
todo_wine ok(U(iosb2).Status == STATUS_CANCELLED, "status wrong\n");
|
||||
|
||||
ok(iosb.Information == 0, "info wrong\n");
|
||||
ok(iosb2.Information == 0, "info wrong\n");
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ static void read_file_test(void)
|
|||
ok( U(iosb).Status == STATUS_CANCELLED, "wrong status %x\n", U(iosb).Status );
|
||||
ok( iosb.Information == 0, "wrong info %lu\n", iosb.Information );
|
||||
ok( is_signaled( event ), "event is signaled\n" );
|
||||
ok( !apc_count, "apc was called\n" );
|
||||
todo_wine ok( !apc_count, "apc was called\n" );
|
||||
SleepEx( 1, TRUE ); /* alertable sleep */
|
||||
ok( apc_count == 1, "apc was not called\n" );
|
||||
CloseHandle( read );
|
||||
|
|
|
@ -2013,6 +2013,7 @@ NTSYSAPI NTSTATUS WINAPI NtAreMappedFilesTheSame(PVOID,PVOID);
|
|||
NTSYSAPI NTSTATUS WINAPI NtAssignProcessToJobObject(HANDLE,HANDLE);
|
||||
NTSYSAPI NTSTATUS WINAPI NtCallbackReturn(PVOID,ULONG,NTSTATUS);
|
||||
NTSYSAPI NTSTATUS WINAPI NtCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
|
||||
NTSYSAPI NTSTATUS WINAPI NtCancelIoFileEx(HANDLE,PIO_STATUS_BLOCK,PIO_STATUS_BLOCK);
|
||||
NTSYSAPI NTSTATUS WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
|
||||
NTSYSAPI NTSTATUS WINAPI NtClearEvent(HANDLE);
|
||||
NTSYSAPI NTSTATUS WINAPI NtClose(HANDLE);
|
||||
|
|
Loading…
Reference in New Issue