ntdll: Implement the NamedPipeConfiguration value for the FilePipeLocalInformation class of NtQueryInformationFile.

This commit is contained in:
Bernhard Loos 2011-09-29 11:21:14 +02:00 committed by Alexandre Julliard
parent 9034e694a3
commit 07b681e04a
7 changed files with 28 additions and 8 deletions

View File

@ -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;

View File

@ -182,6 +182,7 @@ static void test_create(void)
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 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);
}

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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 );

View File

@ -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 );