From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/user32/static.c | 2 +- dlls/win32u/class.c | 6 ++++++ dlls/win32u/ntuser_private.h | 1 + dlls/win32u/window.c | 9 ++++----- include/ntuser.h | 4 +--- server/window.c | 6 ++++-- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/dlls/user32/static.c b/dlls/user32/static.c index 042255c0d88..f36c35bcec4 100644 --- a/dlls/user32/static.c +++ b/dlls/user32/static.c @@ -399,7 +399,7 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam { CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam; - NtUserSetWindowFNID( hwnd, MAKE_FNID(0, HICON_GWL_OFFSET + sizeof(HANDLE)) ); + NtUserSetWindowFNID( hwnd, MAKE_FNID(NTUSER_WNDPROC_STATIC) ); if (full_style & SS_SUNKEN || style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT) SetWindowLongW( hwnd, GWL_EXSTYLE, diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index ac9771e8cc3..f65da58658c 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -1073,6 +1073,12 @@ WORD get_class_word( HWND hwnd, INT offset ) return get_class_long_size( hwnd, offset, sizeof(WORD), TRUE ); } +DWORD get_builtin_class_extra( enum ntuser_client_procs proc ) +{ + get_desktop_window(); /* create the desktop window to trigger builtin class registration */ + return builtin_classes[proc].extra; +} + /*********************************************************************** * register_builtin * diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 713d0e20524..13cbbfff3c3 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -199,6 +199,7 @@ struct dce *set_class_dce( struct tagCLASS *class, struct dce *dce ); extern atom_t wine_server_add_atom( void *req, UNICODE_STRING *str ); extern BOOL is_desktop_class( UNICODE_STRING *name ); extern BOOL is_message_class( UNICODE_STRING *name ); +extern DWORD get_builtin_class_extra( enum ntuser_client_procs proc ); extern void register_builtin_classes(void); extern void register_desktop_class(void); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 8681a6ec128..5315644060b 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1587,8 +1587,7 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO */ BOOL WINAPI NtUserSetWindowFNID( HWND hwnd, WORD fnid ) { - int off = FNID_OFF(fnid); - int len = FNID_LEN(fnid); + DWORD len = get_builtin_class_extra( fnid & 0x7fff ); WND *win; BOOL ret; @@ -1608,7 +1607,7 @@ BOOL WINAPI NtUserSetWindowFNID( HWND hwnd, WORD fnid ) if (win->private_len) { - ret = win->private_off == off && win->private_len == len; + ret = win->private_off == 0 && win->private_len == len; release_win_ptr( win ); if (!ret) RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); @@ -1619,10 +1618,10 @@ BOOL WINAPI NtUserSetWindowFNID( HWND hwnd, WORD fnid ) { req->handle = wine_server_user_handle( hwnd ); req->offset = GWLP_FNID_INTERNAL; - req->new_info = fnid; + req->new_info = len; if ((ret = !wine_server_call_err( req ))) { - win->private_off = off; + win->private_off = 0; win->private_len = len; } } diff --git a/include/ntuser.h b/include/ntuser.h index ac998b2ab78..846f75b7975 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -659,9 +659,7 @@ enum wine_internal_message /* not compatible with Windows */ #define GWLP_FNID_INTERNAL (-1000) -#define MAKE_FNID(off, len) (((off) << 8) + len) -#define FNID_OFF(fnid) ((fnid) >> 8) -#define FNID_LEN(fnid) ((fnid) & 0xff) +#define MAKE_FNID(index) ((WORD)(0x8000 | (index))) /* builtin IME driver calls */ enum wine_ime_call diff --git a/server/window.c b/server/window.c index f222b5c2a59..0d5cf7d064f 100644 --- a/server/window.c +++ b/server/window.c @@ -679,6 +679,8 @@ 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; win->shared = NULL; @@ -2472,8 +2474,8 @@ DECL_HANDLER(set_window_info) win->user_data = req->new_info; break; case GWLP_FNID_INTERNAL: - win->private_off = FNID_OFF(req->new_info); - win->private_len = FNID_LEN(req->new_info); + win->private_off = 0; + win->private_len = req->new_info; break; default: if (req->size > sizeof(req->new_info) || req->offset < 0 || -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10999