From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/class.c | 10 ----- dlls/user32/controls.h | 3 -- dlls/user32/desktop.c | 14 ------- dlls/user32/message.c | 12 ------ dlls/user32/user_main.c | 1 - dlls/win32u/class.c | 73 ++++++++++++++++++++++++++++++++++++ dlls/win32u/ntuser_private.h | 1 + dlls/win32u/syscall.c | 2 + 8 files changed, 76 insertions(+), 40 deletions(-)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c index c18e48b257a..bb81e4551bc 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -332,16 +332,6 @@ BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, }
-/*********************************************************************** - * register_desktop_class - */ -void register_desktop_class(void) -{ - register_builtin( &DESKTOP_builtin_class ); - register_builtin( &MESSAGE_builtin_class ); -} - - /*********************************************************************** * RegisterClassA (USER32.@) * diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index a6c45ca1652..b004413113b 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -39,13 +39,11 @@ extern const struct builtin_class_descr BUTTON_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr COMBO_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr COMBOLBOX_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr DIALOG_builtin_class DECLSPEC_HIDDEN; -extern const struct builtin_class_descr DESKTOP_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr EDIT_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr ICONTITLE_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr LISTBOX_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr MDICLIENT_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr MENU_builtin_class DECLSPEC_HIDDEN; -extern const struct builtin_class_descr MESSAGE_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr SCROLL_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr STATIC_builtin_class DECLSPEC_HIDDEN; extern const struct builtin_class_descr IME_builtin_class DECLSPEC_HIDDEN; @@ -102,7 +100,6 @@ extern LRESULT StaticWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDE
/* Class functions */ extern ATOM get_int_atom_value( UNICODE_STRING *name ) DECLSPEC_HIDDEN; -extern void register_desktop_class(void) DECLSPEC_HIDDEN;
/* desktop */ extern BOOL update_wallpaper( const WCHAR *wallpaper, const WCHAR *pattern ) DECLSPEC_HIDDEN; diff --git a/dlls/user32/desktop.c b/dlls/user32/desktop.c index ca000972bc4..377c21d4f48 100644 --- a/dlls/user32/desktop.c +++ b/dlls/user32/desktop.c @@ -34,20 +34,6 @@ static SIZE bitmapSize; static BOOL fTileWallPaper;
-/********************************************************************* - * desktop class descriptor - */ -const struct builtin_class_descr DESKTOP_builtin_class = -{ - (LPCWSTR)DESKTOP_CLASS_ATOM, /* name */ - CS_DBLCLKS, /* style */ - WINPROC_DESKTOP, /* proc */ - 0, /* extra */ - 0, /* cursor */ - (HBRUSH)(COLOR_BACKGROUND+1) /* brush */ -}; - - /*********************************************************************** * DESKTOP_LoadBitmap */ diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 65aa93d858c..42cab89da05 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -47,18 +47,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msg);
-/* Message class descriptor */ -const struct builtin_class_descr MESSAGE_builtin_class = -{ - L"Message", /* name */ - 0, /* style */ - WINPROC_MESSAGE, /* proc */ - 0, /* extra */ - 0, /* cursor */ - 0 /* brush */ -}; - - /* pack a pointer into a 32/64 portable format */ static inline ULONGLONG pack_ptr( const void *ptr ) { diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index acbd93cccdd..133a7457bfd 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -220,7 +220,6 @@ static BOOL process_attach(void)
dpiaware_init(); winproc_init(); - register_desktop_class();
/* Initialize system colors and metrics */ SYSPARAMS_Init(); diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index eab65b72ef6..84e923c5b0c 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -60,6 +60,17 @@ typedef struct tagCLASS struct client_menu_name menu_name; /* Default menu name */ } CLASS;
+/* Built-in class descriptor */ +struct builtin_class_descr +{ + const char *name; /* class name */ + UINT style; /* class style */ + INT extra; /* window extra bytes */ + ULONG_PTR cursor; /* cursor id */ + HBRUSH brush; /* brush or system color */ + enum builtin_winprocs proc; +}; + typedef struct tagWINDOWPROC { WNDPROC procA; /* ANSI window proc */ @@ -1050,6 +1061,59 @@ BOOL needs_ime_window( HWND hwnd ) return ret; }
+static const struct builtin_class_descr desktop_builtin_class = +{ + .name = MAKEINTRESOURCEA(DESKTOP_CLASS_ATOM), + .style = CS_DBLCLKS, + .proc = WINPROC_DESKTOP, + .brush = (HBRUSH)(COLOR_BACKGROUND + 1), +}; + +static const struct builtin_class_descr message_builtin_class = +{ + .name = "Message", + .proc = WINPROC_MESSAGE, +}; + +/*********************************************************************** + * register_builtin + * + * Register a builtin control class. + * This allows having both ANSI and Unicode winprocs for the same class. + */ +static void register_builtin( const struct builtin_class_descr *descr ) +{ + UNICODE_STRING name, version = { .Length = 0 }; + struct client_menu_name menu_name = { 0 }; + WCHAR nameW[64]; + WNDCLASSEXW class = { + .cbSize = sizeof(class), + .hInstance = user32_module, + .style = descr->style, + .cbWndExtra = descr->extra, + .hbrBackground = descr->brush, + .lpfnWndProc = BUILTIN_WINPROC( descr->proc ), + }; + + if (descr->cursor) + class.hCursor = LoadImageW( 0, (const WCHAR *)descr->cursor, IMAGE_CURSOR, + 0, 0, LR_SHARED | LR_DEFAULTSIZE ); + + if (IS_INTRESOURCE( descr->name )) + { + name.Buffer = (WCHAR *)descr->name; + name.Length = name.MaximumLength = 0; + } + else + { + asciiz_to_unicode( nameW, descr->name ); + RtlInitUnicodeString( &name, nameW ); + } + + if (!NtUserRegisterClassExWOW( &class, &name, &version, &menu_name, 1, 0, NULL ) && class.hCursor) + NtUserDestroyCursor( class.hCursor, 0 ); +} + static void register_builtins(void) { void *ret_ptr; @@ -1065,3 +1129,12 @@ void register_builtin_classes(void) static pthread_once_t init_once = PTHREAD_ONCE_INIT; pthread_once( &init_once, register_builtins ); } + +/*********************************************************************** + * register_desktop_class + */ +void register_desktop_class(void) +{ + register_builtin( &desktop_builtin_class ); + register_builtin( &message_builtin_class ); +} diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 3ecd7424f77..e068ff849f3 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -249,6 +249,7 @@ struct dce *get_class_dce( struct tagCLASS *class ) DECLSPEC_HIDDEN; struct dce *set_class_dce( struct tagCLASS *class, struct dce *dce ) DECLSPEC_HIDDEN; BOOL needs_ime_window( HWND hwnd ) DECLSPEC_HIDDEN; extern void register_builtin_classes(void) DECLSPEC_HIDDEN; +extern void register_desktop_class(void) DECLSPEC_HIDDEN;
/* cursoricon.c */ HICON alloc_cursoricon_handle( BOOL is_icon ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 532c08ef2e0..e36e7097047 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -29,6 +29,7 @@ #include "windef.h" #include "winnt.h" #include "ntgdi_private.h" +#include "ntuser_private.h" #include "ntuser.h" #include "wine/unixlib.h"
@@ -318,6 +319,7 @@ static NTSTATUS init( void *dispatcher ) if ((status = gdi_init())) return status; winstation_init(); sysparams_init(); + register_desktop_class(); return STATUS_SUCCESS; }