1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-05 17:28:47 +00:00

server: Send the version with the initial fd so that it can be checked before sending the first request.

This commit is contained in:
Alexandre Julliard 2008-12-30 22:37:25 +01:00
parent eb4eda2757
commit 1d2d0d5622
2 changed files with 11 additions and 12 deletions

View File

@ -934,7 +934,7 @@ static void send_server_task_port(void)
*/
void server_init_process(void)
{
obj_handle_t dummy_handle;
obj_handle_t version;
const char *env_socket = getenv( "WINESERVERSOCKET" );
if (env_socket)
@ -958,8 +958,15 @@ void server_init_process(void)
pthread_functions.sigprocmask( SIG_BLOCK, &server_block_set, NULL );
/* receive the first thread request fd on the main socket */
ntdll_get_thread_data()->request_fd = receive_fd( &dummy_handle );
ntdll_get_thread_data()->request_fd = receive_fd( &version );
if (version != SERVER_PROTOCOL_VERSION)
server_protocol_error( "version mismatch %d/%d.\n"
"Your %s binary was not upgraded correctly,\n"
"or you have an older one somewhere in your PATH.\n"
"Or maybe the wrong wineserver is still running?\n",
version, SERVER_PROTOCOL_VERSION,
(version > SERVER_PROTOCOL_VERSION) ? "wine" : "wineserver" );
#ifdef __APPLE__
send_server_task_port();
#endif
@ -1004,7 +1011,7 @@ NTSTATUS server_init_process_done(void)
*/
size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point )
{
int version, ret;
int ret;
int reply_pipe[2];
struct sigaction sig_act;
size_t info_size;
@ -1049,18 +1056,10 @@ size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point )
NtCurrentTeb()->ClientId.UniqueProcess = ULongToHandle(reply->pid);
NtCurrentTeb()->ClientId.UniqueThread = ULongToHandle(reply->tid);
info_size = reply->info_size;
version = reply->version;
server_start_time = reply->server_start;
}
SERVER_END_REQ;
if (ret) server_protocol_error( "init_thread failed with status %x\n", ret );
if (version != SERVER_PROTOCOL_VERSION)
server_protocol_error( "version mismatch %d/%d.\n"
"Your %s binary was not upgraded correctly,\n"
"or you have an older one somewhere in your PATH.\n"
"Or maybe the wrong wineserver is still running?\n",
version, SERVER_PROTOCOL_VERSION,
(version > SERVER_PROTOCOL_VERSION) ? "wine" : "wineserver" );
return info_size;
}

View File

@ -377,7 +377,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
file_set_error();
goto error;
}
if (send_client_fd( process, request_pipe[1], 0 ) == -1)
if (send_client_fd( process, request_pipe[1], SERVER_PROTOCOL_VERSION ) == -1)
{
close( request_pipe[0] );
close( request_pipe[1] );