Jacek Caban : win32u: Fix name comparison in find_class.

Alexandre Julliard julliard at winehq.org
Tue Mar 15 17:57:49 CDT 2022


Module: wine
Branch: master
Commit: d402df31966d73f7f120b4a4d90f22bcffd79b26
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d402df31966d73f7f120b4a4d90f22bcffd79b26

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar 15 14:26:39 2022 +0100

win32u: Fix name comparison in find_class.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52654
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/class.c | 5 +++++
 dlls/win32u/class.c       | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index 64fc3c014e3..eed90b8adc9 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -1049,6 +1049,11 @@ if (0) { /* crashes under XP */
     ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
     ok(wcx.cbSize == sizeof(wcx) + 1, "expected sizeof(wcx)+1, got %u\n", wcx.cbSize);
     ok(wcx.lpfnWndProc != NULL, "got null proc\n");
+
+    wcx.cbSize = sizeof(wcx);
+    ret = GetClassInfoExA(0, "stati", &wcx);
+    ok(!ret && GetLastError() == ERROR_CLASS_DOES_NOT_EXIST,
+       "GetClassInfoExA() returned %x %ld\n", ret, GetLastError());
 }
 
 static void test_icons(void)
diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c
index 74d06ee04de..3113ef357cf 100644
--- a/dlls/win32u/class.c
+++ b/dlls/win32u/class.c
@@ -259,7 +259,8 @@ static CLASS *find_class( HINSTANCE module, UNICODE_STRING *name )
         }
         else
         {
-            if (wcsnicmp( class->name, name->Buffer, name->Length / sizeof(WCHAR) )) continue;
+            if (wcsnicmp( class->name, name->Buffer, name->Length / sizeof(WCHAR) ) ||
+                class->name[name->Length / sizeof(WCHAR)]) continue;
         }
         if (!class->local || !module || (class->instance & ~0xffff) == instance)
         {




More information about the wine-cvs mailing list