From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/button.c | 13 ----- dlls/user32/class.c | 43 +-------------- dlls/user32/combo.c | 14 ----- dlls/user32/controls.h | 24 --------- dlls/user32/dialog.c | 14 ----- dlls/user32/edit.c | 14 ----- dlls/user32/icontitle.c | 13 ----- dlls/user32/listbox.c | 27 ---------- dlls/user32/mdi.c | 14 ----- dlls/user32/menu.c | 13 ----- dlls/user32/misc.c | 10 ---- dlls/user32/scroll.c | 13 ----- dlls/user32/static.c | 14 ----- dlls/user32/user_main.c | 2 +- dlls/user32/user_private.h | 2 +- dlls/win32u/class.c | 104 ++++++++++++++++++++++++++++++++++++- include/ntuser.h | 2 +- 17 files changed, 107 insertions(+), 229 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c index d1dc6a3c6ff..afc0f53134a 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -118,19 +118,6 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] = OB_Paint /* BS_OWNERDRAW */ };
-/********************************************************************* - * button class descriptor - */ -const struct builtin_class_descr BUTTON_builtin_class = -{ - L"Button", /* name */ - CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */ - WINPROC_BUTTON, /* proc */ - NB_EXTRA_BYTES, /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; -
static inline LONG get_button_state( HWND hwnd ) { diff --git a/dlls/user32/class.c b/dlls/user32/class.c index bb81e4551bc..4e55b3bcc33 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -264,32 +264,6 @@ static void get_versioned_name( const WCHAR *name, UNICODE_STRING *ret, UNICODE_ }
-/*********************************************************************** - * 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 }; - 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 = LoadCursorA( 0, (LPSTR)descr->cursor ); - - init_class_name( &name, descr->name ); - if (!NtUserRegisterClassExWOW( &class, &name, &version, &menu_name, 1, 0, NULL ) && class.hCursor) - DestroyCursor( class.hCursor ); -} - static void load_uxtheme(void) { BOOL (WINAPI * pIsThemeActive)(void); @@ -305,25 +279,12 @@ static void load_uxtheme(void) }
/*********************************************************************** - * User32RegisterBuiltinClasses + * User32InitBuiltinClasses */ -BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, ULONG size ) +BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULONG size ) { DWORD layout;
- register_builtin( &BUTTON_builtin_class ); - register_builtin( &COMBO_builtin_class ); - register_builtin( &COMBOLBOX_builtin_class ); - register_builtin( &DIALOG_builtin_class ); - register_builtin( &EDIT_builtin_class ); - register_builtin( &ICONTITLE_builtin_class ); - register_builtin( &LISTBOX_builtin_class ); - register_builtin( &MDICLIENT_builtin_class ); - register_builtin( &MENU_builtin_class ); - register_builtin( &SCROLL_builtin_class ); - register_builtin( &STATIC_builtin_class ); - register_builtin( &IME_builtin_class ); - GetProcessDefaultLayout( &layout ); /* make sure that process layout is initialized */
/* Load uxtheme.dll so that standard scrollbars and dialogs are hooked for theming support */ diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index fe7b33235c0..31deadb2ba9 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -76,20 +76,6 @@ static UINT CBitHeight, CBitWidth; static void CBCalcPlacement(HEADCOMBO *combo); static void CBResetPos(HEADCOMBO *combo, BOOL redraw);
-/********************************************************************* - * combo class descriptor - */ -const struct builtin_class_descr COMBO_builtin_class = -{ - L"ComboBox", /* name */ - CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, /* style */ - WINPROC_COMBO, /* proc */ - sizeof(HEADCOMBO *), /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; - - /*********************************************************************** * COMBO_Init * diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index b004413113b..66c2d1af2da 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -24,30 +24,6 @@ #include "winuser.h" #include "../win32u/ntuser_private.h"
-/* Built-in class descriptor */ -struct builtin_class_descr -{ - LPCWSTR name; /* class name */ - UINT style; /* class style */ - enum builtin_winprocs proc; - INT extra; /* window extra bytes */ - ULONG_PTR cursor; /* cursor id */ - HBRUSH brush; /* brush or system color */ -}; - -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 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 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; - extern LRESULT WINAPI ImeWndProcA(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN; extern LRESULT WINAPI ImeWndProcW(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN; extern LRESULT WINAPI DesktopWndProc(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN; diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 5c74de65ac0..00d315f9ff7 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -85,20 +85,6 @@ typedef struct } RADIOGROUP;
-/********************************************************************* - * dialog class descriptor - */ -const struct builtin_class_descr DIALOG_builtin_class = -{ - (LPCWSTR)DIALOG_CLASS_ATOM, /* name */ - CS_SAVEBITS | CS_DBLCLKS, /* style */ - WINPROC_DIALOG, /* proc */ - DLGWINDOWEXTRA, /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; - - /*********************************************************************** * DIALOG_GetControl32 * diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 3bbcd9ab746..496d5e7287f 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -5255,17 +5255,3 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
return result; } - - -/********************************************************************* - * edit class descriptor - */ -const struct builtin_class_descr EDIT_builtin_class = -{ - L"Edit", /* name */ - CS_DBLCLKS | CS_PARENTDC, /* style */ - WINPROC_EDIT, /* proc */ - sizeof(UINT64), /* extra */ - IDC_IBEAM, /* cursor */ - 0 /* brush */ -}; diff --git a/dlls/user32/icontitle.c b/dlls/user32/icontitle.c index e6b89b0a92a..718da3006e2 100644 --- a/dlls/user32/icontitle.c +++ b/dlls/user32/icontitle.c @@ -32,19 +32,6 @@ static BOOL bMultiLineTitle; static HFONT hIconTitleFont;
-/********************************************************************* - * icon title class descriptor - */ -const struct builtin_class_descr ICONTITLE_builtin_class = -{ - (LPCWSTR)ICONTITLE_CLASS_ATOM, /* name */ - 0, /* style */ - WINPROC_ICONTITLE, /* proc */ - 0, /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; - /*********************************************************************** * ICONTITLE_SetTitlePos */ diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index d96fc8c219d..f6b5a3fb7db 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -241,33 +241,6 @@ static void remove_item_data(LB_DESCR *descr, UINT index) memmove(p, p + size, (descr->nb_items - index) * size); }
-/********************************************************************* - * listbox class descriptor - */ -const struct builtin_class_descr LISTBOX_builtin_class = -{ - L"ListBox", /* name */ - CS_DBLCLKS /*| CS_PARENTDC*/, /* style */ - WINPROC_LISTBOX, /* proc */ - sizeof(LB_DESCR *), /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; - - -/********************************************************************* - * combolbox class descriptor - */ -const struct builtin_class_descr COMBOLBOX_builtin_class = -{ - L"ComboLBox", /* name */ - CS_DBLCLKS | CS_SAVEBITS, /* style */ - WINPROC_LISTBOX, /* proc */ - sizeof(LB_DESCR *), /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; -
/*********************************************************************** * LISTBOX_GetCurrentPageSize diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index 746f8c6f46f..be567e6024d 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -178,20 +178,6 @@ static void MDI_PostUpdate(HWND hwnd, MDICLIENTINFO* ci, WORD recalc) }
-/********************************************************************* - * MDIClient class descriptor - */ -const struct builtin_class_descr MDICLIENT_builtin_class = -{ - L"MDIClient", /* name */ - 0, /* style */ - WINPROC_MDICLIENT, /* proc */ - 2 * sizeof(void *), /* extra */ - IDC_ARROW, /* cursor */ - (HBRUSH)(COLOR_APPWORKSPACE+1) /* brush */ -}; - - static MDICLIENTINFO *get_client_info( HWND client ) { return NtUserGetMDIClientInfo( client ); diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 07be830eed3..4ba6fa71028 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -68,19 +68,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(menu); #define STATE_MASK (~TYPE_MASK) #define MENUITEMINFO_STATE_MASK (STATE_MASK & ~(MF_BYPOSITION | MF_MOUSESELECT))
-/********************************************************************* - * menu class descriptor - */ -const struct builtin_class_descr MENU_builtin_class = -{ - (LPCWSTR)POPUPMENU_CLASS_ATOM, /* name */ - CS_DROPSHADOW | CS_SAVEBITS | CS_DBLCLKS, /* style */ - WINPROC_MENU, /* proc */ - sizeof(HMENU), /* extra */ - IDC_ARROW, /* cursor */ - (HBRUSH)(COLOR_MENU+1) /* brush */ -}; -
/********************************************************************** * MENU_ParseResource diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c index 64a300f83ef..24adcc62b9c 100644 --- a/dlls/user32/misc.c +++ b/dlls/user32/misc.c @@ -530,16 +530,6 @@ BOOL WINAPI GetPointerType(UINT32 id, POINTER_INPUT_TYPE *type) return TRUE; }
-const struct builtin_class_descr IME_builtin_class = -{ - L"IME", /* name */ - 0, /* style */ - WINPROC_IME, /* proc */ - 2*sizeof(LONG_PTR), /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; - LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { if (!imm_ime_wnd_proc) return DefWindowProcA(hwnd, msg, wParam, lParam); diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index 9750d6276df..976f88ea7dd 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -35,19 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(scroll); /* Overlap between arrows and thumb */ #define SCROLL_ARROW_THUMB_OVERLAP 0
-/********************************************************************* - * scrollbar class descriptor - */ -const struct builtin_class_descr SCROLL_builtin_class = -{ - L"ScrollBar", /* name */ - CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */ - WINPROC_SCROLLBAR, /* proc */ - sizeof(struct scroll_bar_win_data), /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; -
/*********************************************************************** * SCROLL_DrawArrows diff --git a/dlls/user32/static.c b/dlls/user32/static.c index cfcbe92cd98..a88203f5716 100644 --- a/dlls/user32/static.c +++ b/dlls/user32/static.c @@ -52,7 +52,6 @@ static COLORREF color_3dshadow, color_3ddkshadow, color_3dhighlight; /* offsets for GetWindowLong for static private information */ #define HFONT_GWL_OFFSET 0 #define HICON_GWL_OFFSET (sizeof(HFONT)) -#define STATIC_EXTRA_BYTES (HICON_GWL_OFFSET + sizeof(HICON))
typedef void (*pfPaint)( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style );
@@ -80,19 +79,6 @@ static const pfPaint staticPaintFunc[SS_TYPEMASK+1] = };
-/********************************************************************* - * static class descriptor - */ -const struct builtin_class_descr STATIC_builtin_class = -{ - L"Static", /* name */ - CS_DBLCLKS | CS_PARENTDC, /* style */ - WINPROC_STATIC, /* proc */ - STATIC_EXTRA_BYTES, /* extra */ - IDC_ARROW, /* cursor */ - 0 /* brush */ -}; - /*********************************************************************** * STATIC_SetIcon * diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 133a7457bfd..269fdede708 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -201,11 +201,11 @@ static const void *kernel_callback_table[NtUserCallCount] = User32FreeCachedClipboardData, User32ImmProcessKey, User32ImmTranslateMessage, + User32InitBuiltinClasses, User32LoadDriver, User32LoadImage, User32LoadSysMenu, User32PostDDEMessage, - User32RegisterBuiltinClasses, User32RenderSsynthesizedFormat, User32UnpackDDEMessage, }; diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 4abb0080a0f..77a5ba54929 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -96,7 +96,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 ); +BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULONG size );
/* message spy definitions */
diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index 84e923c5b0c..19009fc5c0a 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -1075,6 +1075,104 @@ static const struct builtin_class_descr message_builtin_class = .proc = WINPROC_MESSAGE, };
+static const struct builtin_class_descr builtin_classes[] = +{ + /* button */ + { + .name = "Button", + .style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, + .proc = WINPROC_BUTTON, + .extra = sizeof(UINT) + 2 * sizeof(HANDLE), + .cursor = IDC_ARROW, + }, + /* combo */ + { + .name = "ComboBox", + .style = CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, + .proc = WINPROC_COMBO, + .extra = sizeof(void *), + .cursor = IDC_ARROW, + }, + /* combolbox */ + { + .name = "ComboLBox", + .style = CS_DBLCLKS | CS_SAVEBITS, + .proc = WINPROC_LISTBOX, + .extra = sizeof(void *), + .cursor = IDC_ARROW, + }, + /* dialog */ + { + .name = MAKEINTRESOURCEA(DIALOG_CLASS_ATOM), + .style = CS_SAVEBITS | CS_DBLCLKS, + .proc = WINPROC_DIALOG, + .extra = DLGWINDOWEXTRA, + .cursor = IDC_ARROW, + }, + /* edit */ + { + .name = "Edit", + .style = CS_DBLCLKS | CS_PARENTDC, + .proc = WINPROC_EDIT, + .extra = sizeof(UINT64), + .cursor = IDC_IBEAM, + }, + /* icon title */ + { + .name = MAKEINTRESOURCEA(ICONTITLE_CLASS_ATOM), + .proc = WINPROC_ICONTITLE, + .cursor = IDC_ARROW, + }, + /* IME */ + { + .name = "IME", + .proc = WINPROC_IME, + .extra = 2 * sizeof(LONG_PTR), + .cursor = IDC_ARROW, + }, + /* listbox */ + { + .name = "ListBox", + .style = CS_DBLCLKS, + .proc = WINPROC_LISTBOX, + .extra = sizeof(void *), + .cursor = IDC_ARROW, + }, + /* menu */ + { + .name = MAKEINTRESOURCEA(POPUPMENU_CLASS_ATOM), + .style = CS_DROPSHADOW | CS_SAVEBITS | CS_DBLCLKS, + .proc = WINPROC_MENU, + .extra = sizeof(HMENU), + .cursor = IDC_ARROW, + .brush = (HBRUSH)(COLOR_MENU + 1), + }, + /* MDIClient */ + { + .name = "MDIClient", + .proc = WINPROC_MDICLIENT, + .extra = 2 * sizeof(void *), + .cursor = IDC_ARROW, + .brush = (HBRUSH)(COLOR_APPWORKSPACE + 1), + }, + /* scrollbar */ + { + .name = "ScrollBar", + .style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, + .proc = WINPROC_SCROLLBAR, + .extra = sizeof(struct scroll_bar_win_data), + .cursor = IDC_ARROW, + }, + /* static */ + { + .name = "Static", + .style = CS_DBLCLKS | CS_PARENTDC, + .proc = WINPROC_STATIC, + .extra = 2 * sizeof(HANDLE), + .cursor = IDC_ARROW, + }, +}; + /*********************************************************************** * register_builtin * @@ -1116,9 +1214,11 @@ static void register_builtin( const struct builtin_class_descr *descr )
static void register_builtins(void) { + ULONG ret_len, i; void *ret_ptr; - ULONG ret_len; - KeUserModeCallback( NtUserRegisterBuiltinClasses, NULL, 0, &ret_ptr, &ret_len ); + + for (i = 0; i < ARRAYSIZE(builtin_classes); i++) register_builtin( &builtin_classes[i] ); + KeUserModeCallback( NtUserInitBuiltinClasses, NULL, 0, &ret_ptr, &ret_len ); }
/*********************************************************************** diff --git a/include/ntuser.h b/include/ntuser.h index eb1b860b5c4..6d0ae96ec6f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -39,11 +39,11 @@ enum NtUserFreeCachedClipboardData, NtUserImmProcessKey, NtUserImmTranslateMessage, + NtUserInitBuiltinClasses, NtUserLoadDriver, NtUserLoadImage, NtUserLoadSysMenu, NtUserPostDDEMessage, - NtUserRegisterBuiltinClasses, NtUserRenderSynthesizedFormat, NtUserUnpackDDEMessage, /* win16 hooks */