diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c index fe650124d8f..08bde6da1dd 100644 --- a/dlls/ntdll/tests/pipe.c +++ b/dlls/ntdll/tests/pipe.c @@ -412,9 +412,9 @@ static void test_alertable(void) res = listen_pipe(hPipe, hEvent, &iosb, TRUE); todo_wine ok(res == STATUS_CANCELLED, "NtFsControlFile returned %x\n", res); - todo_wine ok(userapc_called, "user apc didn't run\n"); + ok(userapc_called, "user apc didn't run\n"); ok(U(iosb).Status == 0x55555555, "iosb.Status got changed to %x\n", U(iosb).Status); - todo_wine ok(WaitForSingleObjectEx(hEvent, 0, TRUE) == WAIT_TIMEOUT, "hEvent signaled\n"); + ok(WaitForSingleObjectEx(hEvent, 0, TRUE) == WAIT_TIMEOUT, "hEvent signaled\n"); ok(!ioapc_called, "IOAPC ran\n"); /* queue an user apc from a different thread */ @@ -445,11 +445,11 @@ static void test_alertable(void) ok(hThread != INVALID_HANDLE_VALUE, "can't create thread, GetLastError: %x\n", GetLastError()); res = listen_pipe(hPipe, hEvent, &iosb, TRUE); - todo_wine ok(!res, "NtFsControlFile returned %x\n", res); + ok(!res, "NtFsControlFile returned %x\n", res); ok(open_succeeded, "couldn't open client side pipe\n"); ok(!U(iosb).Status, "Wrong iostatus %x\n", U(iosb).Status); - todo_wine ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n"); + ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n"); WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); @@ -482,11 +482,11 @@ static void test_nonalertable(void) ok(ret, "can't queue user apc, GetLastError: %x\n", GetLastError()); res = listen_pipe(hPipe, hEvent, &iosb, TRUE); - todo_wine ok(!res, "NtFsControlFile returned %x\n", res); + ok(!res, "NtFsControlFile returned %x\n", res); ok(open_succeeded, "couldn't open client side pipe\n"); - todo_wine ok(!U(iosb).Status, "Wrong iostatus %x\n", U(iosb).Status); - todo_wine ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n"); + ok(!U(iosb).Status, "Wrong iostatus %x\n", U(iosb).Status); + ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n"); ok(!ioapc_called, "IOAPC ran too early\n"); ok(!userapc_called, "user apc ran too early\n"); @@ -1348,7 +1348,6 @@ static void test_completion(void) ok(is_signaled(client), "client is not signaled\n"); - if (broken(1)) { /* blocks on wine */ /* no event, APC nor completion: only signals on handle */ memset(&io, 0xcc, sizeof(io)); status = NtReadFile(client, NULL, NULL, NULL, &io, read_buf, sizeof(read_buf), NULL, NULL); @@ -1360,7 +1359,6 @@ static void test_completion(void) ok(is_signaled(client), "client is signaled\n"); ok(io.Status == STATUS_SUCCESS, "Status = %x\n", io.Status); ok(io.Information == sizeof(buf), "Information = %lu\n", io.Information); - } /* event with no APC nor completion: signals only event */ memset(&io, 0xcc, sizeof(io)); @@ -1434,12 +1432,10 @@ static void test_completion(void) ok(!is_signaled(client), "client is signaled\n"); test_queued_completion(port, &io, STATUS_SUCCESS, sizeof(buf)); - if (broken(1)) { /* blocks on wine */ memset(&io, 0xcc, sizeof(io)); status = NtReadFile(client, NULL, NULL, NULL, &io, read_buf, sizeof(read_buf), NULL, NULL); ok(status == STATUS_PENDING, "status = %x\n", status); ok(!is_signaled(client), "client is signaled\n"); - } ret = WriteFile(client, buf, 1, &num_bytes, NULL); ok(ret, "WriteFile failed, error %u\n", GetLastError()); @@ -1575,9 +1571,7 @@ static void test_blocking(ULONG options) SetEvent(ctx.wait); status = NtReadFile(ctx.client, ctx.event, ioapc, &io, &io, read_buf, sizeof(read_buf), NULL, NULL); - todo_wine ok(status == STATUS_SUCCESS, "status = %x\n", status); - if (status == STATUS_PENDING) WaitForSingleObject(ctx.event, INFINITE); ok(io.Status == STATUS_SUCCESS, "Status = %x\n", io.Status); ok(io.Information == 1, "Information = %lu\n", io.Information); ok(is_signaled(ctx.event), "event is not signaled\n"); diff --git a/server/async.c b/server/async.c index f2674bbd459..cadeda3ffbd 100644 --- a/server/async.c +++ b/server/async.c @@ -284,7 +284,7 @@ struct async *create_request_async( struct fd *fd, unsigned int comp_flags, cons } /* return async object status and wait handle to client */ -obj_handle_t async_handoff( struct async *async, int success, data_size_t *result ) +obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ) { if (!success) { @@ -316,7 +316,7 @@ obj_handle_t async_handoff( struct async *async, int success, data_size_t *resul else { async->direct_result = 0; - if (!async_is_blocking( async )) + if (!force_blocking && async->fd && is_fd_overlapped( async->fd )) { close_handle( async->thread->process, async->wait_handle); async->wait_handle = 0; diff --git a/server/fd.c b/server/fd.c index eba3256e76e..119fae68668 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2438,7 +2438,7 @@ DECL_HANDLER(flush) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->event = async_handoff( async, fd->fd_ops->flush( fd, async ), NULL ); + reply->event = async_handoff( async, fd->fd_ops->flush( fd, async ), NULL, 1 ); release_object( async ); } release_object( fd ); @@ -2537,7 +2537,7 @@ DECL_HANDLER(read) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->read( fd, async, req->pos ), NULL ); + reply->wait = async_handoff( async, fd->fd_ops->read( fd, async, req->pos ), NULL, 0 ); reply->options = fd->options; release_object( async ); } @@ -2554,7 +2554,7 @@ DECL_HANDLER(write) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->write( fd, async, req->pos ), &reply->size ); + reply->wait = async_handoff( async, fd->fd_ops->write( fd, async, req->pos ), &reply->size, 0 ); reply->options = fd->options; release_object( async ); } @@ -2572,7 +2572,7 @@ DECL_HANDLER(ioctl) if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->ioctl( fd, req->code, async ), NULL ); + reply->wait = async_handoff( async, fd->fd_ops->ioctl( fd, req->code, async ), NULL, 0 ); reply->options = fd->options; release_object( async ); } diff --git a/server/file.h b/server/file.h index a9581a7f6ea..6b67866d3f2 100644 --- a/server/file.h +++ b/server/file.h @@ -187,7 +187,7 @@ extern struct object *create_serial( struct fd *fd ); extern void free_async_queue( struct async_queue *queue ); extern struct async *create_async( struct fd *fd, struct thread *thread, const async_data_t *data, struct iosb *iosb ); extern struct async *create_request_async( struct fd *fd, unsigned int comp_flags, const async_data_t *data ); -extern obj_handle_t async_handoff( struct async *async, int success, data_size_t *result ); +extern obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ); extern void queue_async( struct async_queue *queue, struct async *async ); extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ); extern void async_set_result( struct object *obj, unsigned int status, apc_param_t total );