From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/comctl32/tests/misc.c | 6 +++++- dlls/user32/class.c | 12 ++++++++++-- dlls/user32/tests/class.c | 20 ++++++++++---------- 3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index 419c9020261..1a22f7af29c 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -450,7 +450,11 @@ static void check_class( const char *name, int must_exist, UINT style, UINT igno RegisterClassA(&wc);
hwnd = CreateWindowA(SUPER_CLASS_NAME_A, 0, 0, 0, 0, 0, 0, 0, NULL, GetModuleHandleA(NULL), 0); - test_hwnd_real_class_name_str(hwnd, SUPER_CLASS_NAME_A); + /* + * Wine's comctl32 doesn't have a separate ScrollBar implementation + * from user32. + */ + todo_wine_if(!strcmp(name, "ScrollBar")) test_hwnd_real_class_name_str(hwnd, SUPER_CLASS_NAME_A);
DestroyWindow(hwnd); UnregisterClassA(SUPER_CLASS_NAME_A, GetModuleHandleA(NULL)); diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 0cfdf552a5d..e2322ea2fc0 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -498,7 +498,14 @@ INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count ) */ UINT WINAPI RealGetWindowClassA( HWND hwnd, LPSTR buffer, UINT count ) { - return GetClassNameA( hwnd, buffer, count ); + WCHAR tmpbuf[MAX_ATOM_LEN + 1]; + DWORD len; + + if (count <= 0) return 0; + if (!RealGetWindowClassW( hwnd, tmpbuf, ARRAY_SIZE( tmpbuf ))) return 0; + RtlUnicodeToMultiByteN( buffer, count - 1, &len, tmpbuf, lstrlenW(tmpbuf) * sizeof(WCHAR) ); + buffer[len] = 0; + return len; }
@@ -507,7 +514,8 @@ UINT WINAPI RealGetWindowClassA( HWND hwnd, LPSTR buffer, UINT count ) */ UINT WINAPI RealGetWindowClassW( HWND hwnd, LPWSTR buffer, UINT count ) { - return GetClassNameW( hwnd, buffer, count ); + UNICODE_STRING name = { .Buffer = buffer, .MaximumLength = count * sizeof(WCHAR) }; + return NtUserGetClassName( hwnd, TRUE, &name ); }
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index 47a0ae60c7f..41512c09a6e 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -1602,16 +1602,16 @@ struct real_class_test { };
static const struct real_class_test class_tests[] = { - { "Button", "Button", TRUE, TRUE }, - { "ComboBox", "ComboBox", TRUE, TRUE }, - { "Edit", "Edit", TRUE, TRUE }, - { "ListBox", "ListBox", TRUE, TRUE }, - { "ScrollBar", "ScrollBar", TRUE, TRUE }, - { "Static", "Static", TRUE, TRUE }, - { "ComboLBox", "ListBox", TRUE, TRUE }, - { "MDIClient", "MDIClient", TRUE, TRUE }, - { "#32768", "#32768", TRUE, TRUE }, - { "#32770", "#32770", TRUE, TRUE }, + { "Button", "Button", TRUE, FALSE }, + { "ComboBox", "ComboBox", TRUE, FALSE }, + { "Edit", "Edit", TRUE, FALSE }, + { "ListBox", "ListBox", TRUE, FALSE }, + { "ScrollBar", "ScrollBar", TRUE, FALSE }, + { "Static", "Static", TRUE, FALSE }, + { "ComboLBox", "ListBox", TRUE, FALSE }, + { "MDIClient", "MDIClient", TRUE, FALSE }, + { "#32768", "#32768", TRUE, FALSE }, + { "#32770", "#32770", TRUE, FALSE }, /* Not all built-in classes set real window class. */ { "Message", SUPER_CLASS_NAME_A, FALSE, FALSE }, };