mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 19:49:50 +00:00
server: Store sharing state for named pipes.
This commit is contained in:
parent
557deb0a19
commit
039bacb0c9
7 changed files with 24 additions and 15 deletions
|
@ -1346,7 +1346,7 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
UNICODE_STRING nt_name;
|
UNICODE_STRING nt_name;
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
DWORD access, options;
|
DWORD access, options, sharing;
|
||||||
BOOLEAN pipe_type, read_mode, non_block;
|
BOOLEAN pipe_type, read_mode, non_block;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
IO_STATUS_BLOCK iosb;
|
IO_STATUS_BLOCK iosb;
|
||||||
|
@ -1379,15 +1379,15 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
|
||||||
switch(dwOpenMode & 3)
|
switch(dwOpenMode & 3)
|
||||||
{
|
{
|
||||||
case PIPE_ACCESS_INBOUND:
|
case PIPE_ACCESS_INBOUND:
|
||||||
options = FILE_PIPE_INBOUND;
|
sharing = FILE_SHARE_WRITE;
|
||||||
access = GENERIC_READ;
|
access = GENERIC_READ;
|
||||||
break;
|
break;
|
||||||
case PIPE_ACCESS_OUTBOUND:
|
case PIPE_ACCESS_OUTBOUND:
|
||||||
options = FILE_PIPE_OUTBOUND;
|
sharing = FILE_SHARE_READ;
|
||||||
access = GENERIC_WRITE;
|
access = GENERIC_WRITE;
|
||||||
break;
|
break;
|
||||||
case PIPE_ACCESS_DUPLEX:
|
case PIPE_ACCESS_DUPLEX:
|
||||||
options = FILE_PIPE_FULL_DUPLEX;
|
sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
access = GENERIC_READ | GENERIC_WRITE;
|
access = GENERIC_READ | GENERIC_WRITE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1395,6 +1395,7 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
access |= SYNCHRONIZE;
|
access |= SYNCHRONIZE;
|
||||||
|
options = 0;
|
||||||
if (dwOpenMode & FILE_FLAG_WRITE_THROUGH) options |= FILE_WRITE_THROUGH;
|
if (dwOpenMode & FILE_FLAG_WRITE_THROUGH) options |= FILE_WRITE_THROUGH;
|
||||||
if (!(dwOpenMode & FILE_FLAG_OVERLAPPED)) options |= FILE_SYNCHRONOUS_IO_NONALERT;
|
if (!(dwOpenMode & FILE_FLAG_OVERLAPPED)) options |= FILE_SYNCHRONOUS_IO_NONALERT;
|
||||||
pipe_type = (dwPipeMode & PIPE_TYPE_MESSAGE) ? TRUE : FALSE;
|
pipe_type = (dwPipeMode & PIPE_TYPE_MESSAGE) ? TRUE : FALSE;
|
||||||
|
@ -1406,7 +1407,7 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
|
||||||
|
|
||||||
SetLastError(0);
|
SetLastError(0);
|
||||||
|
|
||||||
status = NtCreateNamedPipeFile(&handle, access, &attr, &iosb, 0,
|
status = NtCreateNamedPipeFile(&handle, access, &attr, &iosb, sharing,
|
||||||
FILE_OVERWRITE_IF, options, pipe_type,
|
FILE_OVERWRITE_IF, options, pipe_type,
|
||||||
read_mode, non_block, nMaxInstances,
|
read_mode, non_block, nMaxInstances,
|
||||||
nInBufferSize, nOutBufferSize, &timeout);
|
nInBufferSize, nOutBufferSize, &timeout);
|
||||||
|
@ -1847,8 +1848,8 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
|
||||||
GetCurrentProcessId(), ++index);
|
GetCurrentProcessId(), ++index);
|
||||||
RtlInitUnicodeString(&nt_name, name);
|
RtlInitUnicodeString(&nt_name, name);
|
||||||
status = NtCreateNamedPipeFile(&hr, GENERIC_READ | SYNCHRONIZE, &attr, &iosb,
|
status = NtCreateNamedPipeFile(&hr, GENERIC_READ | SYNCHRONIZE, &attr, &iosb,
|
||||||
0, FILE_OVERWRITE_IF,
|
FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT | FILE_PIPE_INBOUND,
|
FILE_SYNCHRONOUS_IO_NONALERT,
|
||||||
FALSE, FALSE, FALSE,
|
FALSE, FALSE, FALSE,
|
||||||
1, size, size, &timeout);
|
1, size, size, &timeout);
|
||||||
if (status)
|
if (status)
|
||||||
|
|
|
@ -2781,6 +2781,7 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
|
||||||
req->attributes = attr->Attributes;
|
req->attributes = attr->Attributes;
|
||||||
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
|
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
|
||||||
req->options = options;
|
req->options = options;
|
||||||
|
req->sharing = sharing;
|
||||||
req->flags =
|
req->flags =
|
||||||
(pipe_type) ? NAMED_PIPE_MESSAGE_STREAM_WRITE : 0 |
|
(pipe_type) ? NAMED_PIPE_MESSAGE_STREAM_WRITE : 0 |
|
||||||
(read_mode) ? NAMED_PIPE_MESSAGE_STREAM_READ : 0 |
|
(read_mode) ? NAMED_PIPE_MESSAGE_STREAM_READ : 0 |
|
||||||
|
|
|
@ -3030,13 +3030,15 @@ struct create_named_pipe_request
|
||||||
unsigned int attributes;
|
unsigned int attributes;
|
||||||
obj_handle_t rootdir;
|
obj_handle_t rootdir;
|
||||||
unsigned int options;
|
unsigned int options;
|
||||||
|
unsigned int sharing;
|
||||||
unsigned int maxinstances;
|
unsigned int maxinstances;
|
||||||
unsigned int outsize;
|
unsigned int outsize;
|
||||||
unsigned int insize;
|
unsigned int insize;
|
||||||
|
char __pad_44[4];
|
||||||
timeout_t timeout;
|
timeout_t timeout;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
/* VARARG(name,unicode_str); */
|
/* VARARG(name,unicode_str); */
|
||||||
char __pad_52[4];
|
char __pad_60[4];
|
||||||
};
|
};
|
||||||
struct create_named_pipe_reply
|
struct create_named_pipe_reply
|
||||||
{
|
{
|
||||||
|
@ -5635,6 +5637,6 @@ union generic_reply
|
||||||
struct set_suspend_context_reply set_suspend_context_reply;
|
struct set_suspend_context_reply set_suspend_context_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 425
|
#define SERVER_PROTOCOL_VERSION 426
|
||||||
|
|
||||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||||
|
|
|
@ -91,6 +91,7 @@ struct named_pipe
|
||||||
{
|
{
|
||||||
struct object obj; /* object header */
|
struct object obj; /* object header */
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
unsigned int sharing;
|
||||||
unsigned int maxinstances;
|
unsigned int maxinstances;
|
||||||
unsigned int outsize;
|
unsigned int outsize;
|
||||||
unsigned int insize;
|
unsigned int insize;
|
||||||
|
@ -960,6 +961,7 @@ DECL_HANDLER(create_named_pipe)
|
||||||
pipe->maxinstances = req->maxinstances;
|
pipe->maxinstances = req->maxinstances;
|
||||||
pipe->timeout = req->timeout;
|
pipe->timeout = req->timeout;
|
||||||
pipe->flags = req->flags;
|
pipe->flags = req->flags;
|
||||||
|
pipe->sharing = req->sharing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -2186,6 +2186,7 @@ enum message_type
|
||||||
unsigned int attributes; /* object attributes */
|
unsigned int attributes; /* object attributes */
|
||||||
obj_handle_t rootdir; /* root directory */
|
obj_handle_t rootdir; /* root directory */
|
||||||
unsigned int options;
|
unsigned int options;
|
||||||
|
unsigned int sharing;
|
||||||
unsigned int maxinstances;
|
unsigned int maxinstances;
|
||||||
unsigned int outsize;
|
unsigned int outsize;
|
||||||
unsigned int insize;
|
unsigned int insize;
|
||||||
|
|
|
@ -1477,12 +1477,13 @@ C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, access) == 12 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, attributes) == 16 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, attributes) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, rootdir) == 20 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, rootdir) == 20 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, options) == 24 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, options) == 24 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, maxinstances) == 28 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, sharing) == 28 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, outsize) == 32 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, maxinstances) == 32 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, insize) == 36 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, outsize) == 36 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, timeout) == 40 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, insize) == 40 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, flags) == 48 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, timeout) == 48 );
|
||||||
C_ASSERT( sizeof(struct create_named_pipe_request) == 56 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_request, flags) == 56 );
|
||||||
|
C_ASSERT( sizeof(struct create_named_pipe_request) == 64 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_reply, handle) == 8 );
|
C_ASSERT( FIELD_OFFSET(struct create_named_pipe_reply, handle) == 8 );
|
||||||
C_ASSERT( sizeof(struct create_named_pipe_reply) == 16 );
|
C_ASSERT( sizeof(struct create_named_pipe_reply) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_request, handle) == 12 );
|
C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_request, handle) == 12 );
|
||||||
|
|
|
@ -2607,6 +2607,7 @@ static void dump_create_named_pipe_request( const struct create_named_pipe_reque
|
||||||
fprintf( stderr, ", attributes=%08x", req->attributes );
|
fprintf( stderr, ", attributes=%08x", req->attributes );
|
||||||
fprintf( stderr, ", rootdir=%04x", req->rootdir );
|
fprintf( stderr, ", rootdir=%04x", req->rootdir );
|
||||||
fprintf( stderr, ", options=%08x", req->options );
|
fprintf( stderr, ", options=%08x", req->options );
|
||||||
|
fprintf( stderr, ", sharing=%08x", req->sharing );
|
||||||
fprintf( stderr, ", maxinstances=%08x", req->maxinstances );
|
fprintf( stderr, ", maxinstances=%08x", req->maxinstances );
|
||||||
fprintf( stderr, ", outsize=%08x", req->outsize );
|
fprintf( stderr, ", outsize=%08x", req->outsize );
|
||||||
fprintf( stderr, ", insize=%08x", req->insize );
|
fprintf( stderr, ", insize=%08x", req->insize );
|
||||||
|
|
Loading…
Reference in a new issue