Commit 07b681e0 authored by Bernhard Loos's avatar Bernhard Loos Committed by Alexandre Julliard

ntdll: Implement the NamedPipeConfiguration value for the…

ntdll: Implement the NamedPipeConfiguration value for the FilePipeLocalInformation class of NtQueryInformationFile.
parent 9034e694
......@@ -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;
......
......@@ -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);
}
......
......@@ -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 */
......@@ -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;
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment