From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/win32u/ntuser_private.h | 1 - dlls/win32u/window.c | 18 ++++-------------- server/window.c | 10 +--------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 13cbbfff3c3..eb612e31bc1 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -76,7 +76,6 @@ typedef struct tagWND int clip_clients; /* Has client surfaces that needs to be clipped out */ int cbWndExtra; /* class cbWndExtra at window creation */ DWORD_PTR userdata; /* User private data */ - int private_off; /* offset of private extra bytes range */ int private_len; /* length of private extra bytes range */ DWORD wExtra[1]; /* Window extra bytes */ } WND; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 5315644060b..5832cc603f6 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1164,11 +1164,6 @@ BOOL is_zoomed( HWND hwnd ) return (get_window_long( hwnd, GWL_STYLE ) & WS_MAXIMIZE) != 0; } -static BOOL in_private_data_range( const WND *win, INT offset, UINT size ) -{ - return offset < win->private_off + win->private_len && offset + size >= win->private_off; -} - static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ansi, BOOL internal ) { LONG_PTR retval = 0; @@ -1233,7 +1228,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans if (offset >= 0) { if (offset > (int)(win->cbWndExtra - size) || - (!internal && in_private_data_range( win, offset, size ))) + (!internal && offset < win->private_len)) { WARN("Invalid offset %d\n", offset ); release_win_ptr( win ); @@ -1492,7 +1487,7 @@ static LONG_PTR set_window_long_internal( HWND hwnd, INT offset, UINT size, break; default: if (offset < 0 || offset > (int)(win->cbWndExtra - size) || - (!internal && in_private_data_range( win, offset, size ))) + (!internal && offset < win->private_len)) { WARN("Invalid offset %d\n", offset ); release_win_ptr( win ); @@ -1607,8 +1602,7 @@ BOOL WINAPI NtUserSetWindowFNID( HWND hwnd, WORD fnid ) if (win->private_len) { - ret = win->private_off == 0 && win->private_len == len; - + ret = win->private_len == len; release_win_ptr( win ); if (!ret) RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ret; @@ -1619,11 +1613,7 @@ BOOL WINAPI NtUserSetWindowFNID( HWND hwnd, WORD fnid ) req->handle = wine_server_user_handle( hwnd ); req->offset = GWLP_FNID_INTERNAL; req->new_info = len; - if ((ret = !wine_server_call_err( req ))) - { - win->private_off = 0; - win->private_len = len; - } + if ((ret = !wine_server_call_err( req ))) win->private_len = len; } SERVER_END_REQ; release_win_ptr( win ); diff --git a/server/window.c b/server/window.c index 0d5cf7d064f..5d2966453bf 100644 --- a/server/window.c +++ b/server/window.c @@ -92,7 +92,6 @@ struct window int prop_inuse; /* number of in-use window properties */ int prop_alloc; /* number of allocated window properties */ struct property *properties; /* window properties array */ - int private_off; /* offset of private extra bytes range */ int private_len; /* length of private extra bytes range */ int nb_extra_bytes; /* number of extra bytes */ char *extra_bytes; /* extra bytes storage */ @@ -679,7 +678,6 @@ static struct window *create_window( struct window *parent, struct window *owner win->prop_inuse = 0; win->prop_alloc = 0; win->properties = NULL; - win->private_off = 0; win->private_len = 0; win->nb_extra_bytes = 0; win->extra_bytes = NULL; @@ -2277,11 +2275,6 @@ DECL_HANDLER(create_window) reply->class_ptr = get_class_client_ptr( win->class ); } -static BOOL in_private_data_range( const struct window *win, int offset, int size ) -{ - return offset < win->private_off + win->private_len && offset + size >= win->private_off; -} - /* set the parent of a window */ DECL_HANDLER(set_parent) @@ -2406,7 +2399,7 @@ DECL_HANDLER(get_window_info) default: if (req->size > sizeof(reply->info) || req->offset < 0 || req->offset > win->nb_extra_bytes - (int)req->size || - in_private_data_range( win, req->offset, req->size )) + req->offset < win->private_len) { set_win32_error( ERROR_INVALID_INDEX ); break; @@ -2474,7 +2467,6 @@ DECL_HANDLER(set_window_info) win->user_data = req->new_info; break; case GWLP_FNID_INTERNAL: - win->private_off = 0; win->private_len = req->new_info; break; default: -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10999