Jacek Caban : user32: Ignore low instance word in find_class.

Alexandre Julliard julliard at winehq.org
Fri Mar 4 15:53:08 CST 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Mar  4 14:29:21 2022 +0100

user32: Ignore low instance word in find_class.

Like we do in wineserver.

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/class.c       | 4 ++--
 dlls/user32/tests/class.c | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/class.c b/dlls/user32/class.c
index b24e72be324..31b02e4658f 100644
--- a/dlls/user32/class.c
+++ b/dlls/user32/class.c
@@ -299,7 +299,7 @@ static void CLASS_FreeClass( CLASS *classPtr )
 static CLASS *find_class( HINSTANCE module, const WCHAR *name )
 {
     ATOM atom = get_int_atom_value( name );
-    UINT_PTR instance = (UINT_PTR)module;
+    UINT_PTR instance = (UINT_PTR)module & ~0xffff;
     CLASS *class;
 
     USER_Lock();
@@ -313,7 +313,7 @@ static CLASS *find_class( HINSTANCE module, const WCHAR *name )
         {
             if (wcsicmp( class->name, name )) continue;
         }
-        if (!class->local || class->instance == instance)
+        if (!class->local || (class->instance & ~0xffff) == instance)
         {
             TRACE("%s %Ix -> %p\n", debugstr_w(name), instance, class);
             return class;
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index e6762032107..c13893ae9d3 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -90,12 +90,14 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
     WNDCLASSW cls, wc;
     static const WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0};
     static const WCHAR winName[]   = {'W','i','n','C','l','a','s','s','T','e','s','t',0};
+    WNDCLASSW info;
     ATOM test_atom;
     HWND hTestWnd;
     LONG i;
     WCHAR str[20];
     ATOM classatom;
     HINSTANCE hInstance2;
+    BOOL ret;
 
     cls.style         = CS_HREDRAW | CS_VREDRAW | (global?CS_GLOBALCLASS:0);
     cls.lpfnWndProc   = ClassTest_WndProc;
@@ -136,6 +138,9 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
 
     DestroyWindow(hTestWnd);
 
+    ret = GetClassInfoW(hInstance2, className, &info);
+    ok(ret, "GetClassInfoW failed: %u\n", GetLastError());
+
     hTestWnd = CreateWindowW (className, winName,
        WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
        CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,




More information about the wine-cvs mailing list