From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/win32u/class.c | 8 ++-- dlls/win32u/window.c | 100 ++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 52 deletions(-) diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index bc8d6a9d5d2..adcbadcd119 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -922,7 +922,7 @@ INT WINAPI NtUserGetClassName( HWND hwnd, BOOL real, UNICODE_STRING *name ) } /* Set class info with the wine server. */ -static BOOL set_server_info( HWND hwnd, INT offset, LONG_PTR newval, UINT size, ULONG_PTR *oldval ) +static BOOL server_set_class_info( HWND hwnd, INT offset, LONG_PTR newval, UINT size, ULONG_PTR *oldval ) { BOOL ret; @@ -956,18 +956,18 @@ static ULONG_PTR set_class_long_size( HWND hwnd, INT offset, LONG_PTR newval, UI case GCLP_HICONSM: case GCLP_HMODULE: case GCLP_MENUNAME: - set_server_info( hwnd, offset, newval, size, &retval ); + server_set_class_info( hwnd, offset, newval, size, &retval ); break; case GCLP_WNDPROC: newval = (ULONG_PTR)alloc_winproc( (WNDPROC)newval, ansi ); - if (!set_server_info( hwnd, offset, newval, size, &retval )) break; + if (!server_set_class_info( hwnd, offset, newval, size, &retval )) break; retval = (ULONG_PTR)get_winproc( (WNDPROC)retval, ansi ); break; case GCL_CBCLSEXTRA: /* cannot change this one */ RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); break; default: - if (offset >= 0) set_server_info( hwnd, offset, newval, size, &retval ); + if (offset >= 0) server_set_class_info( hwnd, offset, newval, size, &retval ); else RtlSetLastWin32Error( ERROR_INVALID_INDEX ); break; } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 3e47becca16..6df31fa9120 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1289,10 +1289,29 @@ static WORD get_window_word( HWND hwnd, INT offset ) return get_window_long_size( hwnd, offset, sizeof(WORD), TRUE, FALSE ); } +/* Set window info with the wine server. */ +static BOOL server_set_window_info( HWND hwnd, INT offset, LONG_PTR newval, UINT size, LONG_PTR *oldval ) +{ + BOOL ret; + + SERVER_START_REQ( set_window_info ) + { + req->handle = wine_server_user_handle( hwnd ); + req->offset = offset; + req->size = size; + req->new_info = newval; + ret = !wine_server_call_err( req ); + *oldval = reply->old_info; + } + SERVER_END_REQ; + return ret; +} + UINT set_window_style_bits( HWND hwnd, UINT set_bits, UINT clear_bits ) { BOOL ok, made_visible = FALSE; STYLESTRUCT style; + LONG_PTR oldval; WND *win = get_win_ptr( hwnd ); if (!win || win == WND_DESKTOP) return 0; @@ -1309,18 +1328,11 @@ UINT set_window_style_bits( HWND hwnd, UINT set_bits, UINT clear_bits ) release_win_ptr( win ); return style.styleNew; } - SERVER_START_REQ( set_window_info ) + if ((ok = server_set_window_info( hwnd, GWL_STYLE, style.styleNew, 0, &oldval ))) { - req->handle = wine_server_user_handle( hwnd ); - req->offset = GWL_STYLE; - req->new_info = style.styleNew; - if ((ok = !wine_server_call( req ))) - { - style.styleOld = reply->old_info; - win->dwStyle = style.styleNew; - } + style.styleOld = oldval; + win->dwStyle = style.styleNew; } - SERVER_END_REQ; if (ok && ((style.styleOld ^ style.styleNew) & WS_VISIBLE)) { @@ -1390,7 +1402,7 @@ static LONG_PTR set_window_long_internal( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOOL ansi, BOOL internal ) { BOOL ok, made_visible = FALSE, layered = FALSE; - LONG_PTR retval = 0; + LONG_PTR retval = 0, oldval; STYLESTRUCT style; WND *win; @@ -1503,47 +1515,39 @@ static LONG_PTR set_window_long_internal( HWND hwnd, INT offset, UINT size, if (offset == GWLP_WNDPROC) newval = !!(win->flags & WIN_ISUNICODE); if (offset == GWLP_USERDATA && size == sizeof(WORD)) newval = MAKELONG( newval, win->userdata >> 16 ); - SERVER_START_REQ( set_window_info ) + if ((ok = server_set_window_info( hwnd, offset, newval, size, &oldval ))) { - req->handle = wine_server_user_handle( hwnd ); - req->offset = offset; - req->new_info = newval; - req->size = size; - if ((ok = !wine_server_call_err( req ))) + switch (offset) { - switch (offset) - { - case GWL_STYLE: - win->dwStyle = newval; - win->dwExStyle = fix_exstyle(win->dwStyle, win->dwExStyle); - retval = reply->old_info; - break; - case GWL_EXSTYLE: - win->dwExStyle = newval; - retval = reply->old_info; - break; - case GWLP_ID: - win->wIDmenu = newval; - retval = reply->old_info; - break; - case GWLP_HINSTANCE: - win->hInstance = (HINSTANCE)newval; - retval = reply->old_info; - break; - case GWLP_WNDPROC: - break; - case GWLP_USERDATA: - win->userdata = newval; - retval = reply->old_info; - break; - default: - set_win_data( (char *)win->wExtra + offset, newval, size ); - retval = reply->old_info; - break; - } + case GWL_STYLE: + win->dwStyle = newval; + win->dwExStyle = fix_exstyle(win->dwStyle, win->dwExStyle); + retval = oldval; + break; + case GWL_EXSTYLE: + win->dwExStyle = newval; + retval = oldval; + break; + case GWLP_ID: + win->wIDmenu = newval; + retval = oldval; + break; + case GWLP_HINSTANCE: + win->hInstance = (HINSTANCE)newval; + retval = oldval; + break; + case GWLP_WNDPROC: + break; + case GWLP_USERDATA: + win->userdata = newval; + retval = oldval; + break; + default: + set_win_data( (char *)win->wExtra + offset, newval, size ); + retval = oldval; + break; } } - SERVER_END_REQ; if (offset == GWL_EXSTYLE && ((style.styleOld ^ style.styleNew) & WS_EX_LAYERED)) layered = TRUE; if ((offset == GWL_STYLE && ((style.styleOld ^ style.styleNew) & WS_VISIBLE)) || layered) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11106