mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-21 17:09:06 -07:00
server: Add support for allocating purely client-side user handles.
This commit is contained in:
parent
a1126242a7
commit
9018e13c5e
6 changed files with 95 additions and 3 deletions
|
@ -115,8 +115,8 @@ typedef union
|
|||
struct
|
||||
{
|
||||
int code;
|
||||
client_ptr_t string;
|
||||
data_size_t length;
|
||||
client_ptr_t string;
|
||||
} output_string;
|
||||
struct
|
||||
{
|
||||
|
@ -4614,6 +4614,31 @@ struct set_window_layered_info_reply
|
|||
};
|
||||
|
||||
|
||||
|
||||
struct alloc_user_handle_request
|
||||
{
|
||||
struct request_header __header;
|
||||
};
|
||||
struct alloc_user_handle_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
user_handle_t handle;
|
||||
char __pad_12[4];
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct free_user_handle_request
|
||||
{
|
||||
struct request_header __header;
|
||||
user_handle_t handle;
|
||||
};
|
||||
struct free_user_handle_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
};
|
||||
|
||||
|
||||
enum request
|
||||
{
|
||||
REQ_new_process,
|
||||
|
@ -4854,6 +4879,8 @@ enum request
|
|||
REQ_add_fd_completion,
|
||||
REQ_get_window_layered_info,
|
||||
REQ_set_window_layered_info,
|
||||
REQ_alloc_user_handle,
|
||||
REQ_free_user_handle,
|
||||
REQ_NB_REQUESTS
|
||||
};
|
||||
|
||||
|
@ -5099,6 +5126,8 @@ union generic_request
|
|||
struct add_fd_completion_request add_fd_completion_request;
|
||||
struct get_window_layered_info_request get_window_layered_info_request;
|
||||
struct set_window_layered_info_request set_window_layered_info_request;
|
||||
struct alloc_user_handle_request alloc_user_handle_request;
|
||||
struct free_user_handle_request free_user_handle_request;
|
||||
};
|
||||
union generic_reply
|
||||
{
|
||||
|
@ -5342,8 +5371,10 @@ union generic_reply
|
|||
struct add_fd_completion_reply add_fd_completion_reply;
|
||||
struct get_window_layered_info_reply get_window_layered_info_reply;
|
||||
struct set_window_layered_info_reply set_window_layered_info_reply;
|
||||
struct alloc_user_handle_reply alloc_user_handle_reply;
|
||||
struct free_user_handle_reply free_user_handle_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 391
|
||||
#define SERVER_PROTOCOL_VERSION 392
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -3224,3 +3224,16 @@ enum message_type
|
|||
unsigned int alpha; /* alpha (0..255) */
|
||||
unsigned int flags; /* LWA_* flags */
|
||||
@END
|
||||
|
||||
|
||||
/* Allocate an arbitrary user handle */
|
||||
@REQ(alloc_user_handle)
|
||||
@REPLY
|
||||
user_handle_t handle; /* allocated handle */
|
||||
@END
|
||||
|
||||
|
||||
/* Free an arbitrary user handle */
|
||||
@REQ(free_user_handle)
|
||||
user_handle_t handle; /* handle to free*/
|
||||
@END
|
||||
|
|
|
@ -349,6 +349,8 @@ DECL_HANDLER(set_completion_info);
|
|||
DECL_HANDLER(add_fd_completion);
|
||||
DECL_HANDLER(get_window_layered_info);
|
||||
DECL_HANDLER(set_window_layered_info);
|
||||
DECL_HANDLER(alloc_user_handle);
|
||||
DECL_HANDLER(free_user_handle);
|
||||
|
||||
#ifdef WANT_REQUEST_HANDLERS
|
||||
|
||||
|
@ -593,6 +595,8 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
|
|||
(req_handler)req_add_fd_completion,
|
||||
(req_handler)req_get_window_layered_info,
|
||||
(req_handler)req_set_window_layered_info,
|
||||
(req_handler)req_alloc_user_handle,
|
||||
(req_handler)req_free_user_handle,
|
||||
};
|
||||
|
||||
C_ASSERT( sizeof(affinity_t) == 8 );
|
||||
|
@ -1892,6 +1896,10 @@ C_ASSERT( FIELD_OFFSET(struct set_window_layered_info_request, color_key) == 16
|
|||
C_ASSERT( FIELD_OFFSET(struct set_window_layered_info_request, alpha) == 20 );
|
||||
C_ASSERT( FIELD_OFFSET(struct set_window_layered_info_request, flags) == 24 );
|
||||
C_ASSERT( sizeof(struct set_window_layered_info_request) == 32 );
|
||||
C_ASSERT( FIELD_OFFSET(struct alloc_user_handle_reply, handle) == 8 );
|
||||
C_ASSERT( sizeof(struct alloc_user_handle_reply) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct free_user_handle_request, handle) == 12 );
|
||||
C_ASSERT( sizeof(struct free_user_handle_request) == 16 );
|
||||
|
||||
#endif /* WANT_REQUEST_HANDLERS */
|
||||
|
||||
|
|
|
@ -3780,6 +3780,20 @@ static void dump_set_window_layered_info_request( const struct set_window_layere
|
|||
fprintf( stderr, ", flags=%08x", req->flags );
|
||||
}
|
||||
|
||||
static void dump_alloc_user_handle_request( const struct alloc_user_handle_request *req )
|
||||
{
|
||||
}
|
||||
|
||||
static void dump_alloc_user_handle_reply( const struct alloc_user_handle_reply *req )
|
||||
{
|
||||
fprintf( stderr, " handle=%08x", req->handle );
|
||||
}
|
||||
|
||||
static void dump_free_user_handle_request( const struct free_user_handle_request *req )
|
||||
{
|
||||
fprintf( stderr, " handle=%08x", req->handle );
|
||||
}
|
||||
|
||||
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
||||
(dump_func)dump_new_process_request,
|
||||
(dump_func)dump_get_new_process_info_request,
|
||||
|
@ -4019,6 +4033,8 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
|||
(dump_func)dump_add_fd_completion_request,
|
||||
(dump_func)dump_get_window_layered_info_request,
|
||||
(dump_func)dump_set_window_layered_info_request,
|
||||
(dump_func)dump_alloc_user_handle_request,
|
||||
(dump_func)dump_free_user_handle_request,
|
||||
};
|
||||
|
||||
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
||||
|
@ -4260,6 +4276,8 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
|||
NULL,
|
||||
(dump_func)dump_get_window_layered_info_reply,
|
||||
NULL,
|
||||
(dump_func)dump_alloc_user_handle_reply,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||
|
@ -4501,6 +4519,8 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
|||
"add_fd_completion",
|
||||
"get_window_layered_info",
|
||||
"set_window_layered_info",
|
||||
"alloc_user_handle",
|
||||
"free_user_handle",
|
||||
};
|
||||
|
||||
static const struct
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "thread.h"
|
||||
#include "user.h"
|
||||
#include "request.h"
|
||||
|
||||
struct user_handle
|
||||
{
|
||||
|
@ -164,3 +165,21 @@ void *next_user_handle( user_handle_t *handle, enum user_object type )
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* allocate an arbitrary user handle */
|
||||
DECL_HANDLER(alloc_user_handle)
|
||||
{
|
||||
reply->handle = alloc_user_handle( NULL, USER_CLIENT );
|
||||
}
|
||||
|
||||
|
||||
/* free an arbitrary user handle */
|
||||
DECL_HANDLER(free_user_handle)
|
||||
{
|
||||
struct user_handle *entry;
|
||||
|
||||
if ((entry = handle_to_entry( req->handle )) && entry->type == USER_CLIENT)
|
||||
free_user_entry( entry );
|
||||
else
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ struct clipboard;
|
|||
enum user_object
|
||||
{
|
||||
USER_WINDOW = 1,
|
||||
USER_HOOK
|
||||
USER_HOOK,
|
||||
USER_CLIENT /* arbitrary client handle */
|
||||
};
|
||||
|
||||
#define DESKTOP_ATOM ((atom_t)32769)
|
||||
|
|
Loading…
Reference in a new issue