From 38b7c8839c9a9b6c02a2bf76250cb6f339dfb1e4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 7 May 2015 15:13:34 +0900 Subject: [PATCH] ntdll: Don't run user APCs in NtCancelIoFile. --- dlls/ntdll/file.c | 22 ---------------------- dlls/ntdll/tests/file.c | 10 ++++------ dlls/ntdll/tests/pipe.c | 1 - 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index e43ef41985b..4c6b1b70f61 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -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; } diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index c02c926d4a3..19a886af06d 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -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); diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c index 9fadb0f2ea9..20d82f416c4 100644 --- a/dlls/ntdll/tests/pipe.c +++ b/dlls/ntdll/tests/pipe.c @@ -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 */ -- 2.11.4.GIT