From 07b681e04a19d9e95c1039c0a791608ef5897617 Mon Sep 17 00:00:00 2001 From: Bernhard Loos Date: Thu, 29 Sep 2011 11:21:14 +0200 Subject: [PATCH] ntdll: Implement the NamedPipeConfiguration value for the FilePipeLocalInformation class of NtQueryInformationFile. --- dlls/ntdll/file.c | 13 ++++++++++++- dlls/ntdll/tests/pipe.c | 7 ++++++- include/wine/server_protocol.h | 4 ++-- server/named_pipe.c | 1 + server/protocol.def | 1 + server/request.h | 9 +++++---- server/trace.c | 1 + 7 files changed, 28 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 278da5db720..53984f92b12 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -1960,7 +1960,18 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, { pli->NamedPipeType = (reply->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) ? FILE_PIPE_TYPE_MESSAGE : FILE_PIPE_TYPE_BYTE; - pli->NamedPipeConfiguration = 0; /* FIXME */ + switch (reply->sharing) + { + case FILE_SHARE_READ: + pli->NamedPipeConfiguration = FILE_PIPE_OUTBOUND; + break; + case FILE_SHARE_WRITE: + pli->NamedPipeConfiguration = FILE_PIPE_INBOUND; + break; + case FILE_SHARE_READ | FILE_SHARE_WRITE: + pli->NamedPipeConfiguration = FILE_PIPE_FULL_DUPLEX; + break; + } pli->MaximumInstances = reply->maxinstances; pli->CurrentInstances = reply->instances; pli->InboundQuota = reply->insize; diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c index e7c49b8d773..29bb6dad561 100644 --- a/dlls/ntdll/tests/pipe.c +++ b/dlls/ntdll/tests/pipe.c @@ -181,7 +181,8 @@ static void test_create(void) IO_STATUS_BLOCK iosb; static const DWORD access[] = { 0, GENERIC_READ, GENERIC_WRITE, GENERIC_READ | GENERIC_WRITE}; - static const DWORD sharing[] = { FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE }; + static const DWORD sharing[] = { FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE }; + static const DWORD pipe_config[]= { 1, 0, 2 }; for (j = 0; j < sizeof(sharing) / sizeof(DWORD); j++) { for (k = 0; k < sizeof(access) / sizeof(DWORD); k++) { @@ -196,12 +197,16 @@ static void test_create(void) res = pNtQueryInformationFile(hserver, &iosb, &info, sizeof(info), (FILE_INFORMATION_CLASS)24); ok(!res, "NtQueryInformationFile for server returned %x, sharing: %x\n", res, sharing[j]); + ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n", + info.NamedPipeConfiguration, pipe_config[j]); hclient = CreateFileW(testpipe, access[k], 0, 0, OPEN_EXISTING, 0, 0); if (hclient != INVALID_HANDLE_VALUE) { res = pNtQueryInformationFile(hclient, &iosb, &info, sizeof(info), (FILE_INFORMATION_CLASS)24); ok(!res, "NtQueryInformationFile for client returned %x, access: %x, sharing: %x\n", res, access[k], sharing[j]); + ok(info.NamedPipeConfiguration == pipe_config[j], "wrong duplex status for pipe: %d, expected %d\n", + info.NamedPipeConfiguration, pipe_config[j]); CloseHandle(hclient); } diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 9db7f78f00c..e0b0ac89e67 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -3063,11 +3063,11 @@ struct get_named_pipe_info_reply { struct reply_header __header; unsigned int flags; + unsigned int sharing; unsigned int maxinstances; unsigned int instances; unsigned int outsize; unsigned int insize; - char __pad_28[4]; }; @@ -5637,6 +5637,6 @@ union generic_reply struct set_suspend_context_reply set_suspend_context_reply; }; -#define SERVER_PROTOCOL_VERSION 426 +#define SERVER_PROTOCOL_VERSION 427 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/named_pipe.c b/server/named_pipe.c index d6c13834146..d720b1727d4 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -1026,6 +1026,7 @@ DECL_HANDLER(get_named_pipe_info) } reply->flags = server->pipe->flags; + reply->sharing = server->pipe->sharing; reply->maxinstances = server->pipe->maxinstances; reply->instances = server->pipe->instances; reply->insize = server->pipe->insize; diff --git a/server/protocol.def b/server/protocol.def index 71524a45fa0..bec2e3c6ae0 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2208,6 +2208,7 @@ enum message_type obj_handle_t handle; @REPLY unsigned int flags; + unsigned int sharing; unsigned int maxinstances; unsigned int instances; unsigned int outsize; diff --git a/server/request.h b/server/request.h index 2d4528a7d32..b875e3038bb 100644 --- a/server/request.h +++ b/server/request.h @@ -1489,10 +1489,11 @@ C_ASSERT( sizeof(struct create_named_pipe_reply) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_request, handle) == 12 ); C_ASSERT( sizeof(struct get_named_pipe_info_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, flags) == 8 ); -C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, maxinstances) == 12 ); -C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, instances) == 16 ); -C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, outsize) == 20 ); -C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, insize) == 24 ); +C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, sharing) == 12 ); +C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, maxinstances) == 16 ); +C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, instances) == 20 ); +C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, outsize) == 24 ); +C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, insize) == 28 ); C_ASSERT( sizeof(struct get_named_pipe_info_reply) == 32 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, parent) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, owner) == 16 ); diff --git a/server/trace.c b/server/trace.c index 670958a7c4b..188eee4b01e 100644 --- a/server/trace.c +++ b/server/trace.c @@ -2629,6 +2629,7 @@ static void dump_get_named_pipe_info_request( const struct get_named_pipe_info_r static void dump_get_named_pipe_info_reply( const struct get_named_pipe_info_reply *req ) { fprintf( stderr, " flags=%08x", req->flags ); + fprintf( stderr, ", sharing=%08x", req->sharing ); fprintf( stderr, ", maxinstances=%08x", req->maxinstances ); fprintf( stderr, ", instances=%08x", req->instances ); fprintf( stderr, ", outsize=%08x", req->outsize );