From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/class.c | 15 ++++++++++----- dlls/win32u/ntuser_private.h | 2 +- dlls/win32u/window.c | 9 +++------ 3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index 2c960a4060a..1b4a410123d 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -287,7 +287,7 @@ NTSTATUS WINAPI NtUserInitializeClientPfnArrays( const ntuser_client_func_ptr *c /*********************************************************************** * get_int_atom_value */ -ATOM get_int_atom_value( UNICODE_STRING *name ) +static ATOM get_int_atom_value( UNICODE_STRING *name ) { const WCHAR *ptr = name->Buffer; const WCHAR *end = ptr + name->Length / sizeof(WCHAR); @@ -305,6 +305,13 @@ ATOM get_int_atom_value( UNICODE_STRING *name ) return ret; }
+atom_t wine_server_add_atom( void *req, UNICODE_STRING *str ) +{ + atom_t atom; + if (!(atom = get_int_atom_value( str ))) wine_server_add_data( req, str->Buffer, str->Length ); + return atom; +} + static unsigned int is_integral_atom( const WCHAR *atomstr, ULONG len, RTL_ATOM *ret_atom ) { RTL_ATOM atom; @@ -501,9 +508,8 @@ ATOM WINAPI NtUserRegisterClassExWOW( const WNDCLASSEXW *wc, UNICODE_STRING *nam req->extra = class->cbClsExtra; req->win_extra = class->cbWndExtra; req->client_ptr = wine_server_client_ptr( class ); - req->atom = class->atomName; + req->atom = wine_server_add_atom( req, name ); req->name_offset = version->Length / sizeof(WCHAR); - if (!req->atom && name) wine_server_add_data( req, name->Buffer, name->Length ); ret = !wine_server_call_err( req ); class->atomName = reply->atom; } @@ -556,8 +562,7 @@ BOOL WINAPI NtUserUnregisterClass( UNICODE_STRING *name, HINSTANCE instance, SERVER_START_REQ( destroy_class ) { req->instance = wine_server_client_ptr( instance ); - if (!(req->atom = get_int_atom_value( name )) && name->Length) - wine_server_add_data( req, name->Buffer, name->Length ); + req->atom = wine_server_add_atom( req, name ); if (!wine_server_call_err( req )) class = wine_server_get_ptr( reply->client_ptr ); } SERVER_END_REQ; diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 27a723b4c2f..601cb784733 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -176,12 +176,12 @@ WNDPROC get_class_winproc( struct tagCLASS *class ); ULONG_PTR get_class_long_ptr( HWND hwnd, INT offset, BOOL ansi ); WORD get_class_word( HWND hwnd, INT offset ); DLGPROC get_dialog_proc( DLGPROC proc, BOOL ansi ); -ATOM get_int_atom_value( UNICODE_STRING *name ); WNDPROC get_winproc( WNDPROC proc, BOOL ansi ); void get_winproc_params( struct win_proc_params *params, BOOL fixup_ansi_dst ); struct dce *get_class_dce( struct tagCLASS *class ); struct dce *set_class_dce( struct tagCLASS *class, struct dce *dce ); BOOL needs_ime_window( HWND hwnd ); +extern atom_t wine_server_add_atom( void *req, UNICODE_STRING *str ); 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 62d6ace72a5..17625e9f52e 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3024,11 +3024,10 @@ HWND WINAPI NtUserFindWindowEx( HWND parent, HWND child, UNICODE_STRING *class, user_handle_t *list; HWND retvalue = 0; int i = 0, size = 128, title_len; - ATOM atom = class ? get_int_atom_value( class ) : 0; NTSTATUS status;
/* empty class is not the same as NULL class */ - if (!atom && class && !class->Length) return 0; + if (class && !class->Length && !IS_INTRESOURCE(class->Buffer)) return 0;
if (parent == HWND_MESSAGE) parent = get_hwnd_message_parent();
@@ -3040,8 +3039,7 @@ HWND WINAPI NtUserFindWindowEx( HWND parent, HWND child, UNICODE_STRING *class, { req->parent = wine_server_user_handle( parent ); req->child = wine_server_user_handle( child ); - req->atom = atom; - if (!atom && class) wine_server_add_data( req, class->Buffer, class->Length ); + if (class) req->atom = wine_server_add_atom( req, class ); wine_server_set_reply( req, list, size * sizeof(user_handle_t) ); status = wine_server_call( req ); size = reply->count; @@ -5381,8 +5379,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, req->dpi_context = dpi_context; req->style = style; req->ex_style = ex_style; - if (!(req->atom = get_int_atom_value( name )) && name->Length) - wine_server_add_data( req, name->Buffer, name->Length ); + req->atom = wine_server_add_atom( req, name ); if (!wine_server_call_err( req )) { handle = wine_server_ptr_handle( reply->handle );