Commit 97903d26 authored by Alexandre Julliard's avatar Alexandre Julliard

Added support for inter-process GetWindowLong on the window extra

bytes.
parent d78dfc8e
...@@ -2525,6 +2525,7 @@ struct create_window_request ...@@ -2525,6 +2525,7 @@ struct create_window_request
user_handle_t parent; user_handle_t parent;
user_handle_t owner; user_handle_t owner;
atom_t atom; atom_t atom;
int extra;
}; };
struct create_window_reply struct create_window_reply
{ {
...@@ -2603,6 +2604,8 @@ struct set_window_info_request ...@@ -2603,6 +2604,8 @@ struct set_window_info_request
unsigned int id; unsigned int id;
void* instance; void* instance;
void* user_data; void* user_data;
int extra_offset;
unsigned int extra_value;
}; };
struct set_window_info_reply struct set_window_info_reply
{ {
...@@ -2612,12 +2615,15 @@ struct set_window_info_reply ...@@ -2612,12 +2615,15 @@ struct set_window_info_reply
unsigned int old_id; unsigned int old_id;
void* old_instance; void* old_instance;
void* old_user_data; void* old_user_data;
unsigned int old_extra_value;
}; };
#define SET_WIN_STYLE 0x01 #define SET_WIN_STYLE 0x01
#define SET_WIN_EXSTYLE 0x02 #define SET_WIN_EXSTYLE 0x02
#define SET_WIN_ID 0x04 #define SET_WIN_ID 0x04
#define SET_WIN_INSTANCE 0x08 #define SET_WIN_INSTANCE 0x08
#define SET_WIN_USERDATA 0x10 #define SET_WIN_USERDATA 0x10
#define SET_WIN_EXTRAWORD 0x20
#define SET_WIN_EXTRALONG 0x40
...@@ -3667,6 +3673,6 @@ union generic_reply ...@@ -3667,6 +3673,6 @@ union generic_reply
struct set_global_windows_reply set_global_windows_reply; struct set_global_windows_reply set_global_windows_reply;
}; };
#define SERVER_PROTOCOL_VERSION 126 #define SERVER_PROTOCOL_VERSION 127
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -1780,6 +1780,7 @@ enum message_type ...@@ -1780,6 +1780,7 @@ enum message_type
user_handle_t parent; /* parent window */ user_handle_t parent; /* parent window */
user_handle_t owner; /* owner window */ user_handle_t owner; /* owner window */
atom_t atom; /* class atom */ atom_t atom; /* class atom */
int extra; /* number of extra bytes */
@REPLY @REPLY
user_handle_t handle; /* created window */ user_handle_t handle; /* created window */
@END @END
...@@ -1832,18 +1833,23 @@ enum message_type ...@@ -1832,18 +1833,23 @@ enum message_type
unsigned int id; /* window id */ unsigned int id; /* window id */
void* instance; /* creator instance */ void* instance; /* creator instance */
void* user_data; /* user-specific data */ void* user_data; /* user-specific data */
int extra_offset; /* offset to set in extra bytes */
unsigned int extra_value; /* value to set in extra bytes */
@REPLY @REPLY
unsigned int old_style; /* old window style */ unsigned int old_style; /* old window style */
unsigned int old_ex_style; /* old window extended style */ unsigned int old_ex_style; /* old window extended style */
unsigned int old_id; /* old window id */ unsigned int old_id; /* old window id */
void* old_instance; /* old creator instance */ void* old_instance; /* old creator instance */
void* old_user_data; /* old user-specific data */ void* old_user_data; /* old user-specific data */
unsigned int old_extra_value; /* old value in extra bytes */
@END @END
#define SET_WIN_STYLE 0x01 #define SET_WIN_STYLE 0x01
#define SET_WIN_EXSTYLE 0x02 #define SET_WIN_EXSTYLE 0x02
#define SET_WIN_ID 0x04 #define SET_WIN_ID 0x04
#define SET_WIN_INSTANCE 0x08 #define SET_WIN_INSTANCE 0x08
#define SET_WIN_USERDATA 0x10 #define SET_WIN_USERDATA 0x10
#define SET_WIN_EXTRAWORD 0x20
#define SET_WIN_EXTRALONG 0x40
/* Get a list of the window parents, up to the root of the tree */ /* Get a list of the window parents, up to the root of the tree */
......
...@@ -2095,7 +2095,8 @@ static void dump_create_window_request( const struct create_window_request *req ...@@ -2095,7 +2095,8 @@ static void dump_create_window_request( const struct create_window_request *req
{ {
fprintf( stderr, " parent=%p,", req->parent ); fprintf( stderr, " parent=%p,", req->parent );
fprintf( stderr, " owner=%p,", req->owner ); fprintf( stderr, " owner=%p,", req->owner );
fprintf( stderr, " atom=%04x", req->atom ); fprintf( stderr, " atom=%04x,", req->atom );
fprintf( stderr, " extra=%d", req->extra );
} }
static void dump_create_window_reply( const struct create_window_reply *req ) static void dump_create_window_reply( const struct create_window_reply *req )
...@@ -2154,7 +2155,9 @@ static void dump_set_window_info_request( const struct set_window_info_request * ...@@ -2154,7 +2155,9 @@ static void dump_set_window_info_request( const struct set_window_info_request *
fprintf( stderr, " ex_style=%08x,", req->ex_style ); fprintf( stderr, " ex_style=%08x,", req->ex_style );
fprintf( stderr, " id=%08x,", req->id ); fprintf( stderr, " id=%08x,", req->id );
fprintf( stderr, " instance=%p,", req->instance ); fprintf( stderr, " instance=%p,", req->instance );
fprintf( stderr, " user_data=%p", req->user_data ); fprintf( stderr, " user_data=%p,", req->user_data );
fprintf( stderr, " extra_offset=%d,", req->extra_offset );
fprintf( stderr, " extra_value=%08x", req->extra_value );
} }
static void dump_set_window_info_reply( const struct set_window_info_reply *req ) static void dump_set_window_info_reply( const struct set_window_info_reply *req )
...@@ -2163,7 +2166,8 @@ static void dump_set_window_info_reply( const struct set_window_info_reply *req ...@@ -2163,7 +2166,8 @@ static void dump_set_window_info_reply( const struct set_window_info_reply *req
fprintf( stderr, " old_ex_style=%08x,", req->old_ex_style ); fprintf( stderr, " old_ex_style=%08x,", req->old_ex_style );
fprintf( stderr, " old_id=%08x,", req->old_id ); fprintf( stderr, " old_id=%08x,", req->old_id );
fprintf( stderr, " old_instance=%p,", req->old_instance ); fprintf( stderr, " old_instance=%p,", req->old_instance );
fprintf( stderr, " old_user_data=%p", req->old_user_data ); fprintf( stderr, " old_user_data=%p,", req->old_user_data );
fprintf( stderr, " old_extra_value=%08x", req->old_extra_value );
} }
static void dump_get_window_parents_request( const struct get_window_parents_request *req ) static void dump_get_window_parents_request( const struct get_window_parents_request *req )
......
...@@ -77,6 +77,8 @@ struct window ...@@ -77,6 +77,8 @@ struct window
int prop_inuse; /* number of in-use window properties */ int prop_inuse; /* number of in-use window properties */
int prop_alloc; /* number of allocated window properties */ int prop_alloc; /* number of allocated window properties */
struct property *properties; /* window properties array */ struct property *properties; /* window properties array */
int nb_extra_bytes; /* number of extra bytes */
char extra_bytes[1]; /* extra bytes storage */
}; };
static struct window *top_window; /* top-level (desktop) window */ static struct window *top_window; /* top-level (desktop) window */
...@@ -264,9 +266,10 @@ static void destroy_window( struct window *win ) ...@@ -264,9 +266,10 @@ static void destroy_window( struct window *win )
} }
/* create a new window structure (note: the window is not linked in the window tree) */ /* create a new window structure (note: the window is not linked in the window tree) */
static struct window *create_window( struct window *parent, struct window *owner, atom_t atom ) static struct window *create_window( struct window *parent, struct window *owner, atom_t atom,
int extra_bytes )
{ {
struct window *win = mem_alloc( sizeof(*win) ); struct window *win = mem_alloc( sizeof(*win) + extra_bytes - 1 );
if (!win) return NULL; if (!win) return NULL;
if (!(win->handle = alloc_user_handle( win, USER_WINDOW ))) if (!(win->handle = alloc_user_handle( win, USER_WINDOW )))
...@@ -292,6 +295,8 @@ static struct window *create_window( struct window *parent, struct window *owner ...@@ -292,6 +295,8 @@ static struct window *create_window( struct window *parent, struct window *owner
win->prop_inuse = 0; win->prop_inuse = 0;
win->prop_alloc = 0; win->prop_alloc = 0;
win->properties = NULL; win->properties = NULL;
win->nb_extra_bytes = extra_bytes;
memset( win->extra_bytes, 0, extra_bytes );
if (parent) /* put it on parent unlinked list */ if (parent) /* put it on parent unlinked list */
{ {
...@@ -448,11 +453,16 @@ user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *threa ...@@ -448,11 +453,16 @@ user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *threa
DECL_HANDLER(create_window) DECL_HANDLER(create_window)
{ {
reply->handle = 0; reply->handle = 0;
if (req->extra < 0 || req->extra > 4096) /* don't allow stupid values here */
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
if (!req->parent) /* return desktop window */ if (!req->parent) /* return desktop window */
{ {
if (!top_window) if (!top_window)
{ {
if (!(top_window = create_window( NULL, NULL, req->atom ))) return; if (!(top_window = create_window( NULL, NULL, req->atom, req->extra ))) return;
top_window->thread = NULL; /* no thread owns the desktop */ top_window->thread = NULL; /* no thread owns the desktop */
top_window->style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; top_window->style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
} }
...@@ -471,7 +481,7 @@ DECL_HANDLER(create_window) ...@@ -471,7 +481,7 @@ DECL_HANDLER(create_window)
set_error( STATUS_ACCESS_DENIED ); set_error( STATUS_ACCESS_DENIED );
return; return;
} }
if (!(win = create_window( parent, owner, req->atom ))) return; if (!(win = create_window( parent, owner, req->atom, req->extra ))) return;
reply->handle = win->handle; reply->handle = win->handle;
} }
} }
...@@ -576,6 +586,22 @@ DECL_HANDLER(set_window_info) ...@@ -576,6 +586,22 @@ DECL_HANDLER(set_window_info)
set_error( STATUS_ACCESS_DENIED ); set_error( STATUS_ACCESS_DENIED );
return; return;
} }
if (req->extra_offset < -1 || req->extra_offset >= win->nb_extra_bytes)
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
if (req->extra_offset != -1)
{
memcpy( &reply->old_extra_value, win->extra_bytes + req->extra_offset,
min( sizeof(reply->old_extra_value),
(size_t)(win->nb_extra_bytes - req->extra_offset) ));
}
else if (req->flags & (SET_WIN_EXTRAWORD|SET_WIN_EXTRALONG))
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
reply->old_style = win->style; reply->old_style = win->style;
reply->old_ex_style = win->ex_style; reply->old_ex_style = win->ex_style;
reply->old_id = win->id; reply->old_id = win->id;
...@@ -586,6 +612,12 @@ DECL_HANDLER(set_window_info) ...@@ -586,6 +612,12 @@ DECL_HANDLER(set_window_info)
if (req->flags & SET_WIN_ID) win->id = req->id; if (req->flags & SET_WIN_ID) win->id = req->id;
if (req->flags & SET_WIN_INSTANCE) win->instance = req->instance; if (req->flags & SET_WIN_INSTANCE) win->instance = req->instance;
if (req->flags & SET_WIN_USERDATA) win->user_data = req->user_data; if (req->flags & SET_WIN_USERDATA) win->user_data = req->user_data;
if (req->flags & (SET_WIN_EXTRAWORD|SET_WIN_EXTRALONG))
{
const int len = (req->flags & SET_WIN_EXTRALONG) ? sizeof(int) : sizeof(short);
memcpy( win->extra_bytes + req->extra_offset, &req->extra_value,
min( len, win->nb_extra_bytes - req->extra_offset ));
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment