diff --git a/dlls/ntdll/tests/change.c b/dlls/ntdll/tests/change.c index 1e643fc3eee..e7201b52a3c 100644 --- a/dlls/ntdll/tests/change.c +++ b/dlls/ntdll/tests/change.c @@ -168,7 +168,7 @@ static void test_ntncdf_async(void) HANDLE hdir, hEvent; char buffer[0x1000]; DWORD fflags, filter = 0; - IO_STATUS_BLOCK iosb, iosb2; + IO_STATUS_BLOCK iosb, iosb2, iosb3; WCHAR path[MAX_PATH], subdir[MAX_PATH]; static const WCHAR szBoo[] = { '\\','b','o','o',0 }; static const WCHAR szHoo[] = { '\\','h','o','o',0 }; @@ -293,16 +293,28 @@ 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"); - r = pNtCancelIoFile(hdir, &iosb); + U(iosb3).Status = 0x111111; + iosb3.Information = 0x222222; + + r = pNtCancelIoFile(hdir, &iosb3); ok( r == STATUS_SUCCESS, "cancel failed\n"); CloseHandle(hdir); - ok(U(iosb).Status == STATUS_SUCCESS, "status wrong\n"); + ok(U(iosb).Status == STATUS_CANCELLED, "status wrong %x\n",U(iosb).Status); ok(U(iosb2).Status == STATUS_CANCELLED, "status wrong %x\n",U(iosb2).Status); + ok(U(iosb3).Status == STATUS_SUCCESS, "status wrong %x\n",U(iosb3).Status); ok(iosb.Information == 0, "info wrong\n"); ok(iosb2.Information == 0, "info wrong\n"); + ok(iosb3.Information == 0, "info wrong\n"); + + U(iosb3).Status = 0x111111; + iosb3.Information = 0x222222; + r = pNtCancelIoFile(hdir, &iosb3); + ok( r == STATUS_INVALID_HANDLE, "cancel failed %x\n", r); + ok(U(iosb3).Status == 0x111111, "status wrong %x\n",U(iosb3).Status); + ok(iosb3.Information == 0x222222, "info wrong\n"); r = RemoveDirectoryW( path ); ok( r == TRUE, "failed to remove directory\n"); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 21bcb215385..626a0957644 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -5931,16 +5931,23 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE handle, IO_STATUS_BLOCK *io ) */ NTSTATUS WINAPI NtCancelIoFile( HANDLE handle, IO_STATUS_BLOCK *io_status ) { + NTSTATUS status; + TRACE( "%p %p\n", handle, io_status ); SERVER_START_REQ( cancel_async ) { req->handle = wine_server_obj_handle( handle ); req->only_thread = TRUE; - io_status->u.Status = wine_server_call( req ); + if (!(status = wine_server_call( req ))) + { + io_status->u.Status = status; + io_status->Information = 0; + } } SERVER_END_REQ; - return io_status->u.Status; + + return status; } @@ -5949,16 +5956,23 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE handle, IO_STATUS_BLOCK *io_status ) */ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE handle, IO_STATUS_BLOCK *io, IO_STATUS_BLOCK *io_status ) { + NTSTATUS status; + TRACE( "%p %p %p\n", handle, io, io_status ); SERVER_START_REQ( cancel_async ) { req->handle = wine_server_obj_handle( handle ); req->iosb = wine_server_client_ptr( io ); - io_status->u.Status = wine_server_call( req ); + if (!(status = wine_server_call( req ))) + { + io_status->u.Status = status; + io_status->Information = 0; + } } SERVER_END_REQ; - return io_status->u.Status; + + return status; }