Added server protocol version check.
diff --git a/include/server.h b/include/server.h index 28c5199..5f47c18 100644 --- a/include/server.h +++ b/include/server.h
@@ -188,6 +188,7 @@ 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 @@ REQ_NB_REQUESTS }; +#define SERVER_PROTOCOL_VERSION 1 + /* ### make_requests end ### */ /* Everything above this line is generated automatically by tools/make_requests */
diff --git a/scheduler/client.c b/scheduler/client.c index 27d4d1b..e78c92d 100644 --- a/scheduler/client.c +++ b/scheduler/client.c
@@ -467,6 +467,12 @@ 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;
diff --git a/server/thread.c b/server/thread.c index 14d7ea6..8f30280 100644 --- a/server/thread.c +++ b/server/thread.c
@@ -104,6 +104,7 @@ 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;
diff --git a/server/trace.c b/server/trace.c index 2bdecde..eaf4793 100644 --- a/server/trace.c +++ b/server/trace.c
@@ -282,7 +282,8 @@ { 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 )
diff --git a/tools/make_requests b/tools/make_requests index 8e608cc..9e84e79 100755 --- a/tools/make_requests +++ b/tools/make_requests
@@ -30,10 +30,12 @@ ### 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 @@ 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 );