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 ));
}
} }
......
...@@ -62,12 +62,12 @@ static void *user_handles[NB_USER_HANDLES]; ...@@ -62,12 +62,12 @@ static void *user_handles[NB_USER_HANDLES];
* *
* Create a window handle with the server. * Create a window handle with the server.
*/ */
static WND *create_window_handle( HWND parent, HWND owner, ATOM atom, INT size ) static WND *create_window_handle( HWND parent, HWND owner, ATOM atom, unsigned int extra_bytes )
{ {
BOOL res; BOOL res;
user_handle_t handle = 0; user_handle_t handle = 0;
WORD index; WORD index;
WND *win = HeapAlloc( GetProcessHeap(), 0, size ); WND *win = HeapAlloc( GetProcessHeap(), 0, sizeof(WND) + extra_bytes - sizeof(win->wExtra) );
if (!win) return NULL; if (!win) return NULL;
...@@ -78,6 +78,7 @@ static WND *create_window_handle( HWND parent, HWND owner, ATOM atom, INT size ) ...@@ -78,6 +78,7 @@ static WND *create_window_handle( HWND parent, HWND owner, ATOM atom, INT size )
req->parent = parent; req->parent = parent;
req->owner = owner; req->owner = owner;
req->atom = atom; req->atom = atom;
req->extra = extra_bytes;
if ((res = !wine_server_call_err( req ))) handle = reply->handle; if ((res = !wine_server_call_err( req ))) handle = reply->handle;
} }
SERVER_END_REQ; SERVER_END_REQ;
...@@ -459,6 +460,7 @@ LONG WIN_SetStyle( HWND hwnd, LONG style ) ...@@ -459,6 +460,7 @@ LONG WIN_SetStyle( HWND hwnd, LONG style )
req->handle = hwnd; req->handle = hwnd;
req->flags = SET_WIN_STYLE; req->flags = SET_WIN_STYLE;
req->style = style; req->style = style;
req->extra_offset = -1;
if ((ok = !wine_server_call( req ))) if ((ok = !wine_server_call( req )))
{ {
ret = reply->old_style; ret = reply->old_style;
...@@ -499,6 +501,7 @@ LONG WIN_SetExStyle( HWND hwnd, LONG style ) ...@@ -499,6 +501,7 @@ LONG WIN_SetExStyle( HWND hwnd, LONG style )
req->handle = hwnd; req->handle = hwnd;
req->flags = SET_WIN_EXSTYLE; req->flags = SET_WIN_EXSTYLE;
req->ex_style = style; req->ex_style = style;
req->extra_offset = -1;
if (!wine_server_call( req )) if (!wine_server_call( req ))
{ {
ret = reply->old_ex_style; ret = reply->old_ex_style;
...@@ -718,8 +721,7 @@ BOOL WIN_CreateDesktopWindow(void) ...@@ -718,8 +721,7 @@ BOOL WIN_CreateDesktopWindow(void)
&wndExtra, &winproc, &clsStyle, &dce ))) &wndExtra, &winproc, &clsStyle, &dce )))
return FALSE; return FALSE;
pWndDesktop = create_window_handle( 0, 0, LOWORD(DESKTOP_CLASS_ATOM), pWndDesktop = create_window_handle( 0, 0, LOWORD(DESKTOP_CLASS_ATOM), wndExtra );
sizeof(WND) + wndExtra - sizeof(pWndDesktop->wExtra) );
if (!pWndDesktop) return FALSE; if (!pWndDesktop) return FALSE;
hwndDesktop = pWndDesktop->hwndSelf; hwndDesktop = pWndDesktop->hwndSelf;
...@@ -759,6 +761,7 @@ BOOL WIN_CreateDesktopWindow(void) ...@@ -759,6 +761,7 @@ BOOL WIN_CreateDesktopWindow(void)
{ {
req->handle = hwndDesktop; req->handle = hwndDesktop;
req->flags = 0; /* don't set anything, just retrieve */ req->flags = 0; /* don't set anything, just retrieve */
req->extra_offset = -1;
wine_server_call( req ); wine_server_call( req );
pWndDesktop->dwStyle = reply->old_style; pWndDesktop->dwStyle = reply->old_style;
pWndDesktop->dwExStyle = reply->old_ex_style; pWndDesktop->dwExStyle = reply->old_ex_style;
...@@ -1049,8 +1052,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom, ...@@ -1049,8 +1052,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
/* Create the window structure */ /* Create the window structure */
if (!(wndPtr = create_window_handle( parent, owner, classAtom, if (!(wndPtr = create_window_handle( parent, owner, classAtom, wndExtra )))
sizeof(*wndPtr) + wndExtra - sizeof(wndPtr->wExtra) )))
{ {
TRACE("out of memory\n" ); TRACE("out of memory\n" );
return 0; return 0;
...@@ -1100,6 +1102,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom, ...@@ -1100,6 +1102,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
req->style = wndPtr->dwStyle; req->style = wndPtr->dwStyle;
req->ex_style = wndPtr->dwExStyle; req->ex_style = wndPtr->dwExStyle;
req->instance = (void *)wndPtr->hInstance; req->instance = (void *)wndPtr->hInstance;
req->extra_offset = -1;
wine_server_call( req ); wine_server_call( req );
} }
SERVER_END_REQ; SERVER_END_REQ;
...@@ -1788,7 +1791,7 @@ WORD WINAPI GetWindowWord( HWND hwnd, INT offset ) ...@@ -1788,7 +1791,7 @@ WORD WINAPI GetWindowWord( HWND hwnd, INT offset )
*/ */
WORD WINAPI SetWindowWord( HWND hwnd, INT offset, WORD newval ) WORD WINAPI SetWindowWord( HWND hwnd, INT offset, WORD newval )
{ {
WORD *ptr, retval; WORD retval = 0;
WND * wndPtr; WND * wndPtr;
switch(offset) switch(offset)
...@@ -1827,10 +1830,22 @@ WORD WINAPI SetWindowWord( HWND hwnd, INT offset, WORD newval ) ...@@ -1827,10 +1830,22 @@ WORD WINAPI SetWindowWord( HWND hwnd, INT offset, WORD newval )
SetLastError( ERROR_INVALID_INDEX ); SetLastError( ERROR_INVALID_INDEX );
return 0; return 0;
} }
ptr = (WORD *)(((char *)wndPtr->wExtra) + offset);
SERVER_START_REQ( set_window_info )
{
req->handle = hwnd;
req->flags = SET_WIN_EXTRAWORD;
req->extra_offset = offset;
req->extra_value = newval;
if (!wine_server_call_err( req ))
{
WORD *ptr = (WORD *)(((char *)wndPtr->wExtra) + offset);
retval = *ptr; retval = *ptr;
*ptr = newval; *ptr = newval;
WIN_ReleasePtr(wndPtr); }
}
SERVER_END_REQ;
WIN_ReleasePtr( wndPtr );
return retval; return retval;
} }
...@@ -1860,13 +1875,6 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type ) ...@@ -1860,13 +1875,6 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type )
if (wndPtr == WND_OTHER_PROCESS) if (wndPtr == WND_OTHER_PROCESS)
{ {
if (offset >= 0)
{
if (IsWindow(hwnd))
FIXME( "(%d) not supported on other process window %p\n", offset, hwnd );
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0;
}
if (offset == GWL_WNDPROC) if (offset == GWL_WNDPROC)
{ {
SetLastError( ERROR_ACCESS_DENIED ); SetLastError( ERROR_ACCESS_DENIED );
...@@ -1876,6 +1884,7 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type ) ...@@ -1876,6 +1884,7 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type )
{ {
req->handle = hwnd; req->handle = hwnd;
req->flags = 0; /* don't set anything, just retrieve */ req->flags = 0; /* don't set anything, just retrieve */
req->extra_offset = (offset >= 0) ? offset : -1;
if (!wine_server_call_err( req )) if (!wine_server_call_err( req ))
{ {
switch(offset) switch(offset)
...@@ -1886,10 +1895,13 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type ) ...@@ -1886,10 +1895,13 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type )
case GWL_HINSTANCE: retvalue = (ULONG_PTR)reply->old_instance; break; case GWL_HINSTANCE: retvalue = (ULONG_PTR)reply->old_instance; break;
case GWL_USERDATA: retvalue = (ULONG_PTR)reply->old_user_data; break; case GWL_USERDATA: retvalue = (ULONG_PTR)reply->old_user_data; break;
default: default:
SetLastError( ERROR_INVALID_INDEX ); if (offset >= 0) retvalue = reply->old_extra_value;
else SetLastError( ERROR_INVALID_INDEX );
break; break;
} }
} }
else if (offset >= 0 && GetLastError() == ERROR_INVALID_PARAMETER)
SetLastError( ERROR_INVALID_INDEX );
} }
SERVER_END_REQ; SERVER_END_REQ;
return retvalue; return retvalue;
...@@ -1961,6 +1973,8 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type ) ...@@ -1961,6 +1973,8 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type )
static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
WINDOWPROCTYPE type ) WINDOWPROCTYPE type )
{ {
STYLESTRUCT style;
BOOL ok;
LONG retval = 0; LONG retval = 0;
WND *wndPtr; WND *wndPtr;
...@@ -1990,33 +2004,6 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, ...@@ -1990,33 +2004,6 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
return 0; return 0;
} }
if (offset >= 0)
{
LONG *ptr = (LONG *)(((char *)wndPtr->wExtra) + offset);
if (offset > (int)(wndPtr->cbWndExtra - sizeof(LONG)))
{
WARN("Invalid offset %d\n", offset );
WIN_ReleasePtr( wndPtr );
SetLastError( ERROR_INVALID_INDEX );
return 0;
}
/* Special case for dialog window procedure */
if ((offset == DWL_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG))
{
retval = (LONG)WINPROC_GetProc( (WNDPROC)*ptr, type );
WINPROC_SetProc( (WNDPROC *)ptr, (WNDPROC)newval, type, WIN_PROC_WINDOW );
WIN_ReleasePtr( wndPtr );
return retval;
}
retval = *ptr;
*ptr = newval;
WIN_ReleasePtr( wndPtr );
}
else
{
STYLESTRUCT style;
BOOL ok;
/* first some special cases */ /* first some special cases */
switch( offset ) switch( offset )
{ {
...@@ -2050,16 +2037,40 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, ...@@ -2050,16 +2037,40 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
case GWL_HINSTANCE: case GWL_HINSTANCE:
case GWL_USERDATA: case GWL_USERDATA:
break; break;
default: case DWL_DLGPROC:
if ((wndPtr->cbWndExtra + sizeof(LONG) >= DWL_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG))
{
WNDPROC *ptr = (WNDPROC *)((char *)wndPtr->wExtra + DWL_DLGPROC);
retval = (LONG)WINPROC_GetProc( *ptr, type );
WINPROC_SetProc( ptr, (WNDPROC)newval, type, WIN_PROC_WINDOW );
WIN_ReleasePtr( wndPtr ); WIN_ReleasePtr( wndPtr );
return retval;
}
/* fall through */
default:
if (offset < 0 || offset > (int)(wndPtr->cbWndExtra - sizeof(LONG)))
{
WARN("Invalid offset %d\n", offset ); WARN("Invalid offset %d\n", offset );
WIN_ReleasePtr( wndPtr );
SetLastError( ERROR_INVALID_INDEX ); SetLastError( ERROR_INVALID_INDEX );
return 0; return 0;
} }
else
{
LONG *ptr = (LONG *)((char *)wndPtr->wExtra + offset);
if (*ptr == newval) /* already set to the same value */
{
WIN_ReleasePtr( wndPtr );
return newval;
}
}
break;
}
SERVER_START_REQ( set_window_info ) SERVER_START_REQ( set_window_info )
{ {
req->handle = hwnd; req->handle = hwnd;
req->extra_offset = -1;
switch(offset) switch(offset)
{ {
case GWL_STYLE: case GWL_STYLE:
...@@ -2082,6 +2093,10 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, ...@@ -2082,6 +2093,10 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
req->flags = SET_WIN_USERDATA; req->flags = SET_WIN_USERDATA;
req->user_data = (void *)newval; req->user_data = (void *)newval;
break; break;
default:
req->flags = SET_WIN_EXTRALONG;
req->extra_offset = offset;
req->extra_value = newval;
} }
if ((ok = !wine_server_call_err( req ))) if ((ok = !wine_server_call_err( req )))
{ {
...@@ -2107,6 +2122,13 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, ...@@ -2107,6 +2122,13 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
wndPtr->userdata = newval; wndPtr->userdata = newval;
retval = (ULONG_PTR)reply->old_user_data; retval = (ULONG_PTR)reply->old_user_data;
break; break;
default:
{
LONG *ptr = (LONG *)((char *)wndPtr->wExtra + offset);
retval = *ptr;
*ptr = newval;
}
break;
} }
} }
} }
...@@ -2121,7 +2143,6 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, ...@@ -2121,7 +2143,6 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
if (offset == GWL_STYLE || offset == GWL_EXSTYLE) if (offset == GWL_STYLE || offset == GWL_EXSTYLE)
SendMessageW( hwnd, WM_STYLECHANGED, offset, (LPARAM)&style ); SendMessageW( hwnd, WM_STYLECHANGED, offset, (LPARAM)&style );
}
return retval; return retval;
} }
......
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