Based on a patch by Nikolay Sivov
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45689 Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/comctl32/tests/combo.c | 15 +++++++++++++++ dlls/user32/class.c | 14 ++++++++++++++ 2 files changed, 29 insertions(+)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 923d826b30..065ce1a620 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -1254,6 +1254,20 @@ static void test_combo_dropdown_size(DWORD style) } }
+static void test_combo(void) +{ + HWND handle_combo; + char classname[10]; + + handle_combo = create_combobox(CBS_DROPDOWNLIST); + + GetClassNameA(handle_combo, classname, sizeof(classname)); + + ok(strcmp(classname, "ComboBox") == 0, "Got wrong classname: %s\n", classname); + + DestroyWindow(handle_combo); +} + START_TEST(combo) { ULONG_PTR ctx_cookie; @@ -1281,6 +1295,7 @@ START_TEST(combo) }
/* ComboBox control tests. */ + test_combo(); test_combo_WS_VSCROLL(); test_combo_setfont(CBS_DROPDOWN); test_combo_setfont(CBS_DROPDOWNLIST); diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 07d36f05d7..b8309025ca 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -664,6 +664,7 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc ) { const WCHAR *classname = NULL; WCHAR name[MAX_ATOM_LEN + 1]; + WCHAR classname_versioned[MAX_ATOM_LEN + 1]; ATOM atom; CLASS *classPtr; HINSTANCE instance; @@ -683,6 +684,12 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc ) UINT basename_offset; if (!MultiByteToWideChar( CP_ACP, 0, wc->lpszClassName, -1, name, MAX_ATOM_LEN + 1 )) return 0; classname = CLASS_GetVersionedName( name, &basename_offset, FALSE ); + if (basename_offset) /* Make sure redirected classes have the same name as their base class */ + { + strcpyW(classname_versioned, classname); + strcpyW(&classname_versioned[basename_offset], name); + classname = classname_versioned; + } classPtr = CLASS_RegisterClass( classname, basename_offset, instance, !(wc->style & CS_GLOBALCLASS), wc->style, wc->cbClsExtra, wc->cbWndExtra ); } @@ -721,6 +728,7 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc ) ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc ) { const WCHAR *classname; + WCHAR classname_versioned[MAX_ATOM_LEN + 1]; UINT basename_offset; ATOM atom; CLASS *classPtr; @@ -737,6 +745,12 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc ) if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
classname = CLASS_GetVersionedName( wc->lpszClassName, &basename_offset, FALSE ); + if (basename_offset) /* Make sure redirected classes have the same name as their base class */ + { + strcpyW(classname_versioned, classname); + strcpyW(&classname_versioned[basename_offset], wc->lpszClassName); + classname = classname_versioned; + } if (!(classPtr = CLASS_RegisterClass( classname, basename_offset, instance, !(wc->style & CS_GLOBALCLASS), wc->style, wc->cbClsExtra, wc->cbWndExtra ))) return 0;