Commit 38b7c883 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Don't run user APCs in NtCancelIoFile.

parent e40e5661
......@@ -3457,8 +3457,6 @@ NTSTATUS WINAPI NtDeleteFile( POBJECT_ATTRIBUTES ObjectAttributes )
*/
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 )
......@@ -3469,16 +3467,7 @@ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE hFile, PIO_STATUS_BLOCK iosb, PIO_STATU
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.QuadPart = 0;
NtDelayExecution( TRUE, &timeout );
return io_status->u.Status;
}
......@@ -3489,8 +3478,6 @@ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE hFile, PIO_STATUS_BLOCK iosb, PIO_STATU
*/
NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
{
LARGE_INTEGER timeout;
TRACE("%p %p\n", hFile, io_status );
SERVER_START_REQ( cancel_async )
......@@ -3501,16 +3488,7 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
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.QuadPart = 0;
NtDelayExecution( TRUE, &timeout );
return io_status->u.Status;
}
......
......@@ -668,7 +668,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" );
todo_wine ok( !apc_count, "apc was called\n" );
ok( !apc_count, "apc was called\n" );
SleepEx( 1, TRUE ); /* alertable sleep */
ok( apc_count == 1, "apc was not called\n" );
......@@ -694,7 +694,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" );
todo_wine ok( !apc_count, "apc was called\n" );
ok( !apc_count, "apc was called\n" );
SleepEx( 1, TRUE ); /* alertable sleep */
ok( apc_count == 1, "apc was not called\n" );
CloseHandle( handle );
......@@ -720,7 +720,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" );
todo_wine ok( !apc_count, "apc was called\n" );
ok( !apc_count, "apc was called\n" );
SleepEx( 1, TRUE ); /* alertable sleep */
ok( apc_count == 1, "apc was not called\n" );
......@@ -746,7 +746,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" );
todo_wine ok( !apc_count, "apc was called\n" );
ok( !apc_count, "apc was called\n" );
SleepEx( 1, TRUE ); /* alertable sleep */
ok( apc_count == 2, "apc was not called\n" );
......@@ -2521,7 +2521,6 @@ static void test_read_write(void)
ret = ReadFile(hfile, buf, 0, &bytes, &ovl);
/* ReadFile return value depends on Windows version and testing it is not practical */
if (!ret)
todo_wine
ok(GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %d\n", GetLastError());
ret = GetLastError();
ok(bytes == 0, "bytes %u\n", bytes);
......@@ -2552,7 +2551,6 @@ todo_wine
ret = ReadFile(hfile, NULL, 0, &bytes, &ovl);
/* ReadFile return value depends on Windows version and testing it is not practical */
if (!ret)
todo_wine
ok(GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %d\n", GetLastError());
ret = GetLastError();
ok(bytes == 0, "bytes %u\n", bytes);
......
......@@ -474,7 +474,6 @@ static void test_cancelio(void)
ok(U(iosb).Status == STATUS_CANCELLED, "Wrong iostatus %x\n", U(iosb).Status);
ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
todo_wine
ok(!ioapc_called, "IOAPC ran too early\n");
SleepEx(0, TRUE); /* alertable wait state */
......
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