When the server creates or opens a semaphore, the key is passed to the client so that they may open the same semaphore locally. --- include/wine/server_protocol.h | 10 +++++++--- server/protocol.def | 5 +++++ server/request.h | 9 +++++++-- server/trace.c | 5 +++++ 4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 2ba71e8..81c99d2 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1308,7 +1308,8 @@ struct create_semaphore_reply { struct reply_header __header; obj_handle_t handle; - char __pad_12[4]; + unsigned int key; + client_ptr_t server_ptr; };
@@ -1352,7 +1353,10 @@ struct open_semaphore_reply { struct reply_header __header; obj_handle_t handle; - char __pad_12[4]; + unsigned int max; + unsigned int key; + char __pad_20[4]; + client_ptr_t server_ptr; };
@@ -6149,6 +6153,6 @@ union generic_reply struct terminate_job_reply terminate_job_reply; };
-#define SERVER_PROTOCOL_VERSION 487 +#define SERVER_PROTOCOL_VERSION 488
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index c313006..38bcca6 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1103,6 +1103,8 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT }; VARARG(objattr,object_attributes); /* object attributes */ @REPLY obj_handle_t handle; /* handle to the semaphore */ + unsigned int key; /* key to the native semaphore */ + client_ptr_t server_ptr; /* for debugging only */ @END
@@ -1129,6 +1131,9 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT }; VARARG(name,unicode_str); /* object name */ @REPLY obj_handle_t handle; /* handle to the semaphore */ + unsigned int max; /* maximum count */ + unsigned int key; /* key to the native semaphore */ + client_ptr_t server_ptr; /* for debugging only */ @END
diff --git a/server/request.h b/server/request.h index 9405179..bfa4ef9 100644 --- a/server/request.h +++ b/server/request.h @@ -918,7 +918,9 @@ C_ASSERT( FIELD_OFFSET(struct create_semaphore_request, initial) == 20 ); C_ASSERT( FIELD_OFFSET(struct create_semaphore_request, max) == 24 ); C_ASSERT( sizeof(struct create_semaphore_request) == 32 ); C_ASSERT( FIELD_OFFSET(struct create_semaphore_reply, handle) == 8 ); -C_ASSERT( sizeof(struct create_semaphore_reply) == 16 ); +C_ASSERT( FIELD_OFFSET(struct create_semaphore_reply, key) == 12 ); +C_ASSERT( FIELD_OFFSET(struct create_semaphore_reply, server_ptr) == 16 ); +C_ASSERT( sizeof(struct create_semaphore_reply) == 24 ); C_ASSERT( FIELD_OFFSET(struct release_semaphore_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct release_semaphore_request, count) == 16 ); C_ASSERT( sizeof(struct release_semaphore_request) == 24 ); @@ -934,7 +936,10 @@ C_ASSERT( FIELD_OFFSET(struct open_semaphore_request, attributes) == 16 ); C_ASSERT( FIELD_OFFSET(struct open_semaphore_request, rootdir) == 20 ); C_ASSERT( sizeof(struct open_semaphore_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct open_semaphore_reply, handle) == 8 ); -C_ASSERT( sizeof(struct open_semaphore_reply) == 16 ); +C_ASSERT( FIELD_OFFSET(struct open_semaphore_reply, max) == 12 ); +C_ASSERT( FIELD_OFFSET(struct open_semaphore_reply, key) == 16 ); +C_ASSERT( FIELD_OFFSET(struct open_semaphore_reply, server_ptr) == 24 ); +C_ASSERT( sizeof(struct open_semaphore_reply) == 32 ); C_ASSERT( FIELD_OFFSET(struct create_file_request, access) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_file_request, attributes) == 16 ); C_ASSERT( FIELD_OFFSET(struct create_file_request, sharing) == 20 ); diff --git a/server/trace.c b/server/trace.c index 07aee80..fbaa426 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1592,6 +1592,8 @@ static void dump_create_semaphore_request( const struct create_semaphore_request static void dump_create_semaphore_reply( const struct create_semaphore_reply *req ) { fprintf( stderr, " handle=%04x", req->handle ); + fprintf( stderr, ", key=%08x", req->key ); + dump_uint64( ", server_ptr=", &req->server_ptr ); }
static void dump_release_semaphore_request( const struct release_semaphore_request *req ) @@ -1627,6 +1629,9 @@ static void dump_open_semaphore_request( const struct open_semaphore_request *re static void dump_open_semaphore_reply( const struct open_semaphore_reply *req ) { fprintf( stderr, " handle=%04x", req->handle ); + fprintf( stderr, ", max=%08x", req->max ); + fprintf( stderr, ", key=%08x", req->key ); + dump_uint64( ", server_ptr=", &req->server_ptr ); }
static void dump_create_file_request( const struct create_file_request *req )