win32u: Use user mode callback for registering builtin classes.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-26 16:06:11 +01:00 committed by Alexandre Julliard
parent 0082d58cb5
commit a37cae58d9
9 changed files with 24 additions and 18 deletions

View File

@ -40,8 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(class);
#define MAX_ATOM_LEN 255 /* from dlls/kernel32/atom.c */
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
static inline const char *debugstr_us( const UNICODE_STRING *us )
{
if (!us) return "<null>";
@ -307,9 +305,9 @@ static void load_uxtheme(void)
}
/***********************************************************************
* register_builtins
* User32RegisterBuiltinClasses
*/
static BOOL WINAPI register_builtins( INIT_ONCE *once, void *param, void **context )
BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, ULONG size )
{
register_builtin( &BUTTON_builtin_class );
register_builtin( &COMBO_builtin_class );
@ -330,15 +328,6 @@ static BOOL WINAPI register_builtins( INIT_ONCE *once, void *param, void **conte
}
/***********************************************************************
* register_builtin_classes
*/
void register_builtin_classes(void)
{
InitOnceExecuteOnce( &init_once, register_builtins, NULL, NULL );
}
/***********************************************************************
* register_desktop_class
*/

View File

@ -104,7 +104,6 @@ extern LRESULT StaticWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDE
struct tagCLASS; /* opaque structure */
struct tagWND;
extern ATOM get_int_atom_value( UNICODE_STRING *name ) DECLSPEC_HIDDEN;
extern void register_builtin_classes(void) DECLSPEC_HIDDEN;
extern void register_desktop_class(void) DECLSPEC_HIDDEN;
/* defwnd proc */

View File

@ -172,7 +172,6 @@ static const struct user_callbacks user_funcs =
post_dde_message,
process_rawinput_message,
rawinput_device_get_usages,
register_builtin_classes,
SCROLL_SetStandardScrollPainted,
unpack_dde_message,
register_imm,
@ -207,6 +206,7 @@ static const void *kernel_callback_table[NtUserCallCount] =
User32CallWindowsHook,
User32FreeCachedClipboardData,
User32LoadDriver,
User32RegisterBuiltinClasses,
User32RenderSsynthesizedFormat,
};

View File

@ -124,6 +124,7 @@ BOOL WINAPI User32CallSendAsyncCallback( const struct send_async_params *params,
BOOL WINAPI User32CallWinEventHook( const struct win_event_hook_params *params, ULONG size );
BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size );
BOOL WINAPI User32CallWindowsHook( const struct win_hook_params *params, ULONG size );
BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, ULONG size );
/* message spy definitions */

View File

@ -972,3 +972,19 @@ WORD get_class_word( HWND hwnd, INT offset )
release_class_ptr( class );
return retvalue;
}
static void register_builtins(void)
{
void *ret_ptr;
ULONG ret_len;
KeUserModeCallback( NtUserRegisterBuiltinClasses, NULL, 0, &ret_ptr, &ret_len );
}
/***********************************************************************
* register_builtin_classes
*/
void register_builtin_classes(void)
{
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
pthread_once( &init_once, register_builtins );
}

View File

@ -46,7 +46,6 @@ struct user_callbacks
DWORD type );
BOOL (CDECL *process_rawinput_message)( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data );
BOOL (CDECL *rawinput_device_get_usages)(HANDLE handle, USHORT *usage_page, USHORT *usage);
void (CDECL *register_builtin_classes)(void);
void (WINAPI *set_standard_scroll_painted)( HWND hwnd, INT bar, BOOL visible );
BOOL (CDECL *unpack_dde_message)( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
void **buffer, size_t size );
@ -303,6 +302,7 @@ WNDPROC get_winproc( WNDPROC proc, BOOL ansi ) DECLSPEC_HIDDEN;
void get_winproc_params( struct win_proc_params *params ) DECLSPEC_HIDDEN;
struct dce *get_class_dce( struct tagCLASS *class ) DECLSPEC_HIDDEN;
struct dce *set_class_dce( struct tagCLASS *class, struct dce *dce ) DECLSPEC_HIDDEN;
extern void register_builtin_classes(void) DECLSPEC_HIDDEN;
/* cursoricon.c */
HICON alloc_cursoricon_handle( BOOL is_icon ) DECLSPEC_HIDDEN;

View File

@ -4732,7 +4732,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name,
else assert( full_parent == thread_info->top_window );
if (full_parent && !user_driver->pCreateDesktopWindow( thread_info->top_window ))
ERR( "failed to create desktop window\n" );
if (user_callbacks) user_callbacks->register_builtin_classes();
register_builtin_classes();
}
else /* HWND_MESSAGE parent */
{

View File

@ -499,7 +499,7 @@ HWND get_desktop_window(void)
if (!thread_info->top_window || !user_driver->pCreateDesktopWindow( thread_info->top_window ))
ERR_(win)( "failed to create desktop window\n" );
if (user_callbacks) user_callbacks->register_builtin_classes();
register_builtin_classes();
return thread_info->top_window;
}

View File

@ -34,6 +34,7 @@ enum
NtUserCallWindowsHook,
NtUserFreeCachedClipboardData,
NtUserLoadDriver,
NtUserRegisterBuiltinClasses,
NtUserRenderSynthesizedFormat,
/* win16 hooks */
NtUserCallFreeIcon,