Added server protocol version check.

oldstable
Alexandre Julliard 2000-03-08 22:01:02 +00:00
parent c3bcd6cec5
commit 5fb54566d2
5 changed files with 15 additions and 1 deletions

View File

@ -188,6 +188,7 @@ struct get_thread_buffer_request
OUT void* pid; /* process id of the new thread's process */
OUT void* tid; /* thread id of the new thread */
OUT int boot; /* is this the boot thread? */
OUT int version; /* protocol version */
};
@ -1185,6 +1186,8 @@ enum request
REQ_NB_REQUESTS
};
#define SERVER_PROTOCOL_VERSION 1
/* ### make_requests end ### */
/* Everything above this line is generated automatically by tools/make_requests */

View File

@ -467,6 +467,12 @@ int CLIENT_InitThread(void)
first_req = teb->buffer;
teb->process->server_pid = first_req->pid;
teb->tid = first_req->tid;
if (first_req->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",
first_req->version, SERVER_PROTOCOL_VERSION,
(first_req->version > SERVER_PROTOCOL_VERSION) ? "wine" : "wineserver" );
if (first_req->boot) boot_thread_id = teb->tid;
else if (boot_thread_id == teb->tid) boot_thread_id = 0;

View File

@ -104,6 +104,7 @@ static int alloc_client_buffer( struct thread *thread )
req->pid = get_process_id( thread->process );
req->tid = get_thread_id( thread );
req->boot = (thread == booting_thread);
req->version = SERVER_PROTOCOL_VERSION;
set_reply_fd( thread, fd );
send_reply( thread );
return 1;

View File

@ -282,7 +282,8 @@ static void dump_get_thread_buffer_reply( const struct get_thread_buffer_request
{
fprintf( stderr, " pid=%p,", req->pid );
fprintf( stderr, " tid=%p,", req->tid );
fprintf( stderr, " boot=%d", req->boot );
fprintf( stderr, " boot=%d,", req->boot );
fprintf( stderr, " version=%d", req->version );
}
static void dump_terminate_process_request( const struct terminate_process_request *req )

View File

@ -30,10 +30,12 @@ open(SERVER,"include/server.h") or die "Can't open include/server.h";
### Parse server.h to find request/reply structure definitions
my @trace_lines = ();
my $protocol = 0; # server protocol version
while (<SERVER>)
{
if (/^struct +(\w+)_request/) { &DO_REQUEST($1); }
if (/^\#define SERVER_PROTOCOL_VERSION (\d+)/) { $protocol = $1 + 1; }
}
### Output the dumping function tables
@ -68,6 +70,7 @@ my @server_lines = ();
push @server_lines, "enum request\n{\n";
foreach $req (@requests) { push @server_lines, " REQ_\U$req,\n"; }
push @server_lines, " REQ_NB_REQUESTS\n};\n";
push @server_lines, "\n#define SERVER_PROTOCOL_VERSION $protocol\n";
REPLACE_IN_FILE( "include/server.h", @server_lines );