mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-21 17:09:06 -07:00
server: Return the desktop object locator in (get|set)_thread_desktop.
This commit is contained in:
parent
1e10e3a1c0
commit
20f4c9af0f
Notes:
Alexandre Julliard
2024-06-20 23:34:05 +02:00
Approved-by: Huw Davies (@huw) Approved-by: Jinoh Kang (@iamahuman) Approved-by: Jacek Caban (@jacek) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/-/merge_requests/3103
8 changed files with 62 additions and 8 deletions
|
@ -900,6 +900,12 @@ typedef volatile struct
|
|||
object_shm_t shm;
|
||||
} shared_object_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
object_id_t id;
|
||||
mem_size_t offset;
|
||||
} obj_locator_t;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -3895,8 +3901,9 @@ struct get_thread_desktop_request
|
|||
struct get_thread_desktop_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
obj_handle_t handle;
|
||||
char __pad_12[4];
|
||||
obj_locator_t locator;
|
||||
obj_handle_t handle;
|
||||
char __pad_28[4];
|
||||
};
|
||||
|
||||
|
||||
|
@ -3909,6 +3916,7 @@ struct set_thread_desktop_request
|
|||
struct set_thread_desktop_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
obj_locator_t locator;
|
||||
};
|
||||
|
||||
|
||||
|
@ -6552,7 +6560,7 @@ union generic_reply
|
|||
|
||||
/* ### protocol_version begin ### */
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 810
|
||||
#define SERVER_PROTOCOL_VERSION 811
|
||||
|
||||
/* ### protocol_version end ### */
|
||||
|
||||
|
|
|
@ -194,6 +194,7 @@ extern void set_session_mapping( struct mapping *mapping );
|
|||
|
||||
extern const volatile void *alloc_shared_object(void);
|
||||
extern void free_shared_object( const volatile void *object_shm );
|
||||
extern obj_locator_t get_shared_object_locator( const volatile void *object_shm );
|
||||
|
||||
#define SHARED_WRITE_BEGIN( object_shm, type ) \
|
||||
do { \
|
||||
|
|
|
@ -1407,6 +1407,13 @@ void free_shared_object( const volatile void *object_shm )
|
|||
list_add_tail( &session.free_objects, &object->entry );
|
||||
}
|
||||
|
||||
obj_locator_t get_shared_object_locator( const volatile void *object_shm )
|
||||
{
|
||||
struct session_object *object = CONTAINING_RECORD( object_shm, struct session_object, obj.shm );
|
||||
obj_locator_t locator = {.offset = object->offset, .id = object->obj.id};
|
||||
return locator;
|
||||
}
|
||||
|
||||
struct object *create_user_data_mapping( struct object *root, const struct unicode_str *name,
|
||||
unsigned int attr, const struct security_descriptor *sd )
|
||||
{
|
||||
|
|
|
@ -916,6 +916,12 @@ typedef volatile struct
|
|||
object_shm_t shm; /* object shared data */
|
||||
} shared_object_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
object_id_t id; /* object unique id, object data is valid if != 0 */
|
||||
mem_size_t offset; /* offset of the object in session shared memory */
|
||||
} obj_locator_t;
|
||||
|
||||
/****************************************************************/
|
||||
/* Request declarations */
|
||||
|
||||
|
@ -2813,13 +2819,16 @@ enum coords_relative
|
|||
@REQ(get_thread_desktop)
|
||||
thread_id_t tid; /* thread id */
|
||||
@REPLY
|
||||
obj_handle_t handle; /* handle to the desktop */
|
||||
obj_locator_t locator; /* locator for the shared session object */
|
||||
obj_handle_t handle; /* handle to the desktop */
|
||||
@END
|
||||
|
||||
|
||||
/* Set the thread current desktop */
|
||||
@REQ(set_thread_desktop)
|
||||
obj_handle_t handle; /* handle to the desktop */
|
||||
@REPLY
|
||||
obj_locator_t locator; /* locator for the shared session object */
|
||||
@END
|
||||
|
||||
|
||||
|
|
|
@ -721,6 +721,7 @@ C_ASSERT( sizeof(mem_size_t) == 8 );
|
|||
C_ASSERT( sizeof(message_data_t) == 48 );
|
||||
C_ASSERT( sizeof(mod_handle_t) == 8 );
|
||||
C_ASSERT( sizeof(obj_handle_t) == 4 );
|
||||
C_ASSERT( sizeof(obj_locator_t) == 16 );
|
||||
C_ASSERT( sizeof(object_id_t) == 8 );
|
||||
C_ASSERT( sizeof(pe_image_info_t) == 88 );
|
||||
C_ASSERT( sizeof(process_id_t) == 4 );
|
||||
|
@ -1745,10 +1746,13 @@ C_ASSERT( FIELD_OFFSET(struct close_desktop_request, handle) == 12 );
|
|||
C_ASSERT( sizeof(struct close_desktop_request) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_thread_desktop_request, tid) == 12 );
|
||||
C_ASSERT( sizeof(struct get_thread_desktop_request) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_thread_desktop_reply, handle) == 8 );
|
||||
C_ASSERT( sizeof(struct get_thread_desktop_reply) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_thread_desktop_reply, locator) == 8 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_thread_desktop_reply, handle) == 24 );
|
||||
C_ASSERT( sizeof(struct get_thread_desktop_reply) == 32 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_thread_desktop_request, handle) == 12 );
|
||||
C_ASSERT( sizeof(struct set_thread_desktop_request) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_thread_desktop_reply, locator) == 8 );
|
||||
C_ASSERT( sizeof(struct set_thread_desktop_reply) == 24 );
|
||||
C_ASSERT( FIELD_OFFSET(struct enum_desktop_request, winstation) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct enum_desktop_request, index) == 16 );
|
||||
C_ASSERT( sizeof(struct enum_desktop_request) == 24 );
|
||||
|
|
|
@ -467,6 +467,14 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
|
|||
}
|
||||
}
|
||||
|
||||
static void dump_obj_locator( const char *prefix, const obj_locator_t *locator )
|
||||
{
|
||||
fprintf( stderr, "%s{", prefix );
|
||||
dump_uint64( "id=", &locator->id );
|
||||
dump_uint64( ",offset=", &locator->offset );
|
||||
fprintf( stderr, "}" );
|
||||
}
|
||||
|
||||
static void dump_luid( const char *prefix, const struct luid *luid )
|
||||
{
|
||||
fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part );
|
||||
|
@ -3426,7 +3434,8 @@ static void dump_get_thread_desktop_request( const struct get_thread_desktop_req
|
|||
|
||||
static void dump_get_thread_desktop_reply( const struct get_thread_desktop_reply *req )
|
||||
{
|
||||
fprintf( stderr, " handle=%04x", req->handle );
|
||||
dump_obj_locator( " locator=", &req->locator );
|
||||
fprintf( stderr, ", handle=%04x", req->handle );
|
||||
}
|
||||
|
||||
static void dump_set_thread_desktop_request( const struct set_thread_desktop_request *req )
|
||||
|
@ -3434,6 +3443,11 @@ static void dump_set_thread_desktop_request( const struct set_thread_desktop_req
|
|||
fprintf( stderr, " handle=%04x", req->handle );
|
||||
}
|
||||
|
||||
static void dump_set_thread_desktop_reply( const struct set_thread_desktop_reply *req )
|
||||
{
|
||||
dump_obj_locator( " locator=", &req->locator );
|
||||
}
|
||||
|
||||
static void dump_enum_desktop_request( const struct enum_desktop_request *req )
|
||||
{
|
||||
fprintf( stderr, " winstation=%04x", req->winstation );
|
||||
|
@ -5101,7 +5115,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
|||
NULL,
|
||||
NULL,
|
||||
(dump_func)dump_get_thread_desktop_reply,
|
||||
NULL,
|
||||
(dump_func)dump_set_thread_desktop_reply,
|
||||
(dump_func)dump_enum_desktop_reply,
|
||||
(dump_func)dump_set_user_object_info_reply,
|
||||
(dump_func)dump_register_hotkey_reply,
|
||||
|
|
|
@ -742,10 +742,19 @@ DECL_HANDLER(close_desktop)
|
|||
/* get the thread current desktop */
|
||||
DECL_HANDLER(get_thread_desktop)
|
||||
{
|
||||
struct desktop *desktop;
|
||||
struct thread *thread;
|
||||
|
||||
if (!(thread = get_thread_from_id( req->tid ))) return;
|
||||
reply->handle = thread->desktop;
|
||||
|
||||
if (!(desktop = get_thread_desktop( thread, 0 ))) clear_error();
|
||||
else
|
||||
{
|
||||
if (desktop->shared) reply->locator = get_shared_object_locator( desktop->shared );
|
||||
release_object( desktop );
|
||||
}
|
||||
|
||||
release_object( thread );
|
||||
}
|
||||
|
||||
|
@ -788,6 +797,7 @@ DECL_HANDLER(set_thread_desktop)
|
|||
if (old_desktop) remove_desktop_thread( old_desktop, current );
|
||||
add_desktop_thread( new_desktop, current );
|
||||
}
|
||||
reply->locator = get_shared_object_locator( new_desktop->shared );
|
||||
}
|
||||
|
||||
if (!current->process->desktop)
|
||||
|
|
|
@ -53,6 +53,7 @@ my %formats =
|
|||
"generic_map_t" => [ 16, 4, "&dump_generic_map" ],
|
||||
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
|
||||
"hw_input_t" => [ 40, 8, "&dump_hw_input" ],
|
||||
"obj_locator_t" => [ 16, 8, "&dump_obj_locator" ],
|
||||
# varargs-only structures
|
||||
"apc_call_t" => [ 64, 8 ],
|
||||
"context_t" => [ 1728, 8 ],
|
||||
|
|
Loading…
Reference in a new issue