server: Use pipe stored in pipe_end in get_named_pipe_info.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-08-16 15:11:22 +02:00 committed by Alexandre Julliard
parent 6f6f6e5924
commit 3375ccba2f
2 changed files with 18 additions and 33 deletions

View File

@ -1355,7 +1355,6 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state)
memset(&io, 0xcc, sizeof(io)); memset(&io, 0xcc, sizeof(io));
status = pNtQueryInformationFile(pipe, &io, &local_info, sizeof(local_info), FilePipeLocalInformation); status = pNtQueryInformationFile(pipe, &io, &local_info, sizeof(local_info), FilePipeLocalInformation);
if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE) if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE)
todo_wine
ok(status == STATUS_PIPE_DISCONNECTED, ok(status == STATUS_PIPE_DISCONNECTED,
"NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n", "NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n",
is_server ? "server" : "client", state, status); is_server ? "server" : "client", state, status);
@ -1370,7 +1369,6 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state)
status = pNtQueryInformationFile(pipe, &io, &pipe_info, sizeof(pipe_info), FilePipeInformation); status = pNtQueryInformationFile(pipe, &io, &pipe_info, sizeof(pipe_info), FilePipeInformation);
if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE) if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE)
todo_wine
ok(status == STATUS_PIPE_DISCONNECTED, ok(status == STATUS_PIPE_DISCONNECTED,
"NtQueryInformationFile(FilePipeInformation) failed in %s state %u: %x\n", "NtQueryInformationFile(FilePipeInformation) failed in %s state %u: %x\n",
is_server ? "server" : "client", state, status); is_server ? "server" : "client", state, status);
@ -1555,7 +1553,6 @@ static void test_pipe_local_info(HANDLE pipe, BOOL is_server, DWORD state)
memset(&local_info, 0xcc, sizeof(local_info)); memset(&local_info, 0xcc, sizeof(local_info));
status = pNtQueryInformationFile(pipe, &iosb, &local_info, sizeof(local_info), FilePipeLocalInformation); status = pNtQueryInformationFile(pipe, &iosb, &local_info, sizeof(local_info), FilePipeLocalInformation);
if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE) if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE)
todo_wine
ok(status == STATUS_PIPE_DISCONNECTED, ok(status == STATUS_PIPE_DISCONNECTED,
"NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n", "NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n",
is_server ? "server" : "client", state, status); is_server ? "server" : "client", state, status);
@ -1566,23 +1563,18 @@ static void test_pipe_local_info(HANDLE pipe, BOOL is_server, DWORD state)
if (!status) if (!status)
{ {
ok(local_info.NamedPipeType == 1, "NamedPipeType = %u\n", local_info.NamedPipeType); ok(local_info.NamedPipeType == 1, "NamedPipeType = %u\n", local_info.NamedPipeType);
todo_wine_if(!is_server && (state == FILE_PIPE_CLOSING_STATE || state == FILE_PIPE_DISCONNECTED_STATE))
ok(local_info.NamedPipeConfiguration == 1, "NamedPipeConfiguration = %u\n", ok(local_info.NamedPipeConfiguration == 1, "NamedPipeConfiguration = %u\n",
local_info.NamedPipeConfiguration); local_info.NamedPipeConfiguration);
todo_wine_if(!is_server && (state == FILE_PIPE_CLOSING_STATE || state == FILE_PIPE_DISCONNECTED_STATE))
ok(local_info.MaximumInstances == 1, "MaximumInstances = %u\n", local_info.MaximumInstances); ok(local_info.MaximumInstances == 1, "MaximumInstances = %u\n", local_info.MaximumInstances);
if (!is_server && state == FILE_PIPE_CLOSING_STATE) if (!is_server && state == FILE_PIPE_CLOSING_STATE)
ok(local_info.CurrentInstances == 0 || broken(local_info.CurrentInstances == 1 /* winxp */), ok(local_info.CurrentInstances == 0 || broken(local_info.CurrentInstances == 1 /* winxp */),
"CurrentInstances = %u\n", local_info.CurrentInstances); "CurrentInstances = %u\n", local_info.CurrentInstances);
else else
todo_wine_if(!is_server && state == FILE_PIPE_DISCONNECTED_STATE)
ok(local_info.CurrentInstances == 1, ok(local_info.CurrentInstances == 1,
"CurrentInstances = %u\n", local_info.CurrentInstances); "CurrentInstances = %u\n", local_info.CurrentInstances);
todo_wine_if(!is_server && (state == FILE_PIPE_CLOSING_STATE || state == FILE_PIPE_DISCONNECTED_STATE))
ok(local_info.InboundQuota == 100, "InboundQuota = %u\n", local_info.InboundQuota); ok(local_info.InboundQuota == 100, "InboundQuota = %u\n", local_info.InboundQuota);
ok(local_info.ReadDataAvailable == 0, "ReadDataAvailable = %u\n", ok(local_info.ReadDataAvailable == 0, "ReadDataAvailable = %u\n",
local_info.ReadDataAvailable); local_info.ReadDataAvailable);
todo_wine_if(!is_server && (state == FILE_PIPE_CLOSING_STATE || state == FILE_PIPE_DISCONNECTED_STATE))
ok(local_info.OutboundQuota == 200, "OutboundQuota = %u\n", local_info.OutboundQuota); ok(local_info.OutboundQuota == 200, "OutboundQuota = %u\n", local_info.OutboundQuota);
todo_wine todo_wine
ok(local_info.WriteQuotaAvailable == (is_server ? 200 : 100), "WriteQuotaAvailable = %u\n", ok(local_info.WriteQuotaAvailable == (is_server ? 200 : 100), "WriteQuotaAvailable = %u\n",
@ -1608,7 +1600,6 @@ static void test_pipe_local_info(HANDLE pipe, BOOL is_server, DWORD state)
&attr, &iosb, FILE_SHARE_WRITE, FILE_CREATE, 0, 0, 0, 0, 1, &attr, &iosb, FILE_SHARE_WRITE, FILE_CREATE, 0, 0, 0, 0, 1,
100, 200, &timeout); 100, 200, &timeout);
if (!local_info.CurrentInstances) if (!local_info.CurrentInstances)
todo_wine_if(status) /* FIXME */
ok(status == STATUS_SUCCESS, "NtCreateNamedPipeFile failed: %x\n", status); ok(status == STATUS_SUCCESS, "NtCreateNamedPipeFile failed: %x\n", status);
else else
ok(status == STATUS_INSTANCE_NOT_AVAILABLE, "NtCreateNamedPipeFile failed: %x\n", status); ok(status == STATUS_INSTANCE_NOT_AVAILABLE, "NtCreateNamedPipeFile failed: %x\n", status);
@ -1625,7 +1616,6 @@ static void test_pipe_local_info(HANDLE pipe, BOOL is_server, DWORD state)
ok(local_info.CurrentInstances == 0 || broken(local_info.CurrentInstances == 1 /* winxp */), ok(local_info.CurrentInstances == 0 || broken(local_info.CurrentInstances == 1 /* winxp */),
"CurrentInstances = %u\n", local_info.CurrentInstances); "CurrentInstances = %u\n", local_info.CurrentInstances);
else else
todo_wine_if(!is_server && state == FILE_PIPE_DISCONNECTED_STATE)
ok(local_info.CurrentInstances == 1, ok(local_info.CurrentInstances == 1,
"CurrentInstances = %u\n", local_info.CurrentInstances); "CurrentInstances = %u\n", local_info.CurrentInstances);
} }
@ -1633,7 +1623,6 @@ static void test_pipe_local_info(HANDLE pipe, BOOL is_server, DWORD state)
memset(&iosb, 0xcc, sizeof(iosb)); memset(&iosb, 0xcc, sizeof(iosb));
status = pNtQueryInformationFile(pipe, &iosb, &pipe_info, sizeof(pipe_info), FilePipeInformation); status = pNtQueryInformationFile(pipe, &iosb, &pipe_info, sizeof(pipe_info), FilePipeInformation);
if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE) if (!is_server && state == FILE_PIPE_DISCONNECTED_STATE)
todo_wine
ok(status == STATUS_PIPE_DISCONNECTED, ok(status == STATUS_PIPE_DISCONNECTED,
"NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n", "NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n",
is_server ? "server" : "client", state, status); is_server ? "server" : "client", state, status);

View File

@ -1354,39 +1354,35 @@ DECL_HANDLER(create_named_pipe)
DECL_HANDLER(get_named_pipe_info) DECL_HANDLER(get_named_pipe_info)
{ {
struct pipe_server *server; struct pipe_end *pipe_end;
struct pipe_client *client = NULL;
server = get_pipe_server_obj( current->process, req->handle, FILE_READ_ATTRIBUTES ); pipe_end = (struct pipe_end *)get_handle_obj( current->process, req->handle,
if (!server) FILE_READ_ATTRIBUTES, &pipe_server_ops );
if (!pipe_end)
{ {
if (get_error() != STATUS_OBJECT_TYPE_MISMATCH) if (get_error() != STATUS_OBJECT_TYPE_MISMATCH)
return; return;
clear_error(); clear_error();
client = (struct pipe_client *)get_handle_obj( current->process, req->handle, pipe_end = (struct pipe_end *)get_handle_obj( current->process, req->handle,
0, &pipe_client_ops ); 0, &pipe_client_ops );
if (!client) return; if (!pipe_end) return;
server = client->server;
} }
reply->flags = client ? client->pipe_end.flags : server->pipe_end.flags; if (pipe_end->pipe)
if (server)
{ {
reply->sharing = server->pipe->sharing; reply->flags = pipe_end->flags;
reply->maxinstances = server->pipe->maxinstances; reply->sharing = pipe_end->pipe->sharing;
reply->instances = server->pipe->instances; reply->maxinstances = pipe_end->pipe->maxinstances;
reply->insize = server->pipe->insize; reply->instances = pipe_end->pipe->instances;
reply->outsize = server->pipe->outsize; reply->insize = pipe_end->pipe->insize;
} reply->outsize = pipe_end->pipe->outsize;
if (client) if (pipe_end->obj.ops == &pipe_server_ops) reply->flags |= NAMED_PIPE_SERVER_END;
release_object(client);
else
{
reply->flags |= NAMED_PIPE_SERVER_END;
release_object(server);
} }
else set_error( STATUS_PIPE_DISCONNECTED );
release_object( pipe_end );
} }
DECL_HANDLER(set_named_pipe_info) DECL_HANDLER(set_named_pipe_info)