Make it possible to retrieve an inheritable handle in open_named_pipe

(spotted by Uwe Bonnes).
This commit is contained in:
Alexandre Julliard 2003-06-14 01:31:56 +00:00
parent 15566391e2
commit 693bbd79b6
5 changed files with 8 additions and 4 deletions

View File

@ -497,7 +497,7 @@ HANDLE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa
return ret; return ret;
} }
static HANDLE FILE_OpenPipe(LPCWSTR name, DWORD access) static HANDLE FILE_OpenPipe(LPCWSTR name, DWORD access, LPSECURITY_ATTRIBUTES sa )
{ {
HANDLE ret; HANDLE ret;
DWORD len = 0; DWORD len = 0;
@ -510,6 +510,7 @@ static HANDLE FILE_OpenPipe(LPCWSTR name, DWORD access)
SERVER_START_REQ( open_named_pipe ) SERVER_START_REQ( open_named_pipe )
{ {
req->access = access; req->access = access;
req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
SetLastError(0); SetLastError(0);
wine_server_add_data( req, name, len * sizeof(WCHAR) ); wine_server_add_data( req, name, len * sizeof(WCHAR) );
wine_server_call_err( req ); wine_server_call_err( req );
@ -597,7 +598,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
if(!strncmpiW(filename + 4, pipeW, 5)) if(!strncmpiW(filename + 4, pipeW, 5))
{ {
TRACE("Opening a pipe: %s\n", debugstr_w(filename)); TRACE("Opening a pipe: %s\n", debugstr_w(filename));
ret = FILE_OpenPipe(filename,access); ret = FILE_OpenPipe( filename, access, sa );
goto done; goto done;
} }
else if (isalphaW(filename[4]) && filename[5] == ':' && filename[6] == '\0') else if (isalphaW(filename[4]) && filename[5] == ':' && filename[6] == '\0')

View File

@ -2406,6 +2406,7 @@ struct open_named_pipe_request
{ {
struct request_header __header; struct request_header __header;
unsigned int access; unsigned int access;
int inherit;
/* VARARG(name,unicode_str); */ /* VARARG(name,unicode_str); */
}; };
struct open_named_pipe_reply struct open_named_pipe_reply
@ -3568,6 +3569,6 @@ union generic_reply
struct get_next_hook_reply get_next_hook_reply; struct get_next_hook_reply get_next_hook_reply;
}; };
#define SERVER_PROTOCOL_VERSION 108 #define SERVER_PROTOCOL_VERSION 109
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -683,7 +683,7 @@ DECL_HANDLER(open_named_pipe)
server->client = client; server->client = client;
client->server = server; client->server = server;
reply->handle = alloc_handle( current->process, client, reply->handle = alloc_handle( current->process, client,
req->access, 0 ); req->access, req->inherit );
} }
} }
else else

View File

@ -1710,6 +1710,7 @@ enum message_type
/* Open an existing named pipe */ /* Open an existing named pipe */
@REQ(open_named_pipe) @REQ(open_named_pipe)
unsigned int access; unsigned int access;
int inherit; /* inherit flag */
VARARG(name,unicode_str); /* pipe name */ VARARG(name,unicode_str); /* pipe name */
@REPLY @REPLY
obj_handle_t handle; /* handle to the pipe */ obj_handle_t handle; /* handle to the pipe */

View File

@ -1967,6 +1967,7 @@ static void dump_create_named_pipe_reply( const struct create_named_pipe_reply *
static void dump_open_named_pipe_request( const struct open_named_pipe_request *req ) static void dump_open_named_pipe_request( const struct open_named_pipe_request *req )
{ {
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " name=" ); fprintf( stderr, " name=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }